Bug 1108042 - No autoblackboxing of minified sources when they've been already checked. r=ejpbruel

This commit is contained in:
Ahri MAERTEN 2015-11-26 18:26:01 +01:00
Родитель c2726731e4
Коммит 6e3e3c9f05
5 изменённых файлов: 70 добавлений и 1 удалений

Просмотреть файл

@ -15,6 +15,7 @@ support-files =
code_blackboxing_one.js
code_blackboxing_three.js
code_blackboxing_two.js
code_blackboxing_unblackbox.min.js
code_breakpoints-break-on-last-line-of-script-on-reload.js
code_breakpoints-other-tabs.js
code_bug-896139.js
@ -51,6 +52,7 @@ support-files =
doc_auto-pretty-print-02.html
doc_binary_search.html
doc_blackboxing.html
doc_blackboxing_unblackbox.html
doc_breakpoints-break-on-last-line-of-script-on-reload.html
doc_breakpoints-other-tabs.html
doc_breakpoints-reload.html
@ -144,6 +146,7 @@ skip-if = e10s || true # bug 1113935
[browser_dbg_blackboxing-04.js]
[browser_dbg_blackboxing-05.js]
[browser_dbg_blackboxing-06.js]
[browser_dbg_blackboxing-07.js]
[browser_dbg_breadcrumbs-access.js]
[browser_dbg_break-in-anon.js]
[browser_dbg_break-on-next.js]

Просмотреть файл

@ -0,0 +1,49 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test that if we unblackbox a source which has been automatically blackboxed
* and then refresh, it is still unblackboxed.
*/
const TAB_URL = EXAMPLE_URL + "doc_blackboxing_unblackbox.html";
var gTab, gPanel, gDebugger;
function test() {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
waitForSourceShown(gPanel, ".min.js")
.then(testBlackBoxSource)
.then(testBlackBoxReload)
.then(() => closeDebuggerAndFinish(gPanel))
.then(null, aError => {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
});
}
function testBlackBoxSource() {
const bbButton = getBlackBoxButton(gPanel);
ok(bbButton.checked, "Should be black boxed by default");
return toggleBlackBoxing(gPanel).then(aSource => {
ok(!aSource.isBlackBoxed, "The source should no longer be blackboxed.");
});
}
function testBlackBoxReload() {
return reloadActiveTab(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(() => {
const selectedSource = getSelectedSourceElement(gPanel);
ok(!selectedSource.isBlackBoxed, "The source should not be blackboxed.");
});
}
registerCleanupFunction(function() {
gTab = null;
gPanel = null;
gDebugger = null;
});

Просмотреть файл

@ -0,0 +1 @@
function blackboxme(){one()};function one(){};

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Debugger test page</title>
<script type="text/javascript" src="code_blackboxing_unblackbox.min.js"></script>
</head>
<body>
</body>
</html>

Просмотреть файл

@ -34,6 +34,7 @@ function TabSources(threadActor, allowSourceFn=() => true) {
this.blackBoxedSources = new Set();
this.prettyPrintedSources = new Map();
this.neverAutoBlackBoxSources = new Set();
// generated Debugger.Source -> promise of SourceMapConsumer
this._sourceMaps = new Map();
@ -169,8 +170,12 @@ TabSources.prototype = {
this._thread.threadLifetimePool.addActor(actor);
sourceActorStore.setReusableActorId(source, originalUrl, actor.actorID);
if (this._autoBlackBox && this._isMinifiedURL(actor.url)) {
if (this._autoBlackBox &&
!this.neverAutoBlackBoxSources.has(actor.url) &&
this._isMinifiedURL(actor.url)) {
this.blackBox(actor.url);
this.neverAutoBlackBoxSources.add(actor.url);
}
if (source) {