Changeset 53766 in webkit
- Timestamp:
- Jan 23, 2010 2:13:40 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r53764 r53766 1 2010-01-23 Yury Semikhatsky <yurys@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Inject inspector script directly into the inspected context. All the 6 communication between the script and the frontend is serialized into 7 JSON strings. It allows to get rid of object quarantines in Web Inspector. 8 9 Test that web inspector doesn't crash when opening if there are messages in 10 the console. Refactor test case due to InjectedScriptAccess changes. 11 12 https://bugs.webkit.org/show_bug.cgi?id=32554 13 14 * inspector/console-log-before-inspector-open-expected.txt: Added. 15 * inspector/console-log-before-inspector-open.html: Added. 16 * inspector/styles-iframe.html: 17 1 18 2010-01-22 Alex Milowski <alex@milowski.com> 2 19 -
trunk/LayoutTests/inspector/styles-iframe.html
r53558 r53766 57 57 { 58 58 // 1. Get styles for body, store them in mainStyles var. 59 var body Id = WebInspector.domAgent.document.body.id;59 var body = WebInspector.domAgent.document.body; 60 60 var mainStyles = null; 61 61 function mainFrameCallback(styles) { 62 62 mainStyles = styles; 63 63 } 64 InjectedScriptAccess.get Styles(bodyId, false, mainFrameCallback);64 InjectedScriptAccess.get(body.injectedScriptId).getStyles(body.id, false, mainFrameCallback); 65 65 66 66 // 2. Find iframe node 67 67 var innerMapping = WebInspector.domAgent._idToDOMNode; 68 var iframeBody Id= null;68 var iframeBody = null; 69 69 70 70 for (var nodeId in innerMapping) { 71 71 if (innerMapping[nodeId].nodeName === "IFRAME") 72 iframeBody Id = innerMapping[nodeId].firstChild.lastChild.id;72 iframeBody = innerMapping[nodeId].firstChild.lastChild; 73 73 } 74 if ( typeof iframeBodyId !== "number") {74 if (!iframeBody) { 75 75 testController.notifyDone(["No iframe node found"]); 76 76 return; … … 81 81 testController.notifyDone([mainStyles, styles]); 82 82 } 83 InjectedScriptAccess.get Styles(iframeBodyId, false, iframeCallback);83 InjectedScriptAccess.get(iframeBody.injectedScriptId).getStyles(iframeBody.id, false, iframeCallback); 84 84 } 85 85 -
trunk/WebCore/ChangeLog
r53764 r53766 1 2010-01-23 Yury Semikhatsky <yurys@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Inject inspector script directly into the inspected context. All the 6 communication between the script and the frontend is serialized into 7 JSON strings. It allows to get rid of object quarantines in Web Inspector. 8 9 https://bugs.webkit.org/show_bug.cgi?id=32554 10 11 Test: inspector/console-log-before-inspector-open.html 12 13 * bindings/js/JSInjectedScriptHostCustom.cpp: 14 (WebCore::JSInjectedScriptHost::databaseForId): 15 (WebCore::JSInjectedScriptHost::currentCallFrame): 16 (WebCore::JSInjectedScriptHost::nodeForId): 17 (WebCore::JSInjectedScriptHost::pushNodePathToFrontend): 18 (WebCore::JSInjectedScriptHost::selectDatabase): 19 (WebCore::JSInjectedScriptHost::selectDOMStorage): 20 * bindings/js/ScriptCallStack.h: 21 (WebCore::ScriptCallStack::globalState): 22 * bindings/js/ScriptController.cpp: 23 (WebCore::ScriptController::mainWorldScriptState): 24 * bindings/js/ScriptController.h: 25 * bindings/js/ScriptObject.h: 26 (WebCore::ScriptObject::scriptState): 27 * bindings/js/ScriptValue.cpp: 28 * bindings/js/ScriptValue.h: 29 * bindings/v8/ScriptCallStack.h: 30 (WebCore::ScriptCallStack::globalState): 31 * bindings/v8/ScriptObject.h: 32 (WebCore::ScriptObject::scriptState): 33 * bindings/v8/ScriptValue.h: 34 * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: 35 * inspector/ConsoleMessage.cpp: 36 (WebCore::ConsoleMessage::ConsoleMessage): 37 (WebCore::ConsoleMessage::addToConsole): 38 (WebCore::ConsoleMessage::isEqual): 39 * inspector/ConsoleMessage.h: 40 * inspector/InjectedScriptHost.cpp: 41 (WebCore::InjectedScriptHost::releaseWrapperObjectGroup): 42 * inspector/InjectedScriptHost.h: 43 * inspector/InjectedScriptHost.idl: 44 * inspector/InspectorBackend.cpp: 45 (WebCore::InspectorBackend::setInjectedScriptSource): 46 (WebCore::InspectorBackend::dispatchOnInjectedScript): 47 (WebCore::InspectorBackend::releaseWrapperObjectGroup): 48 * inspector/InspectorBackend.h: 49 * inspector/InspectorBackend.idl: 50 * inspector/InspectorController.cpp: 51 (WebCore::InspectorController::InspectorController): 52 (WebCore::InspectorController::clearConsoleMessages): 53 (WebCore::InspectorController::inspectedWindowScriptObjectCleared): 54 (WebCore::InspectorController::windowScriptObjectAvailable): 55 (WebCore::InspectorController::scriptObjectReady): 56 (WebCore::InspectorController::setFrontendProxyObject): 57 (WebCore::InspectorController::close): 58 (WebCore::InspectorController::resetScriptObjects): 59 (WebCore::InspectorController::didPause): 60 (WebCore::InspectorController::injectedScriptForNodeId): 61 * inspector/InspectorController.h: 62 * inspector/InspectorFrontend.cpp: 63 (WebCore::InspectorFrontend::addConsoleMessage): 64 (WebCore::InspectorFrontend::pausedScript): 65 * inspector/InspectorFrontend.h: 66 * inspector/front-end/AuditsPanel.js: 67 (WebInspector.AuditsPanel.prototype._reloadResources): 68 * inspector/front-end/ConsoleView.js: 69 (WebInspector.ConsoleView.prototype.requestClearMessages): 70 (WebInspector.ConsoleView.prototype.doEvalInWindow): 71 * inspector/front-end/DOMAgent.js: 72 (WebInspector.DOMNode): 73 (WebInspector.CSSStyleDeclaration): 74 (WebInspector.CSSStyleDeclaration.parseRule): 75 * inspector/front-end/Database.js: 76 (WebInspector.Database.prototype.executeSql): 77 * inspector/front-end/ElementsPanel.js: 78 (WebInspector.ElementsPanel.this.treeOutline.focusedNodeChanged.InjectedScriptAccess.get addInspectedNode): 79 (WebInspector.ElementsPanel.this.treeOutline.focusedNodeChanged): 80 (WebInspector.ElementsPanel.prototype.setDocument): 81 (WebInspector.ElementsPanel.prototype.searchCanceled): 82 (WebInspector.ElementsPanel.prototype.performSearch): 83 * inspector/front-end/ElementsTreeOutline.js: 84 (WebInspector.ElementsTreeElement.prototype.createTooltipForImageNode): 85 * inspector/front-end/EventListenersSidebarPane.js: 86 (): 87 * inspector/front-end/InjectedScript.js: 88 (injectedScriptConstructor): 89 (injectedScriptConstructor.): 90 * inspector/front-end/InjectedScriptAccess.js: 91 (InjectedScriptAccess): 92 (InjectedScriptAccess.getDefault): 93 (get InjectedScriptAccess): 94 (InjectedScriptAccess._installHandler.InjectedScriptAccess.prototype.methodName): 95 (InjectedScriptAccess._installHandler): 96 * inspector/front-end/MetricsSidebarPane.js: 97 (WebInspector.MetricsSidebarPane): 98 (WebInspector.MetricsSidebarPane.prototype.update.inlineStyleCallback): 99 * inspector/front-end/ObjectPropertiesSection.js: 100 * inspector/front-end/ObjectProxy.js: 101 (WebInspector.ObjectProxy): 102 * inspector/front-end/PropertiesSidebarPane.js: 103 (WebInspector.PropertiesSidebarPane.prototype.update.callback): 104 * inspector/front-end/ResourcesPanel.js: 105 (WebInspector.ResourceSidebarTreeElement.prototype.ondblclick): 106 * inspector/front-end/ScriptsPanel.js: 107 * inspector/front-end/StylesSidebarPane.js: 108 (WebInspector.StylePropertyTreeElement.prototype): 109 * inspector/front-end/WatchExpressionsSidebarPane.js: 110 (WebInspector.WatchExpressionsSection.prototype.update): 111 * inspector/front-end/inspector.js: 112 (WebInspector.loaded): 113 (WebInspector.pausedScript): 114 (WebInspector.addConsoleMessage): 115 (WebInspector.log.logMessage): 116 (WebInspector.log): 117 1 118 2010-01-22 Alex Milowski <alex@milowski.com> 2 119 -
trunk/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
r53558 r53766 48 48 #include "InspectorResource.h" 49 49 #include "JSDOMWindow.h" 50 #include "JSInspectedObjectWrapper.h"51 #include "JSInspectorCallbackWrapper.h"52 50 #include "JSNode.h" 53 51 #include "JSRange.h" … … 113 111 if (!database) 114 112 return jsUndefined(); 115 // Could use currentWorld(exec) ... but which exec! The following mixed use of exec & inspectedWindow->globalExec() scares me! 116 JSDOMWindow* inspectedWindow = toJSDOMWindow(ic->inspectedPage()->mainFrame(), debuggerWorld()); 117 return JSInspectedObjectWrapper::wrap(inspectedWindow->globalExec(), toJS(exec, database)); 118 } 119 #endif 120 121 JSValue JSInjectedScriptHost::inspectedWindow(ExecState*, const ArgList&) 122 { 113 return toJS(exec, database); 114 } 115 #endif 116 117 #if ENABLE(JAVASCRIPT_DEBUGGER) 118 119 JSValue JSInjectedScriptHost::currentCallFrame(ExecState* exec, const ArgList&) 120 { 121 JavaScriptCallFrame* callFrame = impl()->currentCallFrame(); 122 if (!callFrame || !callFrame->isValid()) 123 return jsUndefined(); 124 125 JSLock lock(SilenceAssertionsOnly); 126 return toJS(exec, callFrame); 127 } 128 129 #endif 130 131 JSValue JSInjectedScriptHost::nodeForId(ExecState* exec, const ArgList& args) 132 { 133 if (args.size() < 1) 134 return jsUndefined(); 135 136 Node* node = impl()->nodeForId(args.at(0).toInt32(exec)); 137 if (!node) 138 return jsUndefined(); 139 123 140 InspectorController* ic = impl()->inspectorController(); 124 141 if (!ic) 125 142 return jsUndefined(); 126 JSDOMWindow* inspectedWindow = toJSDOMWindow(ic->inspectedPage()->mainFrame(), debuggerWorld()); 127 return JSInspectedObjectWrapper::wrap(inspectedWindow->globalExec(), inspectedWindow); 128 } 129 130 JSValue JSInjectedScriptHost::wrapCallback(ExecState* exec, const ArgList& args) 131 { 132 if (args.size() < 1) 133 return jsUndefined(); 134 135 return JSInspectorCallbackWrapper::wrap(exec, args.at(0)); 136 } 137 138 #if ENABLE(JAVASCRIPT_DEBUGGER) 139 140 JSValue JSInjectedScriptHost::currentCallFrame(ExecState* exec, const ArgList&) 141 { 142 JavaScriptCallFrame* callFrame = impl()->currentCallFrame(); 143 if (!callFrame || !callFrame->isValid()) 144 return jsUndefined(); 145 146 // FIXME: I am not sure if this is actually needed. Can we just use exec? 147 ExecState* globalExec = callFrame->scopeChain()->globalObject->globalExec(); 148 149 JSLock lock(SilenceAssertionsOnly); 150 return JSInspectedObjectWrapper::wrap(globalExec, toJS(exec, callFrame)); 151 } 152 153 #endif 154 155 JSValue JSInjectedScriptHost::nodeForId(ExecState* exec, const ArgList& args) 156 { 157 if (args.size() < 1) 158 return jsUndefined(); 159 160 Node* node = impl()->nodeForId(args.at(0).toInt32(exec)); 161 if (!node) 162 return jsUndefined(); 163 164 InspectorController* ic = impl()->inspectorController(); 165 if (!ic) 166 return jsUndefined(); 167 168 JSLock lock(SilenceAssertionsOnly); 169 JSDOMWindow* inspectedWindow = toJSDOMWindow(ic->inspectedPage()->mainFrame(), debuggerWorld()); 170 return JSInspectedObjectWrapper::wrap(inspectedWindow->globalExec(), toJS(exec, deprecatedGlobalObjectForPrototype(inspectedWindow->globalExec()), node)); 171 } 172 173 JSValue JSInjectedScriptHost::wrapObject(ExecState* exec, const ArgList& args) 174 { 175 if (args.size() < 2) 176 return jsUndefined(); 177 178 return impl()->wrapObject(ScriptValue(args.at(0)), args.at(1).toString(exec)).jsValue(); 179 } 180 181 JSValue JSInjectedScriptHost::unwrapObject(ExecState* exec, const ArgList& args) 182 { 183 if (args.size() < 1) 184 return jsUndefined(); 185 186 return impl()->unwrapObject(args.at(0).toString(exec)).jsValue(); 143 144 JSLock lock(SilenceAssertionsOnly); 145 return toJS(exec, node); 187 146 } 188 147 … … 192 151 return jsUndefined(); 193 152 194 JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); 195 if (!wrapper) 196 return jsUndefined(); 197 198 Node* node = toNode(wrapper->unwrappedObject()); 153 Node* node = toNode(args.at(0)); 199 154 if (!node) 200 155 return jsUndefined(); … … 211 166 return jsUndefined(); 212 167 213 JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); 214 if (!wrapper) 215 return jsUndefined(); 216 217 Database* database = toDatabase(wrapper->unwrappedObject()); 168 Database* database = toDatabase(args.at(0)); 218 169 if (database) 219 170 impl()->selectDatabase(database); … … 231 182 return jsUndefined(); 232 183 233 JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); 234 if (!wrapper) 235 return jsUndefined(); 236 237 Storage* storage = toStorage(wrapper->unwrappedObject()); 184 Storage* storage = toStorage(args.at(0)); 238 185 if (storage) 239 186 impl()->selectDOMStorage(storage); -
trunk/WebCore/bindings/js/ScriptCallStack.h
r53558 r53766 50 50 51 51 ScriptState* state() const { return m_exec; } 52 ScriptState* globalState() const { return m_exec->lexicalGlobalObject()->globalExec(); } 52 53 // frame retrieval methods 53 54 const ScriptCallFrame &at(unsigned); -
trunk/WebCore/bindings/js/ScriptController.cpp
r53558 r53766 381 381 #endif 382 382 383 ScriptState* ScriptController::mainWorldScriptState() 384 { 385 JSDOMWindowShell* shell = windowShell(mainThreadNormalWorld()); 386 return shell->window()->globalExec(); 387 } 388 383 389 JSObject* ScriptController::jsObjectForPluginElement(HTMLPlugInElement* plugin) 384 390 { -
trunk/WebCore/bindings/js/ScriptController.h
r53558 r53766 25 25 #include "JSDOMWindowShell.h" 26 26 #include "ScriptInstance.h" 27 #include "ScriptState.h" 27 28 #include <runtime/Protect.h> 28 29 #include <wtf/RefPtr.h> … … 160 161 XSSAuditor* xssAuditor() { return m_XSSAuditor.get(); } 161 162 163 ScriptState* mainWorldScriptState(); 164 162 165 private: 163 166 JSDOMWindowShell* initScript(DOMWrapperWorld* world); -
trunk/WebCore/bindings/js/ScriptObject.h
r53558 r53766 48 48 ScriptObject() {} 49 49 JSC::JSObject* jsObject() const { return asObject(jsValue()); } 50 ScriptState* scriptState() const { return m_scriptState; } 50 51 51 52 bool set(const String& name, const String&); -
trunk/WebCore/bindings/js/ScriptValue.cpp
r53558 r53766 33 33 #include <JavaScriptCore/JSValueRef.h> 34 34 35 #include "JSInspectedObjectWrapper.h"36 37 35 #include <runtime/JSLock.h> 38 36 #include <runtime/Protect.h> … … 42 40 43 41 namespace WebCore { 44 45 #if ENABLE(INSPECTOR)46 ScriptValue ScriptValue::quarantineValue(ScriptState* scriptState, const ScriptValue& value)47 {48 JSLock lock(SilenceAssertionsOnly);49 return ScriptValue(JSInspectedObjectWrapper::wrap(scriptState, value.jsValue()));50 }51 #endif52 42 53 43 bool ScriptValue::getString(ScriptState* scriptState, String& result) const -
trunk/WebCore/bindings/js/ScriptValue.h
r53558 r53766 42 42 class ScriptValue { 43 43 public: 44 static ScriptValue quarantineValue(ScriptState* scriptState, const ScriptValue& value);45 46 44 ScriptValue(JSC::JSValue value = JSC::JSValue()) : m_value(value) {} 47 45 virtual ~ScriptValue() {} -
trunk/WebCore/bindings/v8/ScriptCallStack.h
r52653 r53766 53 53 54 54 ScriptState* state() const { return m_scriptState; } 55 ScriptState* globalState() const { return m_scriptState; } 55 56 56 57 private: -
trunk/WebCore/bindings/v8/ScriptObject.h
r53558 r53766 49 49 50 50 v8::Local<v8::Object> v8Object() const; 51 ScriptState* scriptState() const { return m_scriptState; } 51 52 52 53 bool set(const String& name, const String&); -
trunk/WebCore/bindings/v8/ScriptValue.h
r53558 r53766 45 45 class ScriptValue { 46 46 public: 47 static ScriptValue quarantineValue(ScriptState* scriptState, const ScriptValue& value)48 {49 return value;50 }51 52 47 ScriptValue() {} 53 48 -
trunk/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
r53558 r53766 115 115 } 116 116 117 v8::Handle<v8::Value> V8InjectedScriptHost::inspectedWindowCallback(const v8::Arguments& args)118 {119 INC_STATS("InjectedScriptHost.inspectedWindow()");120 121 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());122 InspectorController* ic = host->inspectorController();123 if (!ic)124 return v8::Undefined();125 return V8DOMWrapper::convertToV8Object<DOMWindow>(V8ClassIndex::DOMWINDOW, ic->inspectedPage()->mainFrame()->domWindow());126 }127 128 v8::Handle<v8::Value> V8InjectedScriptHost::wrapCallbackCallback(const v8::Arguments& args)129 {130 INC_STATS("InjectedScriptHost.wrapCallback()");131 return args[0];132 }133 134 117 v8::Handle<v8::Value> V8InjectedScriptHost::nodeForIdCallback(const v8::Arguments& args) 135 118 { … … 149 132 150 133 return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODE, node); 151 }152 153 v8::Handle<v8::Value> V8InjectedScriptHost::wrapObjectCallback(const v8::Arguments& args)154 {155 INC_STATS("InjectedScriptHost.wrapObject()");156 if (args.Length() < 2)157 return v8::Undefined();158 159 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());160 return host->wrapObject(ScriptValue(args[0]), toWebCoreStringWithNullCheck(args[1])).v8Value();161 }162 163 v8::Handle<v8::Value> V8InjectedScriptHost::unwrapObjectCallback(const v8::Arguments& args)164 {165 INC_STATS("InjectedScriptHost.unwrapObject()");166 if (args.Length() < 1)167 return v8::Undefined();168 169 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());170 return host->unwrapObject(toWebCoreStringWithNullCheck(args[0])).v8Value();171 134 } 172 135 -
trunk/WebCore/inspector/ConsoleMessage.cpp
r53558 r53766 55 55 , m_level(l) 56 56 #if ENABLE(INSPECTOR) 57 , m_wrappedArguments(callStack->at(0).argumentCount()) 57 , m_arguments(callStack->at(0).argumentCount()) 58 , m_scriptState(callStack->globalState()) 58 59 #endif 59 60 , m_frames(storeTrace ? callStack->size() : 0) … … 75 76 #if ENABLE(INSPECTOR) 76 77 for (unsigned i = 0; i < lastCaller.argumentCount(); ++i) 77 m_ wrappedArguments[i] = ScriptObject::quarantineValue(callStack->state(), lastCaller.argumentAt(i));78 m_arguments[i] = lastCaller.argumentAt(i); 78 79 #endif 79 80 } … … 90 91 jsonObj.set("groupLevel", static_cast<int>(m_groupLevel)); 91 92 jsonObj.set("repeatCount", static_cast<int>(m_repeatCount)); 92 frontend->addConsoleMessage(jsonObj, m_frames, m_ wrappedArguments, m_message);93 frontend->addConsoleMessage(jsonObj, m_frames, m_scriptState, m_arguments, m_message); 93 94 } 94 95 … … 102 103 { 103 104 #if ENABLE(INSPECTOR) 104 if (msg->m_ wrappedArguments.size() != m_wrappedArguments.size())105 if (msg->m_arguments.size() != m_arguments.size()) 105 106 return false; 106 if (!state && msg->m_ wrappedArguments.size())107 if (!state && msg->m_arguments.size()) 107 108 return false; 108 109 109 ASSERT_ARG(state, state || msg->m_ wrappedArguments.isEmpty());110 ASSERT_ARG(state, state || msg->m_arguments.isEmpty()); 110 111 111 for (size_t i = 0; i < msg->m_ wrappedArguments.size(); ++i) {112 if (!m_ wrappedArguments[i].isEqual(state, msg->m_wrappedArguments[i]))112 for (size_t i = 0; i < msg->m_arguments.size(); ++i) { 113 if (!m_arguments[i].isEqual(state, msg->m_arguments[i])) 113 114 return false; 114 115 } -
trunk/WebCore/inspector/ConsoleMessage.h
r53558 r53766 64 64 String m_message; 65 65 #if ENABLE(INSPECTOR) 66 Vector<ScriptValue> m_wrappedArguments; 66 Vector<ScriptValue> m_arguments; 67 ScriptState* m_scriptState; 67 68 #endif 68 69 Vector<ScriptString> m_frames; -
trunk/WebCore/inspector/InjectedScriptHost.cpp
r53558 r53766 99 99 } 100 100 101 ScriptValue InjectedScriptHost::wrapObject(const ScriptValue& object, const String& objectGroup)102 {103 if (m_inspectorController)104 return m_inspectorController->wrapObject(object, objectGroup);105 return ScriptValue();106 }107 108 ScriptValue InjectedScriptHost::unwrapObject(const String& objectId)109 {110 if (m_inspectorController)111 return m_inspectorController->unwrapObject(objectId);112 return ScriptValue();113 }114 115 101 long InjectedScriptHost::pushNodePathToFrontend(Node* node, bool withChildren, bool selectInUI) 116 102 { … … 192 178 } 193 179 180 void InjectedScriptHost::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup) 181 { 182 if (injectedScriptId) { 183 ScriptObject injectedScript = m_idToInjectedScript.get(injectedScriptId); 184 if (!injectedScript.hasNoValue()) 185 releaseWrapperObjectGroup(injectedScript, objectGroup); 186 } else { 187 // Iterate over all injected scripts if injectedScriptId is not specified. 188 for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != m_idToInjectedScript.end(); ++it) 189 releaseWrapperObjectGroup(it->second, objectGroup); 190 } 191 } 192 194 193 InspectorDOMAgent* InjectedScriptHost::inspectorDOMAgent() 195 194 { … … 206 205 } 207 206 207 void InjectedScriptHost::releaseWrapperObjectGroup(const ScriptObject& injectedScript, const String& objectGroup) 208 { 209 ScriptFunctionCall releaseFunction(injectedScript.scriptState(), injectedScript, "releaseWrapperObjectGroup"); 210 releaseFunction.appendArgument(objectGroup); 211 releaseFunction.call(); 212 } 213 208 214 } // namespace WebCore 209 215 -
trunk/WebCore/inspector/InjectedScriptHost.h
r53558 r53766 67 67 void copyText(const String& text); 68 68 Node* nodeForId(long nodeId); 69 ScriptValue wrapObject(const ScriptValue& object, const String& objectGroup);70 ScriptValue unwrapObject(const String& objectId);71 69 long pushNodePathToFrontend(Node* node, bool withChildren, bool selectInUI); 72 70 … … 89 87 ScriptObject injectedScriptForId(long); 90 88 void discardInjectedScripts(); 89 void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup); 91 90 92 91 private: … … 94 93 InspectorDOMAgent* inspectorDOMAgent(); 95 94 InspectorFrontend* inspectorFrontend(); 95 96 void releaseWrapperObjectGroup(const ScriptObject& injectedScript, const String& objectGroup); 96 97 97 98 InspectorController* m_inspectorController; -
trunk/WebCore/inspector/InjectedScriptHost.idl
r53558 r53766 33 33 module core { 34 34 interface [Conditional=INSPECTOR] InjectedScriptHost { 35 [Custom] DOMWindow inspectedWindow();36 [Custom] DOMObject wrapCallback(in DOMObject callback);37 35 void clearConsoleMessages(); 38 36 39 37 void copyText(in DOMString text); 40 38 [Custom] DOMObject nodeForId(in long nodeId); 41 [Custom] long wrapObject(in DOMObject object, in DOMString objectGroup);42 [Custom] DOMObject unwrapObject(in long objectId);43 39 [Custom] int pushNodePathToFrontend(in DOMObject node, in boolean withChildren, in boolean selectInUI); 44 40 -
trunk/WebCore/inspector/InspectorBackend.cpp
r53696 r53766 41 41 #include "FrameLoader.h" 42 42 #include "HTMLFrameOwnerElement.h" 43 #include "InjectedScriptHost.h" 43 44 #include "InspectorClient.h" 44 45 #include "InspectorController.h" … … 257 258 #endif 258 259 259 void InspectorBackend::dispatchOnInjectedScript(long callId, const String& methodName, const String& arguments, bool async) 260 void InspectorBackend::setInjectedScriptSource(const String& source) 261 { 262 if (m_inspectorController) 263 m_inspectorController->injectedScriptHost()->setInjectedScriptSource(source); 264 } 265 266 void InspectorBackend::dispatchOnInjectedScript(long callId, long injectedScriptId, const String& methodName, const String& arguments, bool async) 260 267 { 261 268 InspectorFrontend* frontend = inspectorFrontend(); … … 263 270 return; 264 271 265 ScriptFunctionCall function(m_inspectorController->m_scriptState, m_inspectorController->m_injectedScriptObj, "dispatch"); 272 // FIXME: explicitly pass injectedScriptId along with node id to the frontend. 273 bool injectedScriptIdIsNodeId = injectedScriptId <= 0; 274 275 ScriptObject injectedScript; 276 if (injectedScriptIdIsNodeId) 277 injectedScript = m_inspectorController->injectedScriptForNodeId(-injectedScriptId); 278 else 279 injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptForId(injectedScriptId); 280 281 if (injectedScript.hasNoValue()) 282 return; 283 284 ScriptFunctionCall function(injectedScript.scriptState(), injectedScript, "dispatch"); 266 285 function.appendArgument(methodName); 267 286 function.appendArgument(arguments); … … 275 294 frontend->didDispatchOnInjectedScript(callId, "", true); 276 295 else 277 frontend->didDispatchOnInjectedScript(callId, result.toString( m_inspectorController->m_scriptState), false);296 frontend->didDispatchOnInjectedScript(callId, result.toString(injectedScript.scriptState()), false); 278 297 } 279 298 … … 372 391 } 373 392 374 void InspectorBackend::releaseWrapperObjectGroup(const String& objectGroup) 375 { 376 if (m_inspectorController) 377 m_inspectorController->releaseWrapperObjectGroup(objectGroup); 393 void InspectorBackend::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup) 394 { 395 if (!m_inspectorController) 396 return; 397 m_inspectorController->injectedScriptHost()->releaseWrapperObjectGroup(injectedScriptId, objectGroup); 378 398 } 379 399 -
trunk/WebCore/inspector/InspectorBackend.h
r53696 r53766 105 105 #endif 106 106 107 void dispatchOnInjectedScript(long callId, const String& methodName, const String& arguments, bool async); 108 // FIXME(32554): Temporarily we have two similar methods so that clients can compile against both signatures. 109 // The method above will be removed soon. 110 void dispatchOnInjectedScript(long, long, const String&, const String&, bool) { } 107 void setInjectedScriptSource(const String& source); 108 void dispatchOnInjectedScript(long callId, long injectedScriptId, const String& methodName, const String& arguments, bool async); 111 109 void getChildNodes(long callId, long nodeId); 112 110 void setAttribute(long callId, long elementId, const String& name, const String& value); … … 123 121 124 122 // Generic code called from custom implementations. 125 void releaseWrapperObjectGroup( const String& objectGroup);123 void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup); 126 124 void didEvaluateForTestInFrontend(long callId, const String& jsonResult); 127 125 -
trunk/WebCore/inspector/InspectorBackend.idl
r53696 r53766 76 76 void getProfile(in long callId, in unsigned long uid); 77 77 #endif 78 void dispatchOnInjectedScript(in long callId, in DOMString methodName, in DOMString arguments, in boolean async); 78 void setInjectedScriptSource(in DOMString scriptSource); 79 void dispatchOnInjectedScript(in long callId, in long injectedScriptId, in DOMString methodName, in DOMString arguments, in boolean async); 79 80 void getChildNodes(in long callId, in long nodeId); 80 81 void setAttribute(in long callId, in long elementId, in DOMString name, in DOMString value); … … 90 91 void deleteCookie(in DOMString cookieName, in DOMString domain); 91 92 92 void releaseWrapperObjectGroup(in DOMString objectGroup);93 void releaseWrapperObjectGroup(in long injectedScriptId, in DOMString objectGroup); 93 94 void didEvaluateForTestInFrontend(in long callId, in DOMString jsonResult); 94 95 -
trunk/WebCore/inspector/InspectorController.cpp
r53558 r53766 144 144 , m_inspectorFrontendHost(InspectorFrontendHost::create(this, client)) 145 145 , m_injectedScriptHost(InjectedScriptHost::create(this)) 146 , m_lastBoundObjectId(1)147 146 #if ENABLE(JAVASCRIPT_DEBUGGER) 148 147 , m_debuggerEnabled(false) … … 376 375 m_previousMessage = 0; 377 376 m_groupLevel = 0; 378 releaseWrapperObjectGroup("console");377 m_injectedScriptHost->releaseWrapperObjectGroup(0 /* release the group in all scripts */, "console"); 379 378 if (m_domAgent) 380 379 m_domAgent->releaseDanglingNodes(); … … 501 500 if (!enabled() || !m_frontend || frame != m_inspectedPage->mainFrame()) 502 501 return; 503 resetInjectedScript();502 m_injectedScriptHost->discardInjectedScripts(); 504 503 } 505 504 … … 514 513 ScriptGlobalObject::set(m_scriptState, "InspectorBackend", m_inspectorBackend.get()); 515 514 ScriptGlobalObject::set(m_scriptState, "InspectorFrontendHost", m_inspectorFrontendHost.get()); 516 ScriptGlobalObject::set(m_scriptState, "InjectedScriptHost", m_injectedScriptHost.get());517 515 } 518 516 … … 527 525 return; 528 526 ScriptObject injectedScriptObj; 529 if (!ScriptGlobalObject::get(m_scriptState, "InjectedScript", injectedScriptObj))530 return;531 527 setFrontendProxyObject(m_scriptState, webInspectorObj, injectedScriptObj); 532 528 … … 546 542 } 547 543 548 void InspectorController::setFrontendProxyObject(ScriptState* scriptState, ScriptObject webInspectorObj, ScriptObject injectedScriptObj)544 void InspectorController::setFrontendProxyObject(ScriptState* scriptState, ScriptObject webInspectorObj, ScriptObject) 549 545 { 550 546 m_scriptState = scriptState; 551 m_injectedScriptObj = injectedScriptObj;552 547 m_frontend.set(new InspectorFrontend(this, scriptState, webInspectorObj)); 553 548 releaseDOMAgent(); … … 607 602 closeWindow(); 608 603 609 m_injectedScriptObj = ScriptObject();610 604 releaseDOMAgent(); 611 605 m_frontend.set(0); … … 716 710 m_frontend->reset(); 717 711 m_domAgent->reset(); 718 m_objectGroups.clear();719 m_idToWrappedObject.clear();720 712 } 721 713 … … 749 741 m_client->inspectedURLChanged(loader->url().string()); 750 742 743 m_injectedScriptHost->discardInjectedScripts(); 751 744 clearConsoleMessages(); 752 745 … … 1592 1585 void InspectorController::didPause() 1593 1586 { 1594 ScriptFunctionCall function(m_scriptState, m_injectedScriptObj, "getCallFrames"); 1595 ScriptValue callFrames = function.call(); 1587 JavaScriptCallFrame* callFrame = m_injectedScriptHost->currentCallFrame(); 1588 ScriptState* scriptState = callFrame->scopeChain()->globalObject->globalExec(); 1589 ASSERT(scriptState); 1590 ScriptObject injectedScriptObj = m_injectedScriptHost->injectedScriptFor(scriptState); 1591 ScriptFunctionCall function(scriptState, injectedScriptObj, "getCallFrames"); 1592 ScriptValue callFramesValue = function.call(); 1593 String callFrames = callFramesValue.toString(scriptState); 1594 1596 1595 m_frontend->pausedScript(callFrames); 1597 1596 } … … 1821 1820 } 1822 1821 1823 ScriptValue InspectorController::wrapObject(const ScriptValue& quarantinedObject, const String& objectGroup)1824 {1825 ScriptFunctionCall function(m_scriptState, m_injectedScriptObj, "createProxyObject");1826 function.appendArgument(quarantinedObject);1827 if (quarantinedObject.isObject()) {1828 long id = m_lastBoundObjectId++;1829 String objectId = String::format("object#%ld", id);1830 m_idToWrappedObject.set(objectId, quarantinedObject);1831 ObjectGroupsMap::iterator it = m_objectGroups.find(objectGroup);1832 if (it == m_objectGroups.end())1833 it = m_objectGroups.set(objectGroup, Vector<String>()).first;1834 it->second.append(objectId);1835 function.appendArgument(objectId);1836 }1837 ScriptValue wrapper = function.call();1838 return wrapper;1839 }1840 1841 ScriptValue InspectorController::unwrapObject(const String& objectId)1842 {1843 HashMap<String, ScriptValue>::iterator it = m_idToWrappedObject.find(objectId);1844 if (it != m_idToWrappedObject.end())1845 return it->second;1846 return ScriptValue();1847 }1848 1849 void InspectorController::releaseWrapperObjectGroup(const String& objectGroup)1850 {1851 ObjectGroupsMap::iterator groupIt = m_objectGroups.find(objectGroup);1852 if (groupIt == m_objectGroups.end())1853 return;1854 1855 Vector<String>& groupIds = groupIt->second;1856 for (Vector<String>::iterator it = groupIds.begin(); it != groupIds.end(); ++it)1857 m_idToWrappedObject.remove(*it);1858 m_objectGroups.remove(groupIt);1859 }1860 1861 void InspectorController::resetInjectedScript()1862 {1863 ScriptFunctionCall function(m_scriptState, m_injectedScriptObj, "reset");1864 function.call();1865 }1866 1867 1822 void InspectorController::deleteCookie(const String& cookieName, const String& domain) 1868 1823 { … … 1875 1830 } 1876 1831 1877 } // namespace WebCore 1832 ScriptObject InspectorController::injectedScriptForNodeId(long id) 1833 { 1834 1835 Frame* frame = 0; 1836 if (id) { 1837 ASSERT(m_domAgent); 1838 Node* node = m_domAgent->nodeForId(id); 1839 if (node) { 1840 Document* document = node->ownerDocument(); 1841 if (document) 1842 frame = document->frame(); 1843 } 1844 } else 1845 frame = m_inspectedPage->mainFrame(); 1846 1847 if (frame) 1848 return m_injectedScriptHost->injectedScriptFor(frame->script()->mainWorldScriptState()); 1849 1850 return ScriptObject(); 1851 } 1852 1853 } // namespace WebCore 1878 1854 1879 1855 #endif // ENABLE(INSPECTOR) -
trunk/WebCore/inspector/InspectorController.h
r53558 r53766 101 101 typedef HashMap<int, RefPtr<InspectorDatabaseResource> > DatabaseResourcesMap; 102 102 typedef HashMap<int, RefPtr<InspectorDOMStorageResource> > DOMStorageResourcesMap; 103 typedef HashMap<String, Vector<String> > ObjectGroupsMap;104 103 105 104 typedef enum { … … 249 248 250 249 void evaluateForTestInFrontend(long callId, const String& script); 250 251 ScriptObject injectedScriptForNodeId(long id); 251 252 252 253 private: … … 265 266 void releaseDOMAgent(); 266 267 267 friend class InspectorFrontend;268 // Following are used from InspectorFrontend only. We don't want to expose them to the269 // rest of the InspectorController clients.270 // TODO: extract these into a separate interface.271 ScriptValue wrapObject(const ScriptValue& object, const String& objectGroup);272 ScriptValue unwrapObject(const String& objectId);273 void releaseWrapperObjectGroup(const String& objectGroup);274 275 void resetInjectedScript();276 277 268 void deleteCookie(const String& cookieName, const String& domain); 278 269 … … 322 313 RefPtr<InspectorDOMAgent> m_domAgent; 323 314 OwnPtr<InspectorTimelineAgent> m_timelineAgent; 324 ScriptObject m_injectedScriptObj;325 315 Page* m_page; 326 316 RefPtr<Node> m_nodeToFocus; … … 351 341 RefPtr<InspectorFrontendHost> m_inspectorFrontendHost; 352 342 RefPtr<InjectedScriptHost> m_injectedScriptHost; 353 HashMap<String, ScriptValue> m_idToWrappedObject;354 ObjectGroupsMap m_objectGroups;355 long m_lastBoundObjectId;356 343 357 344 typedef HashMap<String, String> Settings; -
trunk/WebCore/inspector/InspectorFrontend.cpp
r53558 r53766 35 35 #include "ConsoleMessage.h" 36 36 #include "Frame.h" 37 #include "InjectedScriptHost.h" 37 38 #include "InspectorController.h" 38 39 #include "Node.h" … … 94 95 } 95 96 96 void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const Vector<ScriptString>& frames, const Vector<ScriptValue> wrappedArguments, const String& message)97 void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const Vector<ScriptString>& frames, ScriptState* scriptState, const Vector<ScriptValue> arguments, const String& message) 97 98 { 98 99 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); … … 100 101 function.appendArgument(messageObj); 101 102 if (!frames.isEmpty()) { 103 function.appendArgument(false); 102 104 for (unsigned i = 0; i < frames.size(); ++i) 103 105 function.appendArgument(frames[i]); 104 } else if (!wrappedArguments.isEmpty()) { 105 for (unsigned i = 0; i < wrappedArguments.size(); ++i) 106 function.appendArgument(m_inspectorController->wrapObject(wrappedArguments[i], "console")); 107 } else 106 } else if (!arguments.isEmpty()) { 107 function.appendArgument(true); 108 ScriptObject injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptFor(scriptState); 109 for (unsigned i = 0; i < arguments.size(); ++i) { 110 ScriptFunctionCall wrapFunction(scriptState, injectedScript, "wrapAndStringifyObject"); 111 wrapFunction.appendArgument(arguments[i]); 112 wrapFunction.appendArgument("console"); 113 ScriptValue r = wrapFunction.call(); 114 if (r.hasNoValue()) 115 return; 116 String s = r.toString(scriptState); 117 function.appendArgument(s); 118 } 119 } else { 120 function.appendArgument(false); 108 121 function.appendArgument(message); 122 } 109 123 function.call(); 110 124 } … … 313 327 } 314 328 315 void InspectorFrontend::pausedScript(const S criptValue& callFrames)329 void InspectorFrontend::pausedScript(const String& callFrames) 316 330 { 317 331 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); -
trunk/WebCore/inspector/InspectorFrontend.h
r53558 r53766 68 68 69 69 void updateConsoleMessageExpiredCount(unsigned count); 70 void addConsoleMessage(const ScriptObject& messageObj, const Vector<ScriptString>& frames, const Vector<ScriptValue> wrappedArguments, const String& message);70 void addConsoleMessage(const ScriptObject& messageObj, const Vector<ScriptString>& frames, ScriptState*, const Vector<ScriptValue> arguments, const String& message); 71 71 void updateConsoleMessageRepeatCount(unsigned count); 72 72 void clearConsoleMessages(); … … 96 96 void didGetProfileHeaders(int callId, const ScriptArray& headers); 97 97 void didGetProfile(int callId, const ScriptValue& profile); 98 void pausedScript(const S criptValue& callFrames);98 void pausedScript(const String& callFrames); 99 99 void resumedScript(); 100 100 #endif -
trunk/WebCore/inspector/front-end/AuditsPanel.js
r53558 r53766 194 194 this._updateLauncherViewControls(); 195 195 } else 196 InjectedScriptAccess. evaluate("window.location.reload()", nullCallback);196 InjectedScriptAccess.getDefault().evaluate("window.location.reload()", nullCallback); 197 197 }, 198 198 -
trunk/WebCore/inspector/front-end/ConsoleView.js
r53558 r53766 293 293 requestClearMessages: function() 294 294 { 295 InjectedScriptAccess. clearConsoleMessages(function() {});295 InjectedScriptAccess.getDefault().clearConsoleMessages(function() {}); 296 296 }, 297 297 … … 335 335 336 336 var includeInspectorCommandLineAPI = (!dotNotation && !bracketNotation); 337 if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) 338 var callFrameId = WebInspector.panels.scripts.selectedCallFrameId(); 339 InjectedScriptAccess.getCompletions(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions); 337 var callFrameId = WebInspector.panels.scripts.selectedCallFrameId(); 338 var injectedScriptAccess; 339 if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) { 340 var selectedCallFrame = WebInspector.panels.scripts.sidebarPanes.callstack.selectedCallFrame; 341 injectedScriptAccess = InjectedScriptAccess.get(selectedCallFrame.injectedScriptId); 342 } else 343 injectedScriptAccess = InjectedScriptAccess.getDefault(); 344 injectedScriptAccess.getCompletions(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions); 340 345 }, 341 346 … … 461 466 callback(result.value, result.isException); 462 467 }; 463 InjectedScriptAccess. evaluate(expression, objectGroup, evalCallback);468 InjectedScriptAccess.getDefault().evaluate(expression, objectGroup, evalCallback); 464 469 }, 465 470 … … 534 539 } 535 540 536 InjectedScriptAccess. pushNodeToFrontend(object, printNode);541 InjectedScriptAccess.get(object.injectedScriptId).pushNodeToFrontend(object, printNode); 537 542 }, 538 543 539 544 _formatarray: function(arr, elem) 540 545 { 541 InjectedScriptAccess.get Properties(arr, false, false, this._printArray.bind(this, elem));546 InjectedScriptAccess.get(arr.injectedScriptId).getProperties(arr, false, false, this._printArray.bind(this, elem)); 542 547 }, 543 548 -
trunk/WebCore/inspector/front-end/DOMAgent.js
r53558 r53766 34 34 35 35 this.id = payload.id; 36 // injectedScriptId is a node is for DOM nodes which should be converted 37 // to corresponding InjectedScript by the inspector backend. We indicate 38 // this by making injectedScriptId negative. 39 this.injectedScriptId = -payload.id; 36 40 this.nodeType = payload.nodeType; 37 41 this.nodeName = payload.nodeName; … … 517 521 { 518 522 this.id = payload.id; 523 this.injectedScriptId = payload.injectedScriptId; 519 524 this.width = payload.width; 520 525 this.height = payload.height; … … 559 564 var rule = {}; 560 565 rule.id = payload.id; 566 rule.injectedScriptId = payload.injectedScriptId; 561 567 rule.selectorText = payload.selectorText; 562 568 rule.style = new WebInspector.CSSStyleDeclaration(payload.style); -
trunk/WebCore/inspector/front-end/Database.js
r53558 r53766 96 96 onSuccess(result); 97 97 } 98 InjectedScriptAccess.executeSql(this._id, query, callback); 98 // FIXME: execute the query in the frame the DB comes from. 99 InjectedScriptAccess.getDefault().executeSql(this._id, query, callback); 99 100 } 100 101 } -
trunk/WebCore/inspector/front-end/ElementsPanel.js
r53558 r53766 64 64 } 65 65 if (this._focusedDOMNode) 66 InjectedScriptAccess. addInspectedNode(this._focusedDOMNode.id, function() {});66 InjectedScriptAccess.get(this._focusedDOMNode.injectedScriptId).addInspectedNode(this._focusedDOMNode.id, function() {}); 67 67 }; 68 68 … … 238 238 239 239 if (this._selectedPathOnReset) 240 InjectedScriptAccess. nodeByPath(this._selectedPathOnReset, selectLastSelectedNode.bind(this));240 InjectedScriptAccess.getDefault().nodeByPath(this._selectedPathOnReset, selectLastSelectedNode.bind(this)); 241 241 else 242 242 selectNode.call(this); … … 258 258 this._currentSearchResultIndex = 0; 259 259 this._searchResults = []; 260 InjectedScriptAccess. searchCanceled(function() {});260 InjectedScriptAccess.getDefault().searchCanceled(function() {}); 261 261 }, 262 262 … … 273 273 this._matchesCountUpdateTimeout = null; 274 274 275 InjectedScriptAccess. performSearch(whitespaceTrimmedQuery, function() {});275 InjectedScriptAccess.getDefault().performSearch(whitespaceTrimmedQuery, function() {}); 276 276 }, 277 277 -
trunk/WebCore/inspector/front-end/ElementsTreeOutline.js
r53558 r53766 358 358 callback(tooltipText); 359 359 } 360 var objectProxy = new WebInspector.ObjectProxy(node.i d);360 var objectProxy = new WebInspector.ObjectProxy(node.injectedScriptId, node.id); 361 361 WebInspector.ObjectProxy.getPropertiesAsync(objectProxy, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], createTooltipThenCallback); 362 362 }, … … 1076 1076 function commitChange(value) 1077 1077 { 1078 InjectedScriptAccess. setOuterHTML(node.id, value, wasExpanded, selectNode.bind(this));1079 } 1080 1081 InjectedScriptAccess.get NodePropertyValue(node.id, "outerHTML", this._startEditingAsHTML.bind(this, commitChange));1078 InjectedScriptAccess.get(node.injectedScriptId).setOuterHTML(node.id, value, wasExpanded, selectNode.bind(this)); 1079 } 1080 1081 InjectedScriptAccess.get(node.injectedScriptId).getNodePropertyValue(node.id, "outerHTML", this._startEditingAsHTML.bind(this, commitChange)); 1082 1082 }, 1083 1083 -
trunk/WebCore/inspector/front-end/EventListenersSidebarPane.js
r53558 r53766 192 192 var value = this.eventListener[propertyName]; 193 193 if (value instanceof WebInspector.DOMNode) 194 value = new WebInspector.ObjectProxy(value.i d, [], 0, appropriateSelectorForNode(value), true);194 value = new WebInspector.ObjectProxy(value.injectedScriptId, value.id, [], 0, appropriateSelectorForNode(value), true); 195 195 else 196 196 value = WebInspector.ObjectProxy.wrapPrimitiveValue(value); -
trunk/WebCore/inspector/front-end/InjectedScript.js
r53558 r53766 27 27 */ 28 28 29 var injectedScriptConstructor = (function (InjectedScriptHost, inspectedWindow, injectedScriptId) { 30 29 31 var InjectedScript = {}; 32 33 InjectedScript.lastBoundObjectId = 1; 34 InjectedScript.idToWrappedObject = {}; 35 InjectedScript.objectGroups = {}; 36 InjectedScript.wrapObject = function(object, objectGroupName) 37 { 38 var objectId; 39 if (typeof object === "object" || typeof object === "function" || 40 (typeof object === "undefined" && object instanceof inspectedWindow.HTMLAllCollection)) { // FIXME(33716) 41 var id = InjectedScript.lastBoundObjectId++; 42 objectId = "object#" + id; 43 InjectedScript.idToWrappedObject[objectId] = object; 44 45 var group = InjectedScript.objectGroups[objectGroupName]; 46 if (!group) { 47 group = []; 48 InjectedScript.objectGroups[objectGroupName] = group; 49 } 50 group.push(objectId); 51 } 52 return InjectedScript.createProxyObject(object, objectId); 53 }; 54 55 InjectedScript.wrapAndStringifyObject = function(object, objectGroupName) { 56 var r = InjectedScript.wrapObject(object, objectGroupName); 57 return InjectedScript.JSON.stringify(r); 58 }; 59 60 InjectedScript.unwrapObject = function(objectId) { 61 return InjectedScript.idToWrappedObject[objectId]; 62 }; 63 64 InjectedScript.releaseWrapperObjectGroup = function(objectGroupName) { 65 var group = InjectedScript.objectGroups[objectGroupName]; 66 if (!group) 67 return; 68 for (var i = 0; i < group.length; i++) 69 delete InjectedScript.idToWrappedObject[group[i]]; 70 delete InjectedScript.objectGroups[objectGroupName]; 71 }; 30 72 31 73 // Called from within InspectorController on the 'inspected page' side. … … 52 94 result = null; 53 95 } 54 return JSON.stringify(result);96 return InjectedScript.JSON.stringify(result); 55 97 } 56 98 … … 170 212 if (disabled) { 171 213 if (!style.__disabledPropertyValues || !style.__disabledPropertyPriorities) { 172 var inspectedWindow = InjectedScript._window(); 173 style.__disabledProperties = new inspectedWindow.Object; 174 style.__disabledPropertyValues = new inspectedWindow.Object; 175 style.__disabledPropertyPriorities = new inspectedWindow.Object; 214 style.__disabledProperties = {}; 215 style.__disabledPropertyValues = {}; 216 style.__disabledPropertyPriorities = {}; 176 217 } 177 218 … … 307 348 } 308 349 ruleValue.id = rule.id; 350 ruleValue.injectedScriptId = injectedScriptId; 309 351 } 310 352 return ruleValue; … … 345 387 } 346 388 result.id = style.id; 389 result.injectedScriptId = injectedScriptId; 347 390 } 348 391 return result; … … 446 489 { 447 490 var object = InjectedScript._resolveObject(objectProxy); 448 if (! object)491 if (!InjectedScript._isDefined(object)) 449 492 return false; 450 493 … … 480 523 { 481 524 var object = InjectedScript._resolveObject(objectProxy); 482 if (! object)525 if (!InjectedScript._isDefined(object)) 483 526 return false; 484 527 … … 536 579 InjectedScript._getPropertyNames = function(object, resultSet) 537 580 { 538 for (var o = object; o; o = o.__proto__) { 539 try { 540 var names = Object.getOwnPropertyNames(o); 541 for (var i = 0; i < names.length; ++i) 542 resultSet[names[i]] = true; 543 } catch (e) { 544 } 581 if (Object.getOwnPropertyNames) { 582 for (var o = object; o; o = o.__proto__) { 583 try { 584 var names = Object.getOwnPropertyNames(o); 585 for (var i = 0; i < names.length; ++i) 586 resultSet[names[i]] = true; 587 } catch (e) { 588 } 589 } 590 } else { 591 // Chromium doesn't support getOwnPropertyNames yet. 592 for (var name in object) 593 resultSet[name] = true; 545 594 } 546 595 } … … 589 638 var result = {}; 590 639 try { 591 result.value = InjectedScriptHost.wrapObject(InjectedScript._evaluateOn(evalFunction, object, expression), objectGroup); 640 result.value = InjectedScript.wrapObject(InjectedScript._evaluateOn(evalFunction, object, expression), objectGroup); 641 592 642 // Handle error that might have happened while describing result. 593 643 if (result.value.errorText) { … … 886 936 callFrame = callFrame.caller; 887 937 } while (callFrame); 888 return result;938 return InjectedScript.JSON.stringify(result); 889 939 } 890 940 … … 916 966 return; 917 967 918 var inspectedWindow = InjectedScript._window();919 968 inspectedWindow.console.log(o); 920 969 if (Object.type(o) === "node") { … … 1015 1064 };"); 1016 1065 1017 inspectorCommandLineAPI.clear = InjectedScript Host.wrapCallback(InjectedScript.clearConsoleMessages);1018 inspectorCommandLineAPI.inspect = InjectedScript Host.wrapCallback(InjectedScript._inspectObject);1019 inspectorCommandLineAPI.copy = InjectedScript Host.wrapCallback(InjectedScript._copy);1066 inspectorCommandLineAPI.clear = InjectedScript.clearConsoleMessages; 1067 inspectorCommandLineAPI.inspect = InjectedScript._inspectObject; 1068 inspectorCommandLineAPI.copy = InjectedScript._copy; 1020 1069 } 1021 1070 … … 1027 1076 1028 1077 // Follow the property path. 1029 for (var i = 0; object&& path && i < path.length; ++i)1078 for (var i = 0; InjectedScript._isDefined(object) && path && i < path.length; ++i) 1030 1079 object = object[path[i]]; 1031 1080 1032 1081 // Get to the necessary proto layer. 1033 for (var i = 0; object&& protoDepth && i < protoDepth; ++i)1082 for (var i = 0; InjectedScript._isDefined(object) && protoDepth && i < protoDepth; ++i) 1034 1083 object = object.__proto__; 1035 1084 … … 1041 1090 // TODO: replace with 'return window;' once this script is injected into 1042 1091 // the page's context. 1043 return InjectedScriptHost.inspectedWindow();1092 return inspectedWindow; 1044 1093 } 1045 1094 … … 1060 1109 return InjectedScript._nodeForId(objectId); 1061 1110 } else if (typeof objectId === "string") { 1062 return InjectedScript Host.unwrapObject(objectId);1111 return InjectedScript.unwrapObject(objectId); 1063 1112 } else if (typeof objectId === "object") { 1064 1113 var callFrame = InjectedScript._callFrameForId(objectId.callFrame); … … 1090 1139 { 1091 1140 var result = {}; 1141 result.injectedScriptId = injectedScriptId; 1092 1142 result.objectId = objectId; 1093 1143 result.type = Object.type(object); … … 1171 1221 } 1172 1222 } 1173 InjectedScriptHost.reportDidDispatchOnInjectedScript(callId, JSON.stringify(result), false);1223 InjectedScriptHost.reportDidDispatchOnInjectedScript(callId, InjectedScript.JSON.stringify(result), false); 1174 1224 } 1175 1225 1176 1226 function errorCallback(tx, error) 1177 1227 { 1178 InjectedScriptHost.reportDidDispatchOnInjectedScript(callId, JSON.stringify(error), false);1228 InjectedScriptHost.reportDidDispatchOnInjectedScript(callId, InjectedScript.JSON.stringify(error), false); 1179 1229 } 1180 1230 1181 1231 function queryTransaction(tx) 1182 1232 { 1183 tx.executeSql(query, null, InjectedScriptHost.wrapCallback(successCallback), InjectedScriptHost.wrapCallback(errorCallback));1233 tx.executeSql(query, null, successCallback, errorCallback); 1184 1234 } 1185 1235 … … 1187 1237 if (!database) 1188 1238 errorCallback(null, { code : 2 }); // Return as unexpected version. 1189 database.transaction( InjectedScriptHost.wrapCallback(queryTransaction), InjectedScriptHost.wrapCallback(errorCallback));1239 database.transaction(queryTransaction, errorCallback); 1190 1240 return true; 1241 } 1242 1243 InjectedScript._isDefined = function(object) 1244 { 1245 return object || object instanceof inspectedWindow.HTMLAllCollection; 1191 1246 } 1192 1247 … … 1195 1250 if (obj === null) 1196 1251 return "null"; 1252 1253 // FIXME(33716): typeof document.all is always 'undefined'. 1254 if (obj instanceof inspectedWindow.HTMLAllCollection) 1255 return "array"; 1197 1256 1198 1257 var type = typeof obj; … … 1299 1358 return result; 1300 1359 } 1360 1361 InjectedScript.JSON = {}; 1362 1363 // The following code is a slightly modified version of http://www.json.org/json2.js last modified on 2009-09-29. 1364 // Compared to the original version it ignores toJSON method on objects it serializes. 1365 // It's done to avoid weird behaviour when inspected application provides it's own implementation 1366 // of toJSON methods to the Object and other intrinsic types. We use InjectedScript.JSON implementation 1367 // instead of global JSON object since it can have been modified by the inspected code. 1368 (function() { 1369 1370 function f(n) { 1371 // Format integers to have at least two digits. 1372 return n < 10 ? '0' + n : n; 1373 } 1374 1375 var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, 1376 escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, 1377 gap, 1378 indent, 1379 meta = { // table of character substitutions 1380 '\b': '\\b', 1381 '\t': '\\t', 1382 '\n': '\\n', 1383 '\f': '\\f', 1384 '\r': '\\r', 1385 '"' : '\\"', 1386 '\\': '\\\\' 1387 }, 1388 rep; 1389 1390 1391 function quote(string) { 1392 1393 // If the string contains no control characters, no quote characters, and no 1394 // backslash characters, then we can safely slap some quotes around it. 1395 // Otherwise we must also replace the offending characters with safe escape 1396 // sequences. 1397 1398 escapable.lastIndex = 0; 1399 return escapable.test(string) ? 1400 '"' + string.replace(escapable, function (a) { 1401 var c = meta[a]; 1402 return typeof c === 'string' ? c : 1403 '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); 1404 }) + '"' : 1405 '"' + string + '"'; 1406 } 1407 1408 1409 function str(key, holder) { 1410 1411 // Produce a string from holder[key]. 1412 1413 var i, // The loop counter. 1414 k, // The member key. 1415 v, // The member value. 1416 length, 1417 mind = gap, 1418 partial, 1419 value = holder[key]; 1420 1421 // If we were called with a replacer function, then call the replacer to 1422 // obtain a replacement value. 1423 1424 if (typeof rep === 'function') { 1425 value = rep.call(holder, key, value); 1426 } 1427 1428 // What happens next depends on the value's type. 1429 1430 switch (typeof value) { 1431 case 'string': 1432 return quote(value); 1433 1434 case 'number': 1435 1436 // JSON numbers must be finite. Encode non-finite numbers as null. 1437 1438 return isFinite(value) ? String(value) : 'null'; 1439 1440 case 'boolean': 1441 case 'null': 1442 1443 // If the value is a boolean or null, convert it to a string. Note: 1444 // typeof null does not produce 'null'. The case is included here in 1445 // the remote chance that this gets fixed someday. 1446 1447 return String(value); 1448 1449 // If the type is 'object', we might be dealing with an object or an array or 1450 // null. 1451 1452 case 'object': 1453 1454 // Due to a specification blunder in ECMAScript, typeof null is 'object', 1455 // so watch out for that case. 1456 1457 if (!value) { 1458 return 'null'; 1459 } 1460 1461 // Make an array to hold the partial results of stringifying this object value. 1462 1463 gap += indent; 1464 partial = []; 1465 1466 // Is the value an array? 1467 1468 if (Object.prototype.toString.apply(value) === '[object Array]') { 1469 1470 // The value is an array. Stringify every element. Use null as a placeholder 1471 // for non-JSON values. 1472 1473 length = value.length; 1474 for (i = 0; i < length; i += 1) { 1475 partial[i] = str(i, value) || 'null'; 1476 } 1477 1478 // Join all of the elements together, separated with commas, and wrap them in 1479 // brackets. 1480 1481 v = partial.length === 0 ? '[]' : 1482 gap ? '[\n' + gap + 1483 partial.join(',\n' + gap) + '\n' + 1484 mind + ']' : 1485 '[' + partial.join(',') + ']'; 1486 gap = mind; 1487 return v; 1488 } 1489 1490 // If the replacer is an array, use it to select the members to be stringified. 1491 1492 if (rep && typeof rep === 'object') { 1493 length = rep.length; 1494 for (i = 0; i < length; i += 1) { 1495 k = rep[i]; 1496 if (typeof k === 'string') { 1497 v = str(k, value); 1498 if (v) { 1499 partial.push(quote(k) + (gap ? ': ' : ':') + v); 1500 } 1501 } 1502 } 1503 } else { 1504 1505 // Otherwise, iterate through all of the keys in the object. 1506 1507 for (k in value) { 1508 if (Object.hasOwnProperty.call(value, k)) { 1509 v = str(k, value); 1510 if (v) { 1511 partial.push(quote(k) + (gap ? ': ' : ':') + v); 1512 } 1513 } 1514 } 1515 } 1516 1517 // Join all of the member texts together, separated with commas, 1518 // and wrap them in braces. 1519 1520 v = partial.length === 0 ? '{}' : 1521 gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + 1522 mind + '}' : '{' + partial.join(',') + '}'; 1523 gap = mind; 1524 return v; 1525 } 1526 } 1527 1528 InjectedScript.JSON.stringify = function (value, replacer, space) { 1529 1530 // The stringify method takes a value and an optional replacer, and an optional 1531 // space parameter, and returns a JSON text. The replacer can be a function 1532 // that can replace values, or an array of strings that will select the keys. 1533 // A default replacer method can be provided. Use of the space parameter can 1534 // produce text that is more easily readable. 1535 1536 var i; 1537 gap = ''; 1538 indent = ''; 1539 1540 // If the space parameter is a number, make an indent string containing that 1541 // many spaces. 1542 1543 if (typeof space === 'number') { 1544 for (i = 0; i < space; i += 1) { 1545 indent += ' '; 1546 } 1547 1548 // If the space parameter is a string, it will be used as the indent string. 1549 1550 } else if (typeof space === 'string') { 1551 indent = space; 1552 } 1553 1554 // If there is a replacer, it must be a function or an array. 1555 // Otherwise, throw an error. 1556 1557 rep = replacer; 1558 if (replacer && typeof replacer !== 'function' && 1559 (typeof replacer !== 'object' || 1560 typeof replacer.length !== 'number')) { 1561 throw new Error('JSON.stringify'); 1562 } 1563 1564 // Make a fake root object containing our value under the key of ''. 1565 // Return the result of stringifying the value. 1566 1567 return str('', {'': value}); 1568 }; 1569 1570 1571 // If the JSON object does not yet have a parse method, give it one. 1572 1573 InjectedScript.JSON.parse = function (text, reviver) { 1574 1575 // The parse method takes a text and an optional reviver function, and returns 1576 // a JavaScript value if the text is a valid JSON text. 1577 1578 var j; 1579 1580 function walk(holder, key) { 1581 1582 // The walk method is used to recursively walk the resulting structure so 1583 // that modifications can be made. 1584 1585 var k, v, value = holder[key]; 1586 if (value && typeof value === 'object') { 1587 for (k in value) { 1588 if (Object.hasOwnProperty.call(value, k)) { 1589 v = walk(value, k); 1590 if (v !== undefined) { 1591 value[k] = v; 1592 } else { 1593 delete value[k]; 1594 } 1595 } 1596 } 1597 } 1598 return reviver.call(holder, key, value); 1599 } 1600 1601 1602 // Parsing happens in four stages. In the first stage, we replace certain 1603 // Unicode characters with escape sequences. JavaScript handles many characters 1604 // incorrectly, either silently deleting them, or treating them as line endings. 1605 1606 cx.lastIndex = 0; 1607 if (cx.test(text)) { 1608 text = text.replace(cx, function (a) { 1609 return '\\u' + 1610 ('0000' + a.charCodeAt(0).toString(16)).slice(-4); 1611 }); 1612 } 1613 1614 // In the second stage, we run the text against regular expressions that look 1615 // for non-JSON patterns. We are especially concerned with '()' and 'new' 1616 // because they can cause invocation, and '=' because it can cause mutation. 1617 // But just to be safe, we want to reject all unexpected forms. 1618 1619 // We split the second stage into 4 regexp operations in order to work around 1620 // crippling inefficiencies in IE's and Safari's regexp engines. First we 1621 // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we 1622 // replace all simple value tokens with ']' characters. Third, we delete all 1623 // open brackets that follow a colon or comma or that begin the text. Finally, 1624 // we look to see that the remaining characters are only whitespace or ']' or 1625 // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. 1626 1627 if (/^[\],:{}\s]*$/. 1628 test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@'). 1629 replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'). 1630 replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { 1631 1632 // In the third stage we use the eval function to compile the text into a 1633 // JavaScript structure. The '{' operator is subject to a syntactic ambiguity 1634 // in JavaScript: it can begin a block or an object literal. We wrap the text 1635 // in parens to eliminate the ambiguity. 1636 1637 j = eval('(' + text + ')'); 1638 1639 // In the optional fourth stage, we recursively walk the new structure, passing 1640 // each name/value pair to a reviver function for possible transformation. 1641 1642 return typeof reviver === 'function' ? 1643 walk({'': j}, '') : j; 1644 } 1645 1646 // If the text is not JSON parseable, then a SyntaxError is thrown. 1647 1648 throw new SyntaxError('JSON.parse'); 1649 }; 1650 }()); 1651 1652 return InjectedScript; 1653 }); -
trunk/WebCore/inspector/front-end/InjectedScriptAccess.js
r53558 r53766 30 30 */ 31 31 32 var InjectedScriptAccess = {}; 32 function InjectedScriptAccess(injectedScriptId) { 33 this._injectedScriptId = injectedScriptId; 34 } 35 36 InjectedScriptAccess.get = function(injectedScriptId) 37 { 38 return new InjectedScriptAccess(injectedScriptId); 39 } 40 41 InjectedScriptAccess.getDefault = function() 42 { 43 return InjectedScriptAccess.get(0); 44 } 45 46 InjectedScriptAccess.prototype = {}; 33 47 34 48 InjectedScriptAccess._installHandler = function(methodName, async) 35 49 { 36 InjectedScriptAccess [methodName] = function()50 InjectedScriptAccess.prototype[methodName] = function() 37 51 { 38 52 var allArgs = Array.prototype.slice.call(arguments); … … 48 62 } 49 63 var callId = WebInspector.Callback.wrap(myCallback); 50 InspectorBackend.dispatchOnInjectedScript(callId, methodName, argsString, !!async); 64 65 InspectorBackend.dispatchOnInjectedScript(callId, this._injectedScriptId, methodName, argsString, !!async); 51 66 }; 52 67 } -
trunk/WebCore/inspector/front-end/MetricsSidebarPane.js
r53558 r53766 31 31 WebInspector.SidebarPane.call(this, WebInspector.UIString("Metrics")); 32 32 this._inlineStyleId = null; 33 this._inlineStyleInjectedScriptId = null; 33 34 } 34 35 … … 53 54 self._update(style); 54 55 }; 55 InjectedScriptAccess.get ComputedStyle(node.id, callback);56 InjectedScriptAccess.get(node.injectedScriptId).getComputedStyle(node.id, callback); 56 57 57 58 var inlineStyleCallback = function(stylePayload) { … … 59 60 return; 60 61 self._inlineStyleId = stylePayload.id; 61 }; 62 InjectedScriptAccess.getInlineStyle(node.id, inlineStyleCallback); 62 self._inlineStyleInjectedScriptId = stylePayload.injectedScriptId; 63 }; 64 InjectedScriptAccess.get(node.injectedScriptId).getInlineStyle(node.id, inlineStyleCallback); 63 65 }, 64 66 … … 205 207 self.update(); 206 208 }; 207 InjectedScriptAccess. setStyleProperty(this._inlineStyleId, context.styleProperty, userInput, callback);209 InjectedScriptAccess.get(this._inlineStyleInjectedScriptId).setStyleProperty(this._inlineStyleId, context.styleProperty, userInput, callback); 208 210 } 209 211 } -
trunk/WebCore/inspector/front-end/ObjectPropertiesSection.js
r53558 r53766 51 51 self.updateProperties(properties); 52 52 }; 53 InjectedScriptAccess.get Properties(this.object, this.ignoreHasOwnProperty, true, callback);53 InjectedScriptAccess.get(this.object.injectedScriptId).getProperties(this.object, this.ignoreHasOwnProperty, true, callback); 54 54 }, 55 55 … … 148 148 } 149 149 }; 150 InjectedScriptAccess.get Properties(this.property.value, false, true, callback.bind(this));150 InjectedScriptAccess.get(this.property.value.injectedScriptId).getProperties(this.property.value, false, true, callback.bind(this)); 151 151 }, 152 152 … … 252 252 } 253 253 }; 254 InjectedScriptAccess. setPropertyValue(this.property.parentObjectProxy, this.property.name, expression.trim(), callback);254 InjectedScriptAccess.get(this.property.parentObjectProxy.injectedScriptId).setPropertyValue(this.property.parentObjectProxy, this.property.name, expression.trim(), callback); 255 255 } 256 256 } -
trunk/WebCore/inspector/front-end/ObjectProxy.js
r53558 r53766 29 29 */ 30 30 31 WebInspector.ObjectProxy = function( objectId, path, protoDepth, description, hasChildren)31 WebInspector.ObjectProxy = function(injectedScriptId, objectId, path, protoDepth, description, hasChildren) 32 32 { 33 33 this.objectId = objectId; 34 this.injectedScriptId = injectedScriptId; 34 35 this.path = path || []; 35 36 this.protoDepth = protoDepth || 0; … … 61 62 callback(result); 62 63 }; 63 InjectedScriptAccess.get Properties(objectProxy, true, false, createPropertiesMapThenCallback);64 InjectedScriptAccess.get(objectProxy.injectedScriptId).getProperties(objectProxy, true, false, createPropertiesMapThenCallback); 64 65 } 65 66 -
trunk/WebCore/inspector/front-end/PropertiesSidebarPane.js
r53558 r53766 51 51 // Get array of prototype user-friendly names. 52 52 for (var i = 0; i < prototypes.length; ++i) { 53 var prototype = new WebInspector.ObjectProxy(node.i d, [], i);53 var prototype = new WebInspector.ObjectProxy(node.injectedScriptId, node.id, [], i); 54 54 var section = new WebInspector.ObjectPropertiesSection(prototype, prototypes[i], WebInspector.UIString("Prototype")); 55 55 self.sections.push(section); … … 57 57 } 58 58 }; 59 InjectedScriptAccess.get Prototypes(node.id, callback);59 InjectedScriptAccess.get(node.injectedScriptId).getPrototypes(node.id, callback); 60 60 } 61 61 } -
trunk/WebCore/inspector/front-end/ResourcesPanel.js
r53558 r53766 979 979 ondblclick: function(event) 980 980 { 981 InjectedScriptAccess. openInInspectedWindow(this.resource.url, function() {});981 InjectedScriptAccess.getDefault().openInInspectedWindow(this.resource.url, function() {}); 982 982 }, 983 983 -
trunk/WebCore/inspector/front-end/ScriptsPanel.js
r53696 r53766 408 408 callback(result.value, result.isException); 409 409 } 410 InjectedScriptAccess. evaluateInCallFrame(callFrame.id, code, objectGroup, evalCallback);410 InjectedScriptAccess.get(callFrame.injectedScriptId).evaluateInCallFrame(callFrame.id, code, objectGroup, evalCallback); 411 411 }, 412 412 -
trunk/WebCore/inspector/front-end/StylesSidebarPane.js
r53558 r53766 116 116 } 117 117 118 InjectedScriptAccess.get Styles(node.id, !WebInspector.settings.showUserAgentStyles, callback);118 InjectedScriptAccess.get(node.injectedScriptId).getStyles(node.id, !WebInspector.settings.showUserAgentStyles, callback); 119 119 }, 120 120 … … 693 693 } 694 694 695 InjectedScriptAccess. applyStyleRuleText(this.rule.id, newContent, this.pane.node.id, callback);695 InjectedScriptAccess.get(this.rule.injectedScriptId).applyStyleRuleText(this.rule.id, newContent, this.pane.node.id, callback); 696 696 }, 697 697 … … 747 747 } 748 748 749 InjectedScriptAccess. addStyleSelector(newContent, this.pane.node.id, callback);749 InjectedScriptAccess.get(this.pane.node.injectedScriptId).addStyleSelector(newContent, this.pane.node.id, callback); 750 750 }, 751 751 … … 1054 1054 } 1055 1055 1056 InjectedScriptAccess. toggleStyleEnabled(this.style.id, this.name, disabled, callback);1056 InjectedScriptAccess.get(this.style.injectedScriptId).toggleStyleEnabled(this.style.id, this.name, disabled, callback); 1057 1057 }, 1058 1058 … … 1217 1217 // Restore the original CSS text before applying user changes. This is needed to prevent 1218 1218 // new properties from sticking around if the user adds one, then removes it. 1219 InjectedScriptAccess. setStyleText(this.style.id, this.originalCSSText);1219 InjectedScriptAccess.get(this.style.injectedScriptId).setStyleText(this.style.id, this.originalCSSText); 1220 1220 } 1221 1221 … … 1237 1237 this.treeOutline.removeChild(this); 1238 1238 else if (this.originalCSSText) { 1239 InjectedScriptAccess. setStyleText(this.style.id, this.originalCSSText);1239 InjectedScriptAccess.get(this.style.injectedScriptId).setStyleText(this.style.id, this.originalCSSText); 1240 1240 1241 1241 if (this.treeOutline.section && this.treeOutline.section.pane) … … 1362 1362 } 1363 1363 1364 InjectedScriptAccess. applyStyleText(this.style.id, styleText.trim(), this.name, callback);1364 InjectedScriptAccess.get(this.style.injectedScriptId).applyStyleText(this.style.id, styleText.trim(), this.name, callback); 1365 1365 } 1366 1366 } -
trunk/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js
r53558 r53766 132 132 } 133 133 134 InspectorBackend.releaseWrapperObjectGroup(this._watchObjectGroupId) 134 // TODO: pass exact injected script id. 135 InspectorBackend.releaseWrapperObjectGroup(0, this._watchObjectGroupId) 135 136 var properties = []; 136 137 -
trunk/WebCore/inspector/front-end/inspector.js
r53558 r53766 390 390 WebInspector.loaded = function() 391 391 { 392 InspectorBackend.setInjectedScriptSource("(" + injectedScriptConstructor + ");"); 393 392 394 var platform = WebInspector.platform; 393 395 document.body.addStyleClass("platform-" + platform); … … 1148 1150 WebInspector.pausedScript = function(callFrames) 1149 1151 { 1152 callFrames = JSON.parse(callFrames); 1150 1153 this.panels.scripts.debuggerPaused(callFrames); 1151 1154 } … … 1204 1207 } 1205 1208 1206 WebInspector.addConsoleMessage = function(payload )1209 WebInspector.addConsoleMessage = function(payload, argumentsStringified, opt_args) 1207 1210 { 1208 1211 var consoleMessage = new WebInspector.ConsoleMessage( … … 1214 1217 payload.groupLevel, 1215 1218 payload.repeatCount); 1216 consoleMessage.setMessageBody(Array.prototype.slice.call(arguments, 1)); 1219 var parsedArguments = []; 1220 for (var i = 2; i < arguments.length; i++) { 1221 if (argumentsStringified) 1222 parsedArguments.push(JSON.parse(arguments[i])); 1223 else 1224 parsedArguments.push(arguments[i]); 1225 } 1226 consoleMessage.setMessageBody(parsedArguments); 1217 1227 this.console.addMessage(consoleMessage); 1218 1228 } … … 1271 1281 1272 1282 // ConsoleMessage expects a proxy object 1273 message = new WebInspector.ObjectProxy(null, [], 0, message, false);1283 message = new WebInspector.ObjectProxy(null, null, [], 0, message, false); 1274 1284 1275 1285 // post the message
Note: See TracChangeset
for help on using the changeset viewer.