From 92a33daff850292af80433c237c3ea61de61dc4e Mon Sep 17 00:00:00 2001 From: Joe Walker Date: Sat, 11 May 2013 12:13:09 +0100 Subject: [PATCH] Backed out changeset 6ebf2274acf5 (Bug 852792) for xpcshell bustage --- .../debugger/server/dbg-script-actors.js | 25 ++---- .../debugger/tests/unit/test_sourcemaps-06.js | 86 ------------------- .../devtools/debugger/tests/unit/xpcshell.ini | 1 - 3 files changed, 5 insertions(+), 107 deletions(-) delete mode 100644 toolkit/devtools/debugger/tests/unit/test_sourcemaps-06.js diff --git a/toolkit/devtools/debugger/server/dbg-script-actors.js b/toolkit/devtools/debugger/server/dbg-script-actors.js index 30bdcaee7258..7f4b5d40a163 100644 --- a/toolkit/devtools/debugger/server/dbg-script-actors.js +++ b/toolkit/devtools/debugger/server/dbg-script-actors.js @@ -1381,13 +1381,10 @@ PauseScopedActor.prototype = { * The url of the source we are representing. * @param aThreadActor ThreadActor * The current thread actor. - * @param aSourceContent String - * Optional. The contents of the source, if we already know it. */ -function SourceActor(aUrl, aThreadActor, aSourceContent=null) { +function SourceActor(aUrl, aThreadActor) { this._threadActor = aThreadActor; this._url = aUrl; - this._sourceContent = aSourceContent; } SourceActor.prototype = { @@ -1415,14 +1412,6 @@ SourceActor.prototype = { * Handler for the "source" packet. */ onSource: function SA_onSource(aRequest) { - if (this._sourceContent) { - return { - from: this.actorID, - source: this.threadActor.createValueGrip( - this._sourceContent, this.threadActor.threadLifetimePool) - }; - } - return fetch(this._url) .then(function(aSource) { return this.threadActor.createValueGrip( @@ -2442,13 +2431,10 @@ ThreadSources.prototype = { * Right now this takes a URL, but in the future it should * take a Debugger.Source. See bug 637572. * - * @param String aURL - * The source URL. - * @param String aSourceContent - * Optional. The content of the source, if we already know it. + * @param string the source URL. * @returns a SourceActor representing the source or null. */ - source: function TS_source(aURL, aSourceContent=null) { + source: function TS_source(aURL) { if (!this._allow(aURL)) { return null; } @@ -2457,7 +2443,7 @@ ThreadSources.prototype = { return this._sourceActors[aURL]; } - let actor = new SourceActor(aURL, this._thread, aSourceContent); + let actor = new SourceActor(aURL, this._thread); this._thread.threadLifetimePool.addActor(actor); this._sourceActors[aURL] = actor; try { @@ -2479,8 +2465,7 @@ ThreadSources.prototype = { return this.sourceMap(aScript) .then((aSourceMap) => { return [ - this.source(s, aSourceMap.sourceContentFor(s)) - for (s of aSourceMap.sources) + this.source(s) for (s of aSourceMap.sources) ]; }, (e) => { reportError(e); diff --git a/toolkit/devtools/debugger/tests/unit/test_sourcemaps-06.js b/toolkit/devtools/debugger/tests/unit/test_sourcemaps-06.js deleted file mode 100644 index 97b653e18e1a..000000000000 --- a/toolkit/devtools/debugger/tests/unit/test_sourcemaps-06.js +++ /dev/null @@ -1,86 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Check that we can load sources whose content is embedded in the - * "sourcesContent" field of a source map. - */ - -var gDebuggee; -var gClient; -var gThreadClient; - -Components.utils.import("resource:///modules/devtools/SourceMap.jsm"); - -function run_test() -{ - initTestDebuggerServer(); - gDebuggee = addTestGlobal("test-source-map"); - gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { - attachTestGlobalClientAndResume(gClient, "test-source-map", function(aResponse, aThreadClient) { - gThreadClient = aThreadClient; - test_source_content(); - }); - }); - do_test_pending(); -} - -function test_source_content() -{ - let numNewSources = 0; - - gClient.addListener("newSource", function _onNewSource(aEvent, aPacket) { - if (++numNewSources !== 3) { - return; - } - gClient.removeListener("newSource", _onNewSource); - - gThreadClient.getSources(function (aResponse) { - do_check_true(!aResponse.error, "Should not get an error"); - - testContents(aResponse.sources, () => { - finishClient(gClient); - }); - }); - }); - - let node = new SourceNode(null, null, null, [ - new SourceNode(1, 0, "a.js", "function a() { return 'a'; }\n"), - new SourceNode(1, 0, "b.js", "function b() { return 'b'; }\n"), - new SourceNode(1, 0, "c.js", "function c() { return 'c'; }\n"), - ]); - - node.setSourceContent("a.js", "content for a.js"); - node.setSourceContent("b.js", "content for b.js"); - node.setSourceContent("c.js", "content for c.js"); - - let { code, map } = node.toStringWithSourceMap({ - file: "abc.js" - }); - - code += "//@ sourceMappingURL=data:text/json;base64," + btoa(map.toString()); - - Components.utils.evalInSandbox(code, gDebuggee, "1.8", - "http://example.com/www/js/abc.js", 1); -} - -function testContents(aSources, aCallback) { - if (aSources.length === 0) { - return aCallback(); - } - - let source = aSources[0]; - let sourceClient = gThreadClient.source(aSources[0]); - - sourceClient.source((aResponse) => { - do_check_true(!aResponse.error, - "Should not get an error loading the source from sourcesContent"); - - let expectedContent = "content for " + source.url; - do_check_eq(aResponse.source, expectedContent, - "Should have the expected source content"); - - testContents(aSources.slice(1), aCallback); - }); -} diff --git a/toolkit/devtools/debugger/tests/unit/xpcshell.ini b/toolkit/devtools/debugger/tests/unit/xpcshell.ini index 5b314842616d..0ab8b26dd061 100644 --- a/toolkit/devtools/debugger/tests/unit/xpcshell.ini +++ b/toolkit/devtools/debugger/tests/unit/xpcshell.ini @@ -87,7 +87,6 @@ reason = bug 820380 [test_sourcemaps-05.js] skip-if = toolkit == "gonk" reason = bug 820380 -[test_sourcemaps-06.js] [test_objectgrips-01.js] [test_objectgrips-02.js] [test_objectgrips-03.js]