mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1087054 - Actually use the source map request cache. r=past
This commit is contained in:
parent
b9ee1103fc
commit
f6ad6d6d08
@ -5112,6 +5112,11 @@ ThreadSources.prototype = {
|
||||
*/
|
||||
sourceMap: function (aScript) {
|
||||
dbg_assert(aScript.source.sourceMapURL, "Script should have a sourceMapURL");
|
||||
|
||||
if (this._sourceMapsByGeneratedSource[aScript.url]) {
|
||||
return this._sourceMapsByGeneratedSource[aScript.url];
|
||||
}
|
||||
|
||||
let sourceMapURL = this._normalize(aScript.source.sourceMapURL, aScript.url);
|
||||
let map = this._fetchSourceMap(sourceMapURL, aScript.url)
|
||||
.then(aSourceMap => this.saveSourceMap(aSourceMap, aScript.url));
|
||||
|
@ -598,3 +598,15 @@ function unBlackBox(sourceClient) {
|
||||
dumpn("Un-black boxing source: " + sourceClient.actor);
|
||||
return rdpRequest(sourceClient, sourceClient.unblackBox);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do a fake reload which clears the thread debugger
|
||||
*
|
||||
* @param TabClient tabClient
|
||||
* @returns Promise<response>
|
||||
*/
|
||||
function reload(tabClient) {
|
||||
let deferred = promise.defer();
|
||||
tabClient._reload({}, deferred.resolve);
|
||||
return deferred.promise;
|
||||
}
|
||||
|
@ -2,12 +2,13 @@
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that we don't permanently cache source maps.
|
||||
* Test that we don't permanently cache source maps across reloads.
|
||||
*/
|
||||
|
||||
var gDebuggee;
|
||||
var gClient;
|
||||
var gThreadClient;
|
||||
var gTabClient;
|
||||
|
||||
Components.utils.import("resource:///modules/devtools/SourceMap.jsm");
|
||||
|
||||
@ -19,6 +20,7 @@ function run_test()
|
||||
gClient.connect(function() {
|
||||
attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
gTabClient = aTabClient;
|
||||
setup_code();
|
||||
});
|
||||
});
|
||||
@ -59,7 +61,7 @@ function test_initial_sources() {
|
||||
do_check_true(!error);
|
||||
do_check_eq(sources.length, 1);
|
||||
do_check_eq(sources[0].url, getFileUrl(TEMP_FILE_1, true));
|
||||
setup_new_code();
|
||||
reload(gTabClient).then(setup_new_code);
|
||||
});
|
||||
}
|
||||
|
||||
@ -74,13 +76,12 @@ function setup_new_code() {
|
||||
code += "\n//# sourceMappingURL=" + getFileUrl(MAP_FILE_NAME, true);
|
||||
writeFile(MAP_FILE_NAME, map.toString());
|
||||
|
||||
gClient.addOneTimeListener("newSource", test_new_sources);
|
||||
Cu.evalInSandbox(code,
|
||||
gDebuggee,
|
||||
"1.8",
|
||||
getFileUrl(TEMP_GENERATED_SOURCE, true),
|
||||
1);
|
||||
|
||||
gClient.addOneTimeListener("newSource", test_new_sources);
|
||||
}
|
||||
|
||||
function test_new_sources() {
|
||||
@ -88,7 +89,7 @@ function test_new_sources() {
|
||||
do_check_true(!error);
|
||||
|
||||
// Should now have TEMP_FILE_2 as a source.
|
||||
do_check_eq(sources.length, 2);
|
||||
do_check_eq(sources.length, 1);
|
||||
let s = sources.filter(s => s.url === getFileUrl(TEMP_FILE_2, true))[0];
|
||||
do_check_true(!!s);
|
||||
|
||||
|
@ -120,6 +120,12 @@ TestTabActor.prototype = {
|
||||
return { type: "detached" };
|
||||
},
|
||||
|
||||
onReload: function(aRequest) {
|
||||
this.threadActor.clearDebuggees();
|
||||
this.threadActor.dbg.addDebuggees();
|
||||
return {};
|
||||
},
|
||||
|
||||
/* Support for DebuggerServer.addTabActor. */
|
||||
_createExtraActors: createExtraActors,
|
||||
_appendExtraActors: appendExtraActors
|
||||
@ -127,7 +133,8 @@ TestTabActor.prototype = {
|
||||
|
||||
TestTabActor.prototype.requestTypes = {
|
||||
"attach": TestTabActor.prototype.onAttach,
|
||||
"detach": TestTabActor.prototype.onDetach
|
||||
"detach": TestTabActor.prototype.onDetach,
|
||||
"reload": TestTabActor.prototype.onReload
|
||||
};
|
||||
|
||||
exports.register = function(handle) {
|
||||
|
Loading…
Reference in New Issue
Block a user