Web Inspector: Move MainTarget and WorkerTarget to their own files
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 11 Dec 2016 23:37:11 +0000 (23:37 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 11 Dec 2016 23:37:11 +0000 (23:37 +0000)
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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209686 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
Source/WebInspectorUI/UserInterface/Main.html
Source/WebInspectorUI/UserInterface/Protocol/MainTarget.js [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Protocol/Target.js
Source/WebInspectorUI/UserInterface/Protocol/WorkerTarget.js [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Test.html

index a4dd3f5..e3a5992 100644 (file)
@@ -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
index f682cae..dfee54c 100644 (file)
@@ -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;
index b90c59e..5e1ff0b 100644 (file)
     <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>
 
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/MainTarget.js b/Source/WebInspectorUI/UserInterface/Protocol/MainTarget.js
new file mode 100644 (file)
index 0000000..9b1ccb5
--- /dev/null
@@ -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;
+    }
+}
index e853d97..bf227fc 100644 (file)
@@ -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();
-    }
-}
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/WorkerTarget.js b/Source/WebInspectorUI/UserInterface/Protocol/WorkerTarget.js
new file mode 100644 (file)
index 0000000..aaf2152
--- /dev/null
@@ -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);
+    }
+}
index f466365..e7476e4 100644 (file)
@@ -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>