summaryrefslogtreecommitdiffstats
path: root/WebCore/inspector/front-end/InjectedScript.js
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/inspector/front-end/InjectedScript.js')
-rw-r--r--WebCore/inspector/front-end/InjectedScript.js68
1 files changed, 20 insertions, 48 deletions
diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js
index 8984d0e..e3be6a3 100644
--- a/WebCore/inspector/front-end/InjectedScript.js
+++ b/WebCore/inspector/front-end/InjectedScript.js
@@ -841,9 +841,6 @@ InjectedScript.CallFrameProxy = function(id, callFrame)
this.scopeChain = this._wrapScopeChain(callFrame);
}
-// FIXME(37663): unify scope chain representation and remove this if.
-if (jsEngine === "v8") {
-
InjectedScript.CallFrameProxy.prototype = {
_wrapScopeChain: function(callFrame)
{
@@ -855,12 +852,12 @@ InjectedScript.CallFrameProxy.prototype = {
var scopeChain = callFrame.scopeChain;
var scopeChainProxy = [];
+ var foundLocalScope = false;
for (var i = 0; i < scopeChain.length; i++) {
var scopeType = callFrame.scopeType(i);
var scopeObject = scopeChain[i];
var scopeObjectProxy = InjectedScript.createProxyObject(scopeObject, { callFrame: this.id, chainIndex: i }, true);
- var foundLocalScope = false;
switch(scopeType) {
case LOCAL_SCOPE: {
foundLocalScope = true;
@@ -874,57 +871,21 @@ InjectedScript.CallFrameProxy.prototype = {
}
case WITH_SCOPE:
case CATCH_SCOPE: {
- scopeObjectProxy.isWithBlock = true;
+ if (foundLocalScope && scopeObject instanceof inspectedWindow.Element)
+ scopeObjectProxy.isElement = true;
+ else if (foundLocalScope && scopeObject instanceof inspectedWindow.Document)
+ scopeObjectProxy.isDocument = true;
+ else
+ scopeObjectProxy.isWithBlock = true;
break;
}
}
-
- if (foundLocalScope) {
- if (scopeObject instanceof inspectedWindow.Element)
- scopeObjectProxy.isElement = true;
- else if (scopeObject instanceof inspectedWindow.Document)
- scopeObjectProxy.isDocument = true;
- }
-
- scopeChainProxy.push(scopeObjectProxy);
- }
- return scopeChainProxy;
- }
-}
-
-} else {
-
-InjectedScript.CallFrameProxy.prototype = {
- _wrapScopeChain: function(callFrame)
- {
- var foundLocalScope = false;
- var scopeChain = callFrame.scopeChain;
- var scopeChainProxy = [];
- for (var i = 0; i < scopeChain.length; ++i) {
- var scopeObject = scopeChain[i];
- var scopeObjectProxy = InjectedScript.createProxyObject(scopeObject, { callFrame: this.id, chainIndex: i }, true);
-
- if (InjectedScriptHost.isActivation(scopeObject)) {
- if (!foundLocalScope)
- scopeObjectProxy.thisObject = InjectedScript.createProxyObject(callFrame.thisObject, { callFrame: this.id, thisObject: true }, true);
- else
- scopeObjectProxy.isClosure = true;
- foundLocalScope = true;
- scopeObjectProxy.isLocal = true;
- } else if (foundLocalScope && scopeObject instanceof inspectedWindow.Element)
- scopeObjectProxy.isElement = true;
- else if (foundLocalScope && scopeObject instanceof inspectedWindow.Document)
- scopeObjectProxy.isDocument = true;
- else if (!foundLocalScope)
- scopeObjectProxy.isWithBlock = true;
scopeChainProxy.push(scopeObjectProxy);
}
return scopeChainProxy;
}
}
-}
-
InjectedScript.executeSql = function(callId, databaseId, query)
{
function successCallback(tx, result)
@@ -1052,8 +1013,19 @@ InjectedScript._toString = function(obj)
InjectedScript._className = function(obj)
{
- var str = inspectedWindow.Object ? inspectedWindow.Object.prototype.toString.call(obj) : InjectedScript._toString(obj);
- return str.replace(/^\[object (.*)\]$/i, "$1");
+ // We can't use the same code for fetching class names of the dom bindings prototype chain.
+ // Both of the methods below result in "Object" names on the foreign engine bindings.
+ // I gave up and am using a check below to distinguish between the egine bingings.
+
+ if (typeof Document === "object") {
+ // JSC
+ var str = inspectedWindow.Object ? inspectedWindow.Object.prototype.toString.call(obj) : InjectedScript._toString(obj);
+ return str.replace(/^\[object (.*)\]$/i, "$1");
+ }
+ // V8
+ if (typeof obj !== "object")
+ return "null";
+ return obj.constructor.name;
}
InjectedScript._escapeCharacters = function(str, chars)