diff --git a/browser/devtools/shadereditor/shadereditor.js b/browser/devtools/shadereditor/shadereditor.js index ec6eafea366c..93019876eb2f 100644 --- a/browser/devtools/shadereditor/shadereditor.js +++ b/browser/devtools/shadereditor/shadereditor.js @@ -10,6 +10,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Task.jsm"); Cu.import("resource:///modules/devtools/SideMenuWidget.jsm"); Cu.import("resource:///modules/devtools/ViewHelpers.jsm"); +Cu.import("resource://gre/modules/devtools/Console.jsm"); const require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; const promise = Cu.import("resource://gre/modules/Promise.jsm", {}).Promise; @@ -123,26 +124,26 @@ let EventsHandler = { _onTabNavigated: function(event, {isFrameSwitching}) { switch (event) { case "will-navigate": { - Task.spawn(function*() { - // Make sure the backend is prepared to handle WebGL contexts. - if (!isFrameSwitching) { - gFront.setup({ reload: false }); - } + // Make sure the backend is prepared to handle WebGL contexts. + if (!isFrameSwitching) { + gFront.setup({ reload: false }); + } + + // Reset UI. + ShadersListView.empty(); + // When switching to an iframe, ensure displaying the reload button. + // As the document has already been loaded without being hooked. + if (isFrameSwitching) { + $("#reload-notice").hidden = false; + $("#waiting-notice").hidden = true; + } else { + $("#reload-notice").hidden = true; + $("#waiting-notice").hidden = false; + } + + $("#content").hidden = true; + window.emit(EVENTS.UI_RESET); - // Reset UI. - ShadersListView.empty(); - // When switching to an iframe, ensure displaying the reload button. - // As the document has already been loaded without being hooked. - if (isFrameSwitching) { - $("#reload-notice").hidden = false; - $("#waiting-notice").hidden = true; - } else { - $("#reload-notice").hidden = true; - $("#waiting-notice").hidden = false; - } - yield ShadersEditorsView.setText({ vs: "", fs: "" }); - $("#content").hidden = true; - }).then(() => window.emit(EVENTS.UI_RESET)); break; } case "navigate": { @@ -370,7 +371,7 @@ let ShadersEditorsView = { */ destroy: Task.async(function*() { this._destroyed = true; - this._toggleListeners("off"); + yield this._toggleListeners("off"); for (let p of this._editorPromises.values()) { let editor = yield p; editor.destroy(); @@ -414,9 +415,6 @@ let ShadersEditorsView = { * Returns a promise that resolves to an editor instance */ _getEditor: function(type) { - if ($("#content").hidden) { - return promise.reject(new Error("Shader Editor is still waiting for a WebGL context to be created.")); - } if (this._editorPromises.has(type)) { return this._editorPromises.get(type); } diff --git a/browser/devtools/shadereditor/test/browser_se_aaa_run_first_leaktest.js b/browser/devtools/shadereditor/test/browser_se_aaa_run_first_leaktest.js index bfec65b208f5..5e2f3bd191f6 100644 --- a/browser/devtools/shadereditor/test/browser_se_aaa_run_first_leaktest.js +++ b/browser/devtools/shadereditor/test/browser_se_aaa_run_first_leaktest.js @@ -1,13 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -/////////////////// -// -// Whitelisting this test. -// As part of bug 1077403, the leaking uncaught rejection should be fixed. -// -thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created."); - /** * Tests if the shader editor leaks on initialization and sudden destruction. * You can also use this initialization format as a template for other tests. diff --git a/browser/devtools/shadereditor/test/browser_se_editors-contents.js b/browser/devtools/shadereditor/test/browser_se_editors-contents.js index f6705dcb62f4..b3f85f8c079c 100644 --- a/browser/devtools/shadereditor/test/browser_se_editors-contents.js +++ b/browser/devtools/shadereditor/test/browser_se_editors-contents.js @@ -1,13 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -/////////////////// -// -// Whitelisting this test. -// As part of bug 1077403, the leaking uncaught rejection should be fixed. -// -thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created."); - /** * Tests if the editors contain the correct text when a program * becomes available. diff --git a/browser/devtools/shadereditor/test/browser_se_editors-error-gutter.js b/browser/devtools/shadereditor/test/browser_se_editors-error-gutter.js index 6129bdb66b6a..8f8c2b4d6349 100644 --- a/browser/devtools/shadereditor/test/browser_se_editors-error-gutter.js +++ b/browser/devtools/shadereditor/test/browser_se_editors-error-gutter.js @@ -1,13 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -/////////////////// -// -// Whitelisting this test. -// As part of bug 1077403, the leaking uncaught rejection should be fixed. -// -thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created."); - /** * Tests if error indicators are shown in the editor's gutter and text area * when there's a shader compilation error. diff --git a/browser/devtools/shadereditor/test/browser_se_editors-error-tooltip.js b/browser/devtools/shadereditor/test/browser_se_editors-error-tooltip.js index 6605ef06ba38..5bdc0d800e96 100644 --- a/browser/devtools/shadereditor/test/browser_se_editors-error-tooltip.js +++ b/browser/devtools/shadereditor/test/browser_se_editors-error-tooltip.js @@ -1,13 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -/////////////////// -// -// Whitelisting this test. -// As part of bug 1077403, the leaking uncaught rejection should be fixed. -// -thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created."); - /** * Tests if error tooltips can be opened from the editor's gutter when there's * a shader compilation error. diff --git a/browser/devtools/shadereditor/test/browser_se_editors-lazy-init.js b/browser/devtools/shadereditor/test/browser_se_editors-lazy-init.js index 6b7b0eb4b253..4f31ac6f572e 100644 --- a/browser/devtools/shadereditor/test/browser_se_editors-lazy-init.js +++ b/browser/devtools/shadereditor/test/browser_se_editors-lazy-init.js @@ -1,13 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -/////////////////// -// -// Whitelisting this test. -// As part of bug 1077403, the leaking uncaught rejection should be fixed. -// -thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created."); - /** * Tests if source editors are lazily initialized. */ @@ -16,20 +9,6 @@ function ifWebGLSupported() { let { target, panel } = yield initShaderEditor(SIMPLE_CANVAS_URL); let { gFront, ShadersEditorsView } = panel.panelWin; - try { - yield ShadersEditorsView._getEditor("vs"); - ok(false, "The promise for a vertex shader editor should be rejected."); - } catch (e) { - ok(true, "The vertex shader editors wasn't initialized."); - } - - try { - yield ShadersEditorsView._getEditor("fs"); - ok(false, "The promise for a fragment shader editor should be rejected."); - } catch (e) { - ok(true, "The fragment shader editors wasn't initialized."); - } - reload(target); yield once(gFront, "program-linked"); diff --git a/browser/devtools/shadereditor/test/browser_se_first-run.js b/browser/devtools/shadereditor/test/browser_se_first-run.js index 4ea0ed76e687..bc02546dee8c 100644 --- a/browser/devtools/shadereditor/test/browser_se_first-run.js +++ b/browser/devtools/shadereditor/test/browser_se_first-run.js @@ -1,13 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -/////////////////// -// -// Whitelisting this test. -// As part of bug 1077403, the leaking uncaught rejection should be fixed. -// -thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created."); - /** * Tests if the shader editor shows the appropriate UI when opened. */ diff --git a/browser/devtools/shadereditor/test/browser_se_navigation.js b/browser/devtools/shadereditor/test/browser_se_navigation.js index eacdb546b5c1..5336744c9f0e 100644 --- a/browser/devtools/shadereditor/test/browser_se_navigation.js +++ b/browser/devtools/shadereditor/test/browser_se_navigation.js @@ -1,13 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -/////////////////// -// -// Whitelisting this test. -// As part of bug 1077403, the leaking uncaught rejection should be fixed. -// -thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created."); - /** * Tests target navigations are handled correctly in the UI. */ @@ -48,8 +41,7 @@ function ifWebGLSupported() { let navigated = once(target, "will-navigate"); navigate(target, "about:blank"); - yield navigating; - yield once(panel.panelWin, EVENTS.UI_RESET); + yield promise.all([navigating, once(panel.panelWin, EVENTS.UI_RESET) ]); is($("#reload-notice").hidden, true, "The 'reload this page' notice should be hidden while navigating."); @@ -65,18 +57,6 @@ function ifWebGLSupported() { is(ShadersListView.selectedIndex, -1, "The shaders list has a negative index."); - yield ShadersEditorsView._getEditor("vs").then(() => { - ok(false, "The promise for a vertex shader editor should be rejected."); - }, () => { - ok(true, "The vertex shader editors wasn't initialized."); - }); - - yield ShadersEditorsView._getEditor("fs").then(() => { - ok(false, "The promise for a fragment shader editor should be rejected."); - }, () => { - ok(true, "The fragment shader editors wasn't initialized."); - }); - yield navigated; is($("#reload-notice").hidden, true, diff --git a/browser/devtools/shadereditor/test/browser_se_programs-blackbox-01.js b/browser/devtools/shadereditor/test/browser_se_programs-blackbox-01.js index 23df460d9dc1..4cdfed7ccb30 100644 --- a/browser/devtools/shadereditor/test/browser_se_programs-blackbox-01.js +++ b/browser/devtools/shadereditor/test/browser_se_programs-blackbox-01.js @@ -1,13 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -/////////////////// -// -// Whitelisting this test. -// As part of bug 1077403, the leaking uncaught rejection should be fixed. -// -thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created."); - /** * Tests if blackboxing a program works properly. */ diff --git a/browser/devtools/shadereditor/test/browser_se_programs-blackbox-02.js b/browser/devtools/shadereditor/test/browser_se_programs-blackbox-02.js index 2f3eb122472a..c2fdd38ee399 100644 --- a/browser/devtools/shadereditor/test/browser_se_programs-blackbox-02.js +++ b/browser/devtools/shadereditor/test/browser_se_programs-blackbox-02.js @@ -1,13 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -/////////////////// -// -// Whitelisting this test. -// As part of bug 1077403, the leaking uncaught rejection should be fixed. -// -thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created."); - /** * Tests if blackboxing a program works properly in tandem with blended * overlapping geometry. diff --git a/browser/devtools/shadereditor/test/browser_se_programs-list.js b/browser/devtools/shadereditor/test/browser_se_programs-list.js index 3d676a6ee1cc..5900a8e3a165 100644 --- a/browser/devtools/shadereditor/test/browser_se_programs-list.js +++ b/browser/devtools/shadereditor/test/browser_se_programs-list.js @@ -1,13 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -/////////////////// -// -// Whitelisting this test. -// As part of bug 1077403, the leaking uncaught rejection should be fixed. -// -thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created."); - /** * Tests if the programs list contains an entry after vertex and fragment * shaders are linked. diff --git a/browser/devtools/shadereditor/test/browser_se_shaders-edit-01.js b/browser/devtools/shadereditor/test/browser_se_shaders-edit-01.js index 25244322f789..c7e932c98f99 100644 --- a/browser/devtools/shadereditor/test/browser_se_shaders-edit-01.js +++ b/browser/devtools/shadereditor/test/browser_se_shaders-edit-01.js @@ -1,13 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -/////////////////// -// -// Whitelisting this test. -// As part of bug 1077403, the leaking uncaught rejection should be fixed. -// -thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created."); - /** * Tests if editing a vertex and a fragment shader works properly. */ diff --git a/browser/devtools/shadereditor/test/browser_se_shaders-edit-02.js b/browser/devtools/shadereditor/test/browser_se_shaders-edit-02.js index 1deff7aa1d3e..0b6aaf0f98c0 100644 --- a/browser/devtools/shadereditor/test/browser_se_shaders-edit-02.js +++ b/browser/devtools/shadereditor/test/browser_se_shaders-edit-02.js @@ -1,13 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -/////////////////// -// -// Whitelisting this test. -// As part of bug 1077403, the leaking uncaught rejection should be fixed. -// -thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created."); - /** * Tests if compile or linkage errors are emitted when a shader source * gets malformed after being edited. diff --git a/browser/devtools/shadereditor/test/browser_se_shaders-edit-03.js b/browser/devtools/shadereditor/test/browser_se_shaders-edit-03.js index 15c1b6ab8f94..a73afed6c4ea 100644 --- a/browser/devtools/shadereditor/test/browser_se_shaders-edit-03.js +++ b/browser/devtools/shadereditor/test/browser_se_shaders-edit-03.js @@ -1,13 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -/////////////////// -// -// Whitelisting this test. -// As part of bug 1077403, the leaking uncaught rejection should be fixed. -// -thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created."); - /** * Tests if editing a vertex and a fragment shader would permanently store * their new source on the backend and reshow it in the frontend when required.