Bug 1001090 - Part 5: Fix errors in tests throughout the tree. (r=robcee,gavin)

This commit is contained in:
Shu-yu Guo 2014-09-15 16:30:47 -07:00
parent 4a62c95f46
commit 9baa236495
233 changed files with 633 additions and 631 deletions

View File

@ -42,7 +42,7 @@ add_task(function* test_switchtab_override() {
ok(/moz-action:switchtab/.test(gURLBar.value), "switch to tab entry found"); ok(/moz-action:switchtab/.test(gURLBar.value), "switch to tab entry found");
info("Override switch-to-tab"); info("Override switch-to-tab");
let deferred = Promise.defer(); deferred = Promise.defer();
// In case of failure this would switch tab. // In case of failure this would switch tab.
let onTabSelect = event => { let onTabSelect = event => {
deferred.reject(new Error("Should have overridden switch to tab")); deferred.reject(new Error("Should have overridden switch to tab"));

View File

@ -102,7 +102,7 @@ function get_test_function_for_localhost_with_hostname(hostName, isPrivate) {
browser.removeTab(tab); browser.removeTab(tab);
// Now try again with the pref set. // Now try again with the pref set.
let tab = browser.selectedTab = browser.addTab(); tab = browser.selectedTab = browser.addTab();
// In a private window, the notification should appear again. // In a private window, the notification should appear again.
yield* runURLBarSearchTest(hostName, isPrivate, isPrivate, win); yield* runURLBarSearchTest(hostName, isPrivate, isPrivate, win);
browser.removeTab(tab); browser.removeTab(tab);

View File

@ -49,7 +49,7 @@ function runTests() {
// Test with enhanced = true // Test with enhanced = true
NewTabUtils.allPages.enhanced = true; NewTabUtils.allPages.enhanced = true;
yield addNewTabPageTab(); yield addNewTabPageTab();
let {type, enhanced, title} = getData(0); ({type, enhanced, title} = getData(0));
is(type, "organic", "directory link is still organic"); is(type, "organic", "directory link is still organic");
isnot(enhanced, "", "directory link still has enhanced image"); isnot(enhanced, "", "directory link still has enhanced image");
is(title, "title"); is(title, "title");
@ -59,7 +59,7 @@ function runTests() {
// Test with a pinned link // Test with a pinned link
setPinnedLinks("-1"); setPinnedLinks("-1");
yield addNewTabPageTab(); yield addNewTabPageTab();
let {type, enhanced, title} = getData(0); ({type, enhanced, title} = getData(0));
is(type, "enhanced", "pinned history link is enhanced"); is(type, "enhanced", "pinned history link is enhanced");
isnot(enhanced, "", "pinned history link has enhanced image"); isnot(enhanced, "", "pinned history link has enhanced image");
is(title, "title"); is(title, "title");
@ -69,7 +69,7 @@ function runTests() {
// Test pinned link with enhanced = false // Test pinned link with enhanced = false
NewTabUtils.allPages.enhanced = false; NewTabUtils.allPages.enhanced = false;
yield addNewTabPageTab(); yield addNewTabPageTab();
let {type, enhanced, title} = getData(0); ({type, enhanced, title} = getData(0));
isnot(type, "enhanced", "history link is not enhanced"); isnot(type, "enhanced", "history link is not enhanced");
is(enhanced, "", "history link has no enhanced image"); is(enhanced, "", "history link has no enhanced image");
is(title, "site#-1"); is(title, "site#-1");

View File

@ -70,7 +70,7 @@ function testPart1a() {
let objLoadingContent = test.QueryInterface(Ci.nsIObjectLoadingContent); let objLoadingContent = test.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "part 1a: Test plugin should not be activated"); ok(!objLoadingContent.activated, "part 1a: Test plugin should not be activated");
let secondtest = gTestBrowser.contentDocument.getElementById("secondtestA"); let secondtest = gTestBrowser.contentDocument.getElementById("secondtestA");
let objLoadingContent = secondtest.QueryInterface(Ci.nsIObjectLoadingContent); objLoadingContent = secondtest.QueryInterface(Ci.nsIObjectLoadingContent);
ok(objLoadingContent.activated, "part 1a: Second Test plugin should be activated"); ok(objLoadingContent.activated, "part 1a: Second Test plugin should be activated");
doOnOpenPageInfo(testPart1b); doOnOpenPageInfo(testPart1b);

View File

@ -74,7 +74,7 @@ add_task(function() {
yield waitForCondition(() => navbar.hasAttribute("overflowing")); yield waitForCondition(() => navbar.hasAttribute("overflowing"));
ok(navbar.hasAttribute("overflowing"), "Should have an overflowing toolbar."); ok(navbar.hasAttribute("overflowing"), "Should have an overflowing toolbar.");
let homeButtonPlacement = CustomizableUI.getPlacementOfWidget("home-button"); homeButtonPlacement = CustomizableUI.getPlacementOfWidget("home-button");
ok(homeButtonPlacement, "Home button should still have a placement"); ok(homeButtonPlacement, "Home button should still have a placement");
is(homeButtonPlacement && homeButtonPlacement.area, "nav-bar", "Home button should be back in the navbar now"); is(homeButtonPlacement && homeButtonPlacement.area, "nav-bar", "Home button should be back in the navbar now");

View File

@ -34,7 +34,7 @@ add_task(function() {
assertAreaPlacements(kLazyAreaId, [], "Placements should no longer include widget."); assertAreaPlacements(kLazyAreaId, [], "Placements should no longer include widget.");
is(btn.parentNode.id, gNavBar.customizationTarget.id, is(btn.parentNode.id, gNavBar.customizationTarget.id,
"Button shouldn't actually have moved as it's not removable"); "Button shouldn't actually have moved as it's not removable");
let btn = document.getElementById(kButtonId); btn = document.getElementById(kButtonId);
if (btn) btn.remove(); if (btn) btn.remove();
CustomizableUI.removeWidgetFromArea(kButtonId); CustomizableUI.removeWidgetFromArea(kButtonId);
CustomizableUI.unregisterArea(kLazyAreaId); CustomizableUI.unregisterArea(kLazyAreaId);

View File

@ -12,7 +12,7 @@ add_task(function() {
ok(!CustomizableUI.inDefaultState, "Making the bookmarks toolbar visible takes it out of the default state"); ok(!CustomizableUI.inDefaultState, "Making the bookmarks toolbar visible takes it out of the default state");
let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR); let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
let personalbar = document.getElementById(CustomizableUI.AREA_BOOKMARKS); personalbar = document.getElementById(CustomizableUI.AREA_BOOKMARKS);
let navbarCurrentset = navbar.getAttribute("currentset") || navbar.currentSet; let navbarCurrentset = navbar.getAttribute("currentset") || navbar.currentSet;
let personalbarCurrentset = personalbar.getAttribute("currentset") || personalbar.currentSet; let personalbarCurrentset = personalbar.getAttribute("currentset") || personalbar.currentSet;

View File

@ -89,7 +89,7 @@ add_task(function() {
let hiddenPanelPromise = promiseOverflowHidden(window); let hiddenPanelPromise = promiseOverflowHidden(window);
EventUtils.synthesizeKey("VK_ESCAPE", {}); EventUtils.synthesizeKey("VK_ESCAPE", {});
yield hiddenPanelPromise; yield hiddenPanelPromise;
let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR); navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
window.resizeTo(this.originalWindowWidth, window.outerHeight); window.resizeTo(this.originalWindowWidth, window.outerHeight);
yield waitForCondition(() => !navbar.hasAttribute("overflowing")); yield waitForCondition(() => !navbar.hasAttribute("overflowing"));
ok(!navbar.hasAttribute("overflowing"), "Should not have an overflowing toolbar."); ok(!navbar.hasAttribute("overflowing"), "Should not have an overflowing toolbar.");

View File

@ -35,7 +35,7 @@ add_task(function() {
let spec = {id: kUnregisterAreaTestWidget, type: 'button', removable: true, let spec = {id: kUnregisterAreaTestWidget, type: 'button', removable: true,
label: "areaType test", tooltiptext: "areaType test"}; label: "areaType test", tooltiptext: "areaType test"};
CustomizableUI.createWidget(spec); CustomizableUI.createWidget(spec);
let toolbarNode = createToolbarWithPlacements(kToolbarName, [kUnregisterAreaTestWidget]); toolbarNode = createToolbarWithPlacements(kToolbarName, [kUnregisterAreaTestWidget]);
CustomizableUI.unregisterArea(kToolbarName); CustomizableUI.unregisterArea(kToolbarName);
toolbarNode.remove(); toolbarNode.remove();
w = CustomizableUI.getWidget(spec.id); w = CustomizableUI.getWidget(spec.id);

View File

@ -31,7 +31,7 @@ add_task(function() {
isnot(characterEncoding.getAttribute("auto-hyphens"), "off", isnot(characterEncoding.getAttribute("auto-hyphens"), "off",
"Hyphens should not be disabled if the ­ character is not present in the label"); "Hyphens should not be disabled if the ­ character is not present in the label");
multilineText = document.getAnonymousElementByAttribute(characterEncoding, "class", "toolbarbutton-multiline-text"); multilineText = document.getAnonymousElementByAttribute(characterEncoding, "class", "toolbarbutton-multiline-text");
let multilineTextCS = getComputedStyle(multilineText); multilineTextCS = getComputedStyle(multilineText);
is(multilineTextCS.MozHyphens, "auto", "-moz-hyphens should be set to auto by default.") is(multilineTextCS.MozHyphens, "auto", "-moz-hyphens should be set to auto by default.")
hiddenPanelPromise = promisePanelHidden(window); hiddenPanelPromise = promisePanelHidden(window);
@ -48,8 +48,8 @@ add_task(function() {
gCustomizeMode.addToPanel(characterEncoding); gCustomizeMode.addToPanel(characterEncoding);
is(characterEncoding.getAttribute("auto-hyphens"), "off", is(characterEncoding.getAttribute("auto-hyphens"), "off",
"Hyphens should be disabled if the ­ character is present in the label in customization mode"); "Hyphens should be disabled if the ­ character is present in the label in customization mode");
let multilineText = document.getAnonymousElementByAttribute(characterEncoding, "class", "toolbarbutton-multiline-text"); multilineText = document.getAnonymousElementByAttribute(characterEncoding, "class", "toolbarbutton-multiline-text");
let multilineTextCS = getComputedStyle(multilineText); multilineTextCS = getComputedStyle(multilineText);
is(multilineTextCS.MozHyphens, "manual", "-moz-hyphens should be set to manual when the ­ character is present in customization mode.") is(multilineTextCS.MozHyphens, "manual", "-moz-hyphens should be set to manual when the ­ character is present in customization mode.")
yield endCustomizing(); yield endCustomizing();

View File

@ -45,7 +45,7 @@ add_task(function* testOpenCloseWindow() {
is(newWindow, closedWindow, "Closed window should match previously opened window"); is(newWindow, closedWindow, "Closed window should match previously opened window");
CustomizableUI.removeListener(closeListener); CustomizableUI.removeListener(closeListener);
let windows = []; windows = [];
for (let win of CustomizableUI.windows) for (let win of CustomizableUI.windows)
windows.push(win); windows.push(win);
is(windows.length, 1, "Should have one customizable window"); is(windows.length, 1, "Should have one customizable window");

View File

@ -48,7 +48,7 @@ add_task(function() {
yield tabLoadPromise; yield tabLoadPromise;
yield PanelUI.show(); yield PanelUI.show();
charEncodingButton.click(); charEncodingButton.click();
let checkedButtons = characterEncodingView.querySelectorAll("toolbarbutton[checked='true']"); checkedButtons = characterEncodingView.querySelectorAll("toolbarbutton[checked='true']");
is(checkedButtons[0].getAttribute("label"), "Unicode", "The encoding was reset to Unicode"); is(checkedButtons[0].getAttribute("label"), "Unicode", "The encoding was reset to Unicode");
}); });

View File

@ -50,13 +50,13 @@ function checkRestoredPresence(aWidgetID, aLegacy) {
CustomizableUI.unregisterArea(testBar.id); CustomizableUI.unregisterArea(testBar.id);
testBar.remove(); testBar.remove();
let placement = CustomizableUI.getPlacementOfWidget(aWidgetID); placement = CustomizableUI.getPlacementOfWidget(aWidgetID);
is(placement, null, "Expected " + aWidgetID + " to be in the palette"); is(placement, null, "Expected " + aWidgetID + " to be in the palette");
testBar = createTestBar(aLegacy); testBar = createTestBar(aLegacy);
yield startCustomizing(); yield startCustomizing();
let placement = CustomizableUI.getPlacementOfWidget(aWidgetID); placement = CustomizableUI.getPlacementOfWidget(aWidgetID);
is(placement.area, kTestBarID, is(placement.area, kTestBarID,
"Expected " + aWidgetID + " to be in the test toolbar"); "Expected " + aWidgetID + " to be in the test toolbar");
yield endCustomizing(); yield endCustomizing();

View File

@ -327,7 +327,7 @@ add_task(function* test_CardDavImport() {
}); });
Assert.equal(error.message, "401 Auth Failure", "Auth error should propagate"); Assert.equal(error.message, "401 Auth Failure", "Auth error should propagate");
let error = yield new Promise ((resolve, reject) => { error = yield new Promise ((resolve, reject) => {
info("Initiating import"); info("Initiating import");
importer.startImport({ importer.startImport({
"host": "example.invalid", "host": "example.invalid",
@ -342,7 +342,7 @@ add_task(function* test_CardDavImport() {
mockDb.getByServiceId = function(serviceId, callback) { mockDb.getByServiceId = function(serviceId, callback) {
callback(new Error("getByServiceId failed")); callback(new Error("getByServiceId failed"));
}; };
let error = yield new Promise ((resolve, reject) => { error = yield new Promise ((resolve, reject) => {
info("Initiating import"); info("Initiating import");
importer.startImport({ importer.startImport({
"host": "example.com", "host": "example.com",
@ -354,7 +354,7 @@ add_task(function* test_CardDavImport() {
Assert.equal(error.message, "getByServiceId failed", "Database error should propagate"); Assert.equal(error.message, "getByServiceId failed", "Database error should propagate");
mockDb.getByServiceId = tmp; mockDb.getByServiceId = tmp;
let error = yield new Promise ((resolve, reject) => { error = yield new Promise ((resolve, reject) => {
info("Initiating import"); info("Initiating import");
importer.startImport({ importer.startImport({
"host": "example.com", "host": "example.com",

View File

@ -193,7 +193,7 @@ add_task(function* () {
yield deferred.promise; yield deferred.promise;
info("Get a single contact by id."); info("Get a single contact by id.");
let deferred = Promise.defer(); deferred = Promise.defer();
LoopContacts.getByServiceId(2, (err, contact) => { LoopContacts.getByServiceId(2, (err, contact) => {
Assert.ok(!err, "There shouldn't be an error"); Assert.ok(!err, "There shouldn't be an error");
compareContacts(contact, kContacts[1]); compareContacts(contact, kContacts[1]);
@ -202,7 +202,7 @@ add_task(function* () {
yield deferred.promise; yield deferred.promise;
info("Get a couple of contacts."); info("Get a couple of contacts.");
let deferred = Promise.defer(); deferred = Promise.defer();
let toRetrieve = [contacts[0], contacts[2], contacts[3]]; let toRetrieve = [contacts[0], contacts[2], contacts[3]];
LoopContacts.getMany(toRetrieve.map(contact => contact._guid), (err, result) => { LoopContacts.getMany(toRetrieve.map(contact => contact._guid), (err, result) => {
Assert.ok(!err, "There shouldn't be an error"); Assert.ok(!err, "There shouldn't be an error");

View File

@ -46,7 +46,7 @@ add_task(function remove_smart_bookmark_and_restore() {
PlacesUtils.bookmarks.removeItem(smartBookmarkItemIds[0]); PlacesUtils.bookmarks.removeItem(smartBookmarkItemIds[0]);
Services.prefs.setIntPref("browser.places.smartBookmarksVersion", 0); Services.prefs.setIntPref("browser.places.smartBookmarksVersion", 0);
gluesvc.ensurePlacesDefaultQueriesInitialized(); gluesvc.ensurePlacesDefaultQueriesInitialized();
let smartBookmarkItemIds = smartBookmarkItemIds =
PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO); PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
do_check_eq(smartBookmarkItemIds.length, smartBookmarksCount); do_check_eq(smartBookmarkItemIds.length, smartBookmarksCount);
do_log_info("check that pref has been bumped up"); do_log_info("check that pref has been bumped up");

View File

@ -121,11 +121,11 @@ var tests = [
}, },
run: function() { run: function() {
let testSite1 = getSiteItem(TEST_URI_1.host); let testSite1 = getSiteItem(TEST_URI_1.host);
ok(!testSite2, "test site 1 was not removed from sites list"); ok(testSite1, "test site 1 was not removed from sites list");
let testSite2 = getSiteItem(TEST_URI_2.host); let testSite2 = getSiteItem(TEST_URI_2.host);
ok(!testSite2, "test site 2 was pre-removed from sites list"); ok(!testSite2, "test site 2 was pre-removed from sites list");
let testSite3 = getSiteItem(TEST_URI_3.host); let testSite3 = getSiteItem(TEST_URI_3.host);
ok(!testSite2, "test site 3 was not removed from sites list"); ok(testSite3, "test site 3 was not removed from sites list");
runNextTest(); runNextTest();
} }

View File

@ -238,8 +238,8 @@ function runTest() {
// And give it time to close // And give it time to close
executeSoon(moveAlong); executeSoon(moveAlong);
yield; yield;
let pbWin = yield createWindow({private: true}); pbWin = yield createWindow({private: true});
let pbDownloadLastDir = new DownloadLastDir(pbWin); pbDownloadLastDir = new DownloadLastDir(pbWin);
is((yield checkDownloadLastDir(pbDownloadLastDir, dir1)).path, dir1.path, "uri1 should return the expected last directory"); is((yield checkDownloadLastDir(pbDownloadLastDir, dir1)).path, dir1.path, "uri1 should return the expected last directory");

View File

@ -251,7 +251,7 @@ add_task(function testDropInternalText() {
// were merged so that if testDropInternalText failed it wouldn't cause testDropLink // were merged so that if testDropInternalText failed it wouldn't cause testDropLink
// to fail unexplainably. // to fail unexplainably.
yield prepareTest(); yield prepareTest();
let promisePreventPopup = promiseEvent(searchBar, "popupshowing", true); promisePreventPopup = promiseEvent(searchBar, "popupshowing", true);
ChromeUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/uri-list", data: "http://www.mozilla.org" } ]], "copy", window); ChromeUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/uri-list", data: "http://www.mozilla.org" } ]], "copy", window);
yield promisePreventPopup; yield promisePreventPopup;
is(searchBar.value, "More Text", "drop text/uri-list on searchbar shouldn't change anything"); is(searchBar.value, "More Text", "drop text/uri-list on searchbar shouldn't change anything");

View File

@ -27,7 +27,7 @@ add_task(function test_check_urls_before_restoring() {
ss.setTabState(tab, getState("http://example.com/")); ss.setTabState(tab, getState("http://example.com/"));
yield promiseTabRestored(tab); yield promiseTabRestored(tab);
let value = yield getInputValue(browser, {id: "text"}); value = yield getInputValue(browser, {id: "text"});
is(value, "", "value was not restored"); is(value, "", "value was not restored");
// Cleanup. // Cleanup.

View File

@ -89,7 +89,7 @@ function testTabRestoreData(aFormData, aExpectedValue, aCallback) {
let restoredFormData = restoredTabState.formdata; let restoredFormData = restoredTabState.formdata;
let selectIdFormData = restoredFormData.id.select_id; let selectIdFormData = restoredFormData.id.select_id;
let value = restoredFormData.id.select_id.value; value = restoredFormData.id.select_id.value;
// test format // test format
ok("id" in restoredFormData || "xpath" in restoredFormData, ok("id" in restoredFormData || "xpath" in restoredFormData,

View File

@ -34,7 +34,7 @@ function runTests() {
tab.setAttribute("custom", "foobar"); tab.setAttribute("custom", "foobar");
ss.persistTabAttribute("custom"); ss.persistTabAttribute("custom");
let {attributes} = JSON.parse(ss.getTabState(tab)); ({attributes} = JSON.parse(ss.getTabState(tab)));
is(attributes.custom, "foobar", "'custom' attribute is correct"); is(attributes.custom, "foobar", "'custom' attribute is correct");
// Make sure we're backwards compatible and restore old 'image' attributes. // Make sure we're backwards compatible and restore old 'image' attributes.
@ -55,7 +55,7 @@ function runTests() {
yield whenTabRestored(tab); yield whenTabRestored(tab);
// Ensure no 'image' or 'pending' attributes are stored. // Ensure no 'image' or 'pending' attributes are stored.
let {attributes} = JSON.parse(ss.getTabState(tab)); ({attributes} = JSON.parse(ss.getTabState(tab)));
ok(!("image" in attributes), "'image' attribute not saved"); ok(!("image" in attributes), "'image' attribute not saved");
ok(!("pending" in attributes), "'pending' attribute not saved"); ok(!("pending" in attributes), "'pending' attribute not saved");
is(attributes.custom, "foobaz", "'custom' attribute is correct"); is(attributes.custom, "foobaz", "'custom' attribute is correct");

View File

@ -59,8 +59,8 @@ add_task(function flush_on_duplicate() {
"sessionStorage data has been flushed when duplicating tabs"); "sessionStorage data has been flushed when duplicating tabs");
yield promiseTabRestored(tab2); yield promiseTabRestored(tab2);
gBrowser.removeTab(tab2) gBrowser.removeTab(tab2);
let [{state: {storage}}] = JSON.parse(ss.getClosedTabData(window)); [{state: {storage}}] = JSON.parse(ss.getClosedTabData(window));
is(storage["http://example.com"].test, "on-duplicate", is(storage["http://example.com"].test, "on-duplicate",
"sessionStorage data has been flushed when duplicating tabs"); "sessionStorage data has been flushed when duplicating tabs");

View File

@ -77,7 +77,7 @@ add_task(function () {
yield promiseBrowserLoaded(browser, false /* don't ignore subframes */); yield promiseBrowserLoaded(browser, false /* don't ignore subframes */);
SyncHandlers.get(browser).flush(); SyncHandlers.get(browser).flush();
let {entries} = JSON.parse(ss.getTabState(tab)); ({entries} = JSON.parse(ss.getTabState(tab)));
// Check URLs. // Check URLs.
ok(entries[0].url.startsWith("data:text/html"), "correct 1st root url"); ok(entries[0].url.startsWith("data:text/html"), "correct 1st root url");

View File

@ -43,7 +43,7 @@ add_task(function test_formdata() {
Services.prefs.setIntPref("browser.sessionstore.privacy_level", 1); Services.prefs.setIntPref("browser.sessionstore.privacy_level", 1);
yield createAndRemoveTab(); yield createAndRemoveTab();
let [{state: {formdata}}] = JSON.parse(ss.getClosedTabData(window)); [{state: {formdata}}] = JSON.parse(ss.getClosedTabData(window));
is(formdata.id.txt, OUTER_VALUE, "outer value is correct"); is(formdata.id.txt, OUTER_VALUE, "outer value is correct");
ok(!formdata.children, "inner value was *not* stored"); ok(!formdata.children, "inner value was *not* stored");
@ -51,7 +51,7 @@ add_task(function test_formdata() {
Services.prefs.setIntPref("browser.sessionstore.privacy_level", 2); Services.prefs.setIntPref("browser.sessionstore.privacy_level", 2);
yield createAndRemoveTab(); yield createAndRemoveTab();
let [{state: {formdata}}] = JSON.parse(ss.getClosedTabData(window)); [{state: {formdata}}] = JSON.parse(ss.getClosedTabData(window));
ok(!formdata, "form data has *not* been stored"); ok(!formdata, "form data has *not* been stored");
// Restore the default privacy level. // Restore the default privacy level.
@ -176,13 +176,13 @@ add_task(function test_nested() {
"formdata for iframe stored correctly"); "formdata for iframe stored correctly");
// Restore the closed tab. // Restore the closed tab.
let tab = ss.undoCloseTab(window, 0); tab = ss.undoCloseTab(window, 0);
let browser = tab.linkedBrowser; browser = tab.linkedBrowser;
yield promiseTabRestored(tab); yield promiseTabRestored(tab);
// Check that the input field has the right value. // Check that the input field has the right value.
SyncHandlers.get(browser).flush(); SyncHandlers.get(browser).flush();
let {formdata} = JSON.parse(ss.getTabState(tab)); ({formdata} = JSON.parse(ss.getTabState(tab)));
is(JSON.stringify(formdata), JSON.stringify(FORM_DATA), is(JSON.stringify(formdata), JSON.stringify(FORM_DATA),
"formdata for iframe restored correctly"); "formdata for iframe restored correctly");
@ -224,8 +224,8 @@ add_task(function test_design_mode() {
yield promiseTabRestored(tab); yield promiseTabRestored(tab);
// Check that the innerHTML value was restored. // Check that the innerHTML value was restored.
let html = yield getInnerHTML(browser); html = yield getInnerHTML(browser);
let expected = "<h1>Mmozilla</h1><script>document.designMode='on'</script>"; expected = "<h1>Mmozilla</h1><script>document.designMode='on'</script>";
is(html, expected, "editable document has been restored correctly"); is(html, expected, "editable document has been restored correctly");
// Cleanup. // Cleanup.

View File

@ -31,7 +31,7 @@ add_task(function test_label_and_icon() {
browser = null; browser = null;
// Open a new tab to restore into. // Open a new tab to restore into.
let tab = gBrowser.addTab("about:blank"); tab = gBrowser.addTab("about:blank");
ss.setTabState(tab, state); ss.setTabState(tab, state);
yield promiseTabRestoring(tab); yield promiseTabRestoring(tab);

View File

@ -92,13 +92,13 @@ add_task(function () {
is(ss.getClosedTabCount(win), 0, "no tabs to restore"); is(ss.getClosedTabCount(win), 0, "no tabs to restore");
// Create a new tab in the new window that will load the frame script. // Create a new tab in the new window that will load the frame script.
let tab = win.gBrowser.addTab("about:mozilla"); tab = win.gBrowser.addTab("about:mozilla");
let browser = tab.linkedBrowser; browser = tab.linkedBrowser;
yield promiseBrowserLoaded(browser); yield promiseBrowserLoaded(browser);
SyncHandlers.get(browser).flush(); SyncHandlers.get(browser).flush();
// Check that we consider the tab as private. // Check that we consider the tab as private.
let state = JSON.parse(ss.getTabState(tab)); state = JSON.parse(ss.getTabState(tab));
ok(state.isPrivate, "tab considered private"); ok(state.isPrivate, "tab considered private");
// Check that all private tabs are removed when the non-private // Check that all private tabs are removed when the non-private

View File

@ -52,7 +52,7 @@ add_task(function test_purge() {
// Check that we are left with a single shistory entry. // Check that we are left with a single shistory entry.
SyncHandlers.get(browser).flush(); SyncHandlers.get(browser).flush();
let {entries} = JSON.parse(ss.getTabState(tab)); ({entries} = JSON.parse(ss.getTabState(tab)));
is(entries.length, 1, "there is one shistory entry"); is(entries.length, 1, "there is one shistory entry");
// Cleanup. // Cleanup.
@ -81,7 +81,7 @@ add_task(function test_hashchange() {
// Check that we now have two shistory entries. // Check that we now have two shistory entries.
SyncHandlers.get(browser).flush(); SyncHandlers.get(browser).flush();
let {entries} = JSON.parse(ss.getTabState(tab)); ({entries} = JSON.parse(ss.getTabState(tab)));
is(entries.length, 2, "there are two shistory entries"); is(entries.length, 2, "there are two shistory entries");
// Cleanup. // Cleanup.
@ -144,7 +144,7 @@ add_task(function test_subframes() {
// Check shistory. // Check shistory.
SyncHandlers.get(browser).flush(); SyncHandlers.get(browser).flush();
let {entries} = JSON.parse(ss.getTabState(tab)); ({entries} = JSON.parse(ss.getTabState(tab)));
is(entries.length, 2, "there now are two shistory entries"); is(entries.length, 2, "there now are two shistory entries");
is(entries[1].children.length, 1, "the second entry has one child"); is(entries[1].children.length, 1, "the second entry has one child");
@ -158,7 +158,7 @@ add_task(function test_subframes() {
// Check shistory. // Check shistory.
SyncHandlers.get(browser).flush(); SyncHandlers.get(browser).flush();
let {entries} = JSON.parse(ss.getTabState(tab)); ({entries} = JSON.parse(ss.getTabState(tab)));
is(entries.length, 2, "there now are two shistory entries"); is(entries.length, 2, "there now are two shistory entries");
is(entries[1].children.length, 1, "the second entry has one child"); is(entries[1].children.length, 1, "the second entry has one child");
@ -186,7 +186,7 @@ add_task(function test_about_page_navigate() {
// Check that we have changed the history entry. // Check that we have changed the history entry.
SyncHandlers.get(browser).flush(); SyncHandlers.get(browser).flush();
let {entries} = JSON.parse(ss.getTabState(tab)); ({entries} = JSON.parse(ss.getTabState(tab)));
is(entries.length, 1, "there is one shistory entry"); is(entries.length, 1, "there is one shistory entry");
is(entries[0].url, "about:robots", "url is correct"); is(entries[0].url, "about:robots", "url is correct");
@ -215,7 +215,7 @@ add_task(function test_pushstate_replacestate() {
// Check that we have added the history entry. // Check that we have added the history entry.
SyncHandlers.get(browser).flush(); SyncHandlers.get(browser).flush();
let {entries} = JSON.parse(ss.getTabState(tab)); ({entries} = JSON.parse(ss.getTabState(tab)));
is(entries.length, 2, "there is another shistory entry"); is(entries.length, 2, "there is another shistory entry");
is(entries[1].url, "http://example.com/test-entry/", "url is correct"); is(entries[1].url, "http://example.com/test-entry/", "url is correct");
@ -225,7 +225,7 @@ add_task(function test_pushstate_replacestate() {
// Check that we have modified the history entry. // Check that we have modified the history entry.
SyncHandlers.get(browser).flush(); SyncHandlers.get(browser).flush();
let {entries} = JSON.parse(ss.getTabState(tab)); ({entries} = JSON.parse(ss.getTabState(tab)));
is(entries.length, 2, "there is still two shistory entries"); is(entries.length, 2, "there is still two shistory entries");
is(entries[1].url, "http://example.com/test-entry/test-entry2/", "url is correct"); is(entries[1].url, "http://example.com/test-entry/test-entry2/", "url is correct");

View File

@ -34,7 +34,7 @@ add_task(function session_storage() {
yield modifySessionStorage2(browser, {test: "modified2"}); yield modifySessionStorage2(browser, {test: "modified2"});
SyncHandlers.get(browser).flush(); SyncHandlers.get(browser).flush();
let {storage} = JSON.parse(ss.getTabState(tab)); ({storage} = JSON.parse(ss.getTabState(tab)));
is(storage["http://example.com"].test, "modified2", is(storage["http://example.com"].test, "modified2",
"sessionStorage data for example.com has been serialized correctly"); "sessionStorage data for example.com has been serialized correctly");
is(storage["http://mochi.test:8888"].test, "modified", is(storage["http://mochi.test:8888"].test, "modified",
@ -48,7 +48,7 @@ add_task(function session_storage() {
// Flush to make sure chrome received all data. // Flush to make sure chrome received all data.
SyncHandlers.get(browser2).flush(); SyncHandlers.get(browser2).flush();
let {storage} = JSON.parse(ss.getTabState(tab2)); ({storage} = JSON.parse(ss.getTabState(tab2)));
is(storage["http://example.com"].test, "modified2", is(storage["http://example.com"].test, "modified2",
"sessionStorage data for example.com has been duplicated correctly"); "sessionStorage data for example.com has been duplicated correctly");
is(storage["http://mochi.test:8888"].test, "modified", is(storage["http://mochi.test:8888"].test, "modified",
@ -59,7 +59,7 @@ add_task(function session_storage() {
yield modifySessionStorage(browser2, {test: "modified3"}); yield modifySessionStorage(browser2, {test: "modified3"});
SyncHandlers.get(browser2).flush(); SyncHandlers.get(browser2).flush();
let {storage} = JSON.parse(ss.getTabState(tab2)); ({storage} = JSON.parse(ss.getTabState(tab2)));
is(storage["http://example.com"].test, "modified2", is(storage["http://example.com"].test, "modified2",
"sessionStorage data for example.com has been duplicated correctly"); "sessionStorage data for example.com has been duplicated correctly");
is(storage["http://mochi.test:8888"].test, "modified3", is(storage["http://mochi.test:8888"].test, "modified3",
@ -70,7 +70,7 @@ add_task(function session_storage() {
yield promiseBrowserLoaded(browser2); yield promiseBrowserLoaded(browser2);
SyncHandlers.get(browser2).flush(); SyncHandlers.get(browser2).flush();
let {storage} = JSON.parse(ss.getTabState(tab2)); ({storage} = JSON.parse(ss.getTabState(tab2)));
is(storage["http://mochi.test:8888"].test, "modified3", is(storage["http://mochi.test:8888"].test, "modified3",
"navigating retains correct storage data"); "navigating retains correct storage data");
ok(!storage["http://example.com"], "storage data was discarded"); ok(!storage["http://example.com"], "storage data was discarded");
@ -130,11 +130,11 @@ add_task(function respect_privacy_level() {
// Disable saving data for encrypted sites. // Disable saving data for encrypted sites.
Services.prefs.setIntPref("browser.sessionstore.privacy_level", 1); Services.prefs.setIntPref("browser.sessionstore.privacy_level", 1);
let tab = gBrowser.addTab(URL + "&secure"); tab = gBrowser.addTab(URL + "&secure");
yield promiseBrowserLoaded(tab.linkedBrowser); yield promiseBrowserLoaded(tab.linkedBrowser);
gBrowser.removeTab(tab); gBrowser.removeTab(tab);
let [{state: {storage}}] = JSON.parse(ss.getClosedTabData(window)); [{state: {storage}}] = JSON.parse(ss.getClosedTabData(window));
is(storage["http://mochi.test:8888"].test, OUTER_VALUE, is(storage["http://mochi.test:8888"].test, OUTER_VALUE,
"http sessionStorage data has been saved"); "http sessionStorage data has been saved");
ok(!storage["https://example.com"], ok(!storage["https://example.com"],
@ -144,14 +144,14 @@ add_task(function respect_privacy_level() {
Services.prefs.setIntPref("browser.sessionstore.privacy_level", 2); Services.prefs.setIntPref("browser.sessionstore.privacy_level", 2);
// Check that duplicating a tab copies all private data. // Check that duplicating a tab copies all private data.
let tab = gBrowser.addTab(URL + "&secure"); tab = gBrowser.addTab(URL + "&secure");
yield promiseBrowserLoaded(tab.linkedBrowser); yield promiseBrowserLoaded(tab.linkedBrowser);
let tab2 = gBrowser.duplicateTab(tab); let tab2 = gBrowser.duplicateTab(tab);
yield promiseTabRestored(tab2); yield promiseTabRestored(tab2);
gBrowser.removeTab(tab); gBrowser.removeTab(tab);
// With privacy_level=2 the |tab| shouldn't have any sessionStorage data. // With privacy_level=2 the |tab| shouldn't have any sessionStorage data.
let [{state: {storage}}] = JSON.parse(ss.getClosedTabData(window)); [{state: {storage}}] = JSON.parse(ss.getClosedTabData(window));
ok(!storage, "sessionStorage data has *not* been saved"); ok(!storage, "sessionStorage data has *not* been saved");
// Restore the default privacy level and close the duplicated tab. // Restore the default privacy level and close the duplicated tab.
@ -159,7 +159,7 @@ add_task(function respect_privacy_level() {
gBrowser.removeTab(tab2); gBrowser.removeTab(tab2);
// With privacy_level=0 the duplicated |tab2| should persist all data. // With privacy_level=0 the duplicated |tab2| should persist all data.
let [{state: {storage}}] = JSON.parse(ss.getClosedTabData(window)); [{state: {storage}}] = JSON.parse(ss.getClosedTabData(window));
is(storage["http://mochi.test:8888"].test, OUTER_VALUE, is(storage["http://mochi.test:8888"].test, OUTER_VALUE,
"http sessionStorage data has been saved"); "http sessionStorage data has been saved");
is(storage["https://example.com"].test, INNER_VALUE, is(storage["https://example.com"].test, INNER_VALUE,

View File

@ -19,7 +19,7 @@ function test() {
let dragTabItem = function (tabItem) { let dragTabItem = function (tabItem) {
let doc = cw.document.documentElement; let doc = cw.document.documentElement;
let tabItem = groupItem.getChild(0); tabItem = groupItem.getChild(0);
let container = tabItem.container; let container = tabItem.container;
let aspectRange = getAspectRange(); let aspectRange = getAspectRange();

View File

@ -146,14 +146,14 @@ add_task(function* test_record_translation() {
yield provider.recordTranslation("es", "en", 4, now); yield provider.recordTranslation("es", "en", 4, now);
values = yield m.getValues(); values = yield m.getValues();
let day = values.days.getDay(now); day = values.days.getDay(now);
Assert.ok(day.has("pageTranslatedCount")); Assert.ok(day.has("pageTranslatedCount"));
Assert.equal(day.get("pageTranslatedCount"), 4); Assert.equal(day.get("pageTranslatedCount"), 4);
Assert.ok(day.has("charactersTranslatedCount")); Assert.ok(day.has("charactersTranslatedCount"));
Assert.equal(day.get("charactersTranslatedCount"), 1007); Assert.equal(day.get("charactersTranslatedCount"), 1007);
Assert.ok(day.has("pageTranslatedCountsByLanguage")); Assert.ok(day.has("pageTranslatedCountsByLanguage"));
let countsByLanguage = JSON.parse(day.get("pageTranslatedCountsByLanguage")); countsByLanguage = JSON.parse(day.get("pageTranslatedCountsByLanguage"));
Assert.ok("fr" in countsByLanguage); Assert.ok("fr" in countsByLanguage);
Assert.equal(countsByLanguage["fr"]["total"], 3); Assert.equal(countsByLanguage["fr"]["total"], 3);
Assert.equal(countsByLanguage["fr"]["es"], 2); Assert.equal(countsByLanguage["fr"]["es"], 2);

View File

@ -73,7 +73,7 @@ function ifTestingSupported() {
is(new Uint8Array(secondScreenshot.pixels.buffer)[3], 255, is(new Uint8Array(secondScreenshot.pixels.buffer)[3], 255,
"The second screenshot has the correct alpha component."); "The second screenshot has the correct alpha component.");
let gl = debuggee.gl; gl = debuggee.gl;
is(gl.getParameter(gl.FRAMEBUFFER_BINDING), debuggee.customFramebuffer, is(gl.getParameter(gl.FRAMEBUFFER_BINDING), debuggee.customFramebuffer,
"The debuggee's gl context framebuffer still wasn't changed."); "The debuggee's gl context framebuffer still wasn't changed.");
is(gl.getParameter(gl.RENDERBUFFER_BINDING), debuggee.customRenderbuffer, is(gl.getParameter(gl.RENDERBUFFER_BINDING), debuggee.customRenderbuffer,

View File

@ -44,7 +44,7 @@ function ifTestingSupported() {
"The visible item's caller has the expected value."); "The visible item's caller has the expected value.");
let secondRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED); let secondRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED); callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
SnapshotsListView._onRecordButtonClick(); SnapshotsListView._onRecordButtonClick();
yield secondRecordingFinished; yield secondRecordingFinished;

View File

@ -34,9 +34,9 @@ function ifTestingSupported() {
yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED); yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
ok(true, "The full-sized screenshot was displayed for the item at index 1."); ok(true, "The full-sized screenshot was displayed for the item at index 1.");
let thumbnailImageElementSet = waitForMozSetImageElement(window); thumbnailImageElementSet = waitForMozSetImageElement(window);
$("#calls-slider").value = 2; $("#calls-slider").value = 2;
let thumbnailPixels = yield thumbnailImageElementSet; thumbnailPixels = yield thumbnailImageElementSet;
ok(sameArray(thumbnailPixels, thumbnails[1].pixels), ok(sameArray(thumbnailPixels, thumbnails[1].pixels),
"The screenshot element should have a thumbnail as an immediate background."); "The screenshot element should have a thumbnail as an immediate background.");
@ -44,9 +44,9 @@ function ifTestingSupported() {
yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED); yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
ok(true, "The full-sized screenshot was displayed for the item at index 2."); ok(true, "The full-sized screenshot was displayed for the item at index 2.");
let thumbnailImageElementSet = waitForMozSetImageElement(window); thumbnailImageElementSet = waitForMozSetImageElement(window);
$("#calls-slider").value = 7; $("#calls-slider").value = 7;
let thumbnailPixels = yield thumbnailImageElementSet; thumbnailPixels = yield thumbnailImageElementSet;
ok(sameArray(thumbnailPixels, thumbnails[3].pixels), ok(sameArray(thumbnailPixels, thumbnails[3].pixels),
"The screenshot element should have a thumbnail as an immediate background."); "The screenshot element should have a thumbnail as an immediate background.");
@ -54,9 +54,9 @@ function ifTestingSupported() {
yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED); yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
ok(true, "The full-sized screenshot was displayed for the item at index 7."); ok(true, "The full-sized screenshot was displayed for the item at index 7.");
let thumbnailImageElementSet = waitForMozSetImageElement(window); thumbnailImageElementSet = waitForMozSetImageElement(window);
$("#calls-slider").value = 4; $("#calls-slider").value = 4;
let thumbnailPixels = yield thumbnailImageElementSet; thumbnailPixels = yield thumbnailImageElementSet;
ok(sameArray(thumbnailPixels, thumbnails[2].pixels), ok(sameArray(thumbnailPixels, thumbnails[2].pixels),
"The screenshot element should have a thumbnail as an immediate background."); "The screenshot element should have a thumbnail as an immediate background.");
@ -64,9 +64,9 @@ function ifTestingSupported() {
yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED); yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
ok(true, "The full-sized screenshot was displayed for the item at index 4."); ok(true, "The full-sized screenshot was displayed for the item at index 4.");
let thumbnailImageElementSet = waitForMozSetImageElement(window); thumbnailImageElementSet = waitForMozSetImageElement(window);
$("#calls-slider").value = 0; $("#calls-slider").value = 0;
let thumbnailPixels = yield thumbnailImageElementSet; thumbnailPixels = yield thumbnailImageElementSet;
ok(sameArray(thumbnailPixels, thumbnails[0].pixels), ok(sameArray(thumbnailPixels, thumbnails[0].pixels),
"The screenshot element should have a thumbnail as an immediate background."); "The screenshot element should have a thumbnail as an immediate background.");

View File

@ -53,7 +53,7 @@ function ifTestingSupported() {
"The first draw call should now be selected in the snapshot."); "The first draw call should now be selected in the snapshot.");
let firstSnapshotTarget = SnapshotsListView.getItemAtIndex(0).target; let firstSnapshotTarget = SnapshotsListView.getItemAtIndex(0).target;
let snapshotSelected = waitForSnapshotSelection(); snapshotSelected = waitForSnapshotSelection();
EventUtils.sendMouseEvent({ type: "mousedown" }, firstSnapshotTarget, window); EventUtils.sendMouseEvent({ type: "mousedown" }, firstSnapshotTarget, window);
yield snapshotSelected; yield snapshotSelected;

View File

@ -17,7 +17,7 @@ function testDeconstructRuleId() {
is(rule.column, 20, "1 column"); is(rule.column, 20, "1 column");
// This is the harder case with a URL containing a '|' // This is the harder case with a URL containing a '|'
let rule = csscoverage.deconstructRuleId("http://thing/blah?q=a|b|11|22"); rule = csscoverage.deconstructRuleId("http://thing/blah?q=a|b|11|22");
is(rule.url, "http://thing/blah?q=a|b", "2 url"); is(rule.url, "http://thing/blah?q=a|b", "2 url");
is(rule.line, 11, "2 line"); is(rule.line, 11, "2 line");
is(rule.column, 22, "2 column"); is(rule.column, 22, "2 column");

View File

@ -45,7 +45,7 @@ function test() {
testEventGroup("mouseEvents", false); testEventGroup("mouseEvents", false);
testEventArrays("change,click,keydown,keyup", "change"); testEventArrays("change,click,keydown,keyup", "change");
let updated = waitForDebuggerEvents(aPanel, gDebugger.EVENTS.EVENT_BREAKPOINTS_UPDATED); updated = waitForDebuggerEvents(aPanel, gDebugger.EVENTS.EVENT_BREAKPOINTS_UPDATED);
EventUtils.sendMouseEvent({ type: "click" }, getItemCheckboxNode(0), gDebugger); EventUtils.sendMouseEvent({ type: "click" }, getItemCheckboxNode(0), gDebugger);
yield updated; yield updated;

View File

@ -46,7 +46,7 @@ function test() {
testEventGroup("mouseEvents", false); testEventGroup("mouseEvents", false);
testEventArrays("change,click,keydown,keyup", "change"); testEventArrays("change,click,keydown,keyup", "change");
let updated = waitForDebuggerEvents(aPanel, gDebugger.EVENTS.EVENT_BREAKPOINTS_UPDATED); updated = waitForDebuggerEvents(aPanel, gDebugger.EVENTS.EVENT_BREAKPOINTS_UPDATED);
EventUtils.sendMouseEvent({ type: "click" }, getGroupCheckboxNode("interactionEvents"), gDebugger); EventUtils.sendMouseEvent({ type: "click" }, getGroupCheckboxNode("interactionEvents"), gDebugger);
yield updated; yield updated;
@ -59,7 +59,7 @@ function test() {
testEventGroup("mouseEvents", false); testEventGroup("mouseEvents", false);
testEventArrays("change,click,keydown,keyup", ""); testEventArrays("change,click,keydown,keyup", "");
let updated = waitForDebuggerEvents(aPanel, gDebugger.EVENTS.EVENT_BREAKPOINTS_UPDATED); updated = waitForDebuggerEvents(aPanel, gDebugger.EVENTS.EVENT_BREAKPOINTS_UPDATED);
EventUtils.sendMouseEvent({ type: "click" }, getGroupCheckboxNode("keyboardEvents"), gDebugger); EventUtils.sendMouseEvent({ type: "click" }, getGroupCheckboxNode("keyboardEvents"), gDebugger);
yield updated; yield updated;
@ -72,7 +72,7 @@ function test() {
testEventGroup("mouseEvents", false); testEventGroup("mouseEvents", false);
testEventArrays("change,click,keydown,keyup", "keydown,keyup"); testEventArrays("change,click,keydown,keyup", "keydown,keyup");
let updated = waitForDebuggerEvents(aPanel, gDebugger.EVENTS.EVENT_BREAKPOINTS_UPDATED); updated = waitForDebuggerEvents(aPanel, gDebugger.EVENTS.EVENT_BREAKPOINTS_UPDATED);
EventUtils.sendMouseEvent({ type: "click" }, getGroupCheckboxNode("keyboardEvents"), gDebugger); EventUtils.sendMouseEvent({ type: "click" }, getGroupCheckboxNode("keyboardEvents"), gDebugger);
yield updated; yield updated;

View File

@ -58,7 +58,7 @@ function test() {
testEventGroup("mouseEvents", false); testEventGroup("mouseEvents", false);
testEventArrays("change,click,keydown,keyup", "change,click,keydown"); testEventArrays("change,click,keydown,keyup", "change,click,keydown");
let updated = waitForDebuggerEvents(aPanel, gDebugger.EVENTS.EVENT_BREAKPOINTS_UPDATED); updated = waitForDebuggerEvents(aPanel, gDebugger.EVENTS.EVENT_BREAKPOINTS_UPDATED);
EventUtils.sendMouseEvent({ type: "click" }, getItemCheckboxNode(0), gDebugger); EventUtils.sendMouseEvent({ type: "click" }, getItemCheckboxNode(0), gDebugger);
EventUtils.sendMouseEvent({ type: "click" }, getItemCheckboxNode(1), gDebugger); EventUtils.sendMouseEvent({ type: "click" }, getItemCheckboxNode(1), gDebugger);
EventUtils.sendMouseEvent({ type: "click" }, getItemCheckboxNode(2), gDebugger); EventUtils.sendMouseEvent({ type: "click" }, getItemCheckboxNode(2), gDebugger);

View File

@ -42,7 +42,7 @@ function spawnTest() {
// test Un-Black-Box Source // test Un-Black-Box Source
yield cmd("dbg unblackbox " + BLACKBOXME_URL); yield cmd("dbg unblackbox " + BLACKBOXME_URL);
let bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXME_URL); bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXME_URL);
ok(!bbButton.checked, ok(!bbButton.checked,
"Should be able to stop black boxing a specific source."); "Should be able to stop black boxing a specific source.");
@ -50,7 +50,7 @@ function spawnTest() {
yield cmd("dbg blackbox --glob *blackboxing_t*.js", 2, yield cmd("dbg blackbox --glob *blackboxing_t*.js", 2,
[/blackboxing_three\.js/g, /blackboxing_two\.js/g]); [/blackboxing_three\.js/g, /blackboxing_two\.js/g]);
let bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXME_URL); bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXME_URL);
ok(!bbButton.checked, ok(!bbButton.checked,
"blackboxme should not be black boxed because it doesn't match the glob."); "blackboxme should not be black boxed because it doesn't match the glob.");
bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXONE_URL); bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXONE_URL);
@ -67,7 +67,7 @@ function spawnTest() {
// test Un-Black-Box Glob // test Un-Black-Box Glob
yield cmd("dbg unblackbox --glob *blackboxing_t*.js", 2); yield cmd("dbg unblackbox --glob *blackboxing_t*.js", 2);
let bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXTWO_URL); bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXTWO_URL);
ok(!bbButton.checked, ok(!bbButton.checked,
"blackbox_two should be un-black boxed because it matches the glob."); "blackbox_two should be un-black boxed because it matches the glob.");
bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXTHREE_URL); bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXTHREE_URL);
@ -78,7 +78,7 @@ function spawnTest() {
yield cmd("dbg blackbox --invert --glob *blackboxing_t*.js", 3, yield cmd("dbg blackbox --invert --glob *blackboxing_t*.js", 3,
[/blackboxing_three\.js/g, /blackboxing_two\.js/g]); [/blackboxing_three\.js/g, /blackboxing_two\.js/g]);
let bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXME_URL); bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXME_URL);
ok(bbButton.checked, ok(bbButton.checked,
"blackboxme should be black boxed because it doesn't match the glob."); "blackboxme should be black boxed because it doesn't match the glob.");
bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXONE_URL); bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXONE_URL);
@ -98,7 +98,7 @@ function spawnTest() {
// test Un-Black-Box Invert // test Un-Black-Box Invert
yield cmd("dbg unblackbox --invert --glob *blackboxing_t*.js", 3); yield cmd("dbg unblackbox --invert --glob *blackboxing_t*.js", 3);
let bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXME_URL); bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXME_URL);
ok(!bbButton.checked, ok(!bbButton.checked,
"blackboxme should be un-black boxed because it does not match the glob."); "blackboxme should be un-black boxed because it does not match the glob.");
bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXONE_URL); bbButton = yield selectSourceAndGetBlackBoxButton(panel, BLACKBOXONE_URL);

View File

@ -62,7 +62,7 @@ function test() {
ok(true, "Evaluating in the topmost frame works properly."); ok(true, "Evaluating in the topmost frame works properly.");
// Eval in a different frame, while paused. // Eval in a different frame, while paused.
let updatedView = waitForDebuggerEvents(panel, events.FETCHED_SCOPES); updatedView = waitForDebuggerEvents(panel, events.FETCHED_SCOPES);
try { try {
yield frames.evaluate("foo", { depth: 3 }); // oldest frame yield frames.evaluate("foo", { depth: 3 }); // oldest frame
} catch (result) { } catch (result) {

View File

@ -43,7 +43,7 @@ function test() {
ok(gEditor.getText().contains("bacon"), ok(gEditor.getText().contains("bacon"),
"The newly shown source contains bacon. Mmm, delicious!"); "The newly shown source contains bacon. Mmm, delicious!");
let { source } = gSources.selectedItem.attachment; ({ source } = gSources.selectedItem.attachment);
let [, secondText] = yield gControllerSources.getText(source); let [, secondText] = yield gControllerSources.getText(source);
let secondNumber = parseFloat(secondText.match(/\d\.\d+/)[0]); let secondNumber = parseFloat(secondText.match(/\d\.\d+/)[0]);

View File

@ -6,7 +6,7 @@
function test() { function test() {
Task.spawn(function* () { Task.spawn(function* () {
const TAB_URL = EXAMPLE_URL + "doc_closure-optimized-out.html"; const TAB_URL = EXAMPLE_URL + "doc_closure-optimized-out.html";
let panel, debuggee, gDebugger, sources; let gDebugger, sources;
let [, debuggee, panel] = yield initDebugger(TAB_URL); let [, debuggee, panel] = yield initDebugger(TAB_URL);
gDebugger = panel.panelWin; gDebugger = panel.panelWin;

View File

@ -7,7 +7,7 @@
function test() { function test() {
Task.spawn(function* () { Task.spawn(function* () {
const TAB_URL = EXAMPLE_URL + "doc_inline-script.html"; const TAB_URL = EXAMPLE_URL + "doc_inline-script.html";
let panel, debuggee, gDebugger, searchBox; let gDebugger, searchBox;
let [, debuggee, panel] = yield initDebugger(TAB_URL); let [, debuggee, panel] = yield initDebugger(TAB_URL);
gDebugger = panel.panelWin; gDebugger = panel.panelWin;

View File

@ -44,7 +44,8 @@ function test() {
"The promise was correctly rejected with a meaningful message."); "The promise was correctly rejected with a meaningful message.");
} }
let [source, text] = yield gControllerSources.getText(source); let text;
[source, text] = yield gControllerSources.getText(source);
is(gSources.selectedValue, TAB_URL, is(gSources.selectedValue, TAB_URL,
"The correct source is still selected."); "The correct source is still selected.");
ok(gEditor.getText().contains("myFunction"), ok(gEditor.getText().contains("myFunction"),

View File

@ -60,7 +60,8 @@ function test() {
"The promise was correctly rejected with a meaningful message."); "The promise was correctly rejected with a meaningful message.");
} }
let [source, text] = yield gControllerSources.getText(source); let text;
[source, text] = yield gControllerSources.getText(source);
is(gSources.selectedValue, JS_URL, is(gSources.selectedValue, JS_URL,
"The correct source is still selected."); "The correct source is still selected.");
ok(gEditor.getText().contains("myFunction"), ok(gEditor.getText().contains("myFunction"),

View File

@ -303,7 +303,7 @@ function testSecondLevelContents() {
let objectItem6 = someProp6.get("p6"); let objectItem6 = someProp6.get("p6");
let objectItem7 = someProp6.get("p7"); let objectItem7 = someProp6.get("p7");
let objectItem8 = someProp6.get("p8"); let objectItem8 = someProp6.get("p8");
let __proto__ = someProp6.get("__proto__"); __proto__ = someProp6.get("__proto__");
is(objectItem0.visible, true, "The first object item visible state is correct."); is(objectItem0.visible, true, "The first object item visible state is correct.");
is(objectItem1.visible, true, "The second object item visible state is correct."); is(objectItem1.visible, true, "The second object item visible state is correct.");

View File

@ -83,7 +83,7 @@ function test() {
// Test getOwnerScopeForVariableOrProperty with second-degree properties. // Test getOwnerScopeForVariableOrProperty with second-degree properties.
let protoVar1 = argsVar1.get("__proto__"); let protoVar1 = argsVar1.get("__proto__");
let fetched = waitForDebuggerEvents(panel, events.FETCHED_PROPERTIES); fetched = waitForDebuggerEvents(panel, events.FETCHED_PROPERTIES);
protoVar1.expand(); protoVar1.expand();
yield fetched; yield fetched;
@ -98,7 +98,7 @@ function test() {
// Only need to wait for a single FETCHED_VARIABLES event, just for the // Only need to wait for a single FETCHED_VARIABLES event, just for the
// global scope, because the other local scopes already have the // global scope, because the other local scopes already have the
// arguments and variables available as evironment bindings. // arguments and variables available as evironment bindings.
let fetched = waitForDebuggerEvents(panel, events.FETCHED_VARIABLES); fetched = waitForDebuggerEvents(panel, events.FETCHED_VARIABLES);
secondScope.expand(); secondScope.expand();
thirdScope.expand(); thirdScope.expand();
globalScope.expand(); globalScope.expand();
@ -118,7 +118,7 @@ function test() {
// from non-topmost scopes. // from non-topmost scopes.
let argsVar2 = secondScope.get("arguments"); let argsVar2 = secondScope.get("arguments");
let fetched = waitForDebuggerEvents(panel, events.FETCHED_PROPERTIES); fetched = waitForDebuggerEvents(panel, events.FETCHED_PROPERTIES);
argsVar2.expand(); argsVar2.expand();
yield fetched; yield fetched;
@ -128,7 +128,7 @@ function test() {
"The getOwnerScopeForVariableOrProperty method works properly (7)."); "The getOwnerScopeForVariableOrProperty method works properly (7).");
let argsVar3 = thirdScope.get("arguments"); let argsVar3 = thirdScope.get("arguments");
let fetched = waitForDebuggerEvents(panel, events.FETCHED_PROPERTIES); fetched = waitForDebuggerEvents(panel, events.FETCHED_PROPERTIES);
argsVar3.expand(); argsVar3.expand();
yield fetched; yield fetched;
@ -141,7 +141,7 @@ function test() {
// from non-topmost scopes. // from non-topmost scopes.
let protoVar2 = argsVar2.get("__proto__"); let protoVar2 = argsVar2.get("__proto__");
let fetched = waitForDebuggerEvents(panel, events.FETCHED_PROPERTIES); fetched = waitForDebuggerEvents(panel, events.FETCHED_PROPERTIES);
protoVar2.expand(); protoVar2.expand();
yield fetched; yield fetched;
@ -151,7 +151,7 @@ function test() {
"The getOwnerScopeForVariableOrProperty method works properly (9)."); "The getOwnerScopeForVariableOrProperty method works properly (9).");
let protoVar3 = argsVar3.get("__proto__"); let protoVar3 = argsVar3.get("__proto__");
let fetched = waitForDebuggerEvents(panel, events.FETCHED_PROPERTIES); fetched = waitForDebuggerEvents(panel, events.FETCHED_PROPERTIES);
protoVar3.expand(); protoVar3.expand();
yield fetched; yield fetched;

View File

@ -49,7 +49,7 @@ function test() {
} }
}); });
let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS); expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
yield openVarPopup(panel, { line: 14, ch: 15 }); yield openVarPopup(panel, { line: 14, ch: 15 });
yield expressionsEvaluated; yield expressionsEvaluated;

View File

@ -50,25 +50,25 @@ function test() {
ok(true, "The new watch expressions were re-evaluated and the panel got hidden (1)."); ok(true, "The new watch expressions were re-evaluated and the panel got hidden (1).");
// Inspect non primitive value variable. // Inspect non primitive value variable.
let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS); expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
yield openVarPopup(panel, { line: 16, ch: 12 }, true); yield openVarPopup(panel, { line: 16, ch: 12 }, true);
yield expressionsEvaluated; yield expressionsEvaluated;
ok(true, "The watch expressions were re-evaluated when a new panel opened (1)."); ok(true, "The watch expressions were re-evaluated when a new panel opened (1).");
let popupHiding = once(tooltip, "popuphiding"); popupHiding = once(tooltip, "popuphiding");
let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS); expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
testExpressionButton(label, className, "b"); testExpressionButton(label, className, "b");
yield promise.all([popupHiding, expressionsEvaluated]); yield promise.all([popupHiding, expressionsEvaluated]);
ok(true, "The new watch expressions were re-evaluated and the panel got hidden (2)."); ok(true, "The new watch expressions were re-evaluated and the panel got hidden (2).");
// Inspect property of an object. // Inspect property of an object.
let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS); expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
yield openVarPopup(panel, { line: 17, ch: 10 }); yield openVarPopup(panel, { line: 17, ch: 10 });
yield expressionsEvaluated; yield expressionsEvaluated;
ok(true, "The watch expressions were re-evaluated when a new panel opened (2)."); ok(true, "The watch expressions were re-evaluated when a new panel opened (2).");
let popupHiding = once(tooltip, "popuphiding"); popupHiding = once(tooltip, "popuphiding");
let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS); expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
testExpressionButton(label, className, "b.a"); testExpressionButton(label, className, "b.a");
yield promise.all([popupHiding, expressionsEvaluated]); yield promise.all([popupHiding, expressionsEvaluated]);
ok(true, "The new watch expressions were re-evaluated and the panel got hidden (3)."); ok(true, "The new watch expressions were re-evaluated and the panel got hidden (3).");

View File

@ -41,26 +41,26 @@ function test() {
ok(true, "The new watch expressions were re-evaluated and the panel got hidden (1)."); ok(true, "The new watch expressions were re-evaluated and the panel got hidden (1).");
// Inspect property of an object. // Inspect property of an object.
let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS); expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
yield openVarPopup(panel, { line: 17, ch: 10 }); yield openVarPopup(panel, { line: 17, ch: 10 });
yield expressionsEvaluated; yield expressionsEvaluated;
ok(true, "The watch expressions were re-evaluated when a new panel opened (1)."); ok(true, "The watch expressions were re-evaluated when a new panel opened (1).");
let popupHiding = once(tooltip, "popuphiding"); popupHiding = once(tooltip, "popuphiding");
let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS); expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
tooltip.querySelector("button").click(); tooltip.querySelector("button").click();
verifyContent("b.a", 2); verifyContent("b.a", 2);
yield promise.all([popupHiding, expressionsEvaluated]); yield promise.all([popupHiding, expressionsEvaluated]);
ok(true, "The new watch expressions were re-evaluated and the panel got hidden (2)."); ok(true, "The new watch expressions were re-evaluated and the panel got hidden (2).");
// Re-inspect primitive value variable. // Re-inspect primitive value variable.
let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS); expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
yield openVarPopup(panel, { line: 15, ch: 12 }); yield openVarPopup(panel, { line: 15, ch: 12 });
yield expressionsEvaluated; yield expressionsEvaluated;
ok(true, "The watch expressions were re-evaluated when a new panel opened (2)."); ok(true, "The watch expressions were re-evaluated when a new panel opened (2).");
let popupHiding = once(tooltip, "popuphiding"); popupHiding = once(tooltip, "popuphiding");
let expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS); expressionsEvaluated = waitForDebuggerEvents(panel, events.FETCHED_WATCH_EXPRESSIONS);
tooltip.querySelector("button").click(); tooltip.querySelector("button").click();
verifyContent("b.a", 2); verifyContent("b.a", 2);
yield promise.all([popupHiding, expressionsEvaluated]); yield promise.all([popupHiding, expressionsEvaluated]);

View File

@ -65,13 +65,13 @@ function applyTheme()
// Select test theme. // Select test theme.
testThemeOption.click(); testThemeOption.click();
let color = panelWin.getComputedStyle(testThemeOption).color; color = panelWin.getComputedStyle(testThemeOption).color;
is(color, "rgb(255, 0, 0)", "style applied"); is(color, "rgb(255, 0, 0)", "style applied");
// Select light theme // Select light theme
lightThemeOption.click(); lightThemeOption.click();
let color = panelWin.getComputedStyle(testThemeOption).color; color = panelWin.getComputedStyle(testThemeOption).color;
isnot(color, "rgb(255, 0, 0)", "style unapplied"); isnot(color, "rgb(255, 0, 0)", "style unapplied");
// Select test theme again. // Select test theme again.

View File

@ -21,12 +21,12 @@ let test = asyncTest(function*() {
ok(isHighlighting(), "The highlighter is shown on a markup container hover"); ok(isHighlighting(), "The highlighter is shown on a markup container hover");
is(getHighlitNode(), getNode("body"), "The highlighter highlights the right node"); is(getHighlitNode(), getNode("body"), "The highlighter highlights the right node");
let onNodeHighlighted = toolbox.once("node-highlight"); onNodeHighlighted = toolbox.once("node-highlight");
let button = bcButtons.childNodes[2]; button = bcButtons.childNodes[2];
EventUtils.synthesizeMouseAtCenter(button, {type: "mousemove"}, button.ownerDocument.defaultView); EventUtils.synthesizeMouseAtCenter(button, {type: "mousemove"}, button.ownerDocument.defaultView);
yield onNodeHighlighted; yield onNodeHighlighted;
ok(isHighlighting(), "The highlighter is shown on a markup container hover"); ok(isHighlighting(), "The highlighter is shown on a markup container hover");
is(getHighlitNode(), getNode("span"), "The highlighter highlights the right node"); is(getHighlitNode(), getNode("span"), "The highlighter highlights the right node");
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
}); });

View File

@ -32,7 +32,7 @@ let test = asyncTest(function*() {
info("Selecting the zero width height DIV"); info("Selecting the zero width height DIV");
let zeroWidthHeight = getNode("#widthHeightZero-div"); let zeroWidthHeight = getNode("#widthHeightZero-div");
let onBoxModelUpdate = waitForBoxModelUpdate(); onBoxModelUpdate = waitForBoxModelUpdate();
yield selectAndHighlightNode(zeroWidthHeight, inspector); yield selectAndHighlightNode(zeroWidthHeight, inspector);
yield onBoxModelUpdate; yield onBoxModelUpdate;

View File

@ -42,13 +42,13 @@ let test = asyncTest(function*() {
let onUpdated = inspector.once("inspector-updated"); let onUpdated = inspector.once("inspector-updated");
EventUtils.synthesizeKey("VK_DOWN", {}); EventUtils.synthesizeKey("VK_DOWN", {});
yield onUpdated; yield onUpdated;
let onUpdated = inspector.once("inspector-updated"); onUpdated = inspector.once("inspector-updated");
EventUtils.synthesizeKey("VK_DOWN", {}); EventUtils.synthesizeKey("VK_DOWN", {});
yield onUpdated; yield onUpdated;
yield isHighlighting("#two", "<p#two> is highlighted"); yield isHighlighting("#two", "<p#two> is highlighted");
info("Navigate back to <p#one> with the keyboard"); info("Navigate back to <p#one> with the keyboard");
let onUpdated = inspector.once("inspector-updated"); onUpdated = inspector.once("inspector-updated");
EventUtils.synthesizeKey("VK_UP", {}); EventUtils.synthesizeKey("VK_UP", {});
yield onUpdated; yield onUpdated;
yield isHighlighting("#one", "<p#one> is highlighted again"); yield isHighlighting("#one", "<p#one> is highlighted again");

View File

@ -30,8 +30,8 @@ let test = asyncTest(function*() {
yield mutated; yield mutated;
info("Checking that the tagname change was done"); info("Checking that the tagname change was done");
let node = content.document.querySelector("#retag-me"); node = content.document.querySelector("#retag-me");
let container = yield getContainerForSelector("#retag-me", inspector); container = yield getContainerForSelector("#retag-me", inspector);
is(node.tagName, "P", "We've got #retag-me, it should now be a P"); is(node.tagName, "P", "We've got #retag-me, it should now be a P");
ok(container.expanded, "It is still expanded"); ok(container.expanded, "It is still expanded");
ok(container.selected, "It is still selected"); ok(container.selected, "It is still selected");

View File

@ -54,8 +54,8 @@ function test() {
yield waitFor(aMonitor.panelWin, TAB_UPDATED); yield waitFor(aMonitor.panelWin, TAB_UPDATED);
let tab = document.querySelectorAll("#details-pane tab")[2]; tab = document.querySelectorAll("#details-pane tab")[2];
let tabpanel = document.querySelectorAll("#details-pane tabpanel")[2]; tabpanel = document.querySelectorAll("#details-pane tabpanel")[2];
let formDataScope = tabpanel.querySelectorAll(".variables-view-scope")[0]; let formDataScope = tabpanel.querySelectorAll(".variables-view-scope")[0];
is(tab.getAttribute("selected"), "true", is(tab.getAttribute("selected"), "true",

View File

@ -33,7 +33,7 @@ let test = Task.async(function*() {
// Perform the second recording... // Perform the second recording...
yield front.startRecording(); yield front.startRecording();
let profilingStartTime = front._profilingStartTime; profilingStartTime = front._profilingStartTime;
info("Started profiling at: " + profilingStartTime); info("Started profiling at: " + profilingStartTime);
busyWait(WAIT_TIME); // allow the profiler module to sample more cpu activity busyWait(WAIT_TIME); // allow the profiler module to sample more cpu activity

View File

@ -30,7 +30,7 @@ let test = Task.async(function*() {
profilerWin.viewSourceInDebugger(SIMPLE_URL, 14); profilerWin.viewSourceInDebugger(SIMPLE_URL, 14);
yield whenSourceShown; yield whenSourceShown;
let debuggerPanel = toolbox.getPanel("jsdebugger"); debuggerPanel = toolbox.getPanel("jsdebugger");
ok(debuggerPanel, "The debugger panel was reselected."); ok(debuggerPanel, "The debugger panel was reselected.");
is(DebuggerView.Sources.selectedValue, SIMPLE_URL, is(DebuggerView.Sources.selectedValue, SIMPLE_URL,

View File

@ -18,7 +18,7 @@ let test = Task.async(function*() {
ok(nsIProfilerModule.IsActive(), ok(nsIProfilerModule.IsActive(),
"The built-in profiler module should now be active."); "The built-in profiler module should now be active.");
let result = yield front._request("profiler", "stopProfiler"); result = yield front._request("profiler", "stopProfiler");
is(result.started, false, is(result.started, false,
"The request finished successfully and the profiler should've been stopped."); "The request finished successfully and the profiler should've been stopped.");
ok(!nsIProfilerModule.IsActive(), ok(!nsIProfilerModule.IsActive(),

View File

@ -90,7 +90,7 @@ let test = Task.async(function*() {
let receivedFocusEvent = treeRoot.once("focus"); let receivedFocusEvent = treeRoot.once("focus");
EventUtils.sendMouseEvent({ type: "mousedown" }, fooItem.target); EventUtils.sendMouseEvent({ type: "mousedown" }, fooItem.target);
let eventItem = yield receivedFocusEvent; eventItem = yield receivedFocusEvent;
is(eventItem, fooItem, is(eventItem, fooItem,
"The 'focus' event target is correct."); "The 'focus' event target is correct.");
is(document.commandDispatcher.focusedElement, fooItem.target, is(document.commandDispatcher.focusedElement, fooItem.target,
@ -99,7 +99,7 @@ let test = Task.async(function*() {
let receivedDblClickEvent = treeRoot.once("focus"); let receivedDblClickEvent = treeRoot.once("focus");
EventUtils.sendMouseEvent({ type: "dblclick" }, barItem.target); EventUtils.sendMouseEvent({ type: "dblclick" }, barItem.target);
let eventItem = yield receivedDblClickEvent; eventItem = yield receivedDblClickEvent;
is(eventItem, barItem, is(eventItem, barItem,
"The 'dblclick' event target is correct."); "The 'dblclick' event target is correct.");
is(document.commandDispatcher.focusedElement, barItem.target, is(document.commandDispatcher.focusedElement, barItem.target,

View File

@ -29,7 +29,7 @@ let test = Task.async(function*() {
let receivedZoomEvent = treeRoot.once("zoom"); let receivedZoomEvent = treeRoot.once("zoom");
EventUtils.sendMouseEvent({ type: "mousedown" }, C.target.querySelector(".call-tree-zoom")); EventUtils.sendMouseEvent({ type: "mousedown" }, C.target.querySelector(".call-tree-zoom"));
let eventItem = yield receivedZoomEvent; eventItem = yield receivedZoomEvent;
is(eventItem, C, "The 'zoom' event target is correct."); is(eventItem, C, "The 'zoom' event target is correct.");
finish(); finish();

View File

@ -18,10 +18,10 @@ let test = asyncTest(function*() {
ok (textEditorContextMenuPopup, "The menu has loaded in the projecteditor document"); ok (textEditorContextMenuPopup, "The menu has loaded in the projecteditor document");
let projecteditor2 = yield addProjectEditorTabForTempDirectory(); let projecteditor2 = yield addProjectEditorTabForTempDirectory();
let contextMenuPopup = projecteditor2.document.getElementById("context-menu-popup"); contextMenuPopup = projecteditor2.document.getElementById("context-menu-popup");
let textEditorContextMenuPopup = projecteditor2.document.getElementById("texteditor-context-popup"); textEditorContextMenuPopup = projecteditor2.document.getElementById("texteditor-context-popup");
ok (!contextMenuPopup, "The menu has NOT loaded in the projecteditor document"); ok (!contextMenuPopup, "The menu has NOT loaded in the projecteditor document");
ok (!textEditorContextMenuPopup, "The menu has NOT loaded in the projecteditor document"); ok (!textEditorContextMenuPopup, "The menu has NOT loaded in the projecteditor document");
ok (content.document.querySelector("#context-menu-popup"), "The menu has loaded in the specified element"); ok (content.document.querySelector("#context-menu-popup"), "The menu has loaded in the specified element");
ok (content.document.querySelector("#texteditor-context-popup"), "The menu has loaded in the specified element"); ok (content.document.querySelector("#texteditor-context-popup"), "The menu has loaded in the specified element");
}); });

View File

@ -58,8 +58,8 @@ function testEditor(projecteditor, filePath) {
projecteditor.projectTree.selectResource(resource); projecteditor.projectTree.selectResource(resource);
yield onceEditorActivated(projecteditor); yield onceEditorActivated(projecteditor);
let editor = projecteditor.currentEditor; editor = projecteditor.currentEditor;
let images = editor.elt.querySelectorAll("image"); images = editor.elt.querySelectorAll("image");
ok (images.length, 1, "There is one image inside the editor"); ok (images.length, 1, "There is one image inside the editor");
is (images[0], editor.image, "The image property is set correctly with the DOM"); is (images[0], editor.image, "The image property is set correctly with the DOM");
is (editor.image.getAttribute("src"), resource.uri, "The image has the resource URL"); is (editor.image.getAttribute("src"), resource.uri, "The image has the resource URL");

View File

@ -50,7 +50,7 @@ function testChangeUnsavedFileExternally(projecteditor, filePath, newData) {
projecteditor.projectTree.selectResource(resource); projecteditor.projectTree.selectResource(resource);
yield onceEditorActivated(projecteditor); yield onceEditorActivated(projecteditor);
let editor = projecteditor.currentEditor; editor = projecteditor.currentEditor;
info ("Checking to make sure the editor is now populated correctly"); info ("Checking to make sure the editor is now populated correctly");
is (editor.editor.getText(), "foobar", "Editor has not been updated with new file contents"); is (editor.editor.getText(), "foobar", "Editor has not been updated with new file contents");
@ -76,7 +76,7 @@ function testChangeFileExternally(projecteditor, filePath, newData) {
projecteditor.projectTree.selectResource(resource); projecteditor.projectTree.selectResource(resource);
yield onceEditorActivated(projecteditor); yield onceEditorActivated(projecteditor);
let editor = projecteditor.currentEditor; editor = projecteditor.currentEditor;
info ("Checking to make sure the editor is now populated correctly"); info ("Checking to make sure the editor is now populated correctly");
is (editor.editor.getText(), newData, "Editor has been updated with correct file contents"); is (editor.editor.getText(), newData, "Editor has been updated with correct file contents");

View File

@ -19,10 +19,10 @@ let test = asyncTest(function*() {
let projecteditor2 = yield addProjectEditorTabForTempDirectory(); let projecteditor2 = yield addProjectEditorTabForTempDirectory();
let menubar = projecteditor2.menubar; let menubar = projecteditor2.menubar;
let fileMenu = projecteditor2.document.getElementById("file-menu"); fileMenu = projecteditor2.document.getElementById("file-menu");
let editMenu = projecteditor2.document.getElementById("edit-menu"); editMenu = projecteditor2.document.getElementById("edit-menu");
ok (!fileMenu, "The menu has NOT loaded in the projecteditor document"); ok (!fileMenu, "The menu has NOT loaded in the projecteditor document");
ok (!editMenu, "The menu has NOT loaded in the projecteditor document"); ok (!editMenu, "The menu has NOT loaded in the projecteditor document");
ok (content.document.querySelector("#file-menu"), "The menu has loaded in the specified element"); ok (content.document.querySelector("#file-menu"), "The menu has loaded in the specified element");
ok (content.document.querySelector("#edit-menu"), "The menu has loaded in the specified element"); ok (content.document.querySelector("#edit-menu"), "The menu has loaded in the specified element");
}); });

View File

@ -190,10 +190,10 @@ function test() {
is(content.innerWidth, expectedWidth, "Size correctly updated (width)."); is(content.innerWidth, expectedWidth, "Size correctly updated (width).");
is(content.innerHeight, expectedHeight, "Size correctly updated (height)."); is(content.innerHeight, expectedHeight, "Size correctly updated (height).");
is(instance.menulist.selectedIndex, -1, "Custom menuitem cannot be selected"); is(instance.menulist.selectedIndex, -1, "Custom menuitem cannot be selected");
let label = instance.menulist.firstChild.firstChild.getAttribute("label"); label = instance.menulist.firstChild.firstChild.getAttribute("label");
let value = instance.menulist.value; value = instance.menulist.value;
isnot(label, value, "Label from the menulist item is different than the value of the menulist") isnot(label, value, "Label from the menulist item is different than the value of the menulist");
let [width, height] = extractSizeFromString(label); [width, height] = extractSizeFromString(label);
is(width, expectedWidth, "Label updated (width)."); is(width, expectedWidth, "Label updated (width).");
is(height, expectedHeight, "Label updated (height)."); is(height, expectedHeight, "Label updated (height).");
[width, height] = extractSizeFromString(value); [width, height] = extractSizeFromString(value);

View File

@ -36,7 +36,7 @@ function ifWebGLSupported() {
"An assignment error is contained in the linkage status."); "An assignment error is contained in the linkage status.");
fsEditor.replaceText("vec4", { line: 2, ch: 14 }, { line: 2, ch: 18 }); fsEditor.replaceText("vec4", { line: 2, ch: 14 }, { line: 2, ch: 18 });
let [, error] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); [, error] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED);
ok(error, ok(error,
"The new fragment shader source was compiled with errors."); "The new fragment shader source was compiled with errors.");
@ -53,11 +53,11 @@ function ifWebGLSupported() {
yield ensurePixelIs(gFront, { x: 511, y: 511 }, { r: 0, g: 255, 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 }); vsEditor.replaceText("vec4", { line: 7, ch: 22 }, { line: 7, ch: 26 });
let [, error] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); [, error] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED);
ok(!error, "The new vertex shader source was compiled successfully."); ok(!error, "The new vertex shader source was compiled successfully.");
fsEditor.replaceText("vec3", { line: 2, ch: 14 }, { line: 2, ch: 18 }); fsEditor.replaceText("vec3", { line: 2, ch: 14 }, { line: 2, ch: 18 });
let [, error] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED); [, error] = yield onceSpread(panel.panelWin, EVENTS.SHADER_COMPILED);
ok(!error, "The new fragment shader source was compiled successfully."); ok(!error, "The new fragment shader source was compiled successfully.");
yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true); yield ensurePixelIs(gFront, { x: 0, y: 0 }, { r: 255, g: 0, b: 0, a: 255 }, true);

View File

@ -33,15 +33,15 @@ function ifWebGLSupported() {
yield ensurePixelIs(front, { x: 128, y: 128 }, { r: 255, 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); yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true);
let vertSource = yield vertexShader.getText(); vertSource = yield vertexShader.getText();
let fragSource = yield fragmentShader.getText(); fragSource = yield fragmentShader.getText();
ok(vertSource.contains("2.0"), ok(vertSource.contains("2.0"),
"The vertex shader source is correct after changing it."); "The vertex shader source is correct after changing it.");
ok(!fragSource.contains("0.5"), ok(!fragSource.contains("0.5"),
"The fragment shader source is correct after changing the vertex shader."); "The fragment shader source is correct after changing the vertex shader.");
let newFragSource = fragSource.replace("1.0", "0.5"); let newFragSource = fragSource.replace("1.0", "0.5");
let status = yield fragmentShader.compile(newFragSource); status = yield fragmentShader.compile(newFragSource);
ok(!status, ok(!status,
"The new fragment shader source was compiled without errors."); "The new fragment shader source was compiled without errors.");
@ -49,8 +49,8 @@ function ifWebGLSupported() {
yield ensurePixelIs(front, { x: 128, y: 128 }, { r: 255, g: 0, b: 0, a: 127 }, 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); yield ensurePixelIs(front, { x: 511, y: 511 }, { r: 0, g: 0, b: 0, a: 255 }, true);
let vertSource = yield vertexShader.getText(); vertSource = yield vertexShader.getText();
let fragSource = yield fragmentShader.getText(); fragSource = yield fragmentShader.getText();
ok(vertSource.contains("2.0"), ok(vertSource.contains("2.0"),
"The vertex shader source is correct after changing the fragment shader."); "The vertex shader source is correct after changing the fragment shader.");
ok(fragSource.contains("0.5"), ok(fragSource.contains("0.5"),

View File

@ -28,9 +28,9 @@ function ifWebGLSupported() {
yield ensurePixelIs(front, { x: 127, y: 127 }, { 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."); ok(true, "The first fragment shader was changed.");
let oldFragSource = yield secondFragmentShader.getText(); oldFragSource = yield secondFragmentShader.getText();
let newFragSource = oldFragSource.replace("vec4(uColor", "vec4(0.75, 0.75, 0.75"); newFragSource = oldFragSource.replace("vec4(uColor", "vec4(0.75, 0.75, 0.75");
let status = yield secondFragmentShader.compile(newFragSource); status = yield secondFragmentShader.compile(newFragSource);
ok(!status, ok(!status,
"The second new fragment shader source was compiled without errors."); "The second new fragment shader source was compiled without errors.");

View File

@ -32,7 +32,7 @@ function ifWebGLSupported() {
navigate(target, MULTIPLE_CONTEXTS_URL); navigate(target, MULTIPLE_CONTEXTS_URL);
let [secondProgram, thirdProgram] = yield getPrograms(front, 2); let [secondProgram, thirdProgram] = yield getPrograms(front, 2);
let programs = yield front.getPrograms(); programs = yield front.getPrograms();
is(programs.length, 2, is(programs.length, 2,
"The second and third programs should be returned by a call to getPrograms()."); "The second and third programs should be returned by a call to getPrograms().");
is(programs[0], secondProgram, is(programs[0], secondProgram,
@ -40,7 +40,7 @@ function ifWebGLSupported() {
is(programs[1], thirdProgram, is(programs[1], thirdProgram,
"The third programs was correctly retrieved from the cache."); "The third programs was correctly retrieved from the cache.");
let allPrograms = yield front._getAllPrograms(); allPrograms = yield front._getAllPrograms();
is(allPrograms.length, 3, is(allPrograms.length, 3,
"Should be three programs in cache."); "Should be three programs in cache.");
@ -53,11 +53,11 @@ function ifWebGLSupported() {
reload(target); reload(target);
yield promise.all([programsLinked, globalDestroyed, globalCreated]); yield promise.all([programsLinked, globalDestroyed, globalCreated]);
let allPrograms = yield front._getAllPrograms(); allPrograms = yield front._getAllPrograms();
is(allPrograms.length, 3, is(allPrograms.length, 3,
"Should be 3 programs total in cache."); "Should be 3 programs total in cache.");
let programs = yield front.getPrograms(); programs = yield front.getPrograms();
is(programs.length, 1, is(programs.length, 1,
"There should be 1 cached program actor now."); "There should be 1 cached program actor now.");
@ -68,18 +68,18 @@ function ifWebGLSupported() {
yield navigateInHistory(target, "forward"); yield navigateInHistory(target, "forward");
let globalDestroyed = once(front, "global-created"); globalDestroyed = once(front, "global-created");
let globalCreated = once(front, "global-destroyed"); globalCreated = once(front, "global-destroyed");
let programsLinked = getPrograms(front, 2); programsLinked = getPrograms(front, 2);
reload(target); reload(target);
yield promise.all([programsLinked, globalDestroyed, globalCreated]); yield promise.all([programsLinked, globalDestroyed, globalCreated]);
let allPrograms = yield front._getAllPrograms(); allPrograms = yield front._getAllPrograms();
is(allPrograms.length, 3, is(allPrograms.length, 3,
"Should be 3 programs total in cache."); "Should be 3 programs total in cache.");
let programs = yield front.getPrograms(); programs = yield front.getPrograms();
is(programs.length, 2, is(programs.length, 2,
"There should be 2 cached program actors now."); "There should be 2 cached program actors now.");

View File

@ -20,7 +20,7 @@ function ifWebGLSupported() {
is(pixel.b, 0, "correct `b` value for first canvas.") is(pixel.b, 0, "correct `b` value for first canvas.")
is(pixel.a, 255, "correct `a` 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 }}); pixel = yield front.getPixel({ selector: "#canvas2", position: { x: 0, y: 0 }});
is(pixel.r, 0, "correct `r` value for second canvas.") is(pixel.r, 0, "correct `r` value for second canvas.")
is(pixel.g, 255, "correct `g` 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.b, 255, "correct `b` value for second canvas.")

View File

@ -45,7 +45,7 @@ function* pointsCanBeDragged(widget) {
is(bezier.P1[1], 1, "The new P1 progress coordinate is correct"); is(bezier.P1[1], 1, "The new P1 progress coordinate is correct");
info("Listening for the update event"); info("Listening for the update event");
let onUpdated = widget.once("updated"); onUpdated = widget.once("updated");
info("Generating a mousedown/move/up on P2"); info("Generating a mousedown/move/up on P2");
widget._onPointMouseDown({target: widget.p2}); widget._onPointMouseDown({target: widget.p2});
@ -54,7 +54,7 @@ function* pointsCanBeDragged(widget) {
EventUtils.synthesizeMouse(content.document.documentElement, 200, 300, EventUtils.synthesizeMouse(content.document.documentElement, 200, 300,
{type: "mouseup"}, content.window); {type: "mouseup"}, content.window);
let bezier = yield onUpdated; bezier = yield onUpdated;
is(bezier.P2[0], 1, "The new P2 time coordinate is correct"); is(bezier.P2[0], 1, "The new P2 time coordinate is correct");
is(bezier.P2[1], 0, "The new P2 progress coordinate is correct"); is(bezier.P2[1], 0, "The new P2 progress coordinate is correct");
} }
@ -76,12 +76,12 @@ function* curveCanBeClicked(widget) {
is(bezier.P2[1], 0, "P2 progress coordinate remained unchanged"); is(bezier.P2[1], 0, "P2 progress coordinate remained unchanged");
info("Listening for the update event"); info("Listening for the update event");
let onUpdated = widget.once("updated"); onUpdated = widget.once("updated");
info("Click close to P2"); info("Click close to P2");
widget._onCurveClick({pageX: 150, pageY: 250}); widget._onCurveClick({pageX: 150, pageY: 250});
let bezier = yield onUpdated; bezier = yield onUpdated;
is(bezier.P2[0], 0.75, "The new P2 time coordinate is correct"); is(bezier.P2[0], 0.75, "The new P2 time coordinate is correct");
is(bezier.P2[1], 0.25, "The new P2 progress coordinate is correct"); is(bezier.P2[1], 0.25, "The new P2 progress coordinate is correct");
is(bezier.P1[0], 0.25, "P1 time coordinate remained unchanged"); is(bezier.P1[0], 0.25, "P1 time coordinate remained unchanged");
@ -99,45 +99,45 @@ function* pointsCanBeMovedWithKeyboard(widget) {
is(bezier.P1[1], 0.75, "The new P1 progress coordinate is correct"); is(bezier.P1[1], 0.75, "The new P1 progress coordinate is correct");
info("Moving P1 to the left, fast"); info("Moving P1 to the left, fast");
let onUpdated = widget.once("updated"); onUpdated = widget.once("updated");
widget._onPointKeyDown(getKeyEvent(widget.p1, 37, true)); widget._onPointKeyDown(getKeyEvent(widget.p1, 37, true));
let bezier = yield onUpdated; bezier = yield onUpdated;
is(bezier.P1[0], 0.085, "The new P1 time coordinate is correct"); is(bezier.P1[0], 0.085, "The new P1 time coordinate is correct");
is(bezier.P1[1], 0.75, "The new P1 progress coordinate is correct"); is(bezier.P1[1], 0.75, "The new P1 progress coordinate is correct");
info("Moving P1 to the right, fast"); info("Moving P1 to the right, fast");
let onUpdated = widget.once("updated"); onUpdated = widget.once("updated");
widget._onPointKeyDown(getKeyEvent(widget.p1, 39, true)); widget._onPointKeyDown(getKeyEvent(widget.p1, 39, true));
let bezier = yield onUpdated; bezier = yield onUpdated;
is(bezier.P1[0], 0.235, "The new P1 time coordinate is correct"); is(bezier.P1[0], 0.235, "The new P1 time coordinate is correct");
is(bezier.P1[1], 0.75, "The new P1 progress coordinate is correct"); is(bezier.P1[1], 0.75, "The new P1 progress coordinate is correct");
info("Moving P1 to the bottom"); info("Moving P1 to the bottom");
let onUpdated = widget.once("updated"); onUpdated = widget.once("updated");
widget._onPointKeyDown(getKeyEvent(widget.p1, 40)); widget._onPointKeyDown(getKeyEvent(widget.p1, 40));
let bezier = yield onUpdated; bezier = yield onUpdated;
is(bezier.P1[0], 0.235, "The new P1 time coordinate is correct"); is(bezier.P1[0], 0.235, "The new P1 time coordinate is correct");
is(bezier.P1[1], 0.735, "The new P1 progress coordinate is correct"); is(bezier.P1[1], 0.735, "The new P1 progress coordinate is correct");
info("Moving P1 to the bottom, fast"); info("Moving P1 to the bottom, fast");
let onUpdated = widget.once("updated"); onUpdated = widget.once("updated");
widget._onPointKeyDown(getKeyEvent(widget.p1, 40, true)); widget._onPointKeyDown(getKeyEvent(widget.p1, 40, true));
let bezier = yield onUpdated; bezier = yield onUpdated;
is(bezier.P1[0], 0.235, "The new P1 time coordinate is correct"); is(bezier.P1[0], 0.235, "The new P1 time coordinate is correct");
is(bezier.P1[1], 0.585, "The new P1 progress coordinate is correct"); is(bezier.P1[1], 0.585, "The new P1 progress coordinate is correct");
info("Moving P1 to the top, fast"); info("Moving P1 to the top, fast");
let onUpdated = widget.once("updated"); onUpdated = widget.once("updated");
widget._onPointKeyDown(getKeyEvent(widget.p1, 38, true)); widget._onPointKeyDown(getKeyEvent(widget.p1, 38, true));
let bezier = yield onUpdated; bezier = yield onUpdated;
is(bezier.P1[0], 0.235, "The new P1 time coordinate is correct"); is(bezier.P1[0], 0.235, "The new P1 time coordinate is correct");
is(bezier.P1[1], 0.735, "The new P1 progress coordinate is correct"); is(bezier.P1[1], 0.735, "The new P1 progress coordinate is correct");
info("Checking that keyboard events also work with P2"); info("Checking that keyboard events also work with P2");
info("Moving P2 to the left"); info("Moving P2 to the left");
let onUpdated = widget.once("updated"); onUpdated = widget.once("updated");
widget._onPointKeyDown(getKeyEvent(widget.p2, 37)); widget._onPointKeyDown(getKeyEvent(widget.p2, 37));
let bezier = yield onUpdated; bezier = yield onUpdated;
is(bezier.P2[0], 0.735, "The new P2 time coordinate is correct"); is(bezier.P2[0], 0.735, "The new P2 time coordinate is correct");
is(bezier.P2[1], 0.25, "The new P2 progress coordinate is correct"); is(bezier.P2[1], 0.25, "The new P2 progress coordinate is correct");
} }

View File

@ -55,9 +55,9 @@ function* coordinatesCanBeChangedByProvidingAValue(widget) {
is(bezier.P2[1], 1, "The new P2 progress coordinate is correct"); is(bezier.P2[1], 1, "The new P2 progress coordinate is correct");
info("Setting a custom cubic-bezier css value"); info("Setting a custom cubic-bezier css value");
let onUpdated = widget.once("updated"); onUpdated = widget.once("updated");
widget.cssCubicBezierValue = "cubic-bezier(.25,-0.5, 1, 1.45)"; widget.cssCubicBezierValue = "cubic-bezier(.25,-0.5, 1, 1.45)";
let bezier = yield onUpdated; bezier = yield onUpdated;
ok(true, "The updated event was fired as a result of setting cssValue"); ok(true, "The updated event was fired as a result of setting cssValue");
is(bezier.P1[0], .25, "The new P1 time coordinate is correct"); is(bezier.P1[0], .25, "The new P1 time coordinate is correct");

View File

@ -171,7 +171,7 @@ function takesScrollingIntoAccount(doc, helper) {
scrolledNode.scrollTop = 0; scrolledNode.scrollTop = 0;
subScrolledNode.scrollTop = 0; subScrolledNode.scrollTop = 0;
let quad = helper.getAdjustedQuads(innerNode, "content"); quad = helper.getAdjustedQuads(innerNode, "content");
is(quad.p1.x, 0, "p1.x of the scrolled node is correct after scrolling up"); is(quad.p1.x, 0, "p1.x of the scrolled node is correct after scrolling up");
is(quad.p1.y, 0, "p1.y of the scrolled node is correct after scrolling up"); is(quad.p1.y, 0, "p1.y of the scrolled node is correct after scrolling up");
} }

View File

@ -42,7 +42,7 @@ function testParseCssProperty() {
target.innerHTML = ""; target.innerHTML = "";
let frag = parser.parseCssProperty("background-image", "linear-gradient(to right, #F60 10%, rgba(0,0,0,1))", { frag = parser.parseCssProperty("background-image", "linear-gradient(to right, #F60 10%, rgba(0,0,0,1))", {
colorSwatchClass: "test-colorswatch", colorSwatchClass: "test-colorswatch",
colorClass: "test-color" colorClass: "test-color"
}); });

View File

@ -339,12 +339,12 @@ function testAPI() {
// Calling it again should sort by it in descending manner // Calling it again should sort by it in descending manner
table.sortBy("col2"); table.sortBy("col2");
let cell = table.tbody.children[2].firstChild.lastChild.previousSibling; cell = table.tbody.children[2].firstChild.lastChild.previousSibling;
checkDescendingOrder(cell); checkDescendingOrder(cell);
// Calling it again should sort by it in ascending manner // Calling it again should sort by it in ascending manner
table.sortBy("col2"); table.sortBy("col2");
let cell = table.tbody.children[2].firstChild.children[2]; cell = table.tbody.children[2].firstChild.children[2];
checkAscendingOrder(cell); checkAscendingOrder(cell);
table.clear(); table.clear();
@ -352,13 +352,13 @@ function testAPI() {
// testing if sorting works should sort by ascending manner // testing if sorting works should sort by ascending manner
table.sortBy("col4"); table.sortBy("col4");
let cell = table.tbody.children[6].firstChild.children[1]; cell = table.tbody.children[6].firstChild.children[1];
is(cell.textContent, "domnode", "DOMNode sorted correctly"); is(cell.textContent, "domnode", "DOMNode sorted correctly");
checkAscendingOrder(cell.nextSibling); checkAscendingOrder(cell.nextSibling);
// Calling it again should sort it in descending order // Calling it again should sort it in descending order
table.sortBy("col4"); table.sortBy("col4");
let cell = table.tbody.children[6].firstChild.children[9]; cell = table.tbody.children[6].firstChild.children[9];
is(cell.textContent, "domnode", "DOMNode sorted correctly"); is(cell.textContent, "domnode", "DOMNode sorted correctly");
checkDescendingOrder(cell.previousSibling); checkDescendingOrder(cell.previousSibling);
} }

View File

@ -147,7 +147,7 @@ let testKeyboardInteraction = Task.async(function*() {
info("Pressing down key to select next row"); info("Pressing down key to select next row");
event = table.once(TableWidget.EVENTS.ROW_SELECTED); event = table.once(TableWidget.EVENTS.ROW_SELECTED);
EventUtils.sendKey("DOWN", doc.defaultView); EventUtils.sendKey("DOWN", doc.defaultView);
let id = yield event; id = yield event;
is(id, "id2", "Correct row was selected after pressing down"); is(id, "id2", "Correct row was selected after pressing down");
ok(node.classList.contains("theme-selected"), "row has selected class"); ok(node.classList.contains("theme-selected"), "row has selected class");
let nodes = doc.querySelectorAll(".theme-selected"); let nodes = doc.querySelectorAll(".theme-selected");
@ -166,7 +166,7 @@ let testKeyboardInteraction = Task.async(function*() {
id = yield event; id = yield event;
is(id, "id3", "Correct row was selected after pressing down"); is(id, "id3", "Correct row was selected after pressing down");
ok(node.classList.contains("theme-selected"), "row has selected class"); ok(node.classList.contains("theme-selected"), "row has selected class");
let nodes = doc.querySelectorAll(".theme-selected"); nodes = doc.querySelectorAll(".theme-selected");
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
is(nodes[i].getAttribute("data-id"), "id3", is(nodes[i].getAttribute("data-id"), "id3",
"Correct cell selected in all columns"); "Correct cell selected in all columns");
@ -183,7 +183,7 @@ let testKeyboardInteraction = Task.async(function*() {
id = yield event; id = yield event;
is(id, "id2", "Correct row was selected after pressing down"); is(id, "id2", "Correct row was selected after pressing down");
ok(node.classList.contains("theme-selected"), "row has selected class"); ok(node.classList.contains("theme-selected"), "row has selected class");
let nodes = doc.querySelectorAll(".theme-selected"); nodes = doc.querySelectorAll(".theme-selected");
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
is(nodes[i].getAttribute("data-id"), "id2", is(nodes[i].getAttribute("data-id"), "id2",
"Correct cell selected in all columns"); "Correct cell selected in all columns");
@ -202,7 +202,7 @@ let testKeyboardInteraction = Task.async(function*() {
id = yield event; id = yield event;
is(id, "id1", "Correct row was selected after pressing down"); is(id, "id1", "Correct row was selected after pressing down");
ok(node.classList.contains("theme-selected"), "row has selected class"); ok(node.classList.contains("theme-selected"), "row has selected class");
let nodes = doc.querySelectorAll(".theme-selected"); nodes = doc.querySelectorAll(".theme-selected");
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
is(nodes[i].getAttribute("data-id"), "id1", is(nodes[i].getAttribute("data-id"), "id1",
"Correct cell selected in all columns"); "Correct cell selected in all columns");
@ -219,7 +219,7 @@ let testKeyboardInteraction = Task.async(function*() {
id = yield event; id = yield event;
is(id, "id9", "Correct row was selected after pressing down"); is(id, "id9", "Correct row was selected after pressing down");
ok(node.classList.contains("theme-selected"), "row has selected class"); ok(node.classList.contains("theme-selected"), "row has selected class");
let nodes = doc.querySelectorAll(".theme-selected"); nodes = doc.querySelectorAll(".theme-selected");
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
is(nodes[i].getAttribute("data-id"), "id9", is(nodes[i].getAttribute("data-id"), "id9",
"Correct cell selected in all columns"); "Correct cell selected in all columns");

View File

@ -147,13 +147,13 @@ let testMouseInteraction = Task.async(function*() {
is(id, "id1", "Correct row was selected"); is(id, "id1", "Correct row was selected");
info("clicking on third row to select it"); info("clicking on third row to select it");
let event = table.once(TableWidget.EVENTS.ROW_SELECTED); event = table.once(TableWidget.EVENTS.ROW_SELECTED);
let node2 = table.tbody.firstChild.firstChild.children[3]; let node2 = table.tbody.firstChild.firstChild.children[3];
// node should not have selected class // node should not have selected class
ok(!node2.classList.contains("theme-selected"), ok(!node2.classList.contains("theme-selected"),
"New node should not have selected class before clicking"); "New node should not have selected class before clicking");
click(node2); click(node2);
let id = yield event; id = yield event;
ok(node2.classList.contains("theme-selected"), ok(node2.classList.contains("theme-selected"),
"New node has selected class after clicking"); "New node has selected class after clicking");
is(id, "id3", "Correct table path is emitted for new node") is(id, "id3", "Correct table path is emitted for new node")
@ -162,15 +162,15 @@ let testMouseInteraction = Task.async(function*() {
"Old node should not have selected class after the click on new node"); "Old node should not have selected class after the click on new node");
// clicking on table header to sort by it // clicking on table header to sort by it
let event = table.once(TableWidget.EVENTS.COLUMN_SORTED); event = table.once(TableWidget.EVENTS.COLUMN_SORTED);
let node = table.tbody.children[6].firstChild.children[0]; node = table.tbody.children[6].firstChild.children[0];
info("clicking on the 4th coulmn header to sort the table by it"); info("clicking on the 4th coulmn header to sort the table by it");
ok(!node.hasAttribute("sorted"), ok(!node.hasAttribute("sorted"),
"Node should not have sorted attribute before clicking"); "Node should not have sorted attribute before clicking");
ok(doc.querySelector("[sorted]"), "Although, something else should be sorted on"); ok(doc.querySelector("[sorted]"), "Although, something else should be sorted on");
isnot(doc.querySelector("[sorted]"), node, "Which is not equal to this node"); isnot(doc.querySelector("[sorted]"), node, "Which is not equal to this node");
click(node); click(node);
let id = yield event; id = yield event;
is(id, "col4", "Correct column was sorted on"); is(id, "col4", "Correct column was sorted on");
ok(node.hasAttribute("sorted"), ok(node.hasAttribute("sorted"),
"Node should now have sorted attribute after clicking"); "Node should now have sorted attribute after clicking");
@ -181,13 +181,13 @@ let testMouseInteraction = Task.async(function*() {
// test context menu opening. // test context menu opening.
// hiding second column // hiding second column
// event listener for popupshown // event listener for popupshown
let event = Promise.defer(); event = Promise.defer();
table.menupopup.addEventListener("popupshown", function onPopupShown(e) { table.menupopup.addEventListener("popupshown", function onPopupShown(e) {
table.menupopup.removeEventListener("popupshown", onPopupShown); table.menupopup.removeEventListener("popupshown", onPopupShown);
event.resolve(); event.resolve();
}) })
info("right clicking on the first column header"); info("right clicking on the first column header");
let node = table.tbody.firstChild.firstChild.firstChild; node = table.tbody.firstChild.firstChild.firstChild;
click(node, 2); click(node, 2);
yield event.promise; yield event.promise;
is(table.menupopup.querySelectorAll("[disabled]").length, 1, is(table.menupopup.querySelectorAll("[disabled]").length, 1,
@ -197,52 +197,52 @@ let testMouseInteraction = Task.async(function*() {
"Which is the unique column"); "Which is the unique column");
// popup should be open now // popup should be open now
// clicking on second column label // clicking on second column label
let event = table.once(TableWidget.EVENTS.HEADER_CONTEXT_MENU); event = table.once(TableWidget.EVENTS.HEADER_CONTEXT_MENU);
let node = table.menupopup.querySelector("[data-id='col2']"); node = table.menupopup.querySelector("[data-id='col2']");
info("selecting to hide the second column"); info("selecting to hide the second column");
ok(!table.tbody.children[2].hasAttribute("hidden"), ok(!table.tbody.children[2].hasAttribute("hidden"),
"Column is not hidden before hiding it"); "Column is not hidden before hiding it");
click(node); click(node);
let id = yield event; id = yield event;
is(id, "col2", "Correct column was triggered to be hidden"); is(id, "col2", "Correct column was triggered to be hidden");
is(table.tbody.children[2].getAttribute("hidden"), "true", is(table.tbody.children[2].getAttribute("hidden"), "true",
"Column is hidden after hiding it"); "Column is hidden after hiding it");
// hiding third column // hiding third column
// event listener for popupshown // event listener for popupshown
let event = Promise.defer(); event = Promise.defer();
table.menupopup.addEventListener("popupshown", function onPopupShown(e) { table.menupopup.addEventListener("popupshown", function onPopupShown(e) {
table.menupopup.removeEventListener("popupshown", onPopupShown); table.menupopup.removeEventListener("popupshown", onPopupShown);
event.resolve(); event.resolve();
}) })
info("right clicking on the first column header"); info("right clicking on the first column header");
let node = table.tbody.firstChild.firstChild.firstChild; node = table.tbody.firstChild.firstChild.firstChild;
click(node, 2); click(node, 2);
yield event.promise; yield event.promise;
is(table.menupopup.querySelectorAll("[disabled]").length, 1, is(table.menupopup.querySelectorAll("[disabled]").length, 1,
"Only 1 menuitem is disabled"); "Only 1 menuitem is disabled");
// popup should be open now // popup should be open now
// clicking on second column label // clicking on second column label
let event = table.once(TableWidget.EVENTS.HEADER_CONTEXT_MENU); event = table.once(TableWidget.EVENTS.HEADER_CONTEXT_MENU);
let node = table.menupopup.querySelector("[data-id='col3']"); node = table.menupopup.querySelector("[data-id='col3']");
info("selecting to hide the second column"); info("selecting to hide the second column");
ok(!table.tbody.children[4].hasAttribute("hidden"), ok(!table.tbody.children[4].hasAttribute("hidden"),
"Column is not hidden before hiding it"); "Column is not hidden before hiding it");
click(node); click(node);
let id = yield event; id = yield event;
is(id, "col3", "Correct column was triggered to be hidden"); is(id, "col3", "Correct column was triggered to be hidden");
is(table.tbody.children[4].getAttribute("hidden"), "true", is(table.tbody.children[4].getAttribute("hidden"), "true",
"Column is hidden after hiding it"); "Column is hidden after hiding it");
// opening again to see if 2 items are disabled now // opening again to see if 2 items are disabled now
// event listener for popupshown // event listener for popupshown
let event = Promise.defer(); event = Promise.defer();
table.menupopup.addEventListener("popupshown", function onPopupShown(e) { table.menupopup.addEventListener("popupshown", function onPopupShown(e) {
table.menupopup.removeEventListener("popupshown", onPopupShown); table.menupopup.removeEventListener("popupshown", onPopupShown);
event.resolve(); event.resolve();
}) })
info("right clicking on the first column header"); info("right clicking on the first column header");
let node = table.tbody.firstChild.firstChild.firstChild; node = table.tbody.firstChild.firstChild.firstChild;
click(node, 2); click(node, 2);
yield event.promise; yield event.promise;
is(table.menupopup.querySelectorAll("[disabled]").length, 2, is(table.menupopup.querySelectorAll("[disabled]").length, 2,
@ -257,37 +257,37 @@ let testMouseInteraction = Task.async(function*() {
// showing back 2nd column // showing back 2nd column
// popup should be open now // popup should be open now
// clicking on second column label // clicking on second column label
let event = table.once(TableWidget.EVENTS.HEADER_CONTEXT_MENU); event = table.once(TableWidget.EVENTS.HEADER_CONTEXT_MENU);
let node = table.menupopup.querySelector("[data-id='col2']"); node = table.menupopup.querySelector("[data-id='col2']");
info("selecting to hide the second column"); info("selecting to hide the second column");
is(table.tbody.children[2].getAttribute("hidden"), "true", is(table.tbody.children[2].getAttribute("hidden"), "true",
"Column is hidden before unhiding it"); "Column is hidden before unhiding it");
click(node); click(node);
let id = yield event; id = yield event;
is(id, "col2", "Correct column was triggered to be hidden"); is(id, "col2", "Correct column was triggered to be hidden");
ok(!table.tbody.children[2].hasAttribute("hidden"), ok(!table.tbody.children[2].hasAttribute("hidden"),
"Column is not hidden after unhiding it"); "Column is not hidden after unhiding it");
// showing back 3rd column // showing back 3rd column
// event listener for popupshown // event listener for popupshown
let event = Promise.defer(); event = Promise.defer();
table.menupopup.addEventListener("popupshown", function onPopupShown(e) { table.menupopup.addEventListener("popupshown", function onPopupShown(e) {
table.menupopup.removeEventListener("popupshown", onPopupShown); table.menupopup.removeEventListener("popupshown", onPopupShown);
event.resolve(); event.resolve();
}) })
info("right clicking on the first column header"); info("right clicking on the first column header");
let node = table.tbody.firstChild.firstChild.firstChild; node = table.tbody.firstChild.firstChild.firstChild;
click(node, 2); click(node, 2);
yield event.promise; yield event.promise;
// popup should be open now // popup should be open now
// clicking on second column label // clicking on second column label
let event = table.once(TableWidget.EVENTS.HEADER_CONTEXT_MENU); event = table.once(TableWidget.EVENTS.HEADER_CONTEXT_MENU);
let node = table.menupopup.querySelector("[data-id='col3']"); node = table.menupopup.querySelector("[data-id='col3']");
info("selecting to hide the second column"); info("selecting to hide the second column");
is(table.tbody.children[4].getAttribute("hidden"), "true", is(table.tbody.children[4].getAttribute("hidden"), "true",
"Column is hidden before unhiding it"); "Column is hidden before unhiding it");
click(node); click(node);
let id = yield event; id = yield event;
is(id, "col3", "Correct column was triggered to be hidden"); is(id, "col3", "Correct column was triggered to be hidden");
ok(!table.tbody.children[4].hasAttribute("hidden"), ok(!table.tbody.children[4].hasAttribute("hidden"),
"Column is not hidden after unhiding it"); "Column is not hidden after unhiding it");

View File

@ -124,7 +124,7 @@ let testKeyboardInteraction = Task.async(function*() {
event = Promise.defer(); event = Promise.defer();
tree.once("select", pass); tree.once("select", pass);
EventUtils.sendKey("DOWN", content); EventUtils.sendKey("DOWN", content);
let [name, data, attachment] = yield event.promise; [name, data, attachment] = yield event.promise;
is(data.length, 2, "Correct level item was selected after second down keypress"); is(data.length, 2, "Correct level item was selected after second down keypress");
is(data[0], "level1", "Correct parent level"); is(data[0], "level1", "Correct parent level");
is(data[1], "level2", "Correct second level"); is(data[1], "level2", "Correct second level");
@ -133,7 +133,7 @@ let testKeyboardInteraction = Task.async(function*() {
event = Promise.defer(); event = Promise.defer();
tree.once("select", pass); tree.once("select", pass);
EventUtils.sendKey("DOWN", content); EventUtils.sendKey("DOWN", content);
let [name, data, attachment] = yield event.promise; [name, data, attachment] = yield event.promise;
is(data.length, 3, "Correct level item was selected after third down keypress"); is(data.length, 3, "Correct level item was selected after third down keypress");
is(data[0], "level1", "Correct parent level"); is(data[0], "level1", "Correct parent level");
is(data[1], "level2", "Correct second level"); is(data[1], "level2", "Correct second level");
@ -143,7 +143,7 @@ let testKeyboardInteraction = Task.async(function*() {
event = Promise.defer(); event = Promise.defer();
tree.once("select", pass); tree.once("select", pass);
EventUtils.sendKey("DOWN", content); EventUtils.sendKey("DOWN", content);
let [name, data, attachment] = yield event.promise; [name, data, attachment] = yield event.promise;
is(data.length, 2, "Correct level item was selected after fourth down keypress"); is(data.length, 2, "Correct level item was selected after fourth down keypress");
is(data[0], "level1", "Correct parent level"); is(data[0], "level1", "Correct parent level");
is(data[1], "level2-1", "Correct second level"); is(data[1], "level2-1", "Correct second level");
@ -173,7 +173,7 @@ let testKeyboardInteraction = Task.async(function*() {
node = tree.root.children.firstChild.nextSibling.firstChild; node = tree.root.children.firstChild.nextSibling.firstChild;
ok(node.hasAttribute("expanded"), "Parent is expanded"); ok(node.hasAttribute("expanded"), "Parent is expanded");
EventUtils.sendKey("LEFT", content); EventUtils.sendKey("LEFT", content);
let [name, data] = yield event.promise; [name, data] = yield event.promise;
is(data.length, 3, "Correct level item was selected after second left keypress"); is(data.length, 3, "Correct level item was selected after second left keypress");
is(data[0], "level1", "Correct parent level"); is(data[0], "level1", "Correct parent level");
is(data[1], "level2", "Correct second level"); is(data[1], "level2", "Correct second level");
@ -186,7 +186,7 @@ let testKeyboardInteraction = Task.async(function*() {
event = Promise.defer(); event = Promise.defer();
tree.once("select", pass); tree.once("select", pass);
EventUtils.sendKey("DOWN", content); EventUtils.sendKey("DOWN", content);
let [name, data, attachment] = yield event.promise; [name, data, attachment] = yield event.promise;
is(data.length, 2, "Correct level item was selected after fifth down keypress"); is(data.length, 2, "Correct level item was selected after fifth down keypress");
is(data[0], "level1", "Correct parent level"); is(data[0], "level1", "Correct parent level");
is(data[1], "level2-1", "Correct second level"); is(data[1], "level2-1", "Correct second level");

View File

@ -123,7 +123,7 @@ let testMouseInteraction = Task.async(function*() {
ok(!node2.hasAttribute("expanded"), "New node is not expanded before clicking"); ok(!node2.hasAttribute("expanded"), "New node is not expanded before clicking");
tree.once("select", pass); tree.once("select", pass);
click(node2); click(node2);
let [name, data, attachment] = yield event.promise; [name, data, attachment] = yield event.promise;
ok(node2.classList.contains("theme-selected"), ok(node2.classList.contains("theme-selected"),
"New node has selected class after clicking"); "New node has selected class after clicking");
is(data[0], "level1", "Correct tree path is emitted for new node") is(data[0], "level1", "Correct tree path is emitted for new node")

View File

@ -35,8 +35,8 @@ function offsetsGetterReturnsData() {
do_print("offsets getter returns data according to current padding"); do_print("offsets getter returns data according to current padding");
let b = new BezierCanvas(getCanvasMock(), getCubicBezier(), [0, 0]); b = new BezierCanvas(getCanvasMock(), getCubicBezier(), [0, 0]);
let offsets = b.offsets; offsets = b.offsets;
do_check_eq(offsets[0].top, "400px"); do_check_eq(offsets[0].top, "400px");
do_check_eq(offsets[0].left, "0px"); do_check_eq(offsets[0].left, "0px");
@ -57,14 +57,14 @@ function convertsOffsetsToCoordinates() {
do_check_eq(coordinates[0], 0); do_check_eq(coordinates[0], 0);
do_check_eq(coordinates[1], 1.5); do_check_eq(coordinates[1], 1.5);
let coordinates = b.offsetsToCoordinates({style: { coordinates = b.offsetsToCoordinates({style: {
left: "0px", left: "0px",
top: "300px" top: "300px"
}}); }});
do_check_eq(coordinates[0], 0); do_check_eq(coordinates[0], 0);
do_check_eq(coordinates[1], 0); do_check_eq(coordinates[1], 0);
let coordinates = b.offsetsToCoordinates({style: { coordinates = b.offsetsToCoordinates({style: {
left: "200px", left: "200px",
top: "100px" top: "100px"
}}); }});

View File

@ -63,8 +63,8 @@ function coordinatesToStringOutputsAString() {
let string = c.coordinates.toString(); let string = c.coordinates.toString();
do_check_eq(string, "0,1,.5,-2"); do_check_eq(string, "0,1,.5,-2");
let c = new CubicBezier([1, 1, 1, 1]); c = new CubicBezier([1, 1, 1, 1]);
let string = c.coordinates.toString(); string = c.coordinates.toString();
do_check_eq(string, "1,1,1,1"); do_check_eq(string, "1,1,1,1");
} }

View File

@ -193,7 +193,7 @@ function spawnTest() {
}, },
]); ]);
let toolbox = gDevTools.getToolbox(options.target); toolbox = gDevTools.getToolbox(options.target);
ok(toolbox != null, "toolbox is open"); ok(toolbox != null, "toolbox is open");
let styleEditor = toolbox.getCurrentPanel(); let styleEditor = toolbox.getCurrentPanel();

View File

@ -73,7 +73,7 @@ function testInitialState(aEditor) {
ok(aEditor.sourceEditor.hasFocus(), "new editor has focus"); ok(aEditor.sourceEditor.hasFocus(), "new editor has focus");
let summary = aEditor.summary; summary = aEditor.summary;
let ruleCount = summary.querySelector(".stylesheet-rule-count").textContent; let ruleCount = summary.querySelector(".stylesheet-rule-count").textContent;
is(parseInt(ruleCount), 0, is(parseInt(ruleCount), 0,
"new editor initially shows 0 rules"); "new editor initially shows 0 rules");

View File

@ -50,7 +50,7 @@ let test = asyncTest(function*() {
ok(secondStyleSelectors.childNodes.length > 0, "Matched selectors expanded"); ok(secondStyleSelectors.childNodes.length > 0, "Matched selectors expanded");
info("Tab back up and test the same thing, with space"); info("Tab back up and test the same thing, with space");
let onExpanded = inspector.once("computed-view-property-expanded"); onExpanded = inspector.once("computed-view-property-expanded");
EventUtils.synthesizeKey("VK_TAB", {shiftKey: true}); EventUtils.synthesizeKey("VK_TAB", {shiftKey: true});
EventUtils.synthesizeKey("VK_SPACE", {}); EventUtils.synthesizeKey("VK_SPACE", {});
yield onExpanded; yield onExpanded;

View File

@ -45,7 +45,7 @@ let test = asyncTest(function*() {
info("Pressing return to commit and focus the new value field"); info("Pressing return to commit and focus the new value field");
let onValueFocus = once(elementRuleEditor.element, "focus", true); let onValueFocus = once(elementRuleEditor.element, "focus", true);
let onModifications = elementRuleEditor.rule._applyingModifications; onModifications = elementRuleEditor.rule._applyingModifications;
EventUtils.synthesizeKey("VK_RETURN", {}, view.doc.defaultView); EventUtils.synthesizeKey("VK_RETURN", {}, view.doc.defaultView);
yield onValueFocus; yield onValueFocus;
yield onModifications; yield onModifications;
@ -62,7 +62,7 @@ let test = asyncTest(function*() {
editor.input.value = "red"; editor.input.value = "red";
info("Escaping out of the field"); info("Escaping out of the field");
let onModifications = elementRuleEditor.rule._applyingModifications; onModifications = elementRuleEditor.rule._applyingModifications;
EventUtils.synthesizeKey("VK_ESCAPE", {}, view.doc.defaultView); EventUtils.synthesizeKey("VK_ESCAPE", {}, view.doc.defaultView);
yield onModifications; yield onModifications;
@ -70,7 +70,7 @@ let test = asyncTest(function*() {
let focusedElement = inplaceEditor(elementRuleEditor.rule.textProps[0].editor.valueSpan).input; let focusedElement = inplaceEditor(elementRuleEditor.rule.textProps[0].editor.valueSpan).input;
is(focusedElement, focusedElement.ownerDocument.activeElement, "Correct element has focus"); is(focusedElement, focusedElement.ownerDocument.activeElement, "Correct element has focus");
let onModifications = elementRuleEditor.rule._applyingModifications; onModifications = elementRuleEditor.rule._applyingModifications;
EventUtils.synthesizeKey("VK_ESCAPE", {}, view.doc.defaultView); EventUtils.synthesizeKey("VK_ESCAPE", {}, view.doc.defaultView);
yield onModifications; yield onModifications;

View File

@ -68,7 +68,7 @@ function* testCreateNew(view) {
info("Entering a value and bluring the field to expect a rule change"); info("Entering a value and bluring the field to expect a rule change");
editor.input.value = "#XYZ"; editor.input.value = "#XYZ";
let onBlur = once(editor.input, "blur"); let onBlur = once(editor.input, "blur");
let onModifications = elementRuleEditor.rule._applyingModifications; onModifications = elementRuleEditor.rule._applyingModifications;
editor.input.blur(); editor.input.blur();
yield onBlur; yield onBlur;
yield onModifications; yield onModifications;

View File

@ -54,7 +54,7 @@ function* testImageTooltipAfterColorChange(swatch, url, ruleView) {
// After a color change, the property is re-populated, we need to get the new // After a color change, the property is re-populated, we need to get the new
// dom node // dom node
url = getRuleViewProperty(ruleView, "body", "background").valueSpan.querySelector(".theme-link"); url = getRuleViewProperty(ruleView, "body", "background").valueSpan.querySelector(".theme-link");
let anchor = yield isHoverTooltipTarget(ruleView.tooltips.previewTooltip, url); anchor = yield isHoverTooltipTarget(ruleView.tooltips.previewTooltip, url);
ok(anchor, "The image preview tooltip is shown on the url span"); ok(anchor, "The image preview tooltip is shown on the url span");
is(anchor, url, "The anchor returned by the showOnHover callback is correct"); is(anchor, url, "The anchor returned by the showOnHover callback is correct");
} }

View File

@ -49,13 +49,13 @@ function* testColorChangeIsntRevertedWhenOtherTooltipIsShown(ruleView) {
info("Open the image preview tooltip"); info("Open the image preview tooltip");
let value = getRuleViewProperty(ruleView, "body", "background").valueSpan; let value = getRuleViewProperty(ruleView, "body", "background").valueSpan;
let url = value.querySelector(".theme-link"); let url = value.querySelector(".theme-link");
let onShown = ruleView.tooltips.previewTooltip.once("shown"); onShown = ruleView.tooltips.previewTooltip.once("shown");
let anchor = yield isHoverTooltipTarget(ruleView.tooltips.previewTooltip, url); let anchor = yield isHoverTooltipTarget(ruleView.tooltips.previewTooltip, url);
ruleView.tooltips.previewTooltip.show(anchor); ruleView.tooltips.previewTooltip.show(anchor);
yield onShown; yield onShown;
info("Image tooltip is shown, verify that the swatch is still correct"); info("Image tooltip is shown, verify that the swatch is still correct");
let swatch = value.querySelector(".ruleview-colorswatch"); swatch = value.querySelector(".ruleview-colorswatch");
is(swatch.style.backgroundColor, "rgb(0, 0, 0)", "The swatch's color is correct"); is(swatch.style.backgroundColor, "rgb(0, 0, 0)", "The swatch's color is correct");
is(swatch.nextSibling.textContent, "#000", "The color name is correct"); is(swatch.nextSibling.textContent, "#000", "The color name is correct");
} }

View File

@ -65,7 +65,7 @@ function* testEditProperty(view, name, value, browser) {
info("Entering a new value, including ; to commit and blur the value"); info("Entering a new value, including ; to commit and blur the value");
let onBlur = once(input, "blur"); let onBlur = once(input, "blur");
let onModifications = idRuleEditor.rule._applyingModifications; onModifications = idRuleEditor.rule._applyingModifications;
for (let ch of value + ";") { for (let ch of value + ";") {
EventUtils.sendChar(ch, view.doc.defaultView); EventUtils.sendChar(ch, view.doc.defaultView);
} }

View File

@ -76,7 +76,7 @@ function* testEditProperty(inspector, ruleView) {
is(newValue, "red", "border-color should have been set."); is(newValue, "red", "border-color should have been set.");
info("Entering property name \"color\" followed by a colon to focus the value"); info("Entering property name \"color\" followed by a colon to focus the value");
let onFocus = once(idRuleEditor.element, "focus", true); onFocus = once(idRuleEditor.element, "focus", true);
for (let ch of "color:") { for (let ch of "color:") {
EventUtils.sendChar(ch, ruleView.doc.defaultView); EventUtils.sendChar(ch, ruleView.doc.defaultView);
} }
@ -86,7 +86,7 @@ function* testEditProperty(inspector, ruleView) {
editor = inplaceEditor(ruleView.doc.activeElement); editor = inplaceEditor(ruleView.doc.activeElement);
info("Entering a value following by a semi-colon to commit it"); info("Entering a value following by a semi-colon to commit it");
let onBlur = once(editor.input, "blur"); onBlur = once(editor.input, "blur");
for (let ch of "red;") { for (let ch of "red;") {
EventUtils.sendChar(ch, ruleView.doc.defaultView); EventUtils.sendChar(ch, ruleView.doc.defaultView);
} }
@ -119,7 +119,7 @@ function* testDisableProperty(inspector, ruleView) {
propEditor.enable.click(); propEditor.enable.click();
yield idRuleEditor.rule._applyingModifications; yield idRuleEditor.rule._applyingModifications;
let newValue = yield executeInContent("Test:GetRulePropertyValue", { newValue = yield executeInContent("Test:GetRulePropertyValue", {
styleSheetIndex: 0, styleSheetIndex: 0,
ruleIndex: 0, ruleIndex: 0,
name: "border-color" name: "border-color"

View File

@ -27,17 +27,17 @@ let test = asyncTest(function*() {
editor.input.value = "color"; editor.input.value = "color";
info("Typing ENTER to focus the next field: property value"); info("Typing ENTER to focus the next field: property value");
let onFocus = once(brace.parentNode, "focus", true); onFocus = once(brace.parentNode, "focus", true);
EventUtils.sendKey("return"); EventUtils.sendKey("return");
yield onFocus; yield onFocus;
ok(true, "The value field was focused"); ok(true, "The value field was focused");
info("Entering a property value"); info("Entering a property value");
let editor = getCurrentInplaceEditor(view); editor = getCurrentInplaceEditor(view);
editor.input.value = "green"; editor.input.value = "green";
info("Typing ENTER again should focus a new property name"); info("Typing ENTER again should focus a new property name");
let onFocus = once(brace.parentNode, "focus", true); onFocus = once(brace.parentNode, "focus", true);
EventUtils.sendKey("return"); EventUtils.sendKey("return");
yield onFocus; yield onFocus;
ok(true, "The new property name field was focused"); ok(true, "The new property name field was focused");

View File

@ -110,7 +110,7 @@ function* testTopLeft(inspector, view) {
is(defaultView.getComputedStyle(element).getPropertyValue("padding-top"), "32px", is(defaultView.getComputedStyle(element).getPropertyValue("padding-top"), "32px",
"Added property should not apply to element"); "Added property should not apply to element");
let firstProp = elementRuleView.addProperty("background-color", "rgb(0, 0, 255)", ""); firstProp = elementRuleView.addProperty("background-color", "rgb(0, 0, 255)", "");
yield elementRule._applyingModifications; yield elementRule._applyingModifications;
is(defaultView.getComputedStyle(element).getPropertyValue("background-color"), "rgb(0, 0, 255)", is(defaultView.getComputedStyle(element).getPropertyValue("background-color"), "rgb(0, 0, 255)",

View File

@ -38,7 +38,7 @@ let test = asyncTest(function*() {
checkRuleViewContent(view, ["element", ".testclass"]); checkRuleViewContent(view, ["element", ".testclass"]);
info("Reverting the ID attribute change"); info("Reverting the ID attribute change");
let ruleViewRefreshed = inspector.once("rule-view-refreshed"); ruleViewRefreshed = inspector.once("rule-view-refreshed");
testElement.setAttribute("id", "testid"); testElement.setAttribute("id", "testid");
yield ruleViewRefreshed; yield ruleViewRefreshed;

View File

@ -34,7 +34,7 @@ let test = asyncTest(function*() {
is(textAlign, "right", "The rule view shows the new text align."); is(textAlign, "right", "The rule view shows the new text align.");
let color = getRuleViewPropertyValue(view, "element", "color"); let color = getRuleViewPropertyValue(view, "element", "color");
is(color, "lightgoldenrodyellow", "The rule view shows the new color.") is(color, "lightgoldenrodyellow", "The rule view shows the new color.")
let fontSize = getRuleViewPropertyValue(view, "element", "font-size"); fontSize = getRuleViewPropertyValue(view, "element", "font-size");
is(fontSize, "3em", "The rule view shows the new font size."); is(fontSize, "3em", "The rule view shows the new font size.");
let textTransform = getRuleViewPropertyValue(view, "element", "text-transform"); let textTransform = getRuleViewPropertyValue(view, "element", "text-transform");
is(textTransform, "uppercase", "The rule view shows the new text transform."); is(textTransform, "uppercase", "The rule view shows the new text transform.");

View File

@ -63,7 +63,7 @@ let test = asyncTest(function*() {
info("Checking that the right NodeFront reference and options are passed"); info("Checking that the right NodeFront reference and options are passed");
yield selectNode("p", inspector); yield selectNode("p", inspector);
let selectorSpan = getRuleViewSelector(rView, "p").firstElementChild; selectorSpan = getRuleViewSelector(rView, "p").firstElementChild;
rView.highlighters._onMouseMove({target: selectorSpan}); rView.highlighters._onMouseMove({target: selectorSpan});
is(HighlighterFront.nodeFront.tagName, "P", is(HighlighterFront.nodeFront.tagName, "P",
"The right NodeFront is passed to the highlighter (1)"); "The right NodeFront is passed to the highlighter (1)");
@ -71,7 +71,7 @@ let test = asyncTest(function*() {
"The right selector option is passed to the highlighter (1)"); "The right selector option is passed to the highlighter (1)");
yield selectNode("body", inspector); yield selectNode("body", inspector);
let selectorSpan = getRuleViewSelector(rView, "body").firstElementChild; selectorSpan = getRuleViewSelector(rView, "body").firstElementChild;
rView.highlighters._onMouseMove({target: selectorSpan}); rView.highlighters._onMouseMove({target: selectorSpan});
is(HighlighterFront.nodeFront.tagName, "BODY", is(HighlighterFront.nodeFront.tagName, "BODY",
"The right NodeFront is passed to the highlighter (2)"); "The right NodeFront is passed to the highlighter (2)");

View File

@ -31,7 +31,7 @@ function* selectNodes(inspector, ruleView) {
is(relativeLink.getAttribute("href"), TEST_IMAGE, "href matches"); is(relativeLink.getAttribute("href"), TEST_IMAGE, "href matches");
yield selectNode(relative2, inspector); yield selectNode(relative2, inspector);
let relativeLink = ruleView.doc.querySelector(".ruleview-propertycontainer a"); relativeLink = ruleView.doc.querySelector(".ruleview-propertycontainer a");
ok(relativeLink, "Link exists for relative2 node"); ok(relativeLink, "Link exists for relative2 node");
is(relativeLink.getAttribute("href"), TEST_IMAGE, "href matches"); is(relativeLink.getAttribute("href"), TEST_IMAGE, "href matches");

View File

@ -66,16 +66,16 @@ function* userAgentStylesVisible(inspector, view) {
yield selectNode("pre", inspector); yield selectNode("pre", inspector);
yield compareAppliedStylesWithUI(inspector, view, "ua"); yield compareAppliedStylesWithUI(inspector, view, "ua");
let userRules = view._elementStyle.rules.filter(rule=>rule.editor.isEditable); userRules = view._elementStyle.rules.filter(rule=>rule.editor.isEditable);
let uaRules = view._elementStyle.rules.filter(rule=>!rule.editor.isEditable); uaRules = view._elementStyle.rules.filter(rule=>!rule.editor.isEditable);
is (userRules.length, 1, "Correct number of user rules"); is (userRules.length, 1, "Correct number of user rules");
ok (uaRules.length > 0, "Has UA rules"); ok (uaRules.length > 0, "Has UA rules");
yield selectNode("a", inspector); yield selectNode("a", inspector);
yield compareAppliedStylesWithUI(inspector, view, "ua"); yield compareAppliedStylesWithUI(inspector, view, "ua");
let userRules = view._elementStyle.rules.filter(rule=>rule.editor.isEditable); userRules = view._elementStyle.rules.filter(rule=>rule.editor.isEditable);
let uaRules = view._elementStyle.rules.filter(rule=>!rule.editor.isEditable); uaRules = view._elementStyle.rules.filter(rule=>!rule.editor.isEditable);
is (userRules.length, 1, "Correct number of user rules"); is (userRules.length, 1, "Correct number of user rules");
ok (userRules.some(rule=> rule.matchedSelectors.length === 0), ok (userRules.some(rule=> rule.matchedSelectors.length === 0),
@ -103,16 +103,16 @@ function* userAgentStylesNotVisible(inspector, view) {
yield selectNode("pre", inspector); yield selectNode("pre", inspector);
yield compareAppliedStylesWithUI(inspector, view); yield compareAppliedStylesWithUI(inspector, view);
let userRules = view._elementStyle.rules.filter(rule=>rule.editor.isEditable); userRules = view._elementStyle.rules.filter(rule=>rule.editor.isEditable);
let uaRules = view._elementStyle.rules.filter(rule=>!rule.editor.isEditable); uaRules = view._elementStyle.rules.filter(rule=>!rule.editor.isEditable);
is (userRules.length, 1, "Correct number of user rules"); is (userRules.length, 1, "Correct number of user rules");
is (uaRules.length, 0, "No UA rules"); is (uaRules.length, 0, "No UA rules");
yield selectNode("a", inspector); yield selectNode("a", inspector);
yield compareAppliedStylesWithUI(inspector, view); yield compareAppliedStylesWithUI(inspector, view);
let userRules = view._elementStyle.rules.filter(rule=>rule.editor.isEditable); userRules = view._elementStyle.rules.filter(rule=>rule.editor.isEditable);
let uaRules = view._elementStyle.rules.filter(rule=>!rule.editor.isEditable); uaRules = view._elementStyle.rules.filter(rule=>!rule.editor.isEditable);
is (userRules.length, 1, "Correct number of user rules"); is (userRules.length, 1, "Correct number of user rules");
is (uaRules.length, 0, "No UA rules"); is (uaRules.length, 0, "No UA rules");
} }

View File

@ -34,8 +34,8 @@ let test = asyncTest(function*() {
allowXUL(); allowXUL();
yield addTab(TEST_URI_XUL); yield addTab(TEST_URI_XUL);
let {toolbox, inspector, view} = yield openRuleView(); ({toolbox, inspector, view} = yield openRuleView());
let target = getNode("#target"); target = getNode("#target");
yield selectNode("#target", inspector); yield selectNode("#target", inspector);
yield checkSheets(target); yield checkSheets(target);

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