cleanup injection, pass important properties to iframe
This commit is contained in:
parent
ff527d9732
commit
4c6c652fe2
1 changed files with 14 additions and 11 deletions
|
|
@ -696,24 +696,27 @@ function __uvHook(window, config = {}, bare = '/bare/') {
|
||||||
'contentWindow'
|
'contentWindow'
|
||||||
).get;
|
).get;
|
||||||
|
|
||||||
|
function uvInject(that) {
|
||||||
|
const win = contentWindowGet.call(that);
|
||||||
|
|
||||||
|
try {
|
||||||
|
win.__uv$bareData = __uv.bareData;
|
||||||
|
win.__uv$cookies = __uv.cookieStr;
|
||||||
|
if (!win.__uv) __uvHook(win, config, bare);
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
client.element.hookProperty(HTMLIFrameElement, 'contentWindow', {
|
client.element.hookProperty(HTMLIFrameElement, 'contentWindow', {
|
||||||
get: (target, that) => {
|
get: (target, that) => {
|
||||||
const win = target.call(that);
|
uvInject(that);
|
||||||
try {
|
return target.call(that);
|
||||||
if (!win.__uv) __uvHook(win, config, bare);
|
|
||||||
} catch (e) {}
|
|
||||||
return win;
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
client.element.hookProperty(HTMLIFrameElement, 'contentDocument', {
|
client.element.hookProperty(HTMLIFrameElement, 'contentDocument', {
|
||||||
get: (target, that) => {
|
get: (target, that) => {
|
||||||
const win = contentWindowGet.call(that);
|
uvInject(that);
|
||||||
const doc = target.call(that);
|
return target.call(that);
|
||||||
try {
|
|
||||||
if (!win.__uv) __uvHook(win, config, bare);
|
|
||||||
} catch (e) {}
|
|
||||||
return doc;
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue