Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: Source/core/inspector/InjectedScriptSource.js

Issue 978233002: bindings,devtools: Shows DOM attributes' values in DevTools. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed review comments. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/InjectedScriptHost.idl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InjectedScriptSource.js
diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js
index 234c0a831a3eb73c6ac57de6a3ba89256daebddb..52d87f4fcaa2b613b466ad78c564aee3e2a6666a 100644
--- a/Source/core/inspector/InjectedScriptSource.js
+++ b/Source/core/inspector/InjectedScriptSource.js
@@ -220,6 +220,33 @@ 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();
+
+/**
+ * @param {!Object} object
+ * @param {!string} attribute
+ * @return {boolean}
+ */
+function doesAttributeHaveObservableSideEffectOnGet(object, attribute)
+{
+ for (var interfaceName in domAttributesWithObservableSideEffectOnGet) {
+ if (window[interfaceName] && object instanceof window[interfaceName]) {
yurys 2015/03/06 09:55:39 Note that window[interfaceName] may well be overwr
Yuki 2015/03/06 14:15:56 I've enclosed this part with InjectedScriptHost.su
+ return attribute in domAttributesWithObservableSideEffectOnGet[interfaceName];
+ }
+ }
+ return false;
+}
+
+/**
* @constructor
*/
var InjectedScript = function()
@@ -555,7 +582,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 +1543,7 @@ InjectedScript.RemoteObject.prototype = {
__proto__: null
}
+
/**
* @constructor
* @param {number} ordinal
« no previous file with comments | « Source/core/inspector/InjectedScriptHost.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698