Backed out changeset e973dc385fd1 (bug 1470086) for devtools failures on browser_se_editors-contents.js. CLOSED TREE

--HG--
rename : devtools/client/shadereditor/index.xul => devtools/client/shadereditor/shadereditor.xul
This commit is contained in:
Brindusan Cristian 2018-06-26 14:58:57 +03:00
Родитель 6ffd31082b
Коммит b881500a7d
22 изменённых файлов: 355 добавлений и 341 удалений

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

@ -6,7 +6,6 @@
const Services = require("Services");
const osString = Services.appinfo.OS;
const { Cu } = require("chrome");
// Panels
loader.lazyGetter(this, "OptionsPanel", () => require("devtools/client/framework/toolbox-options").OptionsPanel);
@ -15,6 +14,7 @@ loader.lazyGetter(this, "WebConsolePanel", () => require("devtools/client/webcon
loader.lazyGetter(this, "DebuggerPanel", () => require("devtools/client/debugger/panel").DebuggerPanel);
loader.lazyGetter(this, "NewDebuggerPanel", () => require("devtools/client/debugger/new/panel").DebuggerPanel);
loader.lazyGetter(this, "StyleEditorPanel", () => require("devtools/client/styleeditor/styleeditor-panel").StyleEditorPanel);
loader.lazyGetter(this, "ShaderEditorPanel", () => require("devtools/client/shadereditor/panel").ShaderEditorPanel);
loader.lazyGetter(this, "CanvasDebuggerPanel", () => require("devtools/client/canvasdebugger/panel").CanvasDebuggerPanel);
loader.lazyGetter(this, "WebAudioEditorPanel", () => require("devtools/client/webaudioeditor/panel").WebAudioEditorPanel);
loader.lazyGetter(this, "MemoryPanel", () => require("devtools/client/memory/panel").MemoryPanel);
@ -219,7 +219,7 @@ Tools.shaderEditor = {
ordinal: 5,
visibilityswitch: "devtools.shadereditor.enabled",
icon: "chrome://devtools/skin/images/tool-shadereditor.svg",
url: "chrome://devtools/content/shadereditor/index.xul",
url: "chrome://devtools/content/shadereditor/shadereditor.xul",
label: l10n("ToolboxShaderEditor.label"),
panelLabel: l10n("ToolboxShaderEditor.panelLabel"),
tooltip: l10n("ToolboxShaderEditor.tooltip"),
@ -229,13 +229,7 @@ Tools.shaderEditor = {
},
build: function(iframeWindow, toolbox) {
const { BrowserLoader } = Cu.import("resource://devtools/client/shared/browser-loader.js", {});
const browserRequire = BrowserLoader({
baseURI: "resource://devtools/client/shadereditor/",
window: iframeWindow
}).require;
const { ShaderEditorPanel } = browserRequire("devtools/client/shadereditor/panel");
return new ShaderEditorPanel(toolbox);
return new ShaderEditorPanel(iframeWindow, toolbox);
}
};

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

@ -44,7 +44,8 @@ devtools.jar:
content/debugger/views/stack-frames-classic-view.js (debugger/views/stack-frames-classic-view.js)
content/debugger/views/filter-view.js (debugger/views/filter-view.js)
content/debugger/utils.js (debugger/utils.js)
content/shadereditor/index.xul (shadereditor/index.xul)
content/shadereditor/shadereditor.xul (shadereditor/shadereditor.xul)
content/shadereditor/shadereditor.js (shadereditor/shadereditor.js)
content/canvasdebugger/index.xul (canvasdebugger/index.xul)
content/canvasdebugger/canvasdebugger.js (canvasdebugger/canvasdebugger.js)
content/canvasdebugger/snapshotslist.js (canvasdebugger/snapshotslist.js)

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

@ -4,8 +4,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DevToolsModules(
'panel.js',
'shadereditor.js'
'panel.js'
)
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']

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

@ -5,15 +5,15 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const promise = require("promise");
const EventEmitter = require("devtools/shared/event-emitter");
const { WebGLFront } = require("devtools/shared/fronts/webgl");
const { EventsHandler, ShadersListView, ShadersEditorsView, EVENTS, $, L10N } =
require("./shadereditor");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
function ShaderEditorPanel(toolbox) {
function ShaderEditorPanel(iframeWindow, toolbox) {
this.panelWin = iframeWindow;
this._toolbox = toolbox;
this._destroyer = null;
this.panelWin = window;
EventEmitter.decorate(this);
}
@ -21,36 +21,37 @@ function ShaderEditorPanel(toolbox) {
exports.ShaderEditorPanel = ShaderEditorPanel;
ShaderEditorPanel.prototype = {
// Expose symbols for tests:
EVENTS,
$,
L10N,
/**
* Open is effectively an asynchronous constructor.
*
* @return object
* A promise that is resolved when the Shader Editor completes opening.
*/
async open() {
open: function() {
let targetPromise;
// Local debugging needs to make the target remote.
if (!this.target.isRemote) {
await this.target.makeRemote();
targetPromise = this.target.makeRemote();
} else {
targetPromise = promise.resolve(this.target);
}
this.front = new WebGLFront(this.target.client, this.target.form);
this.shadersListView = new ShadersListView();
this.eventsHandler = new EventsHandler();
this.shadersEditorsView = new ShadersEditorsView();
await this.shadersListView.initialize(this._toolbox, this.shadersEditorsView);
await this.eventsHandler.initialize(this, this._toolbox, this.target, this.front,
this.shadersListView);
await this.shadersEditorsView.initialize(this, this.shadersListView);
this.isReady = true;
this.emit("ready");
return this;
return targetPromise
.then(() => {
this.panelWin.gToolbox = this._toolbox;
this.panelWin.gTarget = this.target;
this.panelWin.gFront = new WebGLFront(this.target.client, this.target.form);
return this.panelWin.startupShaderEditor();
})
.then(() => {
this.isReady = true;
this.emit("ready");
return this;
})
.catch(function onError(aReason) {
DevToolsUtils.reportException("ShaderEditorPanel.prototype.open", aReason);
});
},
// DevToolPanel API
@ -59,19 +60,16 @@ ShaderEditorPanel.prototype = {
return this._toolbox.target;
},
destroy() {
destroy: function() {
// Make sure this panel is not already destroyed.
if (this._destroyer) {
return this._destroyer;
}
return (this._destroyer = (async () => {
await this.shadersListView.destroy();
await this.eventsHandler.destroy();
await this.shadersEditorsView.destroy();
return (this._destroyer = this.panelWin.shutdownShaderEditor().then(() => {
// Destroy front to ensure packet handler is removed from client
this.front.destroy();
this.panelWin.gFront.destroy();
this.emit("destroyed");
})());
}));
}
};

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

@ -3,8 +3,11 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* exported startupShaderEditor, shutdownShaderEditor */
const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
const {SideMenuWidget} = require("devtools/client/shared/widgets/SideMenuWidget.jsm");
const {SideMenuWidget} = require("resource://devtools/client/shared/widgets/SideMenuWidget.jsm");
const promise = require("promise");
const defer = require("devtools/shared/defer");
const {Task} = require("devtools/shared/task");
@ -16,6 +19,11 @@ const {extend} = require("devtools/shared/extend");
const {WidgetMethods, setNamedTimeout} =
require("devtools/client/shared/widgets/view-helpers");
// Use privileged promise in panel documents to prevent having them to freeze
// during toolbox destruction. See bug 1402779.
// eslint-disable-next-line no-unused-vars
const Promise = require("Promise");
// The panel's window global is an EventEmitter firing the following events:
const EVENTS = {
// When new programs are received from the server.
@ -34,7 +42,7 @@ const EVENTS = {
// When the editor's error markers are all removed
EDITOR_ERROR_MARKERS_REMOVED: "ShaderEditor:EditorCleaned"
};
exports.EVENTS = EVENTS;
XPCOMUtils.defineConstant(this, "EVENTS", EVENTS);
const STRINGS_URI = "devtools/client/locales/shadereditor.properties";
const HIGHLIGHT_TINT = [1, 0, 0.25, 1]; // rgba
@ -48,70 +56,89 @@ const DEFAULT_EDITOR_CONFIG = {
showAnnotationRuler: true
};
/**
* The current target and the WebGL Editor front, set by this tool's host.
*/
var gToolbox, gTarget, gFront;
/**
* Initializes the shader editor controller and views.
*/
function startupShaderEditor() {
return promise.all([
EventsHandler.initialize(),
ShadersListView.initialize(),
ShadersEditorsView.initialize()
]);
}
/**
* Destroys the shader editor controller and views.
*/
function shutdownShaderEditor() {
return promise.all([
EventsHandler.destroy(),
ShadersListView.destroy(),
ShadersEditorsView.destroy()
]);
}
/**
* Functions handling target-related lifetime events.
*/
class EventsHandler {
var EventsHandler = {
/**
* Listen for events emitted by the current tab target.
*/
initialize(panel, toolbox, target, front, shadersListView) {
this.panel = panel;
this.toolbox = toolbox;
this.target = target;
this.front = front;
this.shadersListView = shadersListView;
initialize: function() {
this._onHostChanged = this._onHostChanged.bind(this);
this._onTabNavigated = this._onTabNavigated.bind(this);
this._onTabWillNavigate = this._onTabWillNavigate.bind(this);
this._onProgramLinked = this._onProgramLinked.bind(this);
this._onProgramsAdded = this._onProgramsAdded.bind(this);
this.toolbox.on("host-changed", this._onHostChanged);
this.target.on("will-navigate", this._onTabWillNavigate);
this.target.on("navigate", this._onTabNavigated);
this.front.on("program-linked", this._onProgramLinked);
gToolbox.on("host-changed", this._onHostChanged);
gTarget.on("will-navigate", this._onTabWillNavigate);
gTarget.on("navigate", this._onTabNavigated);
gFront.on("program-linked", this._onProgramLinked);
this.reloadButton = $("#requests-menu-reload-notice-button");
this._onReloadCommand = this._onReloadCommand.bind(this);
this.reloadButton.addEventListener("command", this._onReloadCommand);
}
},
/**
* Remove events emitted by the current tab target.
*/
destroy() {
this.toolbox.off("host-changed", this._onHostChanged);
this.target.off("will-navigate", this._onTabWillNavigate);
this.target.off("navigate", this._onTabNavigated);
this.front.off("program-linked", this._onProgramLinked);
destroy: function() {
gToolbox.off("host-changed", this._onHostChanged);
gTarget.off("will-navigate", this._onTabWillNavigate);
gTarget.off("navigate", this._onTabNavigated);
gFront.off("program-linked", this._onProgramLinked);
this.reloadButton.removeEventListener("command", this._onReloadCommand);
}
},
/**
* Handles a command event on reload button
*/
_onReloadCommand() {
this.front.setup({ reload: true });
}
gFront.setup({ reload: true });
},
/**
* Handles a host change event on the parent toolbox.
*/
_onHostChanged() {
if (this.toolbox.hostType == "right" || this.toolbox.hostType == "left") {
_onHostChanged: function() {
if (gToolbox.hostType == "right" || gToolbox.hostType == "left") {
$("#shaders-pane").removeAttribute("height");
}
}
},
_onTabWillNavigate({isFrameSwitching}) {
_onTabWillNavigate: function({isFrameSwitching}) {
// Make sure the backend is prepared to handle WebGL contexts.
if (!isFrameSwitching) {
this.front.setup({ reload: false });
gFront.setup({ reload: false });
}
// Reset UI.
this.shadersListView.empty();
ShadersListView.empty();
// When switching to an iframe, ensure displaying the reload button.
// As the document has already been loaded without being hooked.
if (isFrameSwitching) {
@ -123,61 +150,55 @@ class EventsHandler {
}
$("#content").hidden = true;
this.panel.emit(EVENTS.UI_RESET);
}
window.emit(EVENTS.UI_RESET);
},
/**
* Called for each location change in the debugged tab.
*/
_onTabNavigated() {
_onTabNavigated: function() {
// Manually retrieve the list of program actors known to the server,
// because the backend won't emit "program-linked" notifications
// in the case of a bfcache navigation (since no new programs are
// actually linked).
this.front.getPrograms().then(this._onProgramsAdded);
}
gFront.getPrograms().then(this._onProgramsAdded);
},
/**
* Called every time a program was linked in the debugged tab.
*/
_onProgramLinked(programActor) {
_onProgramLinked: function(programActor) {
this._addProgram(programActor);
this.panel.emit(EVENTS.NEW_PROGRAM);
}
window.emit(EVENTS.NEW_PROGRAM);
},
/**
* Callback for the front's getPrograms() method.
*/
_onProgramsAdded(programActors) {
programActors.forEach(this._addProgram.bind(this));
this.panel.emit(EVENTS.PROGRAMS_ADDED);
}
_onProgramsAdded: function(programActors) {
programActors.forEach(this._addProgram);
window.emit(EVENTS.PROGRAMS_ADDED);
},
/**
* Adds a program to the shaders list and unhides any modal notices.
*/
_addProgram(programActor) {
_addProgram: function(programActor) {
$("#waiting-notice").hidden = true;
$("#reload-notice").hidden = true;
$("#content").hidden = false;
this.shadersListView.addProgram(programActor);
ShadersListView.addProgram(programActor);
}
}
exports.EventsHandler = EventsHandler;
};
/**
* Functions handling the sources UI.
*/
function WidgetMethodsClass() {
}
WidgetMethodsClass.prototype = WidgetMethods;
class ShadersListView extends WidgetMethodsClass {
var ShadersListView = extend(WidgetMethods, {
/**
* Initialization function, called when the tool is started.
*/
initialize(toolbox, shadersEditorsView) {
this.toolbox = toolbox;
this.shadersEditorsView = shadersEditorsView;
initialize: function() {
this.widget = new SideMenuWidget(this._pane = $("#shaders-pane"), {
showArrows: true,
showItemCheckboxes: true
@ -192,17 +213,17 @@ class ShadersListView extends WidgetMethodsClass {
this.widget.addEventListener("check", this._onProgramCheck);
this.widget.addEventListener("mouseover", this._onProgramMouseOver, true);
this.widget.addEventListener("mouseout", this._onProgramMouseOut, true);
}
},
/**
* Destruction function, called when the tool is closed.
*/
destroy() {
destroy: function() {
this.widget.removeEventListener("select", this._onProgramSelect);
this.widget.removeEventListener("check", this._onProgramCheck);
this.widget.removeEventListener("mouseover", this._onProgramMouseOver, true);
this.widget.removeEventListener("mouseout", this._onProgramMouseOut, true);
}
},
/**
* Adds a program to this programs container.
@ -210,7 +231,7 @@ class ShadersListView extends WidgetMethodsClass {
* @param object programActor
* The program actor coming from the active thread.
*/
addProgram(programActor) {
addProgram: function(programActor) {
if (this.hasProgram(programActor)) {
return;
}
@ -244,11 +265,11 @@ class ShadersListView extends WidgetMethodsClass {
// Prevent this container from growing indefinitely in height when the
// toolbox is docked to the side.
if ((this.toolbox.hostType == "left" || this.toolbox.hostType == "right") &&
if ((gToolbox.hostType == "left" || gToolbox.hostType == "right") &&
this.itemCount == SHADERS_AUTOGROW_ITEMS) {
this._pane.setAttribute("height", this._pane.getBoundingClientRect().height);
}
}
},
/**
* Returns whether a program was already added to this programs container.
@ -258,14 +279,14 @@ class ShadersListView extends WidgetMethodsClass {
* @param boolean
* True if the program was added, false otherwise.
*/
hasProgram(programActor) {
hasProgram: function(programActor) {
return !!this.attachments.filter(e => e.programActor == programActor).length;
}
},
/**
* The select listener for the programs container.
*/
_onProgramSelect({ detail: sourceItem }) {
_onProgramSelect: function({ detail: sourceItem }) {
if (!sourceItem) {
return;
}
@ -284,33 +305,33 @@ class ShadersListView extends WidgetMethodsClass {
fragmentShaderActor.getText()
]);
}
const showSources = ([vertexShaderText, fragmentShaderText]) => {
return this.shadersEditorsView.setText({
function showSources([vertexShaderText, fragmentShaderText]) {
return ShadersEditorsView.setText({
vs: vertexShaderText,
fs: fragmentShaderText
});
};
}
getShaders()
.then(getSources)
.then(showSources)
.catch(console.error);
}
},
/**
* The check listener for the programs container.
*/
_onProgramCheck({ detail: { checked }, target }) {
_onProgramCheck: function({ detail: { checked }, target }) {
const sourceItem = this.getItemForElement(target);
const attachment = sourceItem.attachment;
attachment.isBlackBoxed = !checked;
attachment.programActor[checked ? "unblackbox" : "blackbox"]();
}
},
/**
* The mouseover listener for the programs container.
*/
_onProgramMouseOver(e) {
_onProgramMouseOver: function(e) {
const sourceItem = this.getItemForElement(e.target, { noSiblings: true });
if (sourceItem && !sourceItem.attachment.isBlackBoxed) {
sourceItem.attachment.programActor.highlight(HIGHLIGHT_TINT);
@ -320,12 +341,12 @@ class ShadersListView extends WidgetMethodsClass {
e.stopPropagation();
}
}
}
},
/**
* The mouseout listener for the programs container.
*/
_onProgramMouseOut(e) {
_onProgramMouseOut: function(e) {
const sourceItem = this.getItemForElement(e.target, { noSiblings: true });
if (sourceItem && !sourceItem.attachment.isBlackBoxed) {
sourceItem.attachment.programActor.unhighlight();
@ -336,42 +357,34 @@ class ShadersListView extends WidgetMethodsClass {
}
}
}
}
exports.ShadersListView = ShadersListView;
});
/**
* Functions handling the editors displaying the vertex and fragment shaders.
*/
class ShadersEditorsView {
var ShadersEditorsView = {
/**
* Initialization function, called when the tool is started.
*/
initialize(panel, shadersListView) {
this.panel = panel;
this.shadersListView = shadersListView;
initialize: function() {
XPCOMUtils.defineLazyGetter(this, "_editorPromises", () => new Map());
this._vsFocused = this._onFocused.bind(this, "vs", "fs");
this._fsFocused = this._onFocused.bind(this, "fs", "vs");
this._vsChanged = this._onChanged.bind(this, "vs");
this._fsChanged = this._onChanged.bind(this, "fs");
this._errors = {
vs: [],
fs: []
};
}
},
/**
* Destruction function, called when the tool is closed.
*/
async destroy() {
destroy: Task.async(function* () {
this._destroyed = true;
await this._toggleListeners("off");
yield this._toggleListeners("off");
for (const p of this._editorPromises.values()) {
const editor = await p;
const editor = yield p;
editor.destroy();
}
}
}),
/**
* Sets the text displayed in the vertex and fragment shader editors.
@ -383,7 +396,7 @@ class ShadersEditorsView {
* @return object
* A promise resolving upon completion of text setting.
*/
setText(sources) {
setText: function(sources) {
const view = this;
function setTextAndClearHistory(editor, text) {
editor.setText(text);
@ -397,8 +410,8 @@ class ShadersEditorsView {
view._getEditor("fs").then(e => setTextAndClearHistory(e, sources.fs))
]);
await view._toggleListeners("on");
})().then(() => this.panel.emit(EVENTS.SOURCES_SHOWN, sources));
}
})().then(() => window.emit(EVENTS.SOURCES_SHOWN, sources));
},
/**
* Lazily initializes and returns a promise for an Editor instance.
@ -409,7 +422,7 @@ class ShadersEditorsView {
* @return object
* Returns a promise that resolves to an editor instance
*/
_getEditor(type) {
_getEditor: function(type) {
if (this._editorPromises.has(type)) {
return this._editorPromises.get(type);
}
@ -430,7 +443,7 @@ class ShadersEditorsView {
}
return deferred.promise;
}
},
/**
* Toggles all the event listeners for the editors either on or off.
@ -440,14 +453,14 @@ class ShadersEditorsView {
* @return object
* A promise resolving upon completion of toggling the listeners.
*/
_toggleListeners(flag) {
_toggleListeners: function(flag) {
return promise.all(["vs", "fs"].map(type => {
return this._getEditor(type).then(editor => {
editor[flag]("focus", this["_" + type + "Focused"]);
editor[flag]("change", this["_" + type + "Changed"]);
});
}));
}
},
/**
* The focus listener for a source editor.
@ -457,10 +470,10 @@ class ShadersEditorsView {
* @param string focused
* The corresponding shader type for the other editor (e.g. "fs").
*/
_onFocused(focused, unfocused) {
_onFocused: function(focused, unfocused) {
$("#" + focused + "-editor-label").setAttribute("selected", "");
$("#" + unfocused + "-editor-label").removeAttribute("selected");
}
},
/**
* The change listener for a source editor.
@ -468,12 +481,12 @@ class ShadersEditorsView {
* @param string type
* The corresponding shader type for the focused editor (e.g. "vs").
*/
_onChanged(type) {
_onChanged: function(type) {
setNamedTimeout("gl-typed", TYPING_MAX_DELAY, () => this._doCompile(type));
// Remove all the gutter markers and line classes from the editor.
this._cleanEditor(type);
}
},
/**
* Recompiles the source code for the shader being edited.
@ -482,10 +495,10 @@ class ShadersEditorsView {
* @param string type
* The corresponding shader type for the focused editor (e.g. "vs").
*/
_doCompile(type) {
_doCompile: function(type) {
(async function() {
const editor = await this._getEditor(type);
const shaderActor = await this.shadersListView.selectedAttachment[type];
const shaderActor = await ShadersListView.selectedAttachment[type];
try {
await shaderActor.compile(editor.getText());
@ -494,20 +507,20 @@ class ShadersEditorsView {
this._onFailedCompilation(type, editor, e);
}
}.bind(this))();
}
},
/**
* Called uppon a successful shader compilation.
*/
_onSuccessfulCompilation() {
_onSuccessfulCompilation: function() {
// Signal that the shader was compiled successfully.
this.panel.emit(EVENTS.SHADER_COMPILED, null);
}
window.emit(EVENTS.SHADER_COMPILED, null);
},
/**
* Called uppon an unsuccessful shader compilation.
*/
_onFailedCompilation(type, editor, errors) {
_onFailedCompilation: function(type, editor, errors) {
const lineCount = editor.lineCount();
const currentLine = editor.getCursor().line;
const listeners = { mouseover: this._onMarkerMouseOver };
@ -568,13 +581,13 @@ class ShadersEditorsView {
.forEach(displayErrors);
// Signal that the shader wasn't compiled successfully.
this.panel.emit(EVENTS.SHADER_COMPILED, errors);
}
window.emit(EVENTS.SHADER_COMPILED, errors);
},
/**
* Event listener for the 'mouseover' event on a marker in the editor gutter.
*/
_onMarkerMouseOver(line, node, messages) {
_onMarkerMouseOver: function(line, node, messages) {
if (node._markerErrorsTooltip) {
return;
}
@ -585,30 +598,37 @@ class ShadersEditorsView {
tooltip.startTogglingOnHover(node, () => true, {
toggleDelay: GUTTER_ERROR_PANEL_DELAY
});
}
},
/**
* Removes all the gutter markers and line classes from the editor.
*/
_cleanEditor(type) {
_cleanEditor: function(type) {
this._getEditor(type).then(editor => {
editor.removeAllMarkers("errors");
this._errors[type].forEach(e => editor.removeLineClass(e.line));
this._errors[type].length = 0;
this.panel.emit(EVENTS.EDITOR_ERROR_MARKERS_REMOVED);
window.emit(EVENTS.EDITOR_ERROR_MARKERS_REMOVED);
});
},
_errors: {
vs: [],
fs: []
}
}
exports.ShadersEditorsView = ShadersEditorsView;
};
/**
* Localization convenience methods.
*/
var L10N = new LocalizationHelper(STRINGS_URI);
exports.L10N = L10N;
/**
* Convenient way of emitting events from the panel window.
*/
EventEmitter.decorate(this);
/**
* DOM query helper.
*/
var $ = (selector, target = document) => target.querySelector(selector);
exports.$ = $;

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

@ -16,6 +16,8 @@
<script type="application/javascript"
src="chrome://devtools/content/shared/theme-switching.js"/>
<script type="application/javascript" src="shadereditor.js"/>
<vbox class="theme-body" flex="1">
<hbox id="reload-notice"
class="notice-container"

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

@ -6,26 +6,26 @@
*/
async function ifWebGLSupported() {
const { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL);
const { front, $, EVENTS, ShadersListView, ShadersEditorsView } = panel;
const { gFront, $, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin;
// Attach frame scripts if in e10s to perform
// history navigation via the content
loadFrameScripts();
const reloaded = reload(target);
const firstProgram = await once(front, "program-linked");
const firstProgram = await once(gFront, "program-linked");
await reloaded;
const navigated = navigate(target, MULTIPLE_CONTEXTS_URL);
const [secondProgram, thirdProgram] = await getPrograms(front, 2);
const [secondProgram, thirdProgram] = await getPrograms(gFront, 2);
await navigated;
const vsEditor = await ShadersEditorsView._getEditor("vs");
const fsEditor = await ShadersEditorsView._getEditor("fs");
await navigateInHistory(target, "back", "will-navigate");
await once(panel, EVENTS.PROGRAMS_ADDED);
await once(panel, EVENTS.SOURCES_SHOWN);
await once(panel.panelWin, EVENTS.PROGRAMS_ADDED);
await once(panel.panelWin, EVENTS.SOURCES_SHOWN);
is($("#content").hidden, false,
"The tool's content should not be hidden.");
@ -40,8 +40,8 @@ async function ifWebGLSupported() {
"The fragment shader editor contains the correct text.");
await navigateInHistory(target, "forward", "will-navigate");
await once(panel, EVENTS.PROGRAMS_ADDED);
await once(panel, EVENTS.SOURCES_SHOWN);
await once(panel.panelWin, EVENTS.PROGRAMS_ADDED);
await once(panel.panelWin, EVENTS.SOURCES_SHOWN);
is($("#content").hidden, false,
"The tool's content should not be hidden.");

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

@ -8,12 +8,12 @@
async function ifWebGLSupported() {
const { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL);
const { front, ShadersEditorsView, EVENTS } = panel;
const { gFront, ShadersEditorsView, EVENTS } = panel.panelWin;
reload(target);
await promise.all([
once(front, "program-linked"),
once(panel, EVENTS.SOURCES_SHOWN)
once(gFront, "program-linked"),
once(panel.panelWin, EVENTS.SOURCES_SHOWN)
]);
const vsEditor = await ShadersEditorsView._getEditor("vs");

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

@ -8,64 +8,64 @@
async function ifWebGLSupported() {
const { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL);
const { front, EVENTS, ShadersEditorsView } = panel;
const { gFront, EVENTS, ShadersEditorsView } = panel.panelWin;
reload(target);
await promise.all([
once(front, "program-linked"),
once(panel, EVENTS.SOURCES_SHOWN)
once(gFront, "program-linked"),
once(panel.panelWin, EVENTS.SOURCES_SHOWN)
]);
const vsEditor = await ShadersEditorsView._getEditor("vs");
const fsEditor = await ShadersEditorsView._getEditor("fs");
vsEditor.replaceText("vec3", { line: 7, ch: 22 }, { line: 7, ch: 26 });
let vertError = await panel.once(EVENTS.SHADER_COMPILED);
let vertError = await panel.panelWin.once(EVENTS.SHADER_COMPILED);
checkHasVertFirstError(true, vertError);
checkHasVertSecondError(false, vertError);
info("Error marks added in the vertex shader editor.");
vsEditor.insertText(" ", { line: 1, ch: 0 });
await panel.once(EVENTS.EDITOR_ERROR_MARKERS_REMOVED);
await panel.panelWin.once(EVENTS.EDITOR_ERROR_MARKERS_REMOVED);
is(vsEditor.getText(1), " precision lowp float;", "Typed space.");
checkHasVertFirstError(false, vertError);
checkHasVertSecondError(false, vertError);
info("Error marks removed while typing in the vertex shader editor.");
vertError = await panel.once(EVENTS.SHADER_COMPILED);
vertError = await panel.panelWin.once(EVENTS.SHADER_COMPILED);
checkHasVertFirstError(true, vertError);
checkHasVertSecondError(false, vertError);
info("Error marks were re-added after recompiling the vertex shader.");
fsEditor.replaceText("vec4", { line: 2, ch: 14 }, { line: 2, ch: 18 });
let fragError = await panel.once(EVENTS.SHADER_COMPILED);
let fragError = await panel.panelWin.once(EVENTS.SHADER_COMPILED);
checkHasVertFirstError(true, vertError);
checkHasVertSecondError(false, vertError);
checkHasFragError(true, fragError);
info("Error marks added in the fragment shader editor.");
fsEditor.insertText(" ", { line: 1, ch: 0 });
await panel.once(EVENTS.EDITOR_ERROR_MARKERS_REMOVED);
await panel.panelWin.once(EVENTS.EDITOR_ERROR_MARKERS_REMOVED);
is(fsEditor.getText(1), " precision lowp float;", "Typed space.");
checkHasVertFirstError(true, vertError);
checkHasVertSecondError(false, vertError);
checkHasFragError(false, fragError);
info("Error marks removed while typing in the fragment shader editor.");
fragError = await panel.once(EVENTS.SHADER_COMPILED);
fragError = await panel.panelWin.once(EVENTS.SHADER_COMPILED);
checkHasVertFirstError(true, vertError);
checkHasVertSecondError(false, vertError);
checkHasFragError(true, fragError);
info("Error marks were re-added after recompiling the fragment shader.");
vsEditor.replaceText("2", { line: 3, ch: 19 }, { line: 3, ch: 20 });
await panel.once(EVENTS.EDITOR_ERROR_MARKERS_REMOVED);
await panel.panelWin.once(EVENTS.EDITOR_ERROR_MARKERS_REMOVED);
checkHasVertFirstError(false, vertError);
checkHasVertSecondError(false, vertError);
checkHasFragError(true, fragError);
info("Error marks removed while typing in the vertex shader editor again.");
vertError = await panel.once(EVENTS.SHADER_COMPILED);
vertError = await panel.panelWin.once(EVENTS.SHADER_COMPILED);
checkHasVertFirstError(true, vertError);
checkHasVertSecondError(true, vertError);
checkHasFragError(true, fragError);

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

@ -8,19 +8,19 @@
async function ifWebGLSupported() {
const { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL);
const { front, EVENTS, ShadersEditorsView } = panel;
const { gFront, EVENTS, ShadersEditorsView } = panel.panelWin;
reload(target);
await promise.all([
once(front, "program-linked"),
once(panel, EVENTS.SOURCES_SHOWN)
once(gFront, "program-linked"),
once(panel.panelWin, EVENTS.SOURCES_SHOWN)
]);
const vsEditor = await ShadersEditorsView._getEditor("vs");
const fsEditor = await ShadersEditorsView._getEditor("fs");
vsEditor.replaceText("vec3", { line: 7, ch: 22 }, { line: 7, ch: 26 });
await once(panel, EVENTS.SHADER_COMPILED);
await once(panel.panelWin, EVENTS.SHADER_COMPILED);
// Synthesizing 'mouseover' events doesn't work, hack around this by
// manually calling the event listener with the expected arguments.

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

@ -7,10 +7,10 @@
async function ifWebGLSupported() {
const { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL);
const { front, ShadersEditorsView } = panel;
const { gFront, ShadersEditorsView } = panel.panelWin;
reload(target);
await once(front, "program-linked");
await once(gFront, "program-linked");
const vsEditor = await ShadersEditorsView._getEditor("vs");
const fsEditor = await ShadersEditorsView._getEditor("fs");

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

@ -7,7 +7,7 @@
async function ifWebGLSupported() {
const { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL);
const { front, $ } = panel;
const { gFront, $ } = panel.panelWin;
is($("#reload-notice").hidden, false,
"The 'reload this page' notice should initially be visible.");
@ -17,7 +17,7 @@ async function ifWebGLSupported() {
"The tool's content should initially be hidden.");
const navigating = once(target, "will-navigate");
const linked = once(front, "program-linked");
const linked = once(gFront, "program-linked");
reload(target);
await navigating;

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

@ -7,12 +7,12 @@
async function ifWebGLSupported() {
const { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL);
const { front, $, EVENTS, ShadersListView, ShadersEditorsView } = panel;
const { gFront, $, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin;
reload(target);
await promise.all([
once(front, "program-linked"),
once(panel, EVENTS.SOURCES_SHOWN)
once(gFront, "program-linked"),
once(panel.panelWin, EVENTS.SOURCES_SHOWN)
]);
is($("#reload-notice").hidden, true,
@ -41,7 +41,7 @@ async function ifWebGLSupported() {
const navigated = once(target, "will-navigate");
navigate(target, "about:blank");
await promise.all([navigating, once(panel, EVENTS.UI_RESET) ]);
await promise.all([navigating, once(panel.panelWin, EVENTS.UI_RESET) ]);
is($("#reload-notice").hidden, true,
"The 'reload this page' notice should be hidden while navigating.");

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

@ -7,16 +7,16 @@
async function ifWebGLSupported() {
const { target, debuggee, panel } = await initShaderEditor(MULTIPLE_CONTEXTS_URL);
const { front, EVENTS, ShadersListView, ShadersEditorsView } = panel;
const { gFront, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin;
once(panel, EVENTS.SHADER_COMPILED).then(() => {
once(panel.panelWin, EVENTS.SHADER_COMPILED).then(() => {
ok(false, "No shaders should be publicly compiled during this test.");
});
reload(target);
const [[firstProgramActor, secondProgramActor]] = await promise.all([
getPrograms(front, 2),
once(panel, EVENTS.SOURCES_SHOWN)
getPrograms(gFront, 2),
once(panel.panelWin, EVENTS.SOURCES_SHOWN)
]);
const vsEditor = await ShadersEditorsView._getEditor("vs");
@ -28,14 +28,14 @@ async function ifWebGLSupported() {
fsEditor.once("change", () => {
ok(false, "The fragment shader source was unexpectedly changed.");
});
once(panel, EVENTS.SOURCES_SHOWN).then(() => {
once(panel.panelWin, EVENTS.SOURCES_SHOWN).then(() => {
ok(false, "No sources should be changed form this point onward.");
});
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(!ShadersListView.selectedAttachment.isBlackBoxed,
"The first program should not be blackboxed yet.");
@ -57,10 +57,10 @@ async function ifWebGLSupported() {
is(getBlackBoxCheckbox(panel, 1).checked, true,
"The second blackbox checkbox should still be checked.");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The first program was correctly blackboxed.");
getBlackBoxCheckbox(panel, 1).click();
@ -74,35 +74,35 @@ async function ifWebGLSupported() {
is(getBlackBoxCheckbox(panel, 1).checked, false,
"The second blackbox checkbox should now be unchecked.");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
ok(true, "The second program was correctly blackboxed.");
ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 0) });
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
ok(true, "Highlighting shouldn't work while blackboxed (1).");
ShadersListView._onProgramMouseOut({ target: getItemLabel(panel, 0) });
ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 1) });
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
ok(true, "Highlighting shouldn't work while blackboxed (2).");
ShadersListView._onProgramMouseOut({ target: getItemLabel(panel, 1) });
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
ok(true, "Highlighting shouldn't work while blackboxed (3).");
getBlackBoxCheckbox(panel, 0).click();
@ -117,35 +117,35 @@ async function ifWebGLSupported() {
is(getBlackBoxCheckbox(panel, 1).checked, true,
"The second blackbox checkbox should now be rechecked.");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The two programs were correctly unblackboxed.");
ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 0) });
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The first program was correctly highlighted.");
ShadersListView._onProgramMouseOut({ target: getItemLabel(panel, 0) });
ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 1) });
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2");
ok(true, "The second program was correctly highlighted.");
ShadersListView._onProgramMouseOut({ target: getItemLabel(panel, 1) });
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The two programs were correctly unhighlighted.");
await teardown(panel);

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

@ -8,49 +8,49 @@
async function ifWebGLSupported() {
const { target, debuggee, panel } = await initShaderEditor(BLENDED_GEOMETRY_CANVAS_URL);
const { front, EVENTS, ShadersListView, ShadersEditorsView } = panel;
const { gFront, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin;
reload(target);
const [[firstProgramActor, secondProgramActor]] = await promise.all([
getPrograms(front, 2),
once(panel, EVENTS.SOURCES_SHOWN)
getPrograms(gFront, 2),
once(panel.panelWin, EVENTS.SOURCES_SHOWN)
]);
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
await ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
ok(true, "The canvas was correctly drawn.");
getBlackBoxCheckbox(panel, 0).click();
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 0, b: 0, a: 127 }, true);
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 0, b: 0, a: 127 }, true);
ok(true, "The first program was correctly blackboxed.");
getBlackBoxCheckbox(panel, 0).click();
getBlackBoxCheckbox(panel, 1).click();
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
await ensurePixelIs(front, { x: 64, y: 64 }, { r: 127, g: 127, b: 127, a: 255 }, true);
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 127, g: 127, b: 127, a: 255 }, true);
ok(true, "The second program was correctly blackboxed.");
getBlackBoxCheckbox(panel, 1).click();
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
await ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
ok(true, "The two programs were correctly unblackboxed.");
getBlackBoxCheckbox(panel, 0).click();
getBlackBoxCheckbox(panel, 1).click();
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 0, b: 0, a: 255 }, true);
ok(true, "The two programs were correctly blackboxed again.");
getBlackBoxCheckbox(panel, 0).click();
getBlackBoxCheckbox(panel, 1).click();
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
await ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
ok(true, "The two programs were correctly unblackboxed again.");
await teardown(panel);

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

@ -7,12 +7,12 @@
async function ifWebGLSupported() {
const { target, debuggee, panel } = await initShaderEditor(MULTIPLE_CONTEXTS_URL);
const { EVENTS, front, ShadersListView, ShadersEditorsView } = panel;
const { EVENTS, gFront, ShadersListView, ShadersEditorsView } = panel.panelWin;
reload(target);
const [[programActor]] = await promise.all([
getPrograms(front, 1),
once(panel, EVENTS.SOURCES_SHOWN)
getPrograms(gFront, 1),
once(panel.panelWin, EVENTS.SOURCES_SHOWN)
]);
const programItem = ShadersListView.selectedItem;

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

@ -7,16 +7,16 @@
async function ifWebGLSupported() {
const { target, panel } = await initShaderEditor(MULTIPLE_CONTEXTS_URL);
const { front, EVENTS, ShadersListView, ShadersEditorsView } = panel;
const { gFront, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin;
once(panel, EVENTS.SHADER_COMPILED).then(() => {
once(panel.panelWin, EVENTS.SHADER_COMPILED).then(() => {
ok(false, "No shaders should be publicly compiled during this test.");
});
reload(target);
const [[firstProgramActor, secondProgramActor]] = await promise.all([
getPrograms(front, 2),
once(panel, EVENTS.SOURCES_SHOWN)
getPrograms(gFront, 2),
once(panel.panelWin, EVENTS.SOURCES_SHOWN)
]);
const vsEditor = await ShadersEditorsView._getEditor("vs");
@ -28,54 +28,54 @@ async function ifWebGLSupported() {
fsEditor.once("change", () => {
ok(false, "The fragment shader source was unexpectedly changed.");
});
once(panel, EVENTS.SOURCES_SHOWN).then(() => {
once(panel.panelWin, EVENTS.SOURCES_SHOWN).then(() => {
ok(false, "No sources should be changed form this point onward.");
});
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 0) });
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The first program was correctly highlighted.");
ShadersListView._onProgramMouseOut({ target: getItemLabel(panel, 0) });
ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 1) });
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2");
ok(true, "The second program was correctly highlighted.");
ShadersListView._onProgramMouseOut({ target: getItemLabel(panel, 1) });
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The two programs were correctly unhighlighted.");
ShadersListView._onProgramMouseOver({ target: getBlackBoxCheckbox(panel, 0) });
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The two programs were left unchanged after hovering a blackbox checkbox.");
ShadersListView._onProgramMouseOut({ target: getBlackBoxCheckbox(panel, 0) });
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The two programs were left unchanged after unhovering a blackbox checkbox.");
await teardown(panel);

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

@ -8,35 +8,35 @@
async function ifWebGLSupported() {
const { target, debuggee, panel } = await initShaderEditor(BLENDED_GEOMETRY_CANVAS_URL);
const { front, EVENTS, ShadersListView, ShadersEditorsView } = panel;
const { gFront, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin;
reload(target);
const [[firstProgramActor, secondProgramActor]] = await promise.all([
getPrograms(front, 2),
once(panel, EVENTS.SOURCES_SHOWN)
getPrograms(gFront, 2),
once(panel.panelWin, EVENTS.SOURCES_SHOWN)
]);
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
await ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
ok(true, "The canvas was correctly drawn.");
ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 0) });
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 127, g: 0, b: 32, a: 255 }, true);
await ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 0, b: 32, a: 127 }, true);
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 0, b: 32, a: 255 }, true);
await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 0, b: 32, a: 127 }, true);
ok(true, "The first program was correctly highlighted.");
ShadersListView._onProgramMouseOut({ target: getItemLabel(panel, 0) });
ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 1) });
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
await ensurePixelIs(front, { x: 64, y: 64 }, { r: 255, g: 0, b: 64, a: 255 }, true);
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 255, g: 0, b: 64, a: 255 }, true);
ok(true, "The second program was correctly highlighted.");
ShadersListView._onProgramMouseOut({ target: getItemLabel(panel, 1) });
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
await ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
ok(true, "The two programs were correctly unhighlighted.");
await teardown(panel);

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

@ -8,7 +8,7 @@
async function ifWebGLSupported() {
const { target, panel } = await initShaderEditor(MULTIPLE_CONTEXTS_URL);
const { front, EVENTS, L10N, ShadersListView, ShadersEditorsView } = panel;
const { gFront, EVENTS, L10N, ShadersListView, ShadersEditorsView } = panel.panelWin;
is(ShadersListView.itemCount, 0,
"The shaders list should initially be empty.");
@ -20,7 +20,7 @@ async function ifWebGLSupported() {
reload(target);
const [firstProgramActor, secondProgramActor] = await promise.all([
getPrograms(front, 2, (actors) => {
getPrograms(gFront, 2, (actors) => {
// Fired upon each actor addition, we want to check only
// after the first actor has been added so we can test state
if (actors.length === 1) {
@ -30,7 +30,7 @@ async function ifWebGLSupported() {
checkSecondProgram();
}
}),
once(panel, EVENTS.SOURCES_SHOWN)
once(panel.panelWin, EVENTS.SOURCES_SHOWN)
]).then(([programs, ]) => programs);
is(ShadersListView.attachments[0].label, L10N.getFormatStr("shadersList.programLabel", 0),
@ -51,11 +51,11 @@ async function ifWebGLSupported() {
is(fragSource, fsEditor.getText(),
"The vertex shader editor contains the correct text.");
const compiled = once(panel, EVENTS.SHADER_COMPILED).then(() => {
const compiled = once(panel.panelWin, EVENTS.SHADER_COMPILED).then(() => {
ok(false, "Selecting a different program shouldn't recompile its shaders.");
});
const shown = once(panel, EVENTS.SOURCES_SHOWN).then(() => {
const shown = once(panel.panelWin, EVENTS.SOURCES_SHOWN).then(() => {
ok(true, "The vertex and fragment sources have changed in the editors.");
});

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

@ -7,12 +7,12 @@
async function ifWebGLSupported() {
const { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL);
const { front, $, EVENTS, ShadersEditorsView } = panel;
const { gFront, $, EVENTS, ShadersEditorsView } = panel.panelWin;
reload(target);
await promise.all([
once(front, "program-linked"),
once(panel, EVENTS.SOURCES_SHOWN)
once(gFront, "program-linked"),
once(panel.panelWin, EVENTS.SOURCES_SHOWN)
]);
const vsEditor = await ShadersEditorsView._getEditor("vs");
@ -28,9 +28,9 @@ async function ifWebGLSupported() {
is($("#fs-editor-label").hasAttribute("selected"), false,
"The vertex shader editor shouldn't be initially selected.");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(front, { x: 128, y: 128 }, { r: 191, g: 64, b: 0, a: 255 }, true);
await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(gFront, { x: 128, y: 128 }, { r: 191, g: 64, b: 0, a: 255 }, true);
await ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
vsEditor.focus();
@ -40,13 +40,13 @@ async function ifWebGLSupported() {
"The vertex shader editor shouldn't still not be selected.");
vsEditor.replaceText("2.0", { line: 7, ch: 44 }, { line: 7, ch: 47 });
await once(panel, EVENTS.SHADER_COMPILED);
await once(panel.panelWin, EVENTS.SHADER_COMPILED);
ok(true, "Vertex shader was changed.");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(front, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(gFront, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true);
ok(true, "The vertex shader was recompiled successfully.");
@ -58,13 +58,13 @@ async function ifWebGLSupported() {
"The vertex shader editor should now be selected.");
fsEditor.replaceText("0.5", { line: 5, ch: 44 }, { line: 5, ch: 47 });
await once(panel, EVENTS.SHADER_COMPILED);
await once(panel.panelWin, EVENTS.SHADER_COMPILED);
ok(true, "Fragment shader was changed.");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(front, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 127 }, true);
await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(gFront, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 127 }, true);
await ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true);
ok(true, "The fragment shader was recompiled successfully.");

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

@ -8,19 +8,19 @@
async function ifWebGLSupported() {
const { target, panel } = await initShaderEditor(SIMPLE_CANVAS_URL);
const { front, EVENTS, ShadersEditorsView } = panel;
const { gFront, EVENTS, ShadersEditorsView } = panel.panelWin;
reload(target);
await promise.all([
once(front, "program-linked"),
once(panel, EVENTS.SOURCES_SHOWN)
once(gFront, "program-linked"),
once(panel.panelWin, EVENTS.SOURCES_SHOWN)
]);
const vsEditor = await ShadersEditorsView._getEditor("vs");
const fsEditor = await ShadersEditorsView._getEditor("fs");
vsEditor.replaceText("vec3", { line: 7, ch: 22 }, { line: 7, ch: 26 });
let error = await panel.once(EVENTS.SHADER_COMPILED);
let error = await panel.panelWin.once(EVENTS.SHADER_COMPILED);
ok(error,
"The new vertex shader source was compiled with errors.");
@ -40,7 +40,7 @@ async function ifWebGLSupported() {
"An assignment error is contained in the info log.");
fsEditor.replaceText("vec4", { line: 2, ch: 14 }, { line: 2, ch: 18 });
error = await panel.once(EVENTS.SHADER_COMPILED);
error = await panel.panelWin.once(EVENTS.SHADER_COMPILED);
ok(error,
"The new fragment shader source was compiled with errors.");
@ -54,19 +54,19 @@ async function ifWebGLSupported() {
ok(infoLog.includes("ERROR: 0:6: 'constructor'"),
"A constructor error is contained in the info log.");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
vsEditor.replaceText("vec4", { line: 7, ch: 22 }, { line: 7, ch: 26 });
error = await panel.once(EVENTS.SHADER_COMPILED);
error = await panel.panelWin.once(EVENTS.SHADER_COMPILED);
ok(!error, "The new vertex shader source was compiled successfully.");
fsEditor.replaceText("vec3", { line: 2, ch: 14 }, { line: 2, ch: 18 });
error = await panel.once(EVENTS.SHADER_COMPILED);
error = await panel.panelWin.once(EVENTS.SHADER_COMPILED);
ok(!error, "The new fragment shader source was compiled successfully.");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
await ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
await teardown(panel);
finish();

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

@ -8,16 +8,16 @@
async function ifWebGLSupported() {
const { target, panel } = await initShaderEditor(MULTIPLE_CONTEXTS_URL);
const { front, EVENTS, ShadersListView, ShadersEditorsView } = panel;
const { gFront, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin;
reload(target);
await promise.all([
once(front, "program-linked"),
once(front, "program-linked")
once(gFront, "program-linked"),
once(gFront, "program-linked")
]);
await once(panel, EVENTS.SOURCES_SHOWN);
await once(panel.panelWin, EVENTS.SOURCES_SHOWN);
const vsEditor = await ShadersEditorsView._getEditor("vs");
const fsEditor = await ShadersEditorsView._getEditor("fs");
@ -34,26 +34,26 @@ async function ifWebGLSupported() {
"The fragment shader editor contains the correct initial text (2).");
vsEditor.replaceText("2.", { line: 5, ch: 44 }, { line: 5, ch: 45 });
await once(panel, EVENTS.SHADER_COMPILED);
await once(panel.panelWin, EVENTS.SHADER_COMPILED);
fsEditor.replaceText(".0", { line: 5, ch: 35 }, { line: 5, ch: 37 });
await once(panel, EVENTS.SHADER_COMPILED);
await once(panel.panelWin, EVENTS.SHADER_COMPILED);
ok(true, "Vertex and fragment shaders were changed.");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 32, y: 32 }, { r: 255, g: 255, b: 0, a: 0 }, true, "#canvas1");
await ensurePixelIs(front, { x: 64, y: 64 }, { r: 255, g: 255, b: 0, a: 0 }, true, "#canvas1");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 32, y: 32 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 32, y: 32 }, { r: 255, g: 255, b: 0, a: 0 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 255, g: 255, b: 0, a: 0 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
await ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 32, y: 32 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
await ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The vertex and fragment shaders were recompiled successfully.");
EventUtils.sendMouseEvent({ type: "mousedown" }, ShadersListView.items[1].target);
await once(panel, EVENTS.SOURCES_SHOWN);
await once(panel.panelWin, EVENTS.SOURCES_SHOWN);
is(ShadersListView.selectedIndex, 1,
"The second program is currently selected.");
@ -67,7 +67,7 @@ async function ifWebGLSupported() {
"The fragment shader editor contains the correct text (2).");
EventUtils.sendMouseEvent({ type: "mousedown" }, ShadersListView.items[0].target);
await once(panel, EVENTS.SOURCES_SHOWN);
await once(panel.panelWin, EVENTS.SOURCES_SHOWN);
is(ShadersListView.selectedIndex, 0,
"The first program is currently selected again.");