Diff
Modified: trunk/LayoutTests/ChangeLog (199601 => 199602)
--- trunk/LayoutTests/ChangeLog 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/LayoutTests/ChangeLog 2016-04-15 19:01:39 UTC (rev 199602)
@@ -1,3 +1,23 @@
+2016-04-15 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: sourceMappingURL not used when sourceURL is set
+ https://bugs.webkit.org/show_bug.cgi?id=156021
+ <rdar://problem/25438417>
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/debugger/scriptParsed.html:
+ * inspector/debugger/search-scripts.html:
+ * inspector/debugger/setBreakpointByUrl-sourceURL.html:
+ * inspector/debugger/sourceURLs.html:
+ Update tests that need to handle sourceURL separately.
+
+ * inspector/model/resources/relationship-named.js: Added.
+ * inspector/model/resources/relationship-normal.js: Added.
+ * inspector/model/script-resource-relationship-expected.txt: Added.
+ * inspector/model/script-resource-relationship.html: Added.
+ Tests for Script and Resource relationships.
+
2016-04-15 Jiewen Tan <jiewen_...@apple.com>
Mark fast/text/font-face-_javascript_.html as flaky
Modified: trunk/LayoutTests/inspector/debugger/scriptParsed.html (199601 => 199602)
--- trunk/LayoutTests/inspector/debugger/scriptParsed.html 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/LayoutTests/inspector/debugger/scriptParsed.html 2016-04-15 19:01:39 UTC (rev 199602)
@@ -46,15 +46,15 @@
}
function isEvalScript(params) {
- return params.hasSourceURL && params.url ="" "eval.js";
+ return params.sourceURL === "eval.js";
}
function isInjectedScriptSourceScript(params) {
- return params.hasSourceURL && params.url ="" "__WebInspectorInjectedScript__";
+ return params.sourceURL === "__WebInspectorInjectedScript__";
}
function isCommandLineAPISourceScript(params) {
- return params.hasSourceURL && params.url ="" "__WebInspectorCommandLineAPIModuleSource__";
+ return params.sourceURL === "__WebInspectorCommandLineAPIModuleSource__";
}
suite.addTestCase({
Modified: trunk/LayoutTests/inspector/debugger/search-scripts.html (199601 => 199602)
--- trunk/LayoutTests/inspector/debugger/search-scripts.html 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/LayoutTests/inspector/debugger/search-scripts.html 2016-04-15 19:01:39 UTC (rev 199602)
@@ -27,12 +27,12 @@
WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) {
var script = event.data.script;
- if (!/LayoutTests/.test(script.url) && !/eval\d\.js/.test(script.url))
+ if (!/LayoutTests/.test(script.url) && !/eval\d\.js/.test(script.sourceURL))
return;
DebuggerAgent.searchInContent(script.id, "SEARCHTEST", false, false, function(error, results) {
InspectorTest.log("");
- InspectorTest.log("SCRIPT: " + sanitizeScriptURL(script.url));
+ InspectorTest.log("SCRIPT: " + sanitizeScriptURL(script.sourceURL || script.url));
InspectorTest.log("RESULTS: " + results.length);
for (var result of results) {
InspectorTest.log(" LINE: " + result.lineNumber);
Modified: trunk/LayoutTests/inspector/debugger/setBreakpointByUrl-sourceURL.html (199601 => 199602)
--- trunk/LayoutTests/inspector/debugger/setBreakpointByUrl-sourceURL.html 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/LayoutTests/inspector/debugger/setBreakpointByUrl-sourceURL.html 2016-04-15 19:01:39 UTC (rev 199602)
@@ -13,9 +13,9 @@
InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
{
- if (/sourceURL-test\.js$/.test(messageObject.params.url)) {
+ if (/sourceURL-test\.js$/.test(messageObject.params.sourceURL)) {
ProtocolTest.log("Found sourceURL-test.js");
- var params = {url: messageObject.params.url, lineNumber: 3, columnNumber: 0};
+ var params = {url: messageObject.params.sourceURL, lineNumber: 3, columnNumber: 0};
InspectorProtocol.sendCommand("Debugger.setBreakpointByUrl", params, function(responseObject) {
InspectorProtocol.checkForError(responseObject);
ProtocolTest.log("Running sourceURLFunction");
Modified: trunk/LayoutTests/inspector/debugger/sourceURLs.html (199601 => 199602)
--- trunk/LayoutTests/inspector/debugger/sourceURLs.html 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/LayoutTests/inspector/debugger/sourceURLs.html 2016-04-15 19:01:39 UTC (rev 199602)
@@ -36,12 +36,12 @@
InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject) {
// Ignore named inspector internal scripts.
- if (messageObject.params.url.startsWith("__WebInspector"))
+ if (messageObject.params.sourceURL && messageObject.params.sourceURL.startsWith("__WebInspector"))
return;
// Has a sourceURL, must be one of the valid ones.
- if (messageObject.params.hasSourceURL) {
- let sourceURL = messageObject.params.url;
+ if (messageObject.params.sourceURL) {
+ let sourceURL = messageObject.params.sourceURL;
ProtocolTest.log(`Found Script with sourceURL '${sourceURL}'`);
ProtocolTest.assert(sourceURLExpectations[0] === sourceURL, "Did not expect to see sourceURL: " + sourceURL);
sourceURLExpectations.shift();
Added: trunk/LayoutTests/inspector/model/resources/relationship-named.js (0 => 199602)
--- trunk/LayoutTests/inspector/model/resources/relationship-named.js (rev 0)
+++ trunk/LayoutTests/inspector/model/resources/relationship-named.js 2016-04-15 19:01:39 UTC (rev 199602)
@@ -0,0 +1,5 @@
+//# sourceURL=foo.js
+
+function foo() {
+ return 142;
+}
Added: trunk/LayoutTests/inspector/model/resources/relationship-normal.js (0 => 199602)
--- trunk/LayoutTests/inspector/model/resources/relationship-normal.js (rev 0)
+++ trunk/LayoutTests/inspector/model/resources/relationship-normal.js 2016-04-15 19:01:39 UTC (rev 199602)
@@ -0,0 +1,3 @@
+function foo() {
+ return 42;
+}
Added: trunk/LayoutTests/inspector/model/script-resource-relationship-expected.txt (0 => 199602)
--- trunk/LayoutTests/inspector/model/script-resource-relationship-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/model/script-resource-relationship-expected.txt 2016-04-15 19:01:39 UTC (rev 199602)
@@ -0,0 +1,38 @@
+WebInspector.Script and WebInspector.Resource relationship.
+
+
+== Running test suite: WebInspector.Script and WebInspector.Resource relationship
+-- Running test case: ScriptWithResource
+PASS: Resource was added.
+PASS: Script was added.
+PASS: Resource and Script have the same URL.
+PASS: Resource should be related to one script.
+PASS: Resource should be related to the newly added script.
+PASS: Script should be related to the resource.
+PASS: Script should not have a sourceURL.
+
+-- Running test case: NamedScriptWithResource
+PASS: Resource was added.
+PASS: Script was added.
+PASS: Resource and Script have the same URL.
+PASS: Resource should be related to one script.
+PASS: Resource should be related to the newly added script.
+PASS: Script should be related to the resource.
+PASS: Script should have a sourceURL.
+
+-- Running test case: ScriptWithoutResource
+PASS: Script was added.
+PASS: Script should not be associated with a Resource.
+PASS: Script should have a sourceURL.
+
+-- Running test case: DocumentWithInlineScripts
+PASS: Main Resource should have 4 scripts.
+PASS: Inline script 1 does not have a sourceURL.
+PASS: Inline script 2 has a sourceURL.
+PASS: Inline script 3 does not have a sourceURL.
+PASS: Inline script 4 does not have a sourceURL.
+PASS: Inline script 1 should have a low start line.
+PASS: Inline script 2 should have a low start line.
+PASS: Inline script 3 should have a low start line.
+PASS: Inline script 4 should have a high start line.
+
Added: trunk/LayoutTests/inspector/model/script-resource-relationship.html (0 => 199602)
--- trunk/LayoutTests/inspector/model/script-resource-relationship.html (rev 0)
+++ trunk/LayoutTests/inspector/model/script-resource-relationship.html 2016-04-15 19:01:39 UTC (rev 199602)
@@ -0,0 +1,170 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>function inlineScriptOne() { return 1; }</script>
+ <script>
+ function inlineScriptTwo() {
+ return 2;
+ }
+ //# sourceURL=inline-script-two.js
+ </script>
+<script>
+function triggerResourceWithNormalScript() {
+ let script = document.createElement("script");
+ script.src = ""
+ document.body.appendChild(script);
+}
+
+function triggerResourceWithNamedScript() {
+ let script = document.createElement("script");
+ script.src = ""
+ document.body.appendChild(script);
+}
+
+function triggerScriptWithoutResource() {
+ eval("//# sourceURL=script-only.js\n1+1");
+}
+
+function test()
+{
+ let suite = InspectorTest.createAsyncSuite("WebInspector.Script and WebInspector.Resource relationship");
+
+ InspectorTest.dumpActivityToSystemConsole = true;
+ InspectorBackend.dumpInspectorProtocolMessages = true;
+
+ function validateNormalRelationship(resource, script) {
+ InspectorTest.expectThat(resource.url ="" script.url, "Resource and Script have the same URL.");
+ InspectorTest.expectThat(resource.scripts.length === 1, "Resource should be related to one script.");
+ InspectorTest.expectThat(resource.scripts[0] === script, "Resource should be related to the newly added script.");
+ InspectorTest.expectThat(script.resource === resource, "Script should be related to the resource.");
+ }
+
+ suite.addTestCase({
+ name: "ScriptWithResource",
+ description: "Normal relationship between a script and a resource.",
+ test: (resolve, reject) => {
+ let script = null, resource = null;
+
+ WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, scriptListener);
+ WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, (event) => {
+ InspectorTest.pass("Resource was added.");
+ resource = event.data.resource;
+ });
+
+ function scriptListener(event) {
+ if (!event.data.script.url)
+ return;
+ InspectorTest.pass("Script was added.");
+ script = event.data.script;
+ validateRelationship();
+ }
+
+ function validateRelationship() {
+ validateNormalRelationship(resource, script);
+ InspectorTest.expectThat(!script.sourceURL, "Script should not have a sourceURL.");
+
+ WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, scriptListener, null);
+ resolve();
+ }
+
+ InspectorTest.evaluateInPage("triggerResourceWithNormalScript()");
+ }
+ });
+
+ suite.addTestCase({
+ name: "NamedScriptWithResource",
+ description: "Normal relationship between a named script and a resource.",
+ test: (resolve, reject) => {
+ let script = null, resource = null;
+
+ WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, scriptListener);
+ WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, (event) => {
+ InspectorTest.pass("Resource was added.");
+ resource = event.data.resource;
+ });
+
+ function scriptListener(event) {
+ if (!event.data.script.url)
+ return;
+ InspectorTest.pass("Script was added.");
+ script = event.data.script;
+ validateRelationship();
+ }
+
+ function validateRelationship() {
+ validateNormalRelationship(resource, script);
+ InspectorTest.expectThat(script.sourceURL === "foo.js", "Script should have a sourceURL.");
+ WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, scriptListener, null);
+ resolve();
+ }
+
+ InspectorTest.evaluateInPage("triggerResourceWithNamedScript()");
+ }
+ });
+
+ suite.addTestCase({
+ name: "ScriptWithoutResource",
+ description: "A named eval does not have a resource.",
+ test: (resolve, reject) => {
+ WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, scriptListener);
+ let resourceListener = WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, (event) => {
+ InspectorTest.fail("Resource should not be added.");
+ reject();
+ });
+
+ function scriptListener(event) {
+ if (!event.data.script.sourceURL)
+ return;
+
+ InspectorTest.pass("Script was added.");
+ let script = event.data.script;
+
+ InspectorTest.expectThat(script.resource === null, "Script should not be associated with a Resource.");
+ InspectorTest.expectThat(script.sourceURL === "script-only.js", "Script should have a sourceURL.");
+
+ WebInspector.Frame.removeEventListener(WebInspector.Frame.Event.ResourceWasAdded, resourceListener, null);
+ WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, scriptListener, null);
+ resolve();
+ }
+
+ InspectorTest.evaluateInPage("triggerScriptWithoutResource()");
+ }
+ });
+
+ suite.addTestCase({
+ name: "DocumentWithInlineScripts",
+ description: "A document resource may be associated with multiple inline scripts.",
+ test: (resolve, reject) => {
+ let mainResource = WebInspector.frameResourceManager.mainFrame.mainResource;
+ let scripts = mainResource.scripts.slice().sort((a, b) => a.range.startLine - b.range.startLine);
+
+ // Scripts are:
+ // 1. <script> with inlineScriptOne()
+ // 2. <script> with inlineScriptTwo()
+ // 3. This <script> with test()
+ // 4. The <body onload> inline script event listener
+
+ InspectorTest.expectThat(scripts.length === 4, "Main Resource should have 4 scripts.");
+ InspectorTest.expectThat(!scripts[0].sourceURL, "Inline script 1 does not have a sourceURL.");
+ InspectorTest.expectThat(scripts[1].sourceURL === "inline-script-two.js", "Inline script 2 has a sourceURL.");
+ InspectorTest.expectThat(!scripts[2].sourceURL, "Inline script 3 does not have a sourceURL.");
+ InspectorTest.expectThat(!scripts[3].sourceURL, "Inline script 4 does not have a sourceURL.");
+
+ InspectorTest.expectThat(scripts[0].range.startLine < 15, "Inline script 1 should have a low start line.");
+ InspectorTest.expectThat(scripts[1].range.startLine < 15, "Inline script 2 should have a low start line.");
+ InspectorTest.expectThat(scripts[2].range.startLine < 15, "Inline script 3 should have a low start line.");
+ InspectorTest.expectThat(scripts[3].range.startLine > 100, "Inline script 4 should have a high start line.");
+
+ resolve();
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>WebInspector.Script and WebInspector.Resource relationship.</p>
+</body>
+</html>
Modified: trunk/Source/_javascript_Core/ChangeLog (199601 => 199602)
--- trunk/Source/_javascript_Core/ChangeLog 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-04-15 19:01:39 UTC (rev 199602)
@@ -1,3 +1,27 @@
+2016-04-15 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: sourceMappingURL not used when sourceURL is set
+ https://bugs.webkit.org/show_bug.cgi?id=156021
+ <rdar://problem/25438417>
+
+ Reviewed by Timothy Hatcher.
+
+ Clean up Debugger.sourceParsed to separately include:
+
+ - url ("resource URL", "source url" in JSC APIs)
+ - sourceURL - //# sourceURL directive
+
+ By always having the resource URL the Web Inspector frontend
+ can better match this Script to a Resource of the same URL,
+ and decide to use the sourceURL if it is available when
+ appropriate.
+
+ * inspector/protocol/Debugger.json:
+ * inspector/agents/InspectorDebuggerAgent.cpp:
+ (Inspector::InspectorDebuggerAgent::setBreakpointByUrl):
+ (Inspector::InspectorDebuggerAgent::didParseSource):
+ Send the new sourceParsed parameters.
+
2016-04-14 Joseph Pecoraro <pecor...@apple.com>
Web Inspector: Cleanup inspector/debugger tests
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp (199601 => 199602)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp 2016-04-15 19:01:39 UTC (rev 199602)
@@ -320,8 +320,8 @@
ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition, breakpointActions, autoContinue, ignoreCount);
for (ScriptsMap::iterator it = m_scripts.begin(); it != m_scripts.end(); ++it) {
- String scriptURL = !it->value.sourceURL.isEmpty() ? it->value.sourceURL : it->value.url;
- if (!matches(scriptURL, url, isRegex))
+ String scriptURLForBreakpoints = !it->value.sourceURL.isEmpty() ? it->value.sourceURL : it->value.url;
+ if (!matches(scriptURLForBreakpoints, url, isRegex))
continue;
RefPtr<Inspector::Protocol::Debugger::Location> location = resolveBreakpoint(breakpointIdentifier, it->key, breakpoint);
@@ -613,18 +613,21 @@
void InspectorDebuggerAgent::didParseSource(JSC::SourceID sourceID, const Script& script)
{
+ String scriptIDStr = String::number(sourceID);
bool hasSourceURL = !script.sourceURL.isEmpty();
- String scriptURL = hasSourceURL ? script.sourceURL : script.url;
- bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr;
+ String sourceURL = script.sourceURL;
String sourceMappingURL = sourceMapURLForScript(script);
- String* sourceMapURLParam = sourceMappingURL.isNull() ? nullptr : &sourceMappingURL;
+
const bool* isContentScript = script.isContentScript ? &script.isContentScript : nullptr;
- String scriptIDStr = String::number(sourceID);
- m_frontendDispatcher->scriptParsed(scriptIDStr, scriptURL, script.startLine, script.startColumn, script.endLine, script.endColumn, isContentScript, sourceMapURLParam, hasSourceURLParam);
+ String* sourceURLParam = hasSourceURL ? &sourceURL : nullptr;
+ String* sourceMapURLParam = sourceMappingURL.isEmpty() ? nullptr : &sourceMappingURL;
+ m_frontendDispatcher->scriptParsed(scriptIDStr, script.url, script.startLine, script.startColumn, script.endLine, script.endColumn, isContentScript, sourceURLParam, sourceMapURLParam);
+
m_scripts.set(sourceID, script);
- if (scriptURL.isEmpty())
+ String scriptURLForBreakpoints = hasSourceURL ? script.sourceURL : script.url;
+ if (scriptURLForBreakpoints.isEmpty())
return;
for (auto it = m_javaScriptBreakpoints.begin(), end = m_javaScriptBreakpoints.end(); it != end; ++it) {
@@ -633,10 +636,10 @@
return;
bool isRegex;
+ String url;
breakpointObject->getBoolean(ASCIILiteral("isRegex"), isRegex);
- String url;
breakpointObject->getString(ASCIILiteral("url"), url);
- if (!matches(scriptURL, url, isRegex))
+ if (!matches(scriptURLForBreakpoints, url, isRegex))
continue;
ScriptBreakpoint breakpoint;
Modified: trunk/Source/_javascript_Core/inspector/protocol/Debugger.json (199601 => 199602)
--- trunk/Source/_javascript_Core/inspector/protocol/Debugger.json 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/Source/_javascript_Core/inspector/protocol/Debugger.json 2016-04-15 19:01:39 UTC (rev 199602)
@@ -275,14 +275,14 @@
"name": "scriptParsed",
"parameters": [
{ "name": "scriptId", "$ref": "ScriptId", "description": "Identifier of the script parsed." },
- { "name": "url", "type": "string", "description": "URL or name of the script parsed (if any)." },
+ { "name": "url", "type": "string", "description": "URL of the script parsed (if any)." },
{ "name": "startLine", "type": "integer", "description": "Line offset of the script within the resource with given URL (for script tags)." },
{ "name": "startColumn", "type": "integer", "description": "Column offset of the script within the resource with given URL." },
{ "name": "endLine", "type": "integer", "description": "Last line of the script." },
{ "name": "endColumn", "type": "integer", "description": "Length of the last line of the script." },
{ "name": "isContentScript", "type": "boolean", "optional": true, "description": "Determines whether this script is a user extension script." },
- { "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with script (if any)." },
- { "name": "hasSourceURL", "type": "boolean", "optional": true, "description": "True, if this script has sourceURL." }
+ { "name": "sourceURL", "type": "string", "optional": true, "description": "sourceURL name of the script (if any)." },
+ { "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with script (if any)." }
],
"description": "Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger."
},
Modified: trunk/Source/WebInspectorUI/ChangeLog (199601 => 199602)
--- trunk/Source/WebInspectorUI/ChangeLog 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/Source/WebInspectorUI/ChangeLog 2016-04-15 19:01:39 UTC (rev 199602)
@@ -1,3 +1,68 @@
+2016-04-15 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: sourceMappingURL not used when sourceURL is set
+ https://bugs.webkit.org/show_bug.cgi?id=156021
+ <rdar://problem/25438417>
+
+ Reviewed by Timothy Hatcher.
+
+ Previously Debugger.sourceParsed only providing the sourceURL, and
+ wiping out the resourceURL, meant that a Script from a Resource that
+ set a sourceURL directive would fail to be associated with its Resource.
+
+ This would result in duplicated tree elements in the Resources Sidebar,
+ one for the Resource, and one for the Script. With the Script getting
+ ultimately getting the SourceMap resources. However, since the frontend
+ prefers Resources over Scripts when possible, an error that generated
+ from the script would point to a location in the Resource, not following
+ source maps.
+
+ By always providing the resource URL in Debugger.sourceParsed, a Script
+ can better be associated with its Resource. The result is now a single
+ shared tree element in the Resources Sidebar, and the Resource getting
+ the SourceMap resources. Now the script error goes through the Resource
+ to its SourceMap resources as we would expect.
+
+ * UserInterface/Protocol/DebuggerObserver.js:
+ (WebInspector.DebuggerObserver):
+ (WebInspector.DebuggerObserver.prototype.scriptParsed):
+ We now have to handle two different signatures of scriptParsed. One
+ for legacy, and one for non-legacy. Cache that value early on, since
+ scriptParsed happens a lot.
+
+ * UserInterface/Protocol/InspectorBackend.js:
+ (InspectorBackend.Agent.prototype.hasEventParameter):
+ Runtime check a protocol event to see if it has a parameter. This
+ is used to check if Debugger.sourceParsed is legacy or not based
+ on if it has the legacy "hasSourceURL" parameter.
+
+ * UserInterface/Models/Script.js:
+ (WebInspector.Script):
+ (WebInspector.Script.prototype.get sourceURL):
+ Treat sourceURL and url separately.
+
+ (WebInspector.Script.prototype.get displayName):
+ Handle both the url and sourceURL in displayName.
+
+ * UserInterface/Controllers/DebuggerManager.js:
+ (WebInspector.DebuggerManager.prototype.get knownNonResourceScripts):
+ (WebInspector.DebuggerManager.prototype.debuggerDidPause):
+ (WebInspector.DebuggerManager.prototype.scriptDidParse):
+ * UserInterface/Protocol/RemoteObject.js:
+ (WebInspector.RemoteObject.prototype.findFunctionSourceCodeLocation):
+ Update code that checks the sourceURL to explicitly use sourceURL.
+
+ * UserInterface/Controllers/SourceMapManager.js:
+ (WebInspector.SourceMapManager.prototype.downloadSourceMap):
+ For legacy backends, or in case we get a resource that has an incomplete
+ baseURL, attempt to get an absolute URL based on the main resource.
+
+ * UserInterface/Views/DebuggerSidebarPanel.js:
+ (WebInspector.DebuggerSidebarPanel.prototype._addScript):
+ * UserInterface/Views/ResourceSidebarPanel.js:
+ (WebInspector.ResourceSidebarPanel.prototype._scriptWasAdded):
+ Ignore scripts without a url or sourceURL.
+
2016-04-14 Joseph Pecoraro <pecor...@apple.com>
Web Inspector: Cleanup inspector/debugger tests
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js (199601 => 199602)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js 2016-04-15 19:01:39 UTC (rev 199602)
@@ -337,7 +337,7 @@
for (let script of this._scriptIdMap.values()) {
if (script.resource)
continue;
- if (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(script.url))
+ if (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(script.sourceURL))
continue;
knownScripts.push(script);
}
@@ -535,7 +535,7 @@
continue;
// Exclude the case where the call frame is in the inspector code.
- if (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(sourceCodeLocation.sourceCode.url))
+ if (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(sourceCodeLocation.sourceCode.sourceURL))
continue;
let scopeChain = this._scopeChainFromPayload(callFramePayload.scopeChain);
@@ -565,7 +565,7 @@
InspectorFrontendHost.beep();
}
- scriptDidParse(scriptIdentifier, url, isContentScript, startLine, startColumn, endLine, endColumn, sourceMapURL)
+ scriptDidParse(scriptIdentifier, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceURL, sourceMapURL)
{
// Don't add the script again if it is already known.
if (this._scriptIdMap.has(scriptIdentifier)) {
@@ -578,10 +578,10 @@
return;
}
- if (isWebInspectorInternalScript(url))
+ if (isWebInspectorInternalScript(sourceURL))
return;
- var script = new WebInspector.Script(scriptIdentifier, new WebInspector.TextRange(startLine, startColumn, endLine, endColumn), url, isContentScript, sourceMapURL);
+ let script = new WebInspector.Script(scriptIdentifier, new WebInspector.TextRange(startLine, startColumn, endLine, endColumn), url, isContentScript, sourceURL, sourceMapURL);
this._scriptIdMap.set(scriptIdentifier, script);
@@ -594,7 +594,7 @@
scripts.push(script);
}
- if (isWebKitInternalScript(script.url)) {
+ if (isWebKitInternalScript(script.sourceURL)) {
this._internalWebKitScripts.push(script);
if (!WebInspector.isDebugUIEnabled())
return;
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/SourceMapManager.js (199601 => 199602)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/SourceMapManager.js 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/SourceMapManager.js 2016-04-15 19:01:39 UTC (rev 199602)
@@ -44,6 +44,11 @@
downloadSourceMap(sourceMapURL, baseURL, originalSourceCode)
{
+ // The baseURL could have come from a "//# sourceURL". Attempt to get a
+ // reasonable absolute URL for the base by using the main resource's URL.
+ if (WebInspector.frameResourceManager.mainFrame)
+ baseURL = absoluteURL(WebInspector.frameResourceManager.mainFrame.url, baseURL);
+
sourceMapURL = absoluteURL(sourceMapURL, baseURL);
if (!sourceMapURL)
return;
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Script.js (199601 => 199602)
--- trunk/Source/WebInspectorUI/UserInterface/Models/Script.js 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Script.js 2016-04-15 19:01:39 UTC (rev 199602)
@@ -25,7 +25,7 @@
WebInspector.Script = class Script extends WebInspector.SourceCode
{
- constructor(id, range, url, injected, sourceMapURL)
+ constructor(id, range, url, injected, sourceURL, sourceMapURL)
{
super();
@@ -35,6 +35,7 @@
this._id = id || null;
this._range = range || null;
this._url = url || null;
+ this._sourceURL = sourceURL || null;
this._injected = injected || false;
this._resource = this._resolveResource();
@@ -71,6 +72,11 @@
return this._url;
}
+ get sourceURL()
+ {
+ return this._sourceURL;
+ }
+
get urlComponents()
{
if (!this._urlComponents)
@@ -88,6 +94,12 @@
if (this._url)
return WebInspector.displayNameForURL(this._url, this.urlComponents);
+ if (this._sourceURL) {
+ if (!this._sourceURLComponents)
+ this._sourceURLComponents = parseURL(this._sourceURL);
+ return WebInspector.displayNameForURL(this._sourceURL, this._sourceURLComponents);
+ }
+
// Assign a unique number to the script object so it will stay the same.
if (!this._uniqueDisplayNameNumber)
this._uniqueDisplayNameNumber = this.constructor._nextUniqueDisplayNameNumber++;
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js (199601 => 199602)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js 2016-04-15 19:01:39 UTC (rev 199602)
@@ -25,6 +25,11 @@
WebInspector.DebuggerObserver = class DebuggerObserver
{
+ constructor()
+ {
+ this._legacyScriptParsed = DebuggerAgent.hasEventParameter("scriptParsed", "hasSourceURL");
+ }
+
// Events defined by the "Debugger" domain.
globalObjectCleared()
@@ -32,9 +37,20 @@
WebInspector.debuggerManager.reset();
}
- scriptParsed(scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL, hasSourceURL)
+ scriptParsed(scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceURL, sourceMapURL)
{
- WebInspector.debuggerManager.scriptDidParse(scriptId, url, isContentScript, startLine, startColumn, endLine, endColumn, sourceMapURL);
+ if (this._legacyScriptParsed) {
+ // COMPATIBILITY (iOS 9): Debugger.scriptParsed had slightly different arguments.
+ // Debugger.scriptParsed: (scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL, hasSourceURL)
+ // Note that in this legacy version, url could be the sourceURL name, and the resource URL could be lost.
+ let legacySourceMapURL = arguments[7];
+ let hasSourceURL = arguments[8];
+ let legacySourceURL = hasSourceURL ? url : undefined;
+ WebInspector.debuggerManager.scriptDidParse(scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, legacySourceURL, legacySourceMapURL);
+ return;
+ }
+
+ WebInspector.debuggerManager.scriptDidParse(scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceURL, sourceMapURL);
}
scriptFailedToParse(url, scriptSource, startLine, errorLine, errorMessage)
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js (199601 => 199602)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js 2016-04-15 19:01:39 UTC (rev 199602)
@@ -426,6 +426,12 @@
return eventName in this._events;
}
+ hasEventParameter(eventName, eventParameterName)
+ {
+ let event = this._events[eventName];
+ return event && event.parameterNames.includes(eventParameterName);
+ }
+
activate()
{
this._active = true;
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js (199601 => 199602)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js 2016-04-15 19:01:39 UTC (rev 199602)
@@ -513,7 +513,7 @@
var location = response.location;
var sourceCode = WebInspector.debuggerManager.scriptForIdentifier(location.scriptId);
- if (!sourceCode || (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(sourceCode.url))) {
+ if (!sourceCode || (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(sourceCode.sourceURL))) {
result.resolve(WebInspector.RemoteObject.SourceCodeLocationPromise.NoSourceFound);
return;
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js (199601 => 199602)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js 2016-04-15 19:01:39 UTC (rev 199602)
@@ -428,7 +428,7 @@
_addScript(script)
{
// COMPATIBILITY(iOS 9): Backends could send the frontend built-in code, filter out JSC internals.
- if (!script.url)
+ if (!script.url && !script.sourceURL)
return;
// Don't add breakpoints if the script is represented by a Resource. They were
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js (199601 => 199602)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js 2016-04-15 18:56:53 UTC (rev 199601)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js 2016-04-15 19:01:39 UTC (rev 199602)
@@ -275,7 +275,7 @@
// We don't add scripts without URLs here. Those scripts can quickly clutter the interface and
// are usually more transient. They will get added if/when they need to be shown in a content view.
- if (!script.url)
+ if (!script.url && !script.sourceURL)
return;
// If the script URL matches a resource we can assume it is part of that resource and does not need added.