Web Inspector: Extension scripts with parse errors do not show up in Web Inspector
authorpecoraro@apple.com <pecoraro@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Apr 2019 19:59:24 +0000 (19:59 +0000)
committerpecoraro@apple.com <pecoraro@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Apr 2019 19:59:24 +0000 (19:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196996
<rdar://problem/47054804>

Reviewed by Devin Rousso.

* UserInterface/Controllers/DebuggerManager.js:
(WI.DebuggerManager.prototype.scriptDidFail):
Create a LocalScript that can be linked to but ignore it
if we already have a Resource for the URL.

* UserInterface/Protocol/DebuggerObserver.js:
(WI.DebuggerObserver.prototype.scriptFailedToParse):
Let DebuggerManager potentially create a script for this.

* UserInterface/Models/Script.js:
(WI.Script):
Local scripts provide a null id and id is not required below.

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
Source/WebInspectorUI/UserInterface/Models/Script.js
Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js

index 61ff4d8..7a06efb 100644 (file)
@@ -1,3 +1,24 @@
+2019-04-17  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Extension scripts with parse errors do not show up in Web Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=196996
+        <rdar://problem/47054804>
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Controllers/DebuggerManager.js:
+        (WI.DebuggerManager.prototype.scriptDidFail):
+        Create a LocalScript that can be linked to but ignore it
+        if we already have a Resource for the URL.
+
+        * UserInterface/Protocol/DebuggerObserver.js:
+        (WI.DebuggerObserver.prototype.scriptFailedToParse):
+        Let DebuggerManager potentially create a script for this.
+
+        * UserInterface/Models/Script.js:
+        (WI.Script):
+        Local scripts provide a null id and id is not required below.
+
 2019-04-16  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Worker imported scripts not showing up in Open Quickly dialog if inspector open after workers exist
index 68df3af..7aaeeb8 100644 (file)
@@ -759,6 +759,23 @@ WI.DebuggerManager = class DebuggerManager extends WI.Object
             target.addScript(script);
     }
 
+    scriptDidFail(target, url, scriptSource)
+    {
+        const sourceType = WI.Script.SourceType.Program;
+        let script = new WI.LocalScript(target, url, sourceType, scriptSource);
+
+        // If there is already a resource we don't need to have the script anymore,
+        // we only need a script to use for parser error location links.
+        if (script.resource)
+            return;
+
+        let targetData = this.dataForTarget(target);
+        targetData.addScript(script);
+        target.addScript(script);
+
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.ScriptAdded, {script});
+    }
+
     didSampleProbe(target, sample)
     {
         console.assert(this._probesByIdentifier.has(sample.probeId), "Unknown probe identifier specified for sample: ", sample);
index 9fb6d36..82a2151 100644 (file)
@@ -29,7 +29,6 @@ WI.Script = class Script extends WI.SourceCode
     {
         super();
 
-        console.assert(id);
         console.assert(target instanceof WI.Target);
         console.assert(range instanceof WI.TextRange);
 
index 3f5bc8b..7f4f47d 100644 (file)
@@ -55,7 +55,8 @@ WI.DebuggerObserver = class DebuggerObserver
 
     scriptFailedToParse(url, scriptSource, startLine, errorLine, errorMessage)
     {
-        // FIXME: Not implemented.
+        // NOTE: A Console.messageAdded event will handle the error message.
+        WI.debuggerManager.scriptDidFail(this.target, url, scriptSource);
     }
 
     breakpointResolved(breakpointId, location)