-
Notifications
You must be signed in to change notification settings - Fork 100
/
Copy pathiframe_proxy.js
56 lines (50 loc) · 1.92 KB
/
iframe_proxy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
function defineProperty(obj, key, value, configurable, enumerable, writable, getter, setter){
let attr = {
configurable: configurable,
enumerable: enumerable
}
if(value !== undefined){
attr["value"] = value
}
if(writable !==undefined){
attr["writable"] = writable
}
if (getter){
attr["get"] = getter
}
if (setter){
attr["set"] = setter
}
Object.defineProperty(obj, key, attr)
}
dtavm = typeof dtavm == "undefined" ? {} : dtavm
dtavm.raw_contentWindow_get = Object.getOwnPropertyDescriptors(HTMLIFrameElement.prototype)["contentWindow"].get
dtavm.raw_contentDocument_get = Object.getOwnPropertyDescriptors(HTMLIFrameElement.prototype)["contentDocument"].get
defineProperty(HTMLIFrameElement.prototype, "contentWindow", undefined, true, true, undefined, function(){
var result = dtavm.raw_contentWindow_get.call(this);
dtavm.log(`[HTMLIFrameElement.prototype] getting propKey is [contentWindow], value is`, result);
// contentWindow == contentWindow.window = true
if (result){
return dtavm.proxy(result, "contentWindow");
}else{
return result;
}
}, undefined)
defineProperty(HTMLIFrameElement.prototype, "contentDocument", undefined, true, true, undefined, function(){
// contentDocument == contentWindow.document = true
// contentDocument == contentWindow.window.document = true
var result = dtavm.raw_contentDocument_get.call(this);
dtavm.log(`[HTMLIFrameElement.prototype] getting propKey is [contentDocument], value is`, result);
if (result){
return dtavm.proxy(result, "contentDocument");
}else{
return result;
}
}, undefined)
var iframe = document.createElement('iframe');
//
var iframeDocument = iframe.contentDocument;
var iframeWindow = iframe.contentWindow;
document.body.appendChild(iframe)
iframeDocument = iframe.contentDocument;
iframeWindow = iframe.contentWindow;