Index: Source/core/inspector/InjectedScriptSource.js |
diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js |
index 234c0a831a3eb73c6ac57de6a3ba89256daebddb..c05775eeefc6827a42274c21dc7061619028400d 100644 |
--- a/Source/core/inspector/InjectedScriptSource.js |
+++ b/Source/core/inspector/InjectedScriptSource.js |
@@ -220,6 +220,36 @@ function indexOf(str, searchElement, fromIndex) |
} |
/** |
+ * DOM Attributes which have observable side effect on getter, in the form of |
+ * {interfaceName1: {attributeName1: true, |
+ * attributeName2: true, |
+ * ...}, |
+ * interfaceName2: {...}, |
+ * ...} |
+ * @type {!Object<string, !Object<string, boolean>>} |
+ * @const |
+ */ |
+var domAttributesWithObservableSideEffectOnGet = InjectedScriptHost.getDOMAttributesWithObservableSideEffectOnGet(); |
pfeldman
2015/03/09 11:41:41
var domAttributesWithObservableSideEffectOnGet = n
Yuki
2015/03/09 12:48:13
Done.
|
+ |
+/** |
+ * @param {!Object} object |
+ * @param {!string} attribute |
+ * @return {boolean} |
+ */ |
+function doesAttributeHaveObservableSideEffectOnGet(object, attribute) |
+{ |
+ for (var interfaceName in domAttributesWithObservableSideEffectOnGet) { |
+ var isInstance = InjectedScriptHost.suppressWarningsAndCallFunction(function(object, interfaceName) { |
+ return typeof window[interfaceName] === "function" && object instanceof window[interfaceName]; |
pfeldman
2015/03/09 11:41:41
This is no better than what it used to be as long
Yuki
2015/03/09 12:48:13
I prefer option 1. I don't think it's worth creat
|
+ }, null, [object, interfaceName]); |
+ if (isInstance) { |
+ return attribute in domAttributesWithObservableSideEffectOnGet[interfaceName]; |
+ } |
+ } |
+ return false; |
+} |
+ |
+/** |
* @constructor |
*/ |
var InjectedScript = function() |
@@ -555,7 +585,7 @@ InjectedScript.prototype = { |
if (descriptor) { |
if (accessorPropertiesOnly && !("get" in descriptor || "set" in descriptor)) |
continue; |
- if ("get" in descriptor && "set" in descriptor && InjectedScriptHost.isPopularDOMObject(object) && name != "__proto__") { |
+ if ("get" in descriptor && "set" in descriptor && name != "__proto__" && InjectedScriptHost.isDOMWrapper(object) && !doesAttributeHaveObservableSideEffectOnGet(object, name)) { |
descriptor.value = InjectedScriptHost.suppressWarningsAndCallFunction(function(attribute) { return this[attribute]; }, object, [name]); |
delete descriptor.get; |
delete descriptor.set; |
@@ -1516,6 +1546,7 @@ InjectedScript.RemoteObject.prototype = { |
__proto__: null |
} |
+ |
/** |
* @constructor |
* @param {number} ordinal |