Changeset 55771 in webkit
- Timestamp:
- Mar 10, 2010 1:22:04 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 28 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r55767 r55771 1 2010-03-10 Andrey Kosyakov <caseq@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: display list of active workers & support debugging 6 with fake workers. 7 https://bugs.webkit.org/show_bug.cgi?id=35568 8 9 * English.lproj/localizedStrings.js: 10 * WebCore.gypi: 11 * WebCore.vcproj/WebCore.vcproj: 12 * bindings/js/JSInjectedScriptHostCustom.cpp: 13 (WebCore::InjectedScriptHost::createInjectedScript): 14 (WebCore::InjectedScriptHost::injectedScriptFor): 15 * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: 16 (WebCore::InjectedScriptHost::createInjectedScript): 17 (WebCore::InjectedScriptHost::injectedScriptFor): 18 * dom/Document.cpp: 19 (WebCore::Document::inspectorController): 20 * dom/Document.h: 21 * dom/ScriptExecutionContext.h: 22 (WebCore::ScriptExecutionContext::inspectorController): 23 * inspector/InjectedScriptHost.cpp: 24 (WebCore::InjectedScriptHost::InjectedScriptHost): 25 (WebCore::InjectedScriptHost::injectScript): 26 (WebCore::InjectedScriptHost::nextWorkerId): 27 (WebCore::InjectedScriptHost::didCreateWorker): 28 (WebCore::InjectedScriptHost::willDestroyWorker): 29 * inspector/InjectedScriptHost.h: 30 * inspector/InjectedScriptHost.idl: 31 * inspector/InspectorController.cpp: 32 (WebCore::InspectorController::populateScriptObjects): 33 (WebCore::InspectorController::resetScriptObjects): 34 (WebCore::InspectorController::didCommitLoad): 35 (WebCore::InspectorController::didCreateWorker): 36 (WebCore::InspectorController::willDestroyWorker): 37 * inspector/InspectorController.h: 38 * inspector/InspectorFrontend.cpp: 39 (WebCore::InspectorFrontend::didCreateWorker): 40 (WebCore::InspectorFrontend::willDestroyWorker): 41 * inspector/InspectorFrontend.h: 42 * inspector/InspectorWorkerResource.h: Added. 43 (WebCore::InspectorWorkerResource::create): 44 (WebCore::InspectorWorkerResource::id): 45 (WebCore::InspectorWorkerResource::url): 46 (WebCore::InspectorWorkerResource::isSharedWorker): 47 (WebCore::InspectorWorkerResource::InspectorWorkerResource): 48 * inspector/front-end/Checkbox.js: Added. 49 (WebInspector.Checkbox.callbackWrapper): 50 (WebInspector.Checkbox): 51 (WebInspector.Checkbox.prototype.checked): 52 * inspector/front-end/InjectedFakeWorker.js: 53 (InjectedFakeWorker.FakeWorker): 54 (InjectedFakeWorker.FakeWorker.prototype.terminate): 55 (InjectedFakeWorker.FakeWorker.prototype._handleException): 56 (InjectedFakeWorker.FakeWorker.prototype._importScripts): 57 (InjectedFakeWorker.FakeWorker.prototype._loadScript): 58 (InjectedFakeWorker.FakeWorker.prototype._expandURLAndCheckOrigin): 59 * inspector/front-end/ScriptsPanel.js: 60 (WebInspector.ScriptsPanel): 61 (WebInspector.ScriptsPanel.prototype.debuggerWasEnabled): 62 (WebInspector.ScriptsPanel.prototype.debuggerWasDisabled): 63 (WebInspector.ScriptsPanel.prototype.reset): 64 * inspector/front-end/StylesSidebarPane.js: 65 (WebInspector.StylePropertiesSection.showInheritedToggleFunction): 66 (WebInspector.StylePropertiesSection): 67 * inspector/front-end/WebKit.qrc: 68 * inspector/front-end/WorkersSidebarPane.js: Added. 69 (WebInspector.WorkersSidebarPane): 70 (WebInspector.WorkersSidebarPane.prototype.addWorker): 71 (WebInspector.WorkersSidebarPane.prototype.removeWorker): 72 (WebInspector.WorkersSidebarPane.prototype.setInstrumentation): 73 (WebInspector.WorkersSidebarPane.prototype.reset): 74 (WebInspector.WorkersSidebarPane.prototype._onTriggerInstrument): 75 (WebInspector.Worker): 76 (WebInspector.didCreateWorker): 77 (WebInspector.willDestroyWorker): 78 * inspector/front-end/inspector.css: 79 * inspector/front-end/inspector.html: 80 * workers/AbstractWorker.cpp: 81 (WebCore::AbstractWorker::AbstractWorker): 82 (WebCore::AbstractWorker::~AbstractWorker): 83 (WebCore::AbstractWorker::onDestroyWorker): 84 (WebCore::AbstractWorker::contextDestroyed): 85 * workers/AbstractWorker.h: 86 (WebCore::AbstractWorker::id): 87 * workers/SharedWorker.cpp: 88 (WebCore::SharedWorker::SharedWorker): 89 * workers/Worker.cpp: 90 (WebCore::Worker::Worker): 91 1 92 2010-03-10 Roland Steiner <rolandsteiner@chromium.org> 2 93 -
trunk/WebCore/WebCore.gypi
r55673 r55771 1623 1623 'inspector/InspectorTimelineAgent.cpp', 1624 1624 'inspector/InspectorTimelineAgent.h', 1625 'inspector/InspectorWorkerResource.h', 1625 1626 'inspector/JavaScriptCallFrame.cpp', 1626 1627 'inspector/JavaScriptCallFrame.h', … … 3744 3745 'inspector/front-end/CallStackSidebarPane.js', 3745 3746 'inspector/front-end/ChangesView.js', 3747 'inspector/front-end/Checkbox.js', 3746 3748 'inspector/front-end/Color.js', 3747 3749 'inspector/front-end/ConsolePanel.js', … … 3820 3822 'inspector/front-end/WatchExpressionsSidebarPane.js', 3821 3823 'inspector/front-end/WelcomeView.js', 3824 'inspector/front-end/WorkersSidebarPane.js', 3822 3825 'inspector/front-end/audits.css', 3823 3826 'inspector/front-end/inspector.css', -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r55635 r55771 42762 42762 </File> 42763 42763 <File 42764 RelativePath="..\inspector\InspectorWorkerResource.h" 42765 > 42766 </File> 42767 <File 42764 42768 RelativePath="..\inspector\JavaScriptCallFrame.cpp" 42765 42769 > … … 42841 42845 </File> 42842 42846 <File 42847 RelativePath="..\inspector\front-end\Checkbox.js" 42848 > 42849 </File> 42850 <File 42843 42851 RelativePath="..\inspector\front-end\Color.js" 42844 42852 > … … 43146 43154 <File 43147 43155 RelativePath="..\inspector\front-end\WelcomeView.js" 43156 > 43157 </File> 43158 <File 43159 RelativePath="..\inspector\front-end\WorkersSidebarPane.js" 43148 43160 > 43149 43161 </File> -
trunk/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
r55584 r55771 2 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 4 * Copyright (C) 20 09Google Inc. All rights reserved.4 * Copyright (C) 2010 Google Inc. All rights reserved. 5 5 * 6 6 * Redistribution and use in source and binary forms, with or without … … 76 76 namespace WebCore { 77 77 78 static ScriptObject createInjectedScript(const String& source, InjectedScriptHost* injectedScriptHost, ScriptState* scriptState, long id)78 ScriptObject InjectedScriptHost::createInjectedScript(const String& source, ScriptState* scriptState, long id) 79 79 { 80 80 SourceCode sourceCode = makeSource(source); … … 92 92 93 93 MarkedArgumentBuffer args; 94 args.append(toJS(scriptState, globalObject, injectedScriptHost));94 args.append(toJS(scriptState, globalObject, this)); 95 95 args.append(globalThisValue); 96 96 args.append(jsNumber(scriptState, id)); … … 222 222 return InjectedScript(ScriptObject(scriptState, injectedScript)); 223 223 224 ASSERT(!m_injectedScriptSource.isEmpty()); 225 ScriptObject injectedScriptObject = createInjectedScript(m_injectedScriptSource, this, scriptState, m_nextInjectedScriptId); 226 globalObject->setInjectedScript(injectedScriptObject.jsObject()); 227 InjectedScript result(injectedScriptObject); 228 m_idToInjectedScript.set(m_nextInjectedScriptId, result); 229 m_nextInjectedScriptId++; 224 ASSERT(!m_injectedScriptSource.isEmpty()); 225 pair<long, ScriptObject> injectedScriptObject = injectScript(m_injectedScriptSource, scriptState); 226 globalObject->setInjectedScript(injectedScriptObject.second.jsObject()); 227 InjectedScript result(injectedScriptObject.second); 228 m_idToInjectedScript.set(injectedScriptObject.first, result); 230 229 return result; 231 230 } -
trunk/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
r55584 r55771 80 80 } 81 81 82 static ScriptObject createInjectedScript(const String& scriptSource, InjectedScriptHost* injectedScriptHost, ScriptState* inspectedScriptState, long id)82 ScriptObject InjectedScriptHost::createInjectedScript(const String& scriptSource, ScriptState* inspectedScriptState, long id) 83 83 { 84 84 v8::HandleScope scope; … … 91 91 // wrapper in the current context. 92 92 // FIXME: make it possible to use generic bindings factory for InjectedScriptHost. 93 v8::Local<v8::Object> scriptHostWrapper = createInjectedScriptHostV8Wrapper( injectedScriptHost);93 v8::Local<v8::Object> scriptHostWrapper = createInjectedScriptHostV8Wrapper(this); 94 94 if (scriptHostWrapper.IsEmpty()) 95 95 return ScriptObject(); … … 241 241 242 242 ASSERT(!m_injectedScriptSource.isEmpty()); 243 ScriptObject injectedScriptObject = createInjectedScript(m_injectedScriptSource, this, inspectedScriptState, m_nextInjectedScriptId); 244 InjectedScript result(injectedScriptObject); 245 m_idToInjectedScript.set(m_nextInjectedScriptId, result); 246 ++m_nextInjectedScriptId; 247 global->SetHiddenValue(key, injectedScriptObject.v8Object()); 243 pair<long, ScriptObject> injectedScript = injectScript(m_injectedScriptSource, inspectedScriptState); 244 InjectedScript result(injectedScript.second); 245 m_idToInjectedScript.set(injectedScript.first, result); 246 global->SetHiddenValue(key, injectedScript.second.v8Object()); 248 247 return result; 249 248 } -
trunk/WebCore/dom/Document.cpp
r55673 r55771 4799 4799 return page() ? page()->inspectorTimelineAgent() : 0; 4800 4800 } 4801 4802 InspectorController* Document::inspectorController() const 4803 { 4804 return page() ? page()->inspectorController() : 0; 4805 } 4801 4806 #endif 4802 4807 -
trunk/WebCore/dom/Document.h
r55584 r55771 451 451 #if ENABLE(INSPECTOR) 452 452 InspectorTimelineAgent* inspectorTimelineAgent() const; // can be NULL 453 virtual InspectorController* inspectorController() const; // can be NULL 453 454 #endif 454 455 -
trunk/WebCore/dom/ScriptExecutionContext.h
r55584 r55771 50 50 class ScriptString; 51 51 class String; 52 #if ENABLE(INSPECTOR) 53 class InspectorController; 54 #endif 52 55 53 56 enum MessageDestination { … … 85 88 86 89 SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); } 90 #if ENABLE(INSPECTOR) 91 virtual InspectorController* inspectorController() const { return 0; } 92 #endif 87 93 88 94 virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL) = 0; -
trunk/WebCore/inspector/InjectedScriptHost.cpp
r55584 r55771 2 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 4 * Copyright (C) 20 09Google Inc. All rights reserved.4 * Copyright (C) 2010 Google Inc. All rights reserved. 5 5 * 6 6 * Redistribution and use in source and binary forms, with or without … … 71 71 : m_inspectorController(inspectorController) 72 72 , m_nextInjectedScriptId(1) 73 , m_lastWorkerId(1 << 31) // Distinguish ids of fake workers from real ones, to minimize the chances they overlap. 73 74 { 74 75 } … … 195 196 } 196 197 198 pair<long, ScriptObject> InjectedScriptHost::injectScript(const String& source, ScriptState* scriptState) 199 { 200 long id = m_nextInjectedScriptId++; 201 return std::make_pair(id, createInjectedScript(source, scriptState, id)); 202 } 203 204 #if ENABLE(WORKERS) 205 long InjectedScriptHost::nextWorkerId() 206 { 207 return ++m_lastWorkerId; 208 } 209 210 void InjectedScriptHost::didCreateWorker(long id, const String& url, bool isSharedWorker) 211 { 212 if (m_inspectorController) 213 m_inspectorController->didCreateWorker(id, url, isSharedWorker); 214 } 215 216 void InjectedScriptHost::willDestroyWorker(long id) 217 { 218 if (m_inspectorController) 219 m_inspectorController->willDestroyWorker(id); 220 } 221 #endif // ENABLE(WORKERS) 222 197 223 } // namespace WebCore 198 224 -
trunk/WebCore/inspector/InjectedScriptHost.h
r55584 r55771 81 81 void selectDOMStorage(Storage* storage); 82 82 #endif 83 #if ENABLE(WORKERS) 84 long nextWorkerId(); 85 void didCreateWorker(long id, const String& url, bool isSharedWorker); 86 void willDestroyWorker(long id); 87 #endif 83 88 void reportDidDispatchOnInjectedScript(long callId, SerializedScriptValue* result, bool isException); 84 89 90 pair<long, ScriptObject> injectScript(const String& source, ScriptState*); 85 91 InjectedScript injectedScriptFor(ScriptState*); 86 92 InjectedScript injectedScriptForId(long); … … 92 98 InspectorDOMAgent* inspectorDOMAgent(); 93 99 InspectorFrontend* inspectorFrontend(); 100 ScriptObject createInjectedScript(const String& source, ScriptState* scriptState, long id); 94 101 95 102 InspectorController* m_inspectorController; 96 103 String m_injectedScriptSource; 97 104 long m_nextInjectedScriptId; 105 long m_lastWorkerId; 98 106 typedef HashMap<long, InjectedScript> IdToInjectedScriptMap; 99 107 IdToInjectedScriptMap m_idToInjectedScript; -
trunk/WebCore/inspector/InjectedScriptHost.idl
r55584 r55771 2 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 4 * Copyright (C) 20 09Google Inc. All rights reserved.4 * Copyright (C) 2010 Google Inc. All rights reserved. 5 5 * 6 6 * Redistribution and use in source and binary forms, with or without … … 56 56 #endif 57 57 58 #if defined(ENABLE_WORKERS) && ENABLE_WORKERS 59 void didCreateWorker(in long id, in DOMString url, in boolean isFakeWorker); 60 void willDestroyWorker(in long id); 61 long nextWorkerId(); 62 #endif 58 63 [Custom] void reportDidDispatchOnInjectedScript(in long callId, in DOMObject result, in boolean isException); 59 64 }; -
trunk/WebCore/inspector/InspectorController.cpp
r55761 r55771 64 64 #include "InspectorFrontendHost.h" 65 65 #include "InspectorResource.h" 66 #include "InspectorWorkerResource.h" 66 67 #include "InspectorTimelineAgent.h" 67 68 #include "Page.h" … … 731 732 it->second->bind(m_frontend.get()); 732 733 #endif 734 #if ENABLE(WORKERS) 735 WorkersMap::iterator workersEnd = m_workers.end(); 736 for (WorkersMap::iterator it = m_workers.begin(); it != workersEnd; ++it) 737 m_frontend->didCreateWorker(*it->second); 738 #endif 733 739 734 740 m_frontend->populateInterface(); … … 759 765 it->second->unbind(); 760 766 #endif 761 767 #if ENABLE(WORKERS) 768 m_workers.clear(); 769 #endif 762 770 if (m_timelineAgent) 763 771 m_timelineAgent->reset(); … … 846 854 pruneResources(resourceMap, loader); 847 855 848 for (Vector<String>::iterator it = m_scriptsToEvaluateOnLoad.begin(); 849 it != m_scriptsToEvaluateOnLoad.end(); ++it) { 850 ScriptSourceCode scriptSourceCode(*it); 851 loader->frame()->script()->evaluate(scriptSourceCode); 856 if (m_scriptsToEvaluateOnLoad.size()) { 857 ScriptState* scriptState = mainWorldScriptState(loader->frame()); 858 for (Vector<String>::iterator it = m_scriptsToEvaluateOnLoad.begin(); 859 it != m_scriptsToEvaluateOnLoad.end(); ++it) { 860 m_injectedScriptHost->injectScript(*it, scriptState); 861 } 852 862 } 853 863 } … … 1191 1201 m_frontend->timelineProfilerWasStopped(); 1192 1202 } 1203 1204 #if ENABLE(WORKERS) 1205 void InspectorController::didCreateWorker(long id, const String& url, bool isSharedWorker) 1206 { 1207 if (!enabled()) 1208 return; 1209 1210 RefPtr<InspectorWorkerResource> workerResource(InspectorWorkerResource::create(id, url, isSharedWorker)); 1211 m_workers.set(id, workerResource); 1212 if (m_frontend) 1213 m_frontend->didCreateWorker(*workerResource); 1214 } 1215 1216 void InspectorController::willDestroyWorker(long id) 1217 { 1218 if (!enabled()) 1219 return; 1220 1221 WorkersMap::iterator workerResource = m_workers.find(id); 1222 if (workerResource == m_workers.end()) 1223 return; 1224 if (m_frontend) 1225 m_frontend->willDestroyWorker(*workerResource->second); 1226 m_workers.remove(workerResource); 1227 } 1228 #endif // ENABLE(WORKERS) 1193 1229 1194 1230 #if ENABLE(DATABASE) -
trunk/WebCore/inspector/InspectorController.h
r55761 r55771 86 86 class InspectorDOMStorageResource; 87 87 class InspectorResource; 88 class InspectorWorkerResource; 88 89 89 90 class InspectorController … … 186 187 void mainResourceFiredLoadEvent(DocumentLoader*, const KURL&); 187 188 void mainResourceFiredDOMContentEvent(DocumentLoader*, const KURL&); 188 189 189 190 void didInsertDOMNode(Node*); 190 191 void didRemoveDOMNode(Node*); 191 192 void didModifyDOMAttr(Element*); 192 193 #if ENABLE(WORKERS) 194 void didCreateWorker(long id, const String& url, bool isSharedWorker); 195 void willDestroyWorker(long id); 196 #endif 193 197 void getCookies(long callId); 194 198 … … 372 376 ProfilesMap m_profiles; 373 377 #endif 378 #if ENABLE(WORKERS) 379 typedef HashMap<long, RefPtr<InspectorWorkerResource> > WorkersMap; 380 381 WorkersMap m_workers; 382 #endif 374 383 }; 375 384 -
trunk/WebCore/inspector/InspectorFrontend.cpp
r55584 r55771 38 38 #include "InjectedScriptHost.h" 39 39 #include "InspectorController.h" 40 #include "InspectorWorkerResource.h" 40 41 #include "Node.h" 41 42 #include "ScriptFunctionCall.h" … … 472 473 } 473 474 475 #if ENABLE(WORKERS) 476 void InspectorFrontend::didCreateWorker(const InspectorWorkerResource& worker) 477 { 478 ScriptFunctionCall function(m_webInspector, "dispatch"); 479 function.appendArgument("didCreateWorker"); 480 function.appendArgument(worker.id()); 481 function.appendArgument(worker.url()); 482 function.appendArgument(worker.isSharedWorker()); 483 function.call(); 484 } 485 486 void InspectorFrontend::willDestroyWorker(const InspectorWorkerResource& worker) 487 { 488 ScriptFunctionCall function(m_webInspector, "dispatch"); 489 function.appendArgument("willDestroyWorker"); 490 function.appendArgument(worker.id()); 491 function.call(); 492 } 493 #endif // ENABLE(WORKERS) 494 474 495 void InspectorFrontend::didGetCookies(int callId, const ScriptArray& cookies, const String& cookiesString) 475 496 { -
trunk/WebCore/inspector/InspectorFrontend.h
r55584 r55771 46 46 class SerializedScriptValue; 47 47 class Storage; 48 class InspectorWorkerResource; 48 49 49 50 class InspectorFrontend : public Noncopyable { … … 132 133 void addRecordToTimeline(const ScriptObject&); 133 134 135 #if ENABLE(WORKERS) 136 void didCreateWorker(const InspectorWorkerResource&); 137 void willDestroyWorker(const InspectorWorkerResource&); 138 #endif // ENABLE(WORKER) 139 134 140 void didGetCookies(int callId, const ScriptArray& cookies, const String& cookiesString); 135 141 void didDispatchOnInjectedScript(int callId, SerializedScriptValue* result, bool isException); -
trunk/WebCore/inspector/InspectorWorkerResource.h
r55770 r55771 1 1 /* 2 * Copyright (C) 20 09Google Inc. All rights reserved.2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 */ 30 30 31 #include "config.h" 31 #ifndef InspectorWorkerResource_h 32 #define InspectorWorkerResource_h 32 33 33 #if ENABLE( SHARED_WORKERS)34 #if ENABLE(WORKERS) && ENABLE(INSPECTOR) 34 35 35 #include "SharedWorker.h" 36 37 #include "KURL.h" 38 #include "MessageChannel.h" 39 #include "MessagePort.h" 40 #include "SharedWorkerRepository.h" 36 #include "PlatformString.h" 37 #include <wtf/PassRefPtr.h> 38 #include <wtf/RefCounted.h> 39 #include <wtf/RefPtr.h> 41 40 42 41 namespace WebCore { 43 42 44 SharedWorker::SharedWorker(const String& url, const String& name, ScriptExecutionContext* context, ExceptionCode& ec) 45 : AbstractWorker(context) 46 { 47 RefPtr<MessageChannel> channel = MessageChannel::create(scriptExecutionContext()); 48 m_port = channel->port1(); 49 OwnPtr<MessagePortChannel> remotePort = channel->port2()->disentangle(ec); 50 ASSERT(!ec); 43 class InspectorWorkerResource : public RefCounted<InspectorWorkerResource> { 44 public: 45 static PassRefPtr<InspectorWorkerResource> create(long id, const String& url, bool isSharedWorker) 46 { 47 return adoptRef(new InspectorWorkerResource(id, url, isSharedWorker)); 48 } 51 49 52 KURL scriptUrl = resolveURL(url, ec); 53 if (ec) 54 return; 55 SharedWorkerRepository::connect(this, remotePort.release(), scriptUrl, name, ec); 56 } 50 long id() const { return m_id; } 51 const String& url() const { return m_url; } 52 bool isSharedWorker() const { return m_isSharedWorker; } 53 private: 54 InspectorWorkerResource(long id, const String& url, bool isSharedWorker) 55 : m_id(id) 56 , m_url(url) 57 , m_isSharedWorker(isSharedWorker) 58 { 59 } 57 60 58 SharedWorker::~SharedWorker() 59 { 60 } 61 int m_id; 62 String m_url; 63 bool m_isSharedWorker; 64 }; 61 65 62 66 } // namespace WebCore 63 67 64 #endif // ENABLE(SHARED_WORKERS) 68 #endif // ENABLE(WORKERS) && ENABLE(INSPECTOR) 69 70 #endif // InspectorWorkerResource_h -
trunk/WebCore/inspector/front-end/InjectedFakeWorker.js
r55584 r55771 29 29 */ 30 30 31 var InjectedFakeWorker = function( )31 var InjectedFakeWorker = function(InjectedScriptHost, inspectedWindow, injectedScriptId) 32 32 { 33 33 … … 46 46 function FakeWorker(worker, url) 47 47 { 48 var scriptURL = new URL(document.baseURI).completeWith(url); 49 50 if (!scriptURL.sameOrigin(location.href)) 51 throw new DOMCoreException("SECURITY_ERR",18); 48 var scriptURL = this._expandURLAndCheckOrigin(document.baseURI, location.href, url); 52 49 53 50 this._worker = worker; 54 51 this._buildWorker(scriptURL); 52 this._id = InjectedScriptHost.nextWorkerId(); 53 54 InjectedScriptHost.didCreateWorker(this._id, scriptURL.url, false); 55 55 } 56 56 … … 64 64 terminate: function() 65 65 { 66 InjectedScriptHost.willDestroyWorker(this._id); 67 66 68 if (this._frame != null) { 67 69 this._frame.onmessage = this._worker.onmessage = noop; … … 97 99 { 98 100 // NB: it should be an ErrorEvent, but creating it from script is not 99 // currently supported, to emulate it on top of plain vanilla Event.101 // currently supported, so emulate it on top of plain vanilla Event. 100 102 var errorEvent = this._document.createEvent("Event"); 101 103 errorEvent.initEvent("Event", false, false); … … 148 150 }, 149 151 150 _importScripts: function(evalTarget) 151 { 152 for (var i = 1; i < arguments.length; ++i) 153 evalTarget.eval(this._loadScript(arguments[i])); 152 _importScripts: function(targetFrame) 153 { 154 for (var i = 1; i < arguments.length; ++i) { 155 var workerOrigin = targetFrame.__devtools.location.href; 156 var url = this._expandURLAndCheckOrigin(workerOrigin, workerOrigin, arguments[i]); 157 targetFrame.eval(this._loadScript(url.url) + "\n//@ sourceURL= " + url.url); 158 } 154 159 }, 155 160 … … 166 171 } 167 172 return text; 173 }, 174 175 _expandURLAndCheckOrigin: function(baseURL, origin, url) 176 { 177 var scriptURL = new URL(baseURL).completeWith(url); 178 179 if (!scriptURL.sameOrigin(origin)) 180 throw new DOMCoreException("SECURITY_ERR",18); 181 return scriptURL; 168 182 } 169 183 }; -
trunk/WebCore/inspector/front-end/ScriptsPanel.js
r55584 r55771 136 136 this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane(); 137 137 this.sidebarPanes.breakpoints = new WebInspector.BreakpointsSidebarPane(); 138 this.sidebarPanes.workers = new WebInspector.WorkersSidebarPane(); 138 139 139 140 for (var pane in this.sidebarPanes) … … 425 426 426 427 this._debuggerEnabled = true; 427 this.reset( );428 this.reset(true); 428 429 }, 429 430 … … 434 435 435 436 this._debuggerEnabled = false; 436 this.reset( );437 }, 438 439 reset: function( )437 this.reset(true); 438 }, 439 440 reset: function(preserveWorkers) 440 441 { 441 442 this.visibleView = null; … … 473 474 this.sidebarPanes.watchExpressions.refreshExpressions(); 474 475 this.sidebarPanes.breakpoints.reset(); 476 if (!preserveWorkers) 477 this.sidebarPanes.workers.reset(); 475 478 }, 476 479 -
trunk/WebCore/inspector/front-end/StylesSidebarPane.js
r55764 r55771 405 405 this.element.addStyleClass("show-inherited"); 406 406 407 var showInheritedLabel = document.createElement("label");408 var showInheritedInput = document.createElement("input");409 showInheritedInput.type = "checkbox";410 showInheritedInput.checked = WebInspector.settings.showInheritedComputedStyleProperties;411 412 407 var computedStyleSection = this; 413 408 var showInheritedToggleFunction = function(event) { 414 WebInspector.settings.showInheritedComputedStyleProperties = showInheritedInput.checked;409 WebInspector.settings.showInheritedComputedStyleProperties = computedStyleSection._showInheritedCheckbox.checked(); 415 410 if (WebInspector.settings.showInheritedComputedStyleProperties) 416 411 computedStyleSection.element.addStyleClass("show-inherited"); 417 412 else 418 413 computedStyleSection.element.removeStyleClass("show-inherited"); 419 event.stopPropagation();420 414 }; 421 415 422 showInheritedLabel.addEventListener("click", showInheritedToggleFunction, false);423 424 showInheritedLabel.appendChild(showInheritedInput);425 showInheritedLabel.appendChild(document.createTextNode(WebInspector.UIString("Show inherited"))); 426 this.subtitleElement.appendChild( showInheritedLabel);416 this._showInheritedCheckbox = new WebInspector.Checkbox(WebInspector.UIString("Show inherited"), 417 showInheritedToggleFunction, 418 WebInspector.settings.showInheritedComputedStyleProperties); 419 420 this.subtitleElement.appendChild(this._showInheritedCheckbox.element); 427 421 } else { 428 422 if (!subtitle) { -
trunk/WebCore/inspector/front-end/WebKit.qrc
r55584 r55771 14 14 <file>CallStackSidebarPane.js</file> 15 15 <file>ChangesView.js</file> 16 <file>Checkbox.js</file> 16 17 <file>Color.js</file> 17 18 <file>ConsolePanel.js</file> … … 90 91 <file>WatchExpressionsSidebarPane.js</file> 91 92 <file>WelcomeView.js</file> 93 <file>WorkersSidebarPane.js</file> 92 94 <file>audits.css</file> 93 95 <file>inspector.css</file> -
trunk/WebCore/inspector/front-end/inspector.css
r55765 r55771 1330 1330 } 1331 1331 1332 .section .header input[type=checkbox] {1333 height: 10px;1334 width: 10px;1335 margin-left: 0;1336 margin-top: 0;1337 margin-bottom: 0;1338 vertical-align: 2px;1339 }1340 1341 1332 .section .header .subtitle, .event-bar .header .subtitle { 1342 1333 float: right; … … 1721 1712 background-position: center center, bottom; 1722 1713 height: 5px; 1714 } 1715 1716 .sidebar-pane-subtitle { 1717 float: right; 1718 overflow: hidden; 1719 } 1720 1721 .sidebar-pane-subtitle input, .section .header input[type=checkbox] { 1722 font-size: inherit; 1723 hight: 1em; 1724 width: 1em; 1725 margin-left: 0; 1726 margin-top: 0; 1727 margin-bottom: 0.25em; 1728 vertical-align: bottom; 1723 1729 } 1724 1730 … … 3883 3889 } 3884 3890 3891 .workers-list { 3892 list-style: none; 3893 margin: 0; 3894 padding: 0; 3895 } 3896 3897 .workers-list > li { 3898 overflow: hidden; 3899 text-overflow: ellipsis; 3900 white-space: nowrap; 3901 margin-left: 1em; 3902 font-size: 12px; 3903 } 3904 3905 a.worker-item { 3906 color: rgb(33%, 33%, 33%); 3907 cursor: pointer; 3908 text-decoration: none; 3909 } 3910 3911 a.worker-item:hover { 3912 color: rgb(15%, 15%, 15%); 3913 } 3914 -
trunk/WebCore/inspector/front-end/inspector.html
r55584 r55771 42 42 <script type="text/javascript" src="Object.js"></script> 43 43 <script type="text/javascript" src="Settings.js"></script> 44 <script type="text/javascript" src="Checkbox.js"></script> 44 45 <script type="text/javascript" src="ContextMenu.js"></script> 45 46 <script type="text/javascript" src="KeyboardShortcut.js"></script> … … 75 76 <script type="text/javascript" src="ScopeChainSidebarPane.js"></script> 76 77 <script type="text/javascript" src="WatchExpressionsSidebarPane.js"></script> 78 <script type="text/javascript" src="WorkersSidebarPane.js"></script> 77 79 <script type="text/javascript" src="MetricsSidebarPane.js"></script> 78 80 <script type="text/javascript" src="PropertiesSidebarPane.js"></script> -
trunk/WebCore/workers/AbstractWorker.cpp
r55584 r55771 1 1 /* 2 * Copyright (C) 20 09Google Inc. All rights reserved.2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 39 39 #include "EventException.h" 40 40 #include "EventNames.h" 41 #include "InspectorController.h" 41 42 #include "ScriptExecutionContext.h" 42 43 #include "SecurityOrigin.h" … … 44 45 namespace WebCore { 45 46 47 long AbstractWorker::s_lastId; 48 46 49 AbstractWorker::AbstractWorker(ScriptExecutionContext* context) 47 50 : ActiveDOMObject(context, this) 51 , m_id(++s_lastId) 48 52 { 49 53 } … … 51 55 AbstractWorker::~AbstractWorker() 52 56 { 57 onDestroyWorker(); 58 } 59 60 void AbstractWorker::onDestroyWorker() 61 { 62 #if ENABLE(INSPECTOR) 63 if (InspectorController* inspector = scriptExecutionContext() ? scriptExecutionContext()->inspectorController() : 0) 64 inspector->willDestroyWorker(id()); 65 #endif 66 } 67 68 void AbstractWorker::contextDestroyed() 69 { 70 onDestroyWorker(); 71 ActiveDOMObject::contextDestroyed(); 53 72 } 54 73 -
trunk/WebCore/workers/AbstractWorker.h
r55584 r55771 1 1 /* 2 * Copyright (C) 20 09Google Inc. All rights reserved.2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 58 58 using RefCounted<AbstractWorker>::deref; 59 59 60 long id() const { return m_id; } 61 virtual void contextDestroyed(); 60 62 AbstractWorker(ScriptExecutionContext*); 61 63 virtual ~AbstractWorker(); … … 70 72 virtual EventTargetData* eventTargetData(); 71 73 virtual EventTargetData* ensureEventTargetData(); 74 void onDestroyWorker(); 72 75 73 76 EventTargetData m_eventTargetData; 77 long m_id; 78 79 static long s_lastId; 74 80 }; 75 81 -
trunk/WebCore/workers/SharedWorker.cpp
r55584 r55771 35 35 #include "SharedWorker.h" 36 36 37 #include "InspectorController.h" 37 38 #include "KURL.h" 38 39 #include "MessageChannel.h" … … 54 55 return; 55 56 SharedWorkerRepository::connect(this, remotePort.release(), scriptUrl, name, ec); 57 #if ENABLE(INSPECTOR) 58 if (InspectorController* inspector = scriptExecutionContext()->inspectorController()) 59 inspector->didCreateWorker(id(), scriptUrl.string(), true); 60 #endif 56 61 } 57 62 -
trunk/WebCore/workers/Worker.cpp
r55584 r55771 41 41 #include "Frame.h" 42 42 #include "FrameLoader.h" 43 #include "InspectorController.h" 43 44 #include "MessageEvent.h" 44 45 #include "TextEncoding.h" … … 61 62 m_scriptLoader->loadAsynchronously(scriptExecutionContext(), scriptURL, DenyCrossOriginRequests, this); 62 63 setPendingActivity(this); // The worker context does not exist while loading, so we must ensure that the worker object is not collected, as well as its event listeners. 64 #if ENABLE(INSPECTOR) 65 if (InspectorController* inspector = scriptExecutionContext()->inspectorController()) 66 inspector->didCreateWorker(id(), scriptURL.string(), false); 67 #endif 63 68 } 64 69 -
trunk/WebKit/chromium/ChangeLog
r55769 r55771 1 2010-03-10 Andrey Kosyakov <caseq@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: display list of active workers & support debugging 6 with fake workers 7 https://bugs.webkit.org/show_bug.cgi?id=35568 8 9 * src/js/InspectorControllerImpl.js: 10 (devtools.InspectorBackendImpl): 11 1 12 2010-03-10 Tony Chang <tony@chromium.org> 2 13 -
trunk/WebKit/chromium/src/js/InspectorControllerImpl.js
r55584 r55771 39 39 { 40 40 WebInspector.InspectorBackendStub.call(this); 41 this.installInspectorControllerDelegate_("addScriptToEvaluateOnLoad"); 41 42 this.installInspectorControllerDelegate_("clearMessages"); 42 43 this.installInspectorControllerDelegate_("copyNode"); … … 58 59 this.installInspectorControllerDelegate_("hideDOMNodeHighlight"); 59 60 this.installInspectorControllerDelegate_("releaseWrapperObjectGroup"); 61 this.installInspectorControllerDelegate_("removeAllScriptsToEvaluateOnLoad"); 60 62 this.installInspectorControllerDelegate_("reloadPage"); 61 63 this.installInspectorControllerDelegate_("removeAttribute");
Note: See TracChangeset
for help on using the changeset viewer.