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