зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1134082 - Fix uncaught promise exceptions in shader editor. r=vp
This commit is contained in:
Родитель
b8463e17d6
Коммит
17adb06382
|
@ -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,7 +124,6 @@ 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 });
|
||||
|
@ -140,9 +140,10 @@ let EventsHandler = {
|
|||
$("#reload-notice").hidden = true;
|
||||
$("#waiting-notice").hidden = false;
|
||||
}
|
||||
yield ShadersEditorsView.setText({ vs: "", fs: "" });
|
||||
|
||||
$("#content").hidden = true;
|
||||
}).then(() => window.emit(EVENTS.UI_RESET));
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче