merge fx-team to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2014-07-30 13:50:05 +02:00
commit e945476d43
111 changed files with 2141 additions and 839 deletions

View File

@ -12,7 +12,7 @@ const { make: makeWindow, getHiddenWindow } = require("../window/utils");
const { create: makeFrame, getDocShell } = require("../frame/utils");
const { defer } = require("../core/promise");
const { when: unload } = require("../system/unload");
const cfxArgs = require("@test/options");
const cfxArgs = require("../test/options");
let addonPrincipal = Cc["@mozilla.org/systemprincipal;1"].
createInstance(Ci.nsIPrincipal);

View File

@ -304,7 +304,7 @@ function currentFlavors() {
// confirmation for specific flavors any other way. This is supposed to be
// an inexpensive call, so performance shouldn't be impacted (much).
var currentFlavors = [];
for each (var flavor in kAllowableFlavors) {
for (var flavor of kAllowableFlavors) {
var matches = clipboardService.hasDataMatchingFlavors(
[flavor],
1,
@ -321,7 +321,7 @@ Object.defineProperty(exports, "currentFlavors", { get : currentFlavors });
// SUPPORT FUNCTIONS ////////////////////////////////////////////////////////
function toJetpackFlavor(aFlavor) {
for each (let flavorMap in kFlavorMap)
for (let flavorMap of kFlavorMap)
if (flavorMap.long == aFlavor)
return flavorMap.short;
// Return null in the case where we don't match
@ -330,7 +330,7 @@ function toJetpackFlavor(aFlavor) {
function fromJetpackFlavor(aJetpackFlavor) {
// TODO: Handle proper flavors better
for each (let flavorMap in kFlavorMap)
for (let flavorMap of kFlavorMap)
if (flavorMap.short == aJetpackFlavor || flavorMap.long == aJetpackFlavor)
return flavorMap.long;
// Return null in the case where we don't match.

View File

@ -41,7 +41,7 @@ Object.freeze({
return [];
let args = Array.slice(arguments, 1);
let results = [];
for each (let callback in listeners[name]) {
for (let callback of listeners[name]) {
results.push(callback.apply(null, args));
}
return results;

View File

@ -138,14 +138,14 @@ attach.define(Worker, function (worker, window) {
model.windowID = getInnerId(model.window);
events.on("inner-window-destroyed", model.documentUnload);
// will set model.contentWorker pointing to the private API:
model.contentWorker = WorkerSandbox(worker, model.window);
// Listen to pagehide event in order to freeze the content script
// while the document is frozen in bfcache:
model.window.addEventListener("pageshow", model.pageShow, true);
model.window.addEventListener("pagehide", model.pageHide, true);
// will set model.contentWorker pointing to the private API:
model.contentWorker = WorkerSandbox(worker, model.window);
// Mainly enable worker.port.emit to send event to the content worker
model.inited = true;
model.frozen = false;

View File

@ -148,7 +148,7 @@ const eventEmitter = {
if (!listeners.length)
return false;
let params = Array.slice(arguments, 2);
for each (let listener in listeners) {
for (let listener of listeners) {
try {
listener.apply(targetObj, params);
} catch(e) {

View File

@ -373,7 +373,7 @@ const WorkerSandbox = EventEmitter.compose({
*/
_importScripts: function _importScripts(url) {
let urls = Array.slice(arguments, 0);
for each (let contentScriptFile in urls) {
for (let contentScriptFile of urls) {
try {
let uri = URL(contentScriptFile);
if (uri.scheme === 'resource')

View File

@ -32,7 +32,7 @@ const defineProperties = Object.defineProperties,
function _create(proto, trait) {
let properties = {},
keys = Object.getOwnPropertyNames(trait);
for each(let key in keys) {
for (let key of keys) {
let descriptor = trait[key];
if (descriptor.required &&
!Object.prototype.hasOwnProperty.call(proto, key))
@ -73,7 +73,7 @@ function TraitDescriptor(object)
function Public(instance, trait) {
let result = {},
keys = Object.getOwnPropertyNames(trait);
for each (let key in keys) {
for (let key of keys) {
if ('_' === key.charAt(0) && '__iterator__' !== key )
continue;
let property = trait[key],

View File

@ -53,7 +53,7 @@ function areSame(desc1, desc2) {
*/
function Map(names) {
let map = {};
for each (let name in names)
for (let name of names)
map[name] = true;
return map;
}
@ -115,7 +115,7 @@ function Conflict(name) {
function trait(properties) {
let result = {},
keys = getOwnPropertyNames(properties);
for each (let key in keys) {
for (let key of keys) {
let descriptor = getOwnPropertyDescriptor(properties, key);
result[key] = (required === descriptor.value) ? Required(key) : descriptor;
}
@ -139,9 +139,9 @@ exports.Trait = exports.trait = trait;
function compose(trait1, trait2) {
let traits = Array.slice(arguments, 0),
result = {};
for each (let trait in traits) {
for (let trait of traits) {
let keys = getOwnPropertyNames(trait);
for each (let key in keys) {
for (let key of keys) {
let descriptor = trait[key];
// if property already exists and it's not a requirement
if (hasOwn.call(result, key) && !result[key].required) {
@ -176,7 +176,7 @@ function exclude(keys, trait) {
keys = getOwnPropertyNames(trait);
for each (let key in keys) {
for (let key of keys) {
if (!hasOwn.call(exclusions, key) || trait[key].required)
result[key] = trait[key];
else
@ -209,9 +209,9 @@ function exclude(keys, trait) {
function override() {
let traits = Array.slice(arguments, 0),
result = {};
for each (let trait in traits) {
for (let trait of traits) {
let keys = getOwnPropertyNames(trait);
for each(let key in keys) {
for (let key of keys) {
let descriptor = trait[key];
if (!hasOwn.call(result, key) || result[key].required)
result[key] = descriptor;
@ -237,7 +237,7 @@ exports.override = override;
function rename(map, trait) {
let result = {},
keys = getOwnPropertyNames(trait);
for each(let key in keys) {
for (let key of keys) {
// must be renamed & it's not requirement
if (hasOwn.call(map, key) && !trait[key].required) {
let alias = map[key];
@ -282,7 +282,7 @@ function resolve(resolutions, trait) {
let renames = {},
exclusions = [],
keys = getOwnPropertyNames(resolutions);
for each (let key in keys) { // pre-process renamed and excluded properties
for (let key of keys) { // pre-process renamed and excluded properties
if (resolutions[key]) // old name -> new name
renames[key] = resolutions[key];
else // name -> undefined
@ -307,7 +307,7 @@ exports.resolve = resolve;
function create(proto, trait) {
let properties = {},
keys = getOwnPropertyNames(trait);
for each(let key in keys) {
for (let key of keys) {
let descriptor = trait[key];
if (descriptor.required && !hasOwn.call(proto, key))
throw new Error(ERR_REQUIRED + key);

View File

@ -157,7 +157,7 @@ TestFinder.prototype = {
}
if (this.testInProcess) {
for each (let name in Object.keys(suiteModule).sort()) {
for (let name of Object.keys(suiteModule).sort()) {
if (NOT_TESTS.indexOf(name) === -1 && filter(suite, name)) {
tests.push({
setup: suiteModule.setup,

View File

@ -7,9 +7,9 @@ module.metadata = {
"stability": "deprecated"
};
const memory = require('./memory');
const memory = require("./memory");
const timer = require("../timers");
var cfxArgs = require("@test/options");
const cfxArgs = require("../test/options");
const { getTabs, getURI } = require("../tabs/utils");
const { windows, isBrowser } = require("../window/utils");
const { defer, all } = require("../core/promise");
@ -48,7 +48,7 @@ const TestRunner = function TestRunner(options) {
TestRunner.prototype = {
toString: function toString() "[object TestRunner]",
DEFAULT_PAUSE_TIMEOUT: 5*60000,
DEFAULT_PAUSE_TIMEOUT: cfxArgs.parseable ? 5*60000 : 15000,
PAUSE_DELAY: 500,
_logTestFailed: function _logTestFailed(why) {

View File

@ -51,7 +51,7 @@ exports.windowIterator = windowIterator;
* interface.
*/
function browserWindowIterator() {
for each (let window in windowIterator()) {
for (let window of windowIterator()) {
if (isBrowser(window))
yield window;
}
@ -66,7 +66,7 @@ function WindowTracker(delegate) {
this._delegate = delegate;
this._loadingWindows = [];
for each (let window in getWindows())
for (let window of getWindows())
this._regWindow(window);
windowWatcher.registerNotification(this);
this._onToplevelWindowReady = this._onToplevelWindowReady.bind(this);
@ -120,7 +120,7 @@ WindowTracker.prototype = {
unload: function unload() {
windowWatcher.unregisterNotification(this);
events.off('toplevel-window-ready', this._onToplevelWindowReady);
for each (let window in getWindows())
for (let window of getWindows())
this._unregWindow(window);
},

View File

@ -51,7 +51,7 @@ windowObserver.on("close", function onClose(window) {
});
// Making observer aware of already opened windows.
for each (let window in browserWindowIterator())
for (let window of browserWindowIterator())
observer.observe(window);
exports.observer = observer;

View File

@ -54,7 +54,7 @@ function getPreferedLocales(caseSensitve) {
if (contentLocales) {
// This list is a string of locales seperated by commas.
// There is spaces after commas, so strip each item
for each(let locale in contentLocales.split(","))
for (let locale of contentLocales.split(","))
addLocale(locale.replace(/(^\s+)|(\s+$)/g, ""));
}
@ -88,9 +88,9 @@ exports.findClosestLocale = function findClosestLocale(aLocales, aMatchLocales)
// The number of locale parts in the match
let bestpartcount = 0;
for each (let locale in aMatchLocales) {
for (let locale of aMatchLocales) {
let lparts = locale.split("-");
for each (let localized in aLocales) {
for (let localized of aLocales) {
let found = localized.toLowerCase();
// Exact match is returned immediately
if (locale == found)

View File

@ -28,7 +28,7 @@ function getWindow(anchor) {
let anchorDocument = anchorWindow.document;
// loop thru supported windows
for each(let enumWindow in windows) {
for (let enumWindow of windows) {
// Check if the anchor is in this browser window.
if (enumWindow == anchorWindow) {
window = anchorWindow;

View File

@ -93,6 +93,6 @@ windowObserver.on("activate", function onWindowActivate(chromeWindow) {
// We should synchronize state, since probably we already have at least one
// window open.
for each (let window in browserWindowIterator()) onWindowOpen(window);
for (let window of browserWindowIterator()) onWindowOpen(window);
exports.observer = observer;

View File

@ -7,6 +7,7 @@ const { Trait } = require("../deprecated/traits");
const { EventEmitter } = require("../deprecated/events");
const { defer } = require("../lang/functional");
const { has } = require("../util/array");
const { each } = require("../util/object");
const { EVENTS } = require("./events");
const { getThumbnailURIForWindow } = require("../content/thumbnail");
const { getFaviconURIForLocation } = require("../io/data");
@ -48,7 +49,7 @@ const TabTrait = Trait.compose(EventEmitter, {
let window = this.window = options.window || require('../windows').BrowserWindow({ window: getOwnerWindow(this._tab) });
// Setting event listener if was passed.
for each (let type in EVENTS) {
each(EVENTS, (type) => {
let listener = options[type.listener];
if (listener) {
this.on(type.name, options[type.listener]);
@ -56,7 +57,7 @@ const TabTrait = Trait.compose(EventEmitter, {
// window spreads this event.
if (!has(['ready', 'load', 'pageshow'], (type.name)))
window.tabs.on(type.name, this._onEvent.bind(this, type.name));
}
});
this.on(EVENTS.close.name, this.destroy.bind(this));
@ -281,7 +282,7 @@ const getTabView = tab => viewNS(tab).tab;
function Tab(options, existingOnly) {
let chromeTab = options.tab;
for each (let tab in TABS) {
for (let tab of TABS) {
if (chromeTab == tab._tab)
return tab._public;
}

View File

@ -51,7 +51,7 @@ Object.defineProperties(tabs, {
});
function getWindow(privateState) {
for each (let window in windows) {
for (let window of windows) {
if (privateState === isPrivate(window)) {
return window;
}

View File

@ -113,13 +113,13 @@ exports.getOwnerWindow = getOwnerWindow;
// fennec
function getWindowHoldingTab(rawTab) {
for each (let window in getWindows()) {
for (let window of getWindows()) {
// this function may be called when not using fennec,
// but BrowserApp is only defined on Fennec
if (!window.BrowserApp)
continue;
for each (let tab in window.BrowserApp.tabs) {
for (let tab of window.BrowserApp.tabs) {
if (tab === rawTab)
return window;
}
@ -285,12 +285,12 @@ exports.getSelectedTab = getSelectedTab;
function getTabForBrowser(browser) {
for each (let window in getWindows()) {
for (let window of getWindows()) {
// this function may be called when not using fennec
if (!window.BrowserApp)
continue;
for each (let tab in window.BrowserApp.tabs) {
for (let tab of window.BrowserApp.tabs) {
if (tab.browser === browser)
return tab;
}

View File

@ -164,8 +164,8 @@ function reportMemoryUsage() {
mgr.getReportsForThisProcess(logReporter, null, /* anonymize = */ false);
var weakrefs = [info.weakref.get()
for each (info in memory.getObjects())];
weakrefs = [weakref for each (weakref in weakrefs) if (weakref)];
for (info of memory.getObjects())];
weakrefs = [weakref for (weakref of weakrefs) if (weakref)];
print("Tracked memory objects in testing sandbox: " + weakrefs.length + "\n");
}));
}
@ -227,7 +227,7 @@ function cleanup() {
if (profileMemory) {
gWeakrefInfo = [{ weakref: info.weakref, bin: info.bin }
for each (info in memory.getObjects())];
for (info of memory.getObjects())];
}
loader.unload();
@ -261,7 +261,7 @@ function cleanup() {
console.exception(e);
};
setTimeout(require('@test/options').checkMemory ? checkMemory : showResults, 1);
setTimeout(require("./options").checkMemory ? checkMemory : showResults, 1);
// dump the coverobject
if (Object.keys(coverObject).length){
@ -392,7 +392,7 @@ function nextIteration(tests) {
reportMemoryUsage().then(_ => {
let testRun = [];
for each (let test in tests.testRunSummary) {
for (let test of tests.testRunSummary) {
let testCopy = {};
for (let info in test) {
testCopy[info] = test[info];
@ -446,7 +446,7 @@ var consoleListener = {
return;
this.errorsLogged++;
var message = object.QueryInterface(Ci.nsIConsoleMessage).message;
var pointless = [err for each (err in POINTLESS_ERRORS)
var pointless = [err for (err of POINTLESS_ERRORS)
if (message.indexOf(err) >= 0)];
if (pointless.length == 0 && message)
testConsole.log(message);

View File

@ -1,7 +1,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { resolveURI, Require,

View File

@ -0,0 +1,22 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
module.metadata = {
"stability": "unstable"
};
const options = require("@test/options");
const { id } = require("../self");
const { get } = require("../preferences/service");
const readPref = (key) => get("extensions." + id + ".sdk." + key);
exports.iterations = readPref("test.iterations") || options.iterations;
exports.filter = readPref("test.filter") || options.filter;
exports.profileMemory = readPref("profile.memory") || options.profileMemory,
exports.stopOnError = readPref("test.stop") || options.stopOnError,
exports.verbose = (readPref("output.logLevel") == "verbose") || options.verbose;
exports.parseable = (readPref("output.format") == "tbpl") || options.parseable;
exports.checkMemory = readPref("profile.leaks") || options.check_memory;

View File

@ -8,7 +8,7 @@ module.metadata = {
};
var { exit, stdout } = require("../system");
var cfxArgs = require("@test/options");
var cfxArgs = require("../test/options");
function runTests(findAndRunTests) {
var harness = require("./harness");
@ -53,13 +53,13 @@ function printFailedTests(tests, print) {
print("\nThe following tests failed:\n");
for each (let testRun in tests.testRuns) {
for (let testRun of tests.testRuns) {
iterationNumber++;
if (!singleIteration)
print(" Iteration " + iterationNumber + ":\n");
for each (let test in testRun) {
for (let test of testRun) {
if (test.failed > 0) {
print(padding + " " + test.name + ": " + test.errors +"\n");
}
@ -102,7 +102,7 @@ exports.runTestsFromModule = function runTestsFromModule(module) {
// Reproduce what is done in sdk/deprecated/unit-test-finder.findTests()
let tests = [];
for each (let name in Object.keys(exports).sort()) {
for (let name of Object.keys(exports).sort()) {
tests.push({
setup: exports.setup,
teardown: exports.teardown,

View File

@ -99,7 +99,7 @@ exports.flatten = function flatten(array){
function fromIterator(iterator) {
let array = [];
if (iterator.__iterator__) {
for each (let item in iterator)
for (let item of iterator)
array.push(item);
}
else {

View File

@ -44,7 +44,7 @@ const listOptions = {
__iterator__: function __iterator__(onKeys, onKeyValue) {
let array = listNS(this).keyValueMap.slice(0),
i = -1;
for each(let element in array)
for (let element of array)
yield onKeyValue ? [++i, element] : onKeys ? ++i : element;
},
};

View File

@ -21,7 +21,7 @@ const Registry = EventEmitter.compose({
},
_destructor: function _destructor() {
let _registry = this._registry.slice(0);
for each (let instance in _registry)
for (let instance of _registry)
this._emit('remove', instance);
this._registry.splice(0);
},

View File

@ -322,7 +322,7 @@ const WidgetTrait = LightTrait.compose(EventEmitterTrait, LightTrait({
* Window that has been closed
*/
_onWindowClosed: function _onWindowClosed(window) {
for each (let view in this._views) {
for (let view of this._views) {
if (view._isInChromeWindow(window)) {
view.destroy();
break;
@ -336,7 +336,7 @@ const WidgetTrait = LightTrait.compose(EventEmitterTrait, LightTrait({
* BrowserWindow reference from "windows" module
*/
getView: function getView(window) {
for each (let view in this._views) {
for (let view of this._views) {
if (view._isInWindow(window)) {
return view._public;
}

View File

@ -40,7 +40,7 @@ const browserWindows = exports.browserWindows = BrowserWindows();
* registered, `null` otherwise.
*/
function getRegisteredWindow(chromeWindow) {
for each (let window in browserWindows) {
for (let window of browserWindows) {
if (chromeWindow === windowNS(window).window)
return window;
}

View File

@ -124,7 +124,7 @@ const BrowserWindowTrait = Trait.compose(
* registered, `null` otherwise.
*/
function getRegisteredWindow(chromeWindow) {
for each (let window in windows) {
for (let window of windows) {
if (chromeWindow === window._window)
return window;
}

View File

@ -158,7 +158,7 @@ function onTabSelect(event) {
emit(tab, 'activate', tab);
emit(gTabs, 'activate', tab);
for each (let t in gTabs) {
for (let of in gTabs) {
if (t === tab) continue;
emit(t, 'deactivate', t);
emit(gTabs, 'deactivate', t);

View File

@ -65,7 +65,7 @@ const WindowTabTracker = Trait.compose({
this._onTabPinned = this._onTabEvent.bind(this, "pinned");
this._onTabUnpinned = this._onTabEvent.bind(this, "unpinned");
for each (let tab in getTabs(this._window)) {
for (let tab of getTabs(this._window)) {
// We emulate "open" events for all open tabs since gecko does not emits
// them on the tabs that new windows are open with. Also this is
// necessary to synchronize tabs lists with an actual state.
@ -86,7 +86,7 @@ const WindowTabTracker = Trait.compose({
_destroyWindowTabTracker: function _destroyWindowTabTracker() {
// We emulate close events on all tabs, since gecko does not emits such
// events by itself.
for each (let tab in this.tabs)
for (let tab of this.tabs)
this._emitEvent("close", tab);
this._tabs._clear();

View File

@ -28,4 +28,9 @@ exports.testTabIsRemote = function(assert, done) {
mm.loadFrameScript('data:,sendAsyncMessage("7")', true);
}
// e10s tests should not ride the train to aurora, beta
if (getPref('app.update.channel') !== 'nightly') {
module.exports = {};
}
require('sdk/test/runner').runTestsFromModule(module);

View File

@ -1,7 +1,13 @@
'use strict';
unsafeWindow.runDebuggerStatement = function() {
function runDebuggerStatement () {
window.document.body.setAttribute('style', 'background-color: red');
debugger;
window.document.body.setAttribute('style', 'background-color: green');
}
exportFunction(
runDebuggerStatement,
document.defaultView,
{ defineAs: "runDebuggerStatement" }
);

View File

@ -1,7 +1,13 @@
'use strict';
unsafeWindow.runDebuggerStatement = function() {
function runDebuggerStatement () {
window.document.body.setAttribute('style', 'background-color: red');
debugger;
window.document.body.setAttribute('style', 'background-color: green');
}
exportFunction(
runDebuggerStatement,
document.defaultView,
{ defineAs: "runDebuggerStatement" }
);

View File

@ -135,7 +135,7 @@ exports.testTabProperties = function(assert, done) {
exports.testTabsIteratorAndLength = function(assert, done) {
let newTabs = [];
let startCount = 0;
for each (let t in tabs) startCount++;
for (let t of tabs) startCount++;
assert.equal(startCount, tabs.length, "length property is correct");
@ -146,7 +146,7 @@ exports.testTabsIteratorAndLength = function(assert, done) {
url: url,
onOpen: function(tab) {
let count = 0;
for each (let t in tabs) count++;
for (let t of tabs) count++;
assert.equal(count, startCount + 3, "iterated tab count matches");
assert.equal(startCount + 3, tabs.length, "iterated tab count matches length property");

View File

@ -278,7 +278,7 @@ exports.testTabContentTypeAndReload = function(assert, done) {
exports.testTabsIteratorAndLength = function(assert, done) {
open(null, { features: { chrome: true, toolbar: true } }).then(focus).then(function(window) {
let startCount = 0;
for each (let t in tabs) startCount++;
for (let t of tabs) startCount++;
assert.equal(startCount, tabs.length, "length property is correct");
let url = "data:text/html;charset=utf-8,default";
@ -288,7 +288,7 @@ exports.testTabsIteratorAndLength = function(assert, done) {
url: url,
onOpen: function(tab) {
let count = 0;
for each (let t in tabs) count++;
for (let t of tabs) count++;
assert.equal(count, startCount + 3, "iterated tab count matches");
assert.equal(startCount + 3, tabs.length, "iterated tab count matches length property");

View File

@ -289,7 +289,7 @@ exports.testAddIterator = function testAddIterator (assert) {
apiUtils.addIterator(
obj,
function keysValsGen() {
for each (let keyVal in keysVals)
for (let keyVal of keysVals)
yield keyVal;
}
);

View File

@ -66,7 +66,7 @@ exports.testBasename = function(assert) {
exports.testList = function(assert) {
let list = file.list(profilePath);
let found = [ true for each (name in list)
let found = [ true for (name of list)
if (name === fileNameInProfile) ];
if (found.length > 1)

View File

@ -6,7 +6,7 @@ const port = 8099;
const file = require("sdk/io/file");
const { pathFor } = require("sdk/system");
const { Loader } = require("sdk/test/loader");
const options = require("@test/options");
const options = require("sdk/test/options");
const loader = Loader(module);
const httpd = loader.require("sdk/test/httpd");

View File

@ -16,7 +16,7 @@ exports.testList = function(assert) {
}
let count = 0;
for each (let ele in list) {
for (let ele of list) {
assert.equal(ele, 1, 'ele is correct');
assert.equal(++count, 1, 'count is correct');
}
@ -41,7 +41,7 @@ exports.testImplementsList = function(assert) {
let list2 = List2();
let count = 0;
for each (let ele in list2) {
for (let ele of list2) {
assert.equal(ele, count++, 'ele is correct');
}

View File

@ -13,6 +13,8 @@ const ERR_DESTROYED =
"Couldn't find the worker to receive this message. " +
"The script may not be initialized yet, or may already have been unloaded.";
const Isolate = fn => "(" + fn + ")()";
exports.testSimplePageCreation = function(assert, done) {
let page = new Page({
contentScript: "self.postMessage(window.location.href)",
@ -79,7 +81,7 @@ exports.testUnwrappedDOM = function(assert, done) {
exports.testPageProperties = function(assert) {
let page = new Page();
for each (let prop in ['contentURL', 'allow', 'contentScriptFile',
for (let prop of ['contentURL', 'allow', 'contentScriptFile',
'contentScript', 'contentScriptWhen', 'on',
'postMessage', 'removeListener']) {
assert.ok(prop in page, prop + " property is defined on page.");
@ -477,6 +479,38 @@ exports.testMessageQueue = function (assert, done) {
});
};
exports.testWindowStopDontBreak = function (assert, done) {
const { Ci, Cc } = require('chrome');
const consoleService = Cc['@mozilla.org/consoleservice;1'].
getService(Ci.nsIConsoleService);
const listener = {
observe: ({message}) => {
if (message.contains('contentWorker is null'))
assert.fail('contentWorker is null');
}
};
consoleService.registerListener(listener)
let page = new Page({
contentURL: 'data:text/html;charset=utf-8,testWindowStopDontBreak',
contentScriptWhen: 'ready',
contentScript: Isolate(() => {
window.stop();
self.port.on('ping', () => self.port.emit('pong'));
})
});
page.port.on('pong', () => {
assert.pass('page-worker works after window.stop');
page.destroy();
consoleService.unregisterListener(listener);
done();
});
page.port.emit("ping");
};
function isDestroyed(page) {
try {
page.postMessage("foo");

View File

@ -8,7 +8,7 @@ const file = require("sdk/io/file");
const { URL } = require("sdk/url");
const { extend } = require("sdk/util/object");
const { Loader } = require("sdk/test/loader");
const options = require("@test/options");
const options = require("sdk/test/options");
const loader = Loader(module);
const httpd = loader.require("sdk/test/httpd");

View File

@ -23,9 +23,9 @@ exports.testTabCounts = function(assert, done) {
onReady: function(tab) {
let count1 = 0,
count2 = 0;
for each(let window in browserWindows) {
for (let window of browserWindows) {
count1 += window.tabs.length;
for each(let tab in window.tabs) {
for (let tab of window.tabs) {
count2 += 1;
}
}

View File

@ -120,7 +120,7 @@ exports.testWaitUntilTimeoutInCallback = function(test) {
let expected = [];
let message = 0;
if (require("@test/options").parseable) {
if (require("sdk/test/options").parseable) {
expected.push(["print", "TEST-START | wait4ever\n"]);
expected.push(["error", "fail:", "Timed out"]);
expected.push(["error", "test assertion never became true:\n", "assertion failed, value is false\n"]);

View File

@ -15,7 +15,7 @@ exports.testBrowserWindowsIterator = function(assert) {
let activeWindowCount = 0;
let windows = [];
let i = 0;
for each (let window in browserWindows) {
for (let window of browserWindows) {
if (window === browserWindows.activeWindow)
activeWindowCount++;

View File

@ -10,6 +10,7 @@ support-files =
skip-if = e10s # Bug 941459 - pushPrefEnv, popPrefEnv in specialPowersAPI.js not e10s friendly
[browser_chunk_permissions.js]
[browser_connection_bug388287.js]
[browser_cookies_exceptions.js]
[browser_healthreport.js]
skip-if = !healthreport || (os == 'linux' && debug)
[browser_permissions.js]

View File

@ -0,0 +1,172 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
function prefWindowObserver(subject, topic, data) {
if (topic != "domwindowopened")
return;
Services.ww.unregisterNotification(this);
let win = subject.QueryInterface(Ci.nsIDOMEventTarget);
win.addEventListener("load", function(event) {
let historyMode = event.target.getElementById("historyMode");
historyMode.value = "custom";
historyMode.doCommand();
Services.ww.registerNotification(cookiesWindowObserver);
event.target.getElementById("cookieExceptions").doCommand();
}, false);
}
function cookiesWindowObserver(subject, topic, data) {
if (topic != "domwindowopened")
return;
Services.ww.unregisterNotification(this);
let win = subject.QueryInterface(Ci.nsIDOMEventTarget);
win.addEventListener("load", function(event) {
SimpleTest.executeSoon(function() windowLoad(event, win, dialog));
}, false);
}
Services.ww.registerNotification(prefWindowObserver);
let dialog = openDialog("chrome://browser/content/preferences/preferences.xul",
"Preferences", "chrome,titlebar,toolbar,centerscreen,dialog=no",
"panePrivacy");
}
function windowLoad(event, win, dialog) {
let doc = event.target;
let tree = doc.getElementById("permissionsTree");
let statusCol = tree.treeBoxObject.columns.getColumnAt(1);
let url = doc.getElementById("url");
let btnAllow = doc.getElementById("btnAllow");
let btnBlock = doc.getElementById("btnBlock");
let btnRemove = doc.getElementById("removePermission");
let pm = Cc["@mozilla.org/permissionmanager;1"]
.getService(Ci.nsIPermissionManager);
let ioService = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
const allowText = win.gPermissionManager._getCapabilityString(
Ci.nsIPermissionManager.ALLOW_ACTION);
const denyText = win.gPermissionManager._getCapabilityString(
Ci.nsIPermissionManager.DENY_ACTION);
const allow = Ci.nsIPermissionManager.ALLOW_ACTION;
const deny = Ci.nsIPermissionManager.DENY_ACTION;
is(tree.view.rowCount, 0, "no cookie exceptions");
let tests = [
{
test: function() {
url.value = "test.com";
btnAllow.doCommand();
is(tree.view.rowCount, 1, "added exception shows up in treeview");
is(tree.view.getCellText(0, statusCol), allowText,
"permission text should be set correctly");
},
observances: [{ type: "cookie", host: "test.com", data: "added",
capability: allow }]
},
{
test: function() {
url.value = "test.com";
btnBlock.doCommand();
is(tree.view.getCellText(0, statusCol), denyText,
"permission should change to deny in UI");
},
observances: [{ type: "cookie", host: "test.com", data: "changed",
capability: deny }],
},
{
test: function() {
url.value = "test.com";
btnAllow.doCommand();
is(tree.view.getCellText(0, statusCol), allowText,
"permission should revert back to allow");
},
observances: [{ type: "cookie", host: "test.com", data: "changed",
capability: allow }],
},
{
test: function() {
url.value = "test.com";
btnRemove.doCommand();
is(tree.view.rowCount, 0, "exception should be removed");
},
observances: [{ type: "cookie", host: "test.com", data: "deleted" }],
},
{
test: function() {
let uri = ioService.newURI("http://test.com", null, null);
pm.add(uri, "popup", Ci.nsIPermissionManager.DENY_ACTION);
is(tree.view.rowCount, 0, "adding unrelated permission should not change display");
},
observances: [{ type: "popup", host: "test.com", data: "added",
capability: deny }],
cleanUp: function() {
pm.remove("test.com", "popup");
},
},
];
let permObserver = {
observe: function(aSubject, aTopic, aData) {
if (aTopic != "perm-changed")
return;
if (tests[currentTest].observances.length == 0) {
// Should fail here as we are not expecting a notification.
}
let permission = aSubject.QueryInterface(Ci.nsIPermission);
let expected = tests[currentTest].observances.shift();
is(aData, expected.data, "type of message should be the same");
for each (let prop in ["type", "host", "capability"]) {
if (expected[prop])
is(permission[prop], expected[prop],
"property: \"" + prop + "\" should be equal");
}
if (tests[currentTest].observances.length == 0) {
SimpleTest.executeSoon(function() {
if (tests[currentTest].cleanUp)
tests[currentTest].cleanUp();
runNextTest();
});
}
},
};
let os = Cc["@mozilla.org/observer-service;1"]
.getService(Ci.nsIObserverService);
os.addObserver(permObserver, "perm-changed", false);
var currentTest = -1;
function runNextTest() {
currentTest++;
if (currentTest == tests.length) {
os.removeObserver(permObserver, "perm-changed");
win.close();
dialog.close();
finish();
return;
}
info("Running test #" + (currentTest + 1) + "\n");
tests[currentTest].test();
if (!tests[currentTest].observances)
runNextTest();
}
runNextTest();
}

View File

@ -257,8 +257,7 @@ Toolbox.prototype = {
let splitConsolePromise = promise.resolve();
if (Services.prefs.getBoolPref(SPLITCONSOLE_ENABLED_PREF)) {
// Force the split console on if pref is true.
splitConsolePromise = this.toggleSplitConsole(true);
splitConsolePromise = this.openSplitConsole();
}
let buttonsPromise = this._buildButtons();
@ -372,7 +371,7 @@ Toolbox.prototype = {
webconsolePanel.removeAttribute("collapsed");
} else {
deck.removeAttribute("collapsed");
if (this._splitConsole) {
if (this.splitConsole) {
webconsolePanel.removeAttribute("collapsed");
splitter.removeAttribute("hidden");
} else {
@ -971,36 +970,50 @@ Toolbox.prototype = {
},
/**
* Toggles the split state of the webconsole. If the webconsole panel
* is already selected and no forceToggle is not set, then this command
* is ignored.
*
* @param {bool} forceToggle
* Should the console be toggled regardless of the selected panel.
* Opens the split console.
*
* @returns {Promise} a promise that resolves once the tool has been
* loaded and focused.
*/
toggleSplitConsole: function(forceToggle = false) {
let openedConsolePanel = this.currentToolId === "webconsole";
let ret = promise.resolve();
openSplitConsole: function() {
this._splitConsole = true;
Services.prefs.setBoolPref(SPLITCONSOLE_ENABLED_PREF, true);
this._refreshConsoleDisplay();
this.emit("split-console");
return this.loadTool("webconsole").then(() => {
this.focusConsoleInput();
});
},
// Don't allow changes when console is open, since it could be confusing
if (!openedConsolePanel || forceToggle) {
this._splitConsole = !this._splitConsole;
Services.prefs.setBoolPref(SPLITCONSOLE_ENABLED_PREF, this._splitConsole);
/**
* Closes the split console.
*
* @returns {Promise} a promise that resolves once the tool has been
* closed.
*/
closeSplitConsole: function() {
this._splitConsole = false;
Services.prefs.setBoolPref(SPLITCONSOLE_ENABLED_PREF, false);
this._refreshConsoleDisplay();
this.emit("split-console");
return promise.resolve();
},
this._refreshConsoleDisplay();
this.emit("split-console");
if (this._splitConsole) {
ret = this.loadTool("webconsole").then(() => {
this.focusConsoleInput();
});
}
/**
* Toggles the split state of the webconsole. If the webconsole panel
* is already selected then this command is ignored.
*
* @returns {Promise} a promise that resolves once the tool has been
* opened or closed.
*/
toggleSplitConsole: function() {
if (this.currentToolId !== "webconsole") {
return this.splitConsole ?
this.closeSplitConsole() :
this.openSplitConsole();
}
return ret;
return promise.resolve();
},
/**

View File

@ -23,6 +23,7 @@ browser.jar:
content/browser/devtools/scratchpad-commands.js (scratchpad/scratchpad-commands.js)
content/browser/devtools/splitview.css (shared/splitview.css)
content/browser/devtools/theme-switching.js (shared/theme-switching.js)
content/browser/devtools/frame-script-utils.js (shared/frame-script-utils.js)
content/browser/devtools/styleeditor.xul (styleeditor/styleeditor.xul)
content/browser/devtools/styleeditor.css (styleeditor/styleeditor.css)
content/browser/devtools/computedview.xhtml (styleinspector/computedview.xhtml)

View File

@ -1,5 +1,4 @@
[DEFAULT]
skip-if = e10s # Bug ?????? - devtools tests disabled with e10s
subsuite = devtools
support-files =
doc_blended-geometry.html
@ -44,3 +43,4 @@ skip-if = true # Bug 942473, caused by Bug 940541
[browser_webgl-actor-test-15.js]
[browser_webgl-actor-test-16.js]
[browser_webgl-actor-test-17.js]
[browser_webgl-actor-test-18.js]

View File

@ -4,11 +4,14 @@
/**
* Tests if the shader editor works with bfcache.
*/
function ifWebGLSupported() {
let [target, debuggee, panel] = yield initShaderEditor(SIMPLE_CANVAS_URL);
let { gFront, $, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin;
// Attach frame scripts if in e10s to perform
// history navigation via the content
loadFrameScripts();
let reloaded = reload(target);
let firstProgram = yield once(gFront, "program-linked");
yield reloaded;

View File

@ -32,10 +32,10 @@ function ifWebGLSupported() {
ok(false, "No sources should be changed form this point onward.");
});
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield 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 @@ function ifWebGLSupported() {
is(getBlackBoxCheckbox(panel, 1).checked, true,
"The second blackbox checkbox should still be checked.");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield 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 @@ function ifWebGLSupported() {
is(getBlackBoxCheckbox(panel, 1).checked, false,
"The second blackbox checkbox should now be unchecked.");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield 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) });
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield 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) });
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield 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) });
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield 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 @@ function ifWebGLSupported() {
is(getBlackBoxCheckbox(panel, 1).checked, true,
"The second blackbox checkbox should now be rechecked.");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield 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) });
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield 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) });
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield 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) });
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The two programs were correctly unhighlighted.");
yield teardown(panel);

View File

@ -16,41 +16,41 @@ function ifWebGLSupported() {
once(panel.panelWin, EVENTS.SOURCES_SHOWN)
]);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
yield 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();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 0, b: 0, a: 127 }, true);
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield 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();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 127, g: 127, b: 127, a: 255 }, true);
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
yield 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();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
yield 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();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield 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();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
yield ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
ok(true, "The two programs were correctly unblackboxed again.");
yield teardown(panel);

View File

@ -32,50 +32,50 @@ function ifWebGLSupported() {
ok(false, "No sources should be changed form this point onward.");
});
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ShadersListView._onProgramMouseOver({ target: getItemLabel(panel, 0) });
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield 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) });
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield 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) });
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield 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) });
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield 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) });
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield 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.");
yield teardown(panel);

View File

@ -16,27 +16,27 @@ function ifWebGLSupported() {
once(panel.panelWin, EVENTS.SOURCES_SHOWN)
]);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
yield 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) });
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 0, b: 32, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 0, b: 32, a: 127 }, true);
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 0, b: 32, a: 255 }, true);
yield 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) });
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 255, g: 0, b: 64, a: 255 }, true);
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
yield 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) });
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
yield ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
ok(true, "The two programs were correctly unhighlighted.");
yield teardown(panel);

View File

@ -28,9 +28,9 @@ function ifWebGLSupported() {
is($("#fs-editor-label").hasAttribute("selected"), false,
"The vertex shader editor shouldn't be initially selected.");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 128, y: 128 }, { r: 191, g: 64, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(gFront, { x: 128, y: 128 }, { r: 191, g: 64, b: 0, a: 255 }, true);
yield ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
vsEditor.focus();
@ -44,9 +44,9 @@ function ifWebGLSupported() {
ok(true, "Vertex shader was changed.");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(gFront, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true);
ok(true, "The vertex shader was recompiled successfully.");
@ -62,9 +62,9 @@ function ifWebGLSupported() {
ok(true, "Fragment shader was changed.");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 127 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(gFront, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 127 }, true);
yield ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true);
ok(true, "The fragment shader was recompiled successfully.");

View File

@ -49,8 +49,8 @@ function ifWebGLSupported() {
ok(error.link.contains("ERROR: 0:6: 'constructor'"),
"A constructor error is contained in the linkage status.");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield 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 });
let [, error] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED);
@ -60,8 +60,8 @@ function ifWebGLSupported() {
let [, error] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED);
ok(!error, "The new fragment shader source was compiled successfully.");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield teardown(panel);
finish();

View File

@ -41,14 +41,14 @@ function ifWebGLSupported() {
ok(true, "Vertex and fragment shaders were changed.");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 32, y: 32 }, { r: 255, g: 255, b: 0, a: 0 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 255, g: 255, b: 0, a: 0 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 32, y: 32 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 32, y: 32 }, { r: 255, g: 255, b: 0, a: 0 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 255, g: 255, b: 0, a: 0 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 32, y: 32 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(gFront, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield 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.");

View File

@ -14,32 +14,32 @@ function ifWebGLSupported() {
let vertexShader = yield programActor.getVertexShader();
let fragmentShader = yield programActor.getFragmentShader();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield checkShaderSource("The shader sources are correct before highlighting.");
ok(true, "The corner pixel colors are correct before highlighting.");
yield programActor.highlight([0, 1, 0, 1]);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield checkShaderSource("The shader sources are preserved after highlighting.");
ok(true, "The corner pixel colors are correct after highlighting.");
yield programActor.unhighlight();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield checkShaderSource("The shader sources are correct after unhighlighting.");
ok(true, "The corner pixel colors are correct after unhighlighting.");
yield programActor.blackbox();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield checkShaderSource("The shader sources are preserved after blackboxing.");
ok(true, "The corner pixel colors are correct after blackboxing.");
yield programActor.unblackbox();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield checkShaderSource("The shader sources are correct after unblackboxing.");
ok(true, "The corner pixel colors are correct after unblackboxing.");

View File

@ -13,9 +13,9 @@ function ifWebGLSupported() {
let vertexShader = yield programActor.getVertexShader();
let fragmentShader = yield programActor.getFragmentShader();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 128, y: 128 }, { r: 191, g: 64, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 128, y: 128 }, { r: 191, g: 64, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
let vertSource = yield vertexShader.getText();
let fragSource = yield fragmentShader.getText();
@ -29,9 +29,9 @@ function ifWebGLSupported() {
ok(!status,
"The new vertex shader source was compiled without errors.");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true);
let vertSource = yield vertexShader.getText();
let fragSource = yield fragmentShader.getText();
@ -45,9 +45,9 @@ function ifWebGLSupported() {
ok(!status,
"The new fragment shader source was compiled without errors.");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 127 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 127 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true);
let vertSource = yield vertexShader.getText();
let fragSource = yield fragmentShader.getText();

View File

@ -20,10 +20,10 @@ function ifWebGLSupported() {
ok(!status,
"The new vertex shader source was compiled without errors.");
yield waitForFrame(debuggee);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 255, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 128, y: 128 }, { r: 0, g: 0, b: 255, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 0, b: 255, a: 255 }, true);
yield front.waitForFrame();
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 255, a: 255 }, true);
yield ensurePixelIs(front, { x: 128, y: 128 }, { r: 0, g: 0, b: 255, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 0, b: 255, a: 255 }, true);
let vertSource = yield vertexShader.getText();
let fragSource = yield fragmentShader.getText();

View File

@ -35,8 +35,8 @@ function ifWebGLSupported() {
"An assignment error is contained in the linkage status.");
}
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
ok(true, "The shader was reverted to the old source.");
let vertSource = yield vertexShader.getText();
@ -62,8 +62,8 @@ function ifWebGLSupported() {
"A constructor error is contained in the linkage status.");
}
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
ok(true, "The shader was reverted to the old source.");
let fragSource = yield fragmentShader.getText();
@ -71,13 +71,13 @@ function ifWebGLSupported() {
"The previous correct fragment shader source was preserved.");
yield programActor.highlight([0, 1, 0, 1]);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
ok(true, "Highlighting worked after setting a defective fragment source.");
yield programActor.unhighlight();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
ok(true, "Unhighlighting worked after setting a defective vertex source.");
yield removeTab(target.tab);

View File

@ -26,18 +26,18 @@ function ifWebGLSupported() {
function testHighlighting(programActor) {
return Task.spawn(function() {
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
ok(true, "The corner pixel colors are correct before highlighting.");
yield programActor.highlight([0, 1, 0, 1]);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
ok(true, "The corner pixel colors are correct after highlighting.");
yield programActor.unhighlight();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
ok(true, "The corner pixel colors are correct after unhighlighting.");
});
}

View File

@ -34,32 +34,32 @@ function ifWebGLSupported() {
is(firstFragSource, secondFragSource,
"The vertex shaders should have identical sources.");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The two canvases are correctly drawn.");
yield firstProgramActor.highlight([1, 0, 0, 1]);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The first canvas was correctly filled after highlighting.");
yield secondProgramActor.highlight([0, 1, 0, 1]);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2");
ok(true, "The second canvas was correctly filled after highlighting.");
yield firstProgramActor.unhighlight();
yield secondProgramActor.unhighlight();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The two canvases were correctly filled after unhighlighting.");
yield removeTab(target.tab);

View File

@ -21,11 +21,11 @@ function ifWebGLSupported() {
ok(!status,
"The first new fragment shader source was compiled without errors.");
yield waitForFrame(debuggee);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 64, g: 64, b: 64, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 64, g: 64, b: 64, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield front.waitForFrame();
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 64, g: 64, b: 64, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 64, g: 64, b: 64, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The first fragment shader was changed.");
let oldFragSource = yield secondFragmentShader.getText();
@ -34,11 +34,11 @@ function ifWebGLSupported() {
ok(!status,
"The second new fragment shader source was compiled without errors.");
yield waitForFrame(debuggee);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 64, g: 64, b: 64, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 64, g: 64, b: 64, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 191, g: 191, b: 191, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 191, g: 191, b: 191, a: 255 }, true, "#canvas2");
yield front.waitForFrame();
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 64, g: 64, b: 64, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 64, g: 64, b: 64, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 191, g: 191, b: 191, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 191, g: 191, b: 191, a: 255 }, true, "#canvas2");
ok(true, "The second fragment shader was changed.");
yield removeTab(target.tab);

View File

@ -9,6 +9,10 @@ function ifWebGLSupported() {
let [target, debuggee, front] = yield initBackend(SIMPLE_CANVAS_URL);
front.setup({ reload: false });
// Attach frame scripts if in e10s to perform
// history navigation via the content
loadFrameScripts();
reload(target);
let firstProgram = yield once(front, "program-linked");
yield checkFirstCachedPrograms(firstProgram);
@ -79,50 +83,50 @@ function ifWebGLSupported() {
function checkHighlightingInTheFirstPage(programActor) {
return Task.spawn(function() {
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
ok(true, "The corner pixel colors are correct before highlighting.");
yield programActor.highlight([0, 1, 0, 1]);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
ok(true, "The corner pixel colors are correct after highlighting.");
yield programActor.unhighlight();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
ok(true, "The corner pixel colors are correct after unhighlighting.");
});
}
function checkHighlightingInTheSecondPage(firstProgramActor, secondProgramActor) {
return Task.spawn(function() {
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The two canvases are correctly drawn before highlighting.");
yield firstProgramActor.highlight([1, 0, 0, 1]);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The first canvas was correctly filled after highlighting.");
yield secondProgramActor.highlight([0, 1, 0, 1]);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2");
ok(true, "The second canvas was correctly filled after highlighting.");
yield firstProgramActor.unhighlight();
yield secondProgramActor.unhighlight();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The two canvases were correctly filled after unhighlighting.");
});
}

View File

@ -10,6 +10,10 @@ function ifWebGLSupported() {
let [target, debuggee, front] = yield initBackend(SIMPLE_CANVAS_URL);
front.setup({ reload: false });
// Attach frame scripts if in e10s to perform
// history navigation via the content
loadFrameScripts();
// 0. Perform the initial reload.
reload(target);
@ -20,6 +24,10 @@ function ifWebGLSupported() {
is(programs[0], firstProgram,
"The first programs was correctly retrieved from the cache.");
let allPrograms = yield front._getAllPrograms();
is(allPrograms.length, 1,
"Should be only one program in cache.");
// 1. Perform a simple navigation.
navigate(target, MULTIPLE_CONTEXTS_URL);
@ -32,19 +40,23 @@ function ifWebGLSupported() {
is(programs[1], thirdProgram,
"The third programs was correctly retrieved from the cache.");
let allPrograms = yield front._getAllPrograms();
is(allPrograms.length, 3,
"Should be three programs in cache.");
// 2. Perform a bfcache navigation.
yield navigateInHistory(target, "back");
let globalDestroyed = observe("inner-window-destroyed");
let globalCreated = observe("content-document-global-created");
let globalDestroyed = once(front, "global-created");
let globalCreated = once(front, "global-destroyed");
let programsLinked = once(front, "program-linked");
reload(target);
yield globalDestroyed;
let programs = yield front.getPrograms();
is(programs.length, 0,
"There should be no cached program actors yet.");
yield promise.all([programsLinked, globalDestroyed, globalCreated]);
let allPrograms = yield front._getAllPrograms();
is(allPrograms.length, 3,
"Should be 3 programs total in cache.");
yield globalCreated;
let programs = yield front.getPrograms();
is(programs.length, 1,
"There should be 1 cached program actor now.");
@ -55,17 +67,18 @@ function ifWebGLSupported() {
// 3. Perform a bfcache navigation and a page reload.
yield navigateInHistory(target, "forward");
let globalDestroyed = observe("inner-window-destroyed");
let globalCreated = observe("content-document-global-created");
let globalDestroyed = once(front, "global-created");
let globalCreated = once(front, "global-destroyed");
let programsLinked = getPrograms(front, 2);
reload(target);
yield globalDestroyed;
let programs = yield front.getPrograms();
is(programs.length, 0,
"There should be no cached program actors yet.");
yield promise.all([programsLinked, globalDestroyed, globalCreated]);
let allPrograms = yield front._getAllPrograms();
is(allPrograms.length, 3,
"Should be 3 programs total in cache.");
yield getPrograms(front, 2);
yield globalCreated;
let programs = yield front.getPrograms();
is(programs.length, 2,
"There should be 2 cached program actors now.");
@ -78,50 +91,50 @@ function ifWebGLSupported() {
function checkHighlightingInTheFirstPage(programActor) {
return Task.spawn(function() {
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
ok(true, "The corner pixel colors are correct before highlighting.");
yield programActor.highlight([0, 1, 0, 1]);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
ok(true, "The corner pixel colors are correct after highlighting.");
yield programActor.unhighlight();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 255, b: 0, a: 255 }, true);
ok(true, "The corner pixel colors are correct after unhighlighting.");
});
}
function checkHighlightingInTheSecondPage(firstProgramActor, secondProgramActor) {
return Task.spawn(function() {
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The two canvases are correctly drawn before highlighting.");
yield firstProgramActor.highlight([1, 0, 0, 1]);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The first canvas was correctly filled after highlighting.");
yield secondProgramActor.highlight([0, 1, 0, 1]);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 0, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 0, a: 255 }, true, "#canvas2");
ok(true, "The second canvas was correctly filled after highlighting.");
yield firstProgramActor.unhighlight();
yield secondProgramActor.unhighlight();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 255, b: 255, a: 255 }, true, "#canvas2");
ok(true, "The two canvases were correctly filled after unhighlighting.");
});
}

View File

@ -12,33 +12,33 @@ function ifWebGLSupported() {
let [firstProgramActor, secondProgramActor] = yield getPrograms(front, 2);
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true);
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true);
ok(true, "The corner vs. center pixel colors are correct before blackboxing.");
yield firstProgramActor.blackbox();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true);
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true);
ok(true, "The corner vs. center pixel colors are correct after blackboxing (1).");
yield firstProgramActor.unblackbox();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true);
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true);
ok(true, "The corner vs. center pixel colors are correct after unblackboxing (1).");
yield secondProgramActor.blackbox();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 255, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 64, y: 64 }, { r: 255, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true);
ok(true, "The corner vs. center pixel colors are correct after blackboxing (2).");
yield secondProgramActor.unblackbox();
yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true);
yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true);
yield ensurePixelIs(front, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true);
yield ensurePixelIs(front, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true);
ok(true, "The corner vs. center pixel colors are correct after unblackboxing (2).");
yield removeTab(target.tab);

View File

@ -0,0 +1,28 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests the `getPixel` actor method works across threads.
*/
function ifWebGLSupported() {
let [target, debuggee, front] = yield initBackend(MULTIPLE_CONTEXTS_URL);
front.setup({ reload: true });
yield getPrograms(front, 2);
let pixel = yield front.getPixel({ selector: "#canvas1", position: { x: 0, y: 0 }});
is(pixel.r, 255, "correct `r` value for first canvas.")
is(pixel.g, 255, "correct `g` value for first canvas.")
is(pixel.b, 0, "correct `b` value for first canvas.")
is(pixel.a, 255, "correct `a` value for first canvas.")
let pixel = yield front.getPixel({ selector: "#canvas2", position: { x: 0, y: 0 }});
is(pixel.r, 0, "correct `r` value for second canvas.")
is(pixel.g, 255, "correct `g` value for second canvas.")
is(pixel.b, 255, "correct `b` value for second canvas.")
is(pixel.a, 255, "correct `a` value for second canvas.")
yield removeTab(target.tab);
finish();
}

View File

@ -21,7 +21,9 @@ let { WebGLFront } = devtools.require("devtools/server/actors/webgl");
let TiltGL = devtools.require("devtools/tilt/tilt-gl");
let TargetFactory = devtools.TargetFactory;
let Toolbox = devtools.Toolbox;
let mm = null;
const FRAME_SCRIPT_UTILS_URL = "chrome://browser/content/devtools/frame-script-utils.js"
const EXAMPLE_URL = "http://example.com/browser/browser/devtools/shadereditor/test/";
const SIMPLE_CANVAS_URL = EXAMPLE_URL + "doc_simple-canvas.html";
const SHADER_ORDER_URL = EXAMPLE_URL + "doc_shader-order.html";
@ -45,6 +47,20 @@ registerCleanupFunction(() => {
Cu.forceGC();
});
/**
* Call manually in tests that use frame script utils after initializing
* the shader editor. Must be called after initializing so we can detect
* whether or not `content` is a CPOW or not. Call after init but before navigating
* to different pages, as bfcache and thus shader caching gets really strange if
* frame script attached in the middle of the test.
*/
function loadFrameScripts () {
if (Cu.isCrossProcessWrapper(content)) {
mm = gBrowser.selectedBrowser.messageManager;
mm.loadFrameScript(FRAME_SCRIPT_UTILS_URL, false);
}
}
function addTab(aUrl, aWindow) {
info("Adding tab: " + aUrl);
@ -162,12 +178,6 @@ function observe(aNotificationName, aOwnsWeak = false) {
return deferred.promise;
}
function waitForFrame(aDebuggee) {
let deferred = promise.defer();
aDebuggee.requestAnimationFrame(deferred.resolve);
return deferred.promise;
}
function isApprox(aFirst, aSecond, aMargin = 1) {
return Math.abs(aFirst - aSecond) <= aMargin;
}
@ -179,51 +189,34 @@ function isApproxColor(aFirst, aSecond, aMargin) {
isApprox(aFirst.a, aSecond.a, aMargin);
}
function getPixels(aDebuggee, aSelector = "canvas") {
let canvas = aDebuggee.document.querySelector(aSelector);
let gl = canvas.getContext("webgl");
function ensurePixelIs (aFront, aPosition, aColor, aWaitFlag = false, aSelector = "canvas") {
return Task.spawn(function*() {
let pixel = yield aFront.getPixel({ selector: aSelector, position: aPosition });
if (isApproxColor(pixel, aColor)) {
ok(true, "Expected pixel is shown at: " + aPosition.toSource());
return;
}
let { width, height } = canvas;
let buffer = new aDebuggee.Uint8Array(width * height * 4);
gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buffer);
if (aWaitFlag) {
yield aFront.waitForFrame();
return ensurePixelIs(aFront, aPosition, aColor, aWaitFlag, aSelector);
}
info("Retrieved pixels: " + width + "x" + height);
return [buffer, width, height];
}
function getPixel(aDebuggee, aPosition, aSelector = "canvas") {
let canvas = aDebuggee.document.querySelector(aSelector);
let gl = canvas.getContext("webgl");
let { width, height } = canvas;
let { x, y } = aPosition;
let buffer = new aDebuggee.Uint8Array(4);
gl.readPixels(x, height - y - 1, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, buffer);
let pixel = { r: buffer[0], g: buffer[1], b: buffer[2], a: buffer[3] };
info("Retrieved pixel: " + pixel.toSource() + " at " + aPosition.toSource());
return pixel;
}
function ensurePixelIs(aDebuggee, aPosition, aColor, aWaitFlag = false, aSelector = "canvas") {
let pixel = getPixel(aDebuggee, aPosition, aSelector);
if (isApproxColor(pixel, aColor)) {
ok(true, "Expected pixel is shown at: " + aPosition.toSource());
return promise.resolve(null);
}
if (aWaitFlag) {
return Task.spawn(function() {
yield waitForFrame(aDebuggee);
yield ensurePixelIs(aDebuggee, aPosition, aColor, aWaitFlag, aSelector);
});
}
ok(false, "Expected pixel was not already shown at: " + aPosition.toSource());
return promise.reject(null);
ok(false, "Expected pixel was not already shown at: " + aPosition.toSource());
throw new Error("Expected pixel was not already shown at: " + aPosition.toSource());
});
}
function navigateInHistory(aTarget, aDirection, aWaitForTargetEvent = "navigate") {
executeSoon(() => content.history[aDirection]());
if (Cu.isCrossProcessWrapper(content)) {
if (!mm) {
throw new Error("`loadFrameScripts()` must be called before attempting to navigate in e10s.");
}
mm.sendAsyncMessage("devtools:test:history", { direction: aDirection });
}
else {
executeSoon(() => content.history[aDirection]());
}
return once(aTarget, aWaitForTargetEvent);
}

View File

@ -2,12 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.search.autocomplete;
"use strict";
/**
* Allows rows to pass a search event to the parent fragment.
*/
public interface AcceptsSearchQuery {
void onSearch(String s);
}
addMessageListener("devtools:test:history", function ({ data }) {
content.history[data.direction]();
});

View File

@ -38,6 +38,8 @@ support-files =
sourcemaps.html
test_private.css
test_private.html
doc_uncached.css
doc_uncached.html
[browser_styleeditor_autocomplete.js]
[browser_styleeditor_bug_740541_iframes.js]
@ -46,6 +48,7 @@ skip-if = os == "linux" || "mac" # bug 949355
[browser_styleeditor_bug_870339.js]
[browser_styleeditor_cmd_edit.js]
[browser_styleeditor_enabled.js]
[browser_styleeditor_fetch-from-cache.js]
[browser_styleeditor_filesave.js]
[browser_styleeditor_import.js]
[browser_styleeditor_import_rule.js]

View File

@ -0,0 +1,40 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// A test to ensure Style Editor doesn't bybass cache when loading style sheet
// contents (bug 978688).
const TEST_URL = TEST_BASE_HTTP + "doc_uncached.html";
let test = asyncTest(function() {
waitForExplicitFinish();
info("Opening netmonitor");
let tab = yield addTab("about:blank");
let target = TargetFactory.forTab(tab);
let toolbox = yield gDevTools.showToolbox(target, "netmonitor");
let netmonitor = toolbox.getPanel("netmonitor");
info("Navigating to test page");
content.location = TEST_URL;
info("Opening Style Editor");
let styleeditor = yield toolbox.selectTool("styleeditor");
info("Waiting for an editor to be selected.");
yield styleeditor.UI.once("editor-selected");
info("Checking Netmonitor contents.");
let requestsForCss = 0;
for (let item of netmonitor._view.RequestsMenu) {
if (item.attachment.url.endsWith("doc_uncached.css")) {
requestsForCss++;
}
}
is(requestsForCss, 1,
"Got one request for doc_uncached.css after Style Editor was loaded.");
});

View File

@ -0,0 +1,16 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* ☺ */
body {
background: white;
}
div {
font-size: 4em;
}
div > span {
text-decoration: underline;
}

View File

@ -0,0 +1,10 @@
<!doctype html>
<html>
<head>
<title>uncached testcase</title>
<link rel="stylesheet" charset="UTF-8" type="text/css" media="screen" href="doc_uncached.css"/>
</head>
<body>
<div>uncached <span>testcase</span></div>
</body>
</html>

View File

@ -33,6 +33,26 @@ function asyncTest(generator) {
return () => Task.spawn(generator).then(null, ok.bind(null, false)).then(finish);
}
/**
* Add a new test tab in the browser and load the given url.
* @param {String} url The url to be loaded in the new tab
* @return a promise that resolves to the tab object when the url is loaded
*/
function addTab(url) {
info("Adding a new tab with URL: '" + url + "'");
let def = promise.defer();
let tab = gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function onload() {
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
info("URL '" + url + "' loading complete");
def.resolve(tab);
}, true);
content.location = url;
return def.promise;
}
function cleanup()
{
gPanelWindow = null;

View File

@ -2277,10 +2277,6 @@ chatbox {
%include ../shared/contextmenu.inc.css
#context-navigation {
padding-top: 4px;
}
#context-navigation > .menuitem-iconic > .menu-iconic-left {
visibility: visible;
/* override toolkit/themes/linux/global/menu.css */

View File

@ -7165,6 +7165,7 @@ var SearchEngines = {
name = title.value + " " + i;
Services.search.addEngineWithDetails(name, favicon, null, null, method, formURL);
NativeWindow.toast.show(Strings.browser.formatStringFromName("alertSearchEngineAddedToast", [name], 1), "long");
let engine = Services.search.getEngineByName(name);
engine.wrappedJSObject._queryCharset = charset;
for (let i = 0; i < formData.length; ++i) {

View File

@ -8,7 +8,9 @@ const Cc = Components.classes;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Prompt.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Prompt",
"resource://gre/modules/Prompt.jsm");
function ColorPicker() {
}
@ -19,8 +21,10 @@ ColorPicker.prototype = {
_title: "",
get strings() {
delete this.strings;
return this.strings = Services.strings.createBundle("chrome://browser/locale/browser.properties");
if (!this._strings) {
this._strings = Services.strings.createBundle("chrome://browser/locale/browser.properties");
}
return this._strings;
},
init: function(aParent, aTitle, aInitial) {

View File

@ -19,8 +19,10 @@ ContentDispatchChooser.prototype =
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentDispatchChooser]),
get protoSvc() {
delete this.protoSvc;
return this.protoSvc = Cc["@mozilla.org/uriloader/external-protocol-service;1"].getService(Ci.nsIExternalProtocolService);
if (!this._protoSvc) {
this._protoSvc = Cc["@mozilla.org/uriloader/external-protocol-service;1"].getService(Ci.nsIExternalProtocolService);
}
return this._protoSvc;
},
_getChromeWin: function getChromeWin() {

View File

@ -11,7 +11,6 @@ const URI_GENERIC_ICON_DOWNLOAD = "drawable://alert_download";
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/HelperApps.jsm");
Cu.import("resource://gre/modules/Prompt.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");

View File

@ -8,7 +8,9 @@ const Cc = Components.classes;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Prompt.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Prompt",
"resource://gre/modules/Prompt.jsm");
// -----------------------------------------------------------------------
// NSS Dialog Service

View File

@ -61,8 +61,10 @@ function PaymentUI() {
PaymentUI.prototype = {
get bundle() {
delete this.bundle;
return this.bundle = Services.strings.createBundle("chrome://browser/locale/payments.properties");
if (!this._bundle) {
this._bundle = Services.strings.createBundle("chrome://browser/locale/payments.properties");
}
return this._bundle;
},
confirmPaymentRequest: function confirmPaymentRequest(aRequestId,

View File

@ -8,7 +8,9 @@ const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Prompt.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Prompt",
"resource://gre/modules/Prompt.jsm");
var gPromptService = null;

View File

@ -8,7 +8,9 @@ const { classes: Cc, interfaces: Ci, manager: Cm, utils: Cu, results: Cr } = Com
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Prompt.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Prompt",
"resource://gre/modules/Prompt.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "sendMessageToJava",
"resource://gre/modules/Messaging.jsm");

View File

@ -7,8 +7,12 @@ const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Prompt.jsm");
Cu.import("resource://gre/modules/Messaging.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Prompt",
"resource://gre/modules/Prompt.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "sendMessageToJava",
"resource://gre/modules/Messaging.jsm");
XPCOMUtils.defineLazyGetter(this, "ContentAreaUtils", function() {
let ContentAreaUtils = {};

View File

@ -0,0 +1,35 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.search;
import android.graphics.Rect;
/**
* Allows fragments to pass a search event to the main activity.
*/
public interface AcceptsSearchQuery {
/**
* Starts a search.
*
* @param query
*/
void onSearch(String query);
/**
* Starts a search and animates a suggestion.
*
* @param query
* @param suggestionAnimation
*/
void onSearch(String query, SuggestionAnimation suggestionAnimation);
/**
* Interface to specify search suggestion animation details.
*/
public interface SuggestionAnimation {
public Rect getStartBounds();
public void onAnimationEnd();
}
}

View File

@ -6,13 +6,20 @@ package org.mozilla.search;
import android.content.AsyncQueryHandler;
import android.content.ContentValues;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.TextView;
import com.nineoldandroids.animation.Animator;
import com.nineoldandroids.animation.AnimatorSet;
import com.nineoldandroids.animation.ObjectAnimator;
import org.mozilla.gecko.db.BrowserContract.SearchHistory;
import org.mozilla.search.autocomplete.AcceptsSearchQuery;
import org.mozilla.search.autocomplete.SearchFragment;
/**
@ -34,18 +41,43 @@ public class MainActivity extends FragmentActivity implements AcceptsSearchQuery
private State state = State.START;
private AsyncQueryHandler queryHandler;
private static final int SUGGESTION_TRANSITION_DURATION = 300;
private static final Interpolator SUGGESTION_TRANSITION_INTERPOLATOR =
new AccelerateDecelerateInterpolator();
// Views used for suggestion animation.
private TextView animationText;
private View animationCard;
// Suggestion card background padding.
private int cardPaddingX;
private int cardPaddingY;
// Vertical translation of suggestion animation text to align with the search bar.
private int textEndY;
@Override
protected void onCreate(Bundle stateBundle) {
super.onCreate(stateBundle);
setContentView(R.layout.search_activity_main);
queryHandler = new AsyncQueryHandler(getContentResolver()) {};
animationText = (TextView) findViewById(R.id.animation_text);
animationCard = findViewById(R.id.animation_card);
cardPaddingX = getResources().getDimensionPixelSize(R.dimen.card_background_padding_x);
cardPaddingY = getResources().getDimensionPixelSize(R.dimen.card_background_padding_y);
textEndY = getResources().getDimensionPixelSize(R.dimen.animation_text_translation_y);
}
@Override
protected void onDestroy() {
super.onDestroy();
queryHandler = null;
animationText = null;
animationCard = null;
}
@Override
@ -57,14 +89,98 @@ public class MainActivity extends FragmentActivity implements AcceptsSearchQuery
@Override
public void onSearch(String query) {
startPostsearch();
onSearch(query, null);
}
@Override
public void onSearch(String query, SuggestionAnimation suggestionAnimation) {
storeQuery(query);
((PostSearchFragment) getSupportFragmentManager().findFragmentById(R.id.postsearch))
.setUrl("https://search.yahoo.com/search?p=" + Uri.encode(query));
.startSearch(query);
((SearchFragment) getSupportFragmentManager().findFragmentById(R.id.search_fragment))
.setSearchTerm(query);
if (suggestionAnimation != null) {
// Animate the suggestion card if start bounds are specified.
animateSuggestion(query, suggestionAnimation);
} else {
// Otherwise immediately switch to the results view.
startPostsearch();
}
}
/**
* Animates search suggestion to search bar. This animation has 2 main parts:
*
* 1) Vertically translate query text from suggestion card to search bar.
* 2) Expand suggestion card to fill the results view area.
*
* @param query
* @param suggestionAnimation
*/
private void animateSuggestion(final String query, final SuggestionAnimation suggestionAnimation) {
animationText.setText(query);
final Rect startBounds = suggestionAnimation.getStartBounds();
final Rect endBounds = new Rect();
animationCard.getGlobalVisibleRect(endBounds, null);
// Vertically translate the animated card to align with the start bounds.
final float cardStartY = startBounds.centerY() - endBounds.centerY();
// Account for card background padding when calculating start scale.
final float startScaleX = (float) (startBounds.width() - cardPaddingX * 2) / endBounds.width();
final float startScaleY = (float) (startBounds.height() - cardPaddingY * 2) / endBounds.height();
animationText.setVisibility(View.VISIBLE);
animationCard.setVisibility(View.VISIBLE);
final AnimatorSet set = new AnimatorSet();
set.playTogether(
ObjectAnimator.ofFloat(animationText, "translationY", startBounds.top, textEndY),
ObjectAnimator.ofFloat(animationCard, "translationY", cardStartY, 0),
ObjectAnimator.ofFloat(animationCard, "alpha", 0.5f, 1),
ObjectAnimator.ofFloat(animationCard, "scaleX", startScaleX, 1f),
ObjectAnimator.ofFloat(animationCard, "scaleY", startScaleY, 1f)
);
set.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
// This is crappy, but right now we need to make sure we call this before
// setSearchTerm so that we don't kick off a suggestion request.
suggestionAnimation.onAnimationEnd();
// TODO: Find a way to do this without needing to access SearchFragment.
final SearchFragment searchFragment = ((SearchFragment) getSupportFragmentManager().findFragmentById(R.id.search_fragment));
searchFragment.setSearchTerm(query);
startPostsearch();
// We need to manually clear the animation for the views to be hidden on gingerbread.
animationText.clearAnimation();
animationCard.clearAnimation();
animationText.setVisibility(View.INVISIBLE);
animationCard.setVisibility(View.INVISIBLE);
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
set.setDuration(SUGGESTION_TRANSITION_DURATION);
set.setInterpolator(SUGGESTION_TRANSITION_INTERPOLATOR);
set.start();
}
private void startPresearch() {

View File

@ -9,6 +9,7 @@ import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -72,8 +73,12 @@ public class PostSearchFragment extends Fragment {
setUrl(Constants.YAHOO_WEB_SEARCH_BASE_URL + Uri.encode(query));
}
public void setUrl(String url) {
webview.loadUrl(url);
private void setUrl(String url) {
// Only load URLs if they're different than what's already
// loaded in the webview.
if (!TextUtils.equals(webview.getUrl(), url)) {
webview.loadUrl(url);
}
}
/**
@ -98,7 +103,7 @@ public class PostSearchFragment extends Fragment {
/**
* A custom WebChromeClient that allows us to inject CSS into
* the head of the HTML.
* the head of the HTML and to monitor pageload progress.
*
* We use the WebChromeClient because it provides a hook to the titleReceived
* event. Once the title is available, the page will have started parsing the

View File

@ -7,6 +7,7 @@ package org.mozilla.search;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
@ -21,8 +22,7 @@ import android.widget.AdapterView;
import android.widget.ListView;
import org.mozilla.gecko.db.BrowserContract.SearchHistory;
import org.mozilla.search.autocomplete.AcceptsSearchQuery;
import org.mozilla.search.AcceptsSearchQuery.SuggestionAnimation;
/**
* This fragment is responsible for managing the card stream.
@ -91,7 +91,19 @@ public class PreSearchFragment extends Fragment {
}
final String query = c.getString(c.getColumnIndexOrThrow(SearchHistory.QUERY));
if (!TextUtils.isEmpty(query)) {
searchListener.onSearch(query);
final Rect startBounds = new Rect();
view.getGlobalVisibleRect(startBounds);
searchListener.onSearch(query, new SuggestionAnimation() {
@Override
public Rect getStartBounds() {
return startBounds;
}
@Override
public void onAnimationEnd() {
}
});
}
}
});

View File

@ -6,6 +6,7 @@ package org.mozilla.search.autocomplete;
import android.app.Activity;
import android.content.Context;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
@ -19,6 +20,8 @@ import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import org.mozilla.search.AcceptsSearchQuery;
import org.mozilla.search.AcceptsSearchQuery.SuggestionAnimation;
import org.mozilla.search.R;
import java.util.ArrayList;
@ -147,8 +150,20 @@ public class SearchFragment extends Fragment implements AcceptsJumpTaps {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
final Suggestion suggestion = (Suggestion) suggestionDropdown.getItemAtPosition(position);
transitionToWaiting();
searchListener.onSearch(suggestion.value);
final Rect startBounds = new Rect();
view.getGlobalVisibleRect(startBounds);
searchListener.onSearch(suggestion.value, new SuggestionAnimation() {
@Override
public Rect getStartBounds() {
return startBounds;
}
@Override
public void onAnimationEnd() {
transitionToWaiting();
}
});
}
});

View File

@ -13,7 +13,7 @@
android:inputType="textNoSuggestions|textVisiblePassword"
android:drawableLeft="@drawable/search_icon_inactive"
android:drawablePadding="5dp"
android:textSize="16sp"
android:textSize="@dimen/query_text_size"
android:background="@drawable/edit_text_background"
android:focusable="false"
android:focusableInTouchMode="false"

View File

@ -15,18 +15,40 @@
android:name="org.mozilla.search.PostSearchFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/search_bar_height"/>
android:layout_marginTop="@dimen/search_bar_height"
android:layout_gravity="top"/>
<fragment
android:id="@+id/presearch"
android:name="org.mozilla.search.PreSearchFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/search_bar_height"/>
android:layout_marginTop="@dimen/search_bar_height"
android:layout_gravity="top"/>
<fragment
android:id="@+id/search_fragment"
android:name="org.mozilla.search.autocomplete.SearchFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
android:layout_gravity="top"/>
<View
android:id="@+id/animation_card"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/search_bar_height"
android:background="@color/card_background"
android:visibility="invisible"
android:layout_gravity="top"/>
<TextView
android:id="@+id/animation_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/card_padding_x"
android:textSize="@dimen/query_text_size"
android:visibility="invisible"
android:layout_gravity="top"/>
</merge>

View File

@ -20,7 +20,7 @@
android:layout_height="wrap_content"
android:paddingTop="@dimen/card_padding_y"
android:paddingBottom="@dimen/card_padding_y"
android:textSize="16sp"/>
android:textSize="@dimen/query_text_size"/>
<Button
android:id="@+id/auto_complete_row_jump_button"

View File

@ -12,4 +12,4 @@
android:paddingBottom="@dimen/card_padding_y"
android:paddingLeft="@dimen/card_padding_x"
android:paddingRight="@dimen/card_padding_x"
android:textSize="16sp"/>
android:textSize="@dimen/query_text_size"/>

View File

@ -21,7 +21,7 @@
android:background="@android:color/transparent"
android:padding="15dp"
android:src="@drawable/ic_action_overflow"
android:text="@string/search_settings_icon"
android:layout_gravity="bottom|right"/>
android:layout_gravity="bottom|right"
android:contentDescription="@string/search_pref_button_content_description"/>
</FrameLayout>

View File

@ -8,6 +8,12 @@
<dimen name="search_bar_height">65dp</dimen>
<dimen name="progress_bar_height">3dp</dimen>
<!-- Vertical translation of suggestion animation text to align with search bar text -->
<dimen name="animation_text_translation_y">21dp</dimen>
<!-- Size of the text for query input and suggestions -->
<dimen name="query_text_size">16sp</dimen>
<!-- We use background padding to create space around the cards -->
<dimen name="card_background_padding_x">15dp</dimen>
<dimen name="card_background_padding_y">3dp</dimen>

View File

@ -5,8 +5,8 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
search_activity_sources = [
'java/org/mozilla/search/AcceptsSearchQuery.java',
'java/org/mozilla/search/autocomplete/AcceptsJumpTaps.java',
'java/org/mozilla/search/autocomplete/AcceptsSearchQuery.java',
'java/org/mozilla/search/autocomplete/AutoCompleteAdapter.java',
'java/org/mozilla/search/autocomplete/ClearableEditText.java',
'java/org/mozilla/search/autocomplete/SearchFragment.java',

View File

@ -3,7 +3,6 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!ENTITY search_jump_arrow '&#8598;'>
<!ENTITY search_settings_icon '&#8942;'>
<!ENTITY search_app_name 'Firefox Search'>
<!ENTITY search_for_something 'Search for something'>
@ -12,3 +11,4 @@
<!ENTITY search_pref_clear_history_confirmation 'History cleared'>
<!ENTITY search_pref_clear_history_dialog_message 'Delete all search history from this device?'>
<!ENTITY search_pref_clear_history_title 'Clear search history'>
<!ENTITY search_pref_button_content_description 'Settings'>

View File

@ -1,5 +1,4 @@
<string name="search_jump_arrow">&search_jump_arrow;</string>
<string name="search_settings_icon">&search_settings_icon;</string>
<string name="search_app_name">&search_app_name;</string>
<string name="search_for_something">&search_for_something;</string>
@ -8,3 +7,4 @@
<string name="search_pref_clear_history_confirmation">&search_pref_clear_history_confirmation;</string>
<string name="search_pref_clear_history_dialog_message">&search_pref_clear_history_dialog_message;</string>
<string name="search_pref_clear_history_title">&search_pref_clear_history_title;</string>
<string name="search_pref_button_content_description">&search_pref_button_content_description;</string>

View File

@ -10,6 +10,7 @@ this.EXPORTED_SYMBOLS = [
"AppInfoProvider",
"CrashesProvider",
"HealthReportProvider",
"HotfixProvider",
"Metrics",
"PlacesProvider",
"ProfileMetadataProvider",

Some files were not shown because too many files have changed in this diff Show More