Changeset 58166 in webkit
- Timestamp:
- Apr 23, 2010 8:02:02 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r58163 r58166 1 2010-04-23 Yury Semikhatsky <yurys@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: provide JSC implementation for scopeType method on 6 call frame and use same jsvascript code for JSC and v8 when collecting 7 scope chain data. 8 9 https://bugs.webkit.org/show_bug.cgi?id=37663 10 11 * bindings/js/JSInjectedScriptHostCustom.cpp: 12 (WebCore::JSInjectedScriptHost::currentCallFrame): 13 * bindings/js/JSJavaScriptCallFrameCustom.cpp: 14 (WebCore::JSJavaScriptCallFrame::scopeType): 15 * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: 16 (WebCore::V8InjectedScriptHost::currentCallFrameCallback): 17 * inspector/InjectedScriptHost.idl: 18 * inspector/front-end/InjectedScript.js: 19 (injectedScriptConstructor.): 20 1 21 2010-04-23 Alexander Pavlov <apavlov@chromium.org> 2 22 -
trunk/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
r57738 r58166 130 130 return toJS(exec, callFrame); 131 131 } 132 133 JSValue JSInjectedScriptHost::isActivation(ExecState*, const ArgList& args)134 {135 JSObject* object = args.at(0).getObject();136 return jsBoolean(object && object->isActivationObject());137 }138 132 #endif 139 133 -
trunk/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp
r57812 r58166 86 86 } 87 87 88 JSValue JSJavaScriptCallFrame::scopeType(ExecState* , const ArgList&)88 JSValue JSJavaScriptCallFrame::scopeType(ExecState* exec, const ArgList& args) 89 89 { 90 // FIXME(37663): implement this method the way it's done in the InjectedScipt.js 91 return jsNull(); 90 if (!impl()->scopeChain()) 91 return jsUndefined(); 92 93 if (!args.at(0).isInt32()) 94 return jsUndefined(); 95 int index = args.at(0).asInt32(); 96 97 const ScopeChainNode* scopeChain = impl()->scopeChain(); 98 ScopeChainIterator end = scopeChain->end(); 99 100 bool foundLocalScope = false; 101 for (ScopeChainIterator iter = scopeChain->begin(); iter != end; ++iter) { 102 JSObject* scope = *iter; 103 if (scope->isActivationObject()) { 104 if (!foundLocalScope) { 105 // First activation object is local scope, each successive activation object is closure. 106 if (!index) 107 return jsJavaScriptCallFrameLOCAL_SCOPE(exec, JSValue(), Identifier()); 108 foundLocalScope = true; 109 } else if (!index) 110 return jsJavaScriptCallFrameCLOSURE_SCOPE(exec, JSValue(), Identifier()); 111 } 112 113 if (!index) { 114 // Last in the chain is global scope. 115 if (++iter == end) 116 return jsJavaScriptCallFrameGLOBAL_SCOPE(exec, JSValue(), Identifier()); 117 return jsJavaScriptCallFrameWITH_SCOPE(exec, JSValue(), Identifier()); 118 } 119 120 --index; 121 } 122 return jsUndefined(); 92 123 } 93 124 -
trunk/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
r57812 r58166 162 162 return toV8(ScriptDebugServer::shared().currentCallFrame()); 163 163 } 164 165 v8::Handle<v8::Value> V8InjectedScriptHost::isActivationCallback(const v8::Arguments& args)166 {167 INC_STATS("InjectedScriptHost.isActivation()");168 return v8::Boolean::New(true);169 }170 164 #endif 171 165 -
trunk/WebCore/inspector/InjectedScriptHost.idl
r56404 r58166 44 44 #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER 45 45 [Custom] DOMObject currentCallFrame(); 46 [Custom] boolean isActivation(in DOMObject object);47 46 #endif 48 47 -
trunk/WebCore/inspector/front-end/InjectedScript.js
r57812 r58166 842 842 } 843 843 844 // FIXME(37663): unify scope chain representation and remove this if.845 if (jsEngine === "v8") {846 847 844 InjectedScript.CallFrameProxy.prototype = { 848 845 _wrapScopeChain: function(callFrame) … … 856 853 var scopeChain = callFrame.scopeChain; 857 854 var scopeChainProxy = []; 855 var foundLocalScope = false; 858 856 for (var i = 0; i < scopeChain.length; i++) { 859 857 var scopeType = callFrame.scopeType(i); … … 861 859 var scopeObjectProxy = InjectedScript.createProxyObject(scopeObject, { callFrame: this.id, chainIndex: i }, true); 862 860 863 var foundLocalScope = false;864 861 switch(scopeType) { 865 862 case LOCAL_SCOPE: { … … 875 872 case WITH_SCOPE: 876 873 case CATCH_SCOPE: { 877 scopeObjectProxy.isWithBlock = true; 874 if (foundLocalScope && scopeObject instanceof inspectedWindow.Element) 875 scopeObjectProxy.isElement = true; 876 else if (foundLocalScope && scopeObject instanceof inspectedWindow.Document) 877 scopeObjectProxy.isDocument = true; 878 else 879 scopeObjectProxy.isWithBlock = true; 878 880 break; 879 881 } 880 882 } 881 882 if (foundLocalScope) {883 if (scopeObject instanceof inspectedWindow.Element)884 scopeObjectProxy.isElement = true;885 else if (scopeObject instanceof inspectedWindow.Document)886 scopeObjectProxy.isDocument = true;887 }888 889 883 scopeChainProxy.push(scopeObjectProxy); 890 884 } 891 885 return scopeChainProxy; 892 886 } 893 }894 895 } else {896 897 InjectedScript.CallFrameProxy.prototype = {898 _wrapScopeChain: function(callFrame)899 {900 var foundLocalScope = false;901 var scopeChain = callFrame.scopeChain;902 var scopeChainProxy = [];903 for (var i = 0; i < scopeChain.length; ++i) {904 var scopeObject = scopeChain[i];905 var scopeObjectProxy = InjectedScript.createProxyObject(scopeObject, { callFrame: this.id, chainIndex: i }, true);906 907 if (InjectedScriptHost.isActivation(scopeObject)) {908 if (!foundLocalScope)909 scopeObjectProxy.thisObject = InjectedScript.createProxyObject(callFrame.thisObject, { callFrame: this.id, thisObject: true }, true);910 else911 scopeObjectProxy.isClosure = true;912 foundLocalScope = true;913 scopeObjectProxy.isLocal = true;914 } else if (foundLocalScope && scopeObject instanceof inspectedWindow.Element)915 scopeObjectProxy.isElement = true;916 else if (foundLocalScope && scopeObject instanceof inspectedWindow.Document)917 scopeObjectProxy.isDocument = true;918 else if (!foundLocalScope)919 scopeObjectProxy.isWithBlock = true;920 scopeChainProxy.push(scopeObjectProxy);921 }922 return scopeChainProxy;923 }924 }925 926 887 } 927 888
Note: See TracChangeset
for help on using the changeset viewer.