Skip to content
Permalink
Browse files
Web Inspector: Move MainTarget and WorkerTarget to their own files
https://bugs.webkit.org/show_bug.cgi?id=165701

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-12-11
Reviewed by Brian Burg.

* UserInterface/Controllers/DebuggerManager.js:
(WebInspector.DebuggerManager.prototype.scriptDidParse):
* UserInterface/Main.html:
* UserInterface/Protocol/MainTarget.js: Added.
(WebInspector.MainTarget):
(WebInspector.MainTarget.prototype.get displayName):
(WebInspector.MainTarget.prototype.get mainResource):
* UserInterface/Protocol/Target.js:
(WebInspector.Target):
(WebInspector.MainTarget): Deleted.
(WebInspector.MainTarget.prototype.get displayName): Deleted.
(WebInspector.MainTarget.prototype.get mainResource): Deleted.
(WebInspector.MainTarget.prototype.initialize): Deleted.
(WebInspector.WorkerTarget): Deleted.
(WebInspector.WorkerTarget.prototype.get displayName): Deleted.
(WebInspector.WorkerTarget.prototype.initialize): Deleted.
* UserInterface/Protocol/WorkerTarget.js: Added.
(WebInspector.WorkerTarget):
(WebInspector.WorkerTarget.prototype.get displayName):
* UserInterface/Test.html:

Canonical link: https://commits.webkit.org/183342@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209686 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
JosephPecoraro authored and webkit-commit-queue committed Dec 11, 2016
1 parent 8ce5a2b commit 91628656886406005a2db60a5dc52fca9a92b047
Showing 7 changed files with 154 additions and 79 deletions.
@@ -1,3 +1,31 @@
2016-12-11 Joseph Pecoraro <pecoraro@apple.com>

Web Inspector: Move MainTarget and WorkerTarget to their own files
https://bugs.webkit.org/show_bug.cgi?id=165701

Reviewed by Brian Burg.

* UserInterface/Controllers/DebuggerManager.js:
(WebInspector.DebuggerManager.prototype.scriptDidParse):
* UserInterface/Main.html:
* UserInterface/Protocol/MainTarget.js: Added.
(WebInspector.MainTarget):
(WebInspector.MainTarget.prototype.get displayName):
(WebInspector.MainTarget.prototype.get mainResource):
* UserInterface/Protocol/Target.js:
(WebInspector.Target):
(WebInspector.MainTarget): Deleted.
(WebInspector.MainTarget.prototype.get displayName): Deleted.
(WebInspector.MainTarget.prototype.get mainResource): Deleted.
(WebInspector.MainTarget.prototype.initialize): Deleted.
(WebInspector.WorkerTarget): Deleted.
(WebInspector.WorkerTarget.prototype.get displayName): Deleted.
(WebInspector.WorkerTarget.prototype.initialize): Deleted.
* UserInterface/Protocol/WorkerTarget.js: Added.
(WebInspector.WorkerTarget):
(WebInspector.WorkerTarget.prototype.get displayName):
* UserInterface/Test.html:

2016-12-09 Joseph Pecoraro <pecoraro@apple.com>

Web Inspector: Frontend should not be resetting TypeProfiler state when switching between ContentViews
@@ -699,7 +699,7 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
if (target !== WebInspector.mainTarget && !target.mainResource) {
// FIXME: <https://webkit.org/b/164427> Web Inspector: WorkerTarget's mainResource should be a Resource not a Script
// We make the main resource of a WorkerTarget the Script instead of the Resource
// because the frontend may not be informed of the Resource. We should gaurantee
// because the frontend may not be informed of the Resource. We should guarantee
// the frontend is informed of the Resource.
if (script.url === target.name) {
target.mainResource = script;
@@ -255,28 +255,32 @@
<script src="Protocol/LoggingProtocolTracer.js"></script>
<script src="Protocol/InspectorBackend.js"></script>

<script src="Protocol/Connection.js"></script>
<script src="Protocol/InspectorFrontendAPI.js"></script>
<script src="Protocol/LoadInspectorBackendCommands.js"></script>
<script src="Protocol/MessageDispatcher.js"></script>
<script src="Protocol/RemoteObject.js"></script>
<script src="Protocol/Target.js"></script>

<script src="Protocol/MainTarget.js"></script>
<script src="Protocol/WorkerTarget.js"></script>

<script src="Protocol/ApplicationCacheObserver.js"></script>
<script src="Protocol/CSSObserver.js"></script>
<script src="Protocol/Connection.js"></script>
<script src="Protocol/ConsoleObserver.js"></script>
<script src="Protocol/DOMObserver.js"></script>
<script src="Protocol/DOMStorageObserver.js"></script>
<script src="Protocol/DatabaseObserver.js"></script>
<script src="Protocol/DebuggerObserver.js"></script>
<script src="Protocol/HeapObserver.js"></script>
<script src="Protocol/InspectorFrontendAPI.js"></script>
<script src="Protocol/InspectorObserver.js"></script>
<script src="Protocol/LayerTreeObserver.js"></script>
<script src="Protocol/LoadInspectorBackendCommands.js"></script>
<script src="Protocol/MemoryObserver.js"></script>
<script src="Protocol/MessageDispatcher.js"></script>
<script src="Protocol/NetworkObserver.js"></script>
<script src="Protocol/PageObserver.js"></script>
<script src="Protocol/RemoteObject.js"></script>
<script src="Protocol/ReplayObserver.js"></script>
<script src="Protocol/RuntimeObserver.js"></script>
<script src="Protocol/ScriptProfilerObserver.js"></script>
<script src="Protocol/Target.js"></script>
<script src="Protocol/TimelineObserver.js"></script>
<script src="Protocol/WorkerObserver.js"></script>

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/

WebInspector.MainTarget = class MainTarget extends WebInspector.Target
{
constructor(connection)
{
super("main", "", WebInspector.Target.Type.Main, InspectorBackend.mainConnection);

let displayName = WebInspector.debuggableType === WebInspector.DebuggableType.Web ? WebInspector.UIString("Main Frame") : this.displayName;
this._executionContext = new WebInspector.ExecutionContext(this, WebInspector.RuntimeManager.TopLevelContextExecutionIdentifier, displayName, true, null);
}

// Protected (Target)

get displayName()
{
switch (WebInspector.debuggableType) {
case WebInspector.DebuggableType.Web:
return WebInspector.UIString("Page");
case WebInspector.DebuggableType.JavaScript:
return WebInspector.UIString("JavaScript Context");
default:
console.error("Unexpected debuggable type: ", WebInspector.debuggableType);
return WebInspector.UIString("Main");
}
}

get mainResource()
{
let mainFrame = WebInspector.frameResourceManager.mainFrame;
return mainFrame ? mainFrame.mainResource : null;
}
}
@@ -39,8 +39,6 @@ WebInspector.Target = class Target extends WebInspector.Object
this._extraScriptCollection = new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Script);

this._connection.target = this;

this.initialize();
}

// Agents
@@ -94,73 +92,3 @@ WebInspector.Target.Event = {
ResourceAdded: "target-resource-added",
ScriptAdded: "target-script-added",
};

WebInspector.MainTarget = class MainTarget extends WebInspector.Target
{
constructor(connection)
{
super("main", "", WebInspector.Target.Type.Main, InspectorBackend.mainConnection);
}

// Protected (Target)

get displayName()
{
switch (WebInspector.debuggableType) {
case WebInspector.DebuggableType.Web:
return WebInspector.UIString("Page");
case WebInspector.DebuggableType.JavaScript:
return WebInspector.UIString("JavaScript Context");
default:
console.error("Unexpected debuggable type: ", WebInspector.debuggableType);
return WebInspector.UIString("Main");
}
}

get mainResource()
{
let mainFrame = WebInspector.frameResourceManager.mainFrame;
return mainFrame ? mainFrame.mainResource : null;
}

initialize()
{
let displayName = WebInspector.debuggableType === WebInspector.DebuggableType.Web ? WebInspector.UIString("Main Frame") : this.displayName;
this._executionContext = new WebInspector.ExecutionContext(this, WebInspector.RuntimeManager.TopLevelContextExecutionIdentifier, displayName, true, null);
}
}

WebInspector.WorkerTarget = class WorkerTarget extends WebInspector.Target
{
constructor(workerId, name, connection)
{
super(workerId, name, WebInspector.Target.Type.Worker, connection);
}

// Protected (Target)

get displayName()
{
return WebInspector.displayNameForURL(this._name);
}

initialize()
{
WebInspector.frameResourceManager.adoptOrphanedResourcesForTarget(this);

if (this.RuntimeAgent) {
this._executionContext = new WebInspector.ExecutionContext(this, WebInspector.RuntimeManager.TopLevelContextExecutionIdentifier, this.displayName, false, null);
this.RuntimeAgent.enable();
if (WebInspector.showJavaScriptTypeInformationSetting && WebInspector.showJavaScriptTypeInformationSetting.value)
this.RuntimeAgent.enableTypeProfiler();
if (WebInspector.enableControlFlowProfilerSetting && WebInspector.enableControlFlowProfilerSetting.value)
this.RuntimeAgent.enableControlFlowProfiler();
}

if (this.DebuggerAgent)
WebInspector.debuggerManager.initializeTarget(this);

if (this.ConsoleAgent)
this.ConsoleAgent.enable();
}
}
@@ -0,0 +1,56 @@
/*
* Copyright (C) 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/

WebInspector.WorkerTarget = class WorkerTarget extends WebInspector.Target
{
constructor(workerId, name, connection)
{
super(workerId, name, WebInspector.Target.Type.Worker, connection);

WebInspector.frameResourceManager.adoptOrphanedResourcesForTarget(this);

if (this.RuntimeAgent) {
this._executionContext = new WebInspector.ExecutionContext(this, WebInspector.RuntimeManager.TopLevelContextExecutionIdentifier, this.displayName, false, null);
this.RuntimeAgent.enable();
if (WebInspector.showJavaScriptTypeInformationSetting && WebInspector.showJavaScriptTypeInformationSetting.value)
this.RuntimeAgent.enableTypeProfiler();
if (WebInspector.enableControlFlowProfilerSetting && WebInspector.enableControlFlowProfilerSetting.value)
this.RuntimeAgent.enableControlFlowProfiler();
}

if (this.DebuggerAgent)
WebInspector.debuggerManager.initializeTarget(this);

if (this.ConsoleAgent)
this.ConsoleAgent.enable();
}

// Protected (Target)

get displayName()
{
return WebInspector.displayNameForURL(this._name);
}
}
@@ -66,6 +66,9 @@
<script src="Protocol/MessageDispatcher.js"></script>
<script src="Protocol/Target.js"></script>

<script src="Protocol/MainTarget.js"></script>
<script src="Protocol/WorkerTarget.js"></script>

<script src="Protocol/InspectorObserver.js"></script>
<script src="Protocol/CSSObserver.js"></script>
<script src="Protocol/ConsoleObserver.js"></script>

0 comments on commit 9162865

Please sign in to comment.