mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 1421459: Update to ESLint 4 "indent" rule. r=aswan
MozReview-Commit-ID: LxLDWlsIlSk --HG-- extra : rebase_source : 5762bdf08ff6c09c1b29f87366bddb552e4c74b2 extra : amend_source : 922a0c03722bd5a81daace7f0289ec3228191cfb
This commit is contained in:
parent
d089d170fb
commit
4a4c4fdfd4
@ -2,7 +2,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* globals windowTracker */
|
||||
/* globals windowTracker */
|
||||
|
||||
"use strict";
|
||||
|
||||
@ -170,8 +170,9 @@ this.chrome_settings_overrides = class extends ExtensionAPI {
|
||||
// Needs to be called every time to handle reenabling, but
|
||||
// only sets default for install or enable.
|
||||
await this.setDefault(engineName);
|
||||
} else if (ExtensionSettingsStore.hasSetting(
|
||||
extension.id, DEFAULT_SEARCH_STORE_TYPE, DEFAULT_SEARCH_SETTING_NAME)) {
|
||||
} else if (ExtensionSettingsStore.hasSetting(extension.id,
|
||||
DEFAULT_SEARCH_STORE_TYPE,
|
||||
DEFAULT_SEARCH_SETTING_NAME)) {
|
||||
// is_default has been removed, but we still have a setting. Remove it.
|
||||
chrome_settings_overrides.processDefaultSearchSetting("removeSetting", extension.id);
|
||||
}
|
||||
|
@ -193,8 +193,7 @@ var gMenuBuilder = {
|
||||
}
|
||||
|
||||
if (item.id && item.extension && item.extension.id) {
|
||||
element.setAttribute("id",
|
||||
`${makeWidgetId(item.extension.id)}_${item.id}`);
|
||||
element.setAttribute("id", `${makeWidgetId(item.extension.id)}_${item.id}`);
|
||||
}
|
||||
|
||||
if (item.icons) {
|
||||
|
@ -6,10 +6,9 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
OS: "resource://gre/modules/osfile.jsm",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this,
|
||||
"pkcs11db",
|
||||
"@mozilla.org/security/pkcs11moduledb;1",
|
||||
"nsIPKCS11ModuleDB");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "pkcs11db",
|
||||
"@mozilla.org/security/pkcs11moduledb;1",
|
||||
"nsIPKCS11ModuleDB");
|
||||
|
||||
var {DefaultMap} = ExtensionUtils;
|
||||
|
||||
|
@ -190,8 +190,8 @@ this.windows = class extends ExtensionAPI {
|
||||
if (allowScriptsToClose) {
|
||||
for (let {linkedBrowser} of window.gBrowser.tabs) {
|
||||
onXULFrameLoaderCreated({target: linkedBrowser});
|
||||
linkedBrowser.addEventListener( // eslint-disable-line mozilla/balanced-listeners
|
||||
"XULFrameLoaderCreated", onXULFrameLoaderCreated);
|
||||
// eslint-disable-next-line mozilla/balanced-listeners
|
||||
linkedBrowser.addEventListener("XULFrameLoaderCreated", onXULFrameLoaderCreated);
|
||||
}
|
||||
}
|
||||
if (createData.titlePreface !== null) {
|
||||
|
@ -32,13 +32,13 @@ add_task(async function testBrowserActionPopupResize() {
|
||||
Assert.lessOrEqual(Math.abs(dims.window.innerHeight - expected), 1,
|
||||
`Panel window should be ${expected}px tall (was ${dims.window.innerHeight})`);
|
||||
is(dims.body.clientHeight, dims.body.scrollHeight,
|
||||
"Panel body should be tall enough to fit its contents");
|
||||
"Panel body should be tall enough to fit its contents");
|
||||
|
||||
// Tolerate if it is 1px too wide, as that may happen with the current resizing method.
|
||||
Assert.lessOrEqual(Math.abs(dims.window.innerWidth - expected), 1,
|
||||
`Panel window should be ${expected}px wide`);
|
||||
is(dims.body.clientWidth, dims.body.scrollWidth,
|
||||
"Panel body should be wide enough to fit its contents");
|
||||
"Panel body should be wide enough to fit its contents");
|
||||
}
|
||||
|
||||
/* eslint-disable mozilla/no-cpows-in-tests */
|
||||
@ -162,7 +162,7 @@ async function testPopupSize(standardsMode, browserWin = window, arrowSide = "to
|
||||
// The 'ViewShown' event is the only way to correctly determine when the extensions'
|
||||
// panelview has finished transitioning and is fully in view.
|
||||
let shownPromise = BrowserTestUtils.waitForEvent(panelMultiView, "ViewShown",
|
||||
e => (e.originalTarget.id || "").includes(widgetId));
|
||||
e => (e.originalTarget.id || "").includes(widgetId));
|
||||
let browser = await openPanel(extension, browserWin);
|
||||
let origPanelRect = panel.getBoundingClientRect();
|
||||
|
||||
|
@ -56,13 +56,13 @@ add_task(async function testBrowserActionTelemetryTiming() {
|
||||
histogram.clear();
|
||||
|
||||
is(histogram.snapshot().sum, 0,
|
||||
`No data recorded for histogram: ${TIMING_HISTOGRAM}.`);
|
||||
`No data recorded for histogram: ${TIMING_HISTOGRAM}.`);
|
||||
|
||||
await extension1.startup();
|
||||
await extension2.startup();
|
||||
|
||||
is(histogram.snapshot().sum, 0,
|
||||
`No data recorded for histogram after startup: ${TIMING_HISTOGRAM}.`);
|
||||
`No data recorded for histogram after startup: ${TIMING_HISTOGRAM}.`);
|
||||
|
||||
clickBrowserAction(extension1);
|
||||
await awaitExtensionPanel(extension1);
|
||||
@ -117,7 +117,7 @@ add_task(async function testBrowserActionTelemetryResults() {
|
||||
histogram.clear();
|
||||
|
||||
is(histogram.snapshot().sum, 0,
|
||||
`No data recorded for histogram: ${TIMING_HISTOGRAM}.`);
|
||||
`No data recorded for histogram: ${TIMING_HISTOGRAM}.`);
|
||||
|
||||
await extension.startup();
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
add_task(async function setup() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["dom.serviceWorkers.exemptFromPerDomainMax", true],
|
||||
["dom.serviceWorkers.enabled", true],
|
||||
["dom.serviceWorkers.testing.enabled", true]],
|
||||
["dom.serviceWorkers.enabled", true],
|
||||
["dom.serviceWorkers.testing.enabled", true]],
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -486,7 +486,8 @@ add_task(async function test_bookmark_contextmenu() {
|
||||
});
|
||||
await extension.startup();
|
||||
await extension.awaitMessage("bookmark-created");
|
||||
let menu = await openChromeContextMenu("placesContext",
|
||||
let menu = await openChromeContextMenu(
|
||||
"placesContext",
|
||||
"#PersonalToolbar .bookmark-item:last-child");
|
||||
|
||||
let menuItem = menu.getElementsByAttribute("label", "Get bookmark")[0];
|
||||
@ -515,11 +516,12 @@ add_task(async function test_bookmark_context_requires_permission() {
|
||||
});
|
||||
await extension.startup();
|
||||
await extension.awaitMessage("bookmark-created");
|
||||
let menu = await openChromeContextMenu("placesContext",
|
||||
let menu = await openChromeContextMenu(
|
||||
"placesContext",
|
||||
"#PersonalToolbar .bookmark-item:last-child");
|
||||
|
||||
Assert.equal(menu.getElementsByAttribute("label", "Get bookmark").length, 0,
|
||||
"bookmark context menu not created with `bookmarks` permission.");
|
||||
"bookmark context menu not created with `bookmarks` permission.");
|
||||
|
||||
closeChromeContextMenu("placesContext");
|
||||
|
||||
|
@ -3,7 +3,8 @@
|
||||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser,
|
||||
let tab1 = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
"http://mochi.test:8888/browser/browser/components/extensions/test/browser/context.html");
|
||||
|
||||
gBrowser.selectedTab = tab1;
|
||||
|
@ -69,10 +69,10 @@ function testScript() {
|
||||
// Sanity check - the pages must be in the same process.
|
||||
let pages = browser.extension.getViews();
|
||||
browser.test.assertTrue(pages.includes(window),
|
||||
"Expected this tab to be an extension view");
|
||||
"Expected this tab to be an extension view");
|
||||
pages = pages.filter(w => w !== window);
|
||||
browser.test.assertEq(pages[0], browser.extension.getBackgroundPage(),
|
||||
"Expected the other page to be a background page");
|
||||
"Expected the other page to be a background page");
|
||||
browser.test.sendMessage("tab.html ready");
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,8 @@
|
||||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser,
|
||||
let tab1 = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
"http://mochi.test:8888/browser/browser/components/extensions/test/browser/context.html");
|
||||
|
||||
gBrowser.selectedTab = tab1;
|
||||
|
@ -3,7 +3,8 @@
|
||||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser,
|
||||
let tab1 = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
"http://mochi.test:8888/browser/browser/components/extensions/test/browser/context.html");
|
||||
|
||||
// Install an extension.
|
||||
|
@ -3,7 +3,8 @@
|
||||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser,
|
||||
let tab1 = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
"http://mochi.test:8888/browser/browser/components/extensions/test/browser/context.html");
|
||||
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
|
@ -49,9 +49,9 @@ add_task(async function test_devtools_inspectedWindow_tabId() {
|
||||
}
|
||||
|
||||
function devtools_page() {
|
||||
browser.test.assertEq(undefined, browser.runtime.getBackgroundPage,
|
||||
"The `runtime.getBackgroundPage` API method should be missing in a devtools_page context"
|
||||
);
|
||||
browser.test.assertEq(
|
||||
undefined, browser.runtime.getBackgroundPage,
|
||||
"The `runtime.getBackgroundPage` API method should be missing in a devtools_page context");
|
||||
|
||||
try {
|
||||
let tabId = browser.devtools.inspectedWindow.tabId;
|
||||
|
@ -173,7 +173,7 @@ add_task(async function test_devtools_inspectedWindow_eval_bindings() {
|
||||
const objectPreviewProperties = options.objectActor.preview.ownProperties;
|
||||
is(objectType, "object", "The inspected object has the expected type");
|
||||
Assert.deepEqual(Object.keys(objectPreviewProperties), ["testkey"],
|
||||
"The inspected object has the expected preview properties");
|
||||
"The inspected object has the expected preview properties");
|
||||
}
|
||||
})();
|
||||
|
||||
|
@ -181,7 +181,7 @@ add_task(async function test_devtools_inspectedWindow_reload_custom_user_agent()
|
||||
try {
|
||||
const [text] = await browser.tabs.executeScript(activeTabId, {code});
|
||||
browser.test.assertEq(expectedContent, text,
|
||||
`Got the expected userAgent with userAgent=${enabled}`);
|
||||
`Got the expected userAgent with userAgent=${enabled}`);
|
||||
} catch (err) {
|
||||
browser.test.fail(`Error: ${err.message} - ${err.stack}`);
|
||||
}
|
||||
|
@ -31,11 +31,11 @@ async function testThemeSwitching(extension, locations = ["page"]) {
|
||||
await switchTheme(newTheme);
|
||||
for (let location of locations) {
|
||||
is(await extension.awaitMessage(`devtools_theme_changed_${location}`),
|
||||
newTheme,
|
||||
`The onThemeChanged event listener fired for the ${location}.`);
|
||||
newTheme,
|
||||
`The onThemeChanged event listener fired for the ${location}.`);
|
||||
is(await extension.awaitMessage(`current_theme_${location}`),
|
||||
newTheme,
|
||||
`The current theme is reported as expected for the ${location}.`);
|
||||
newTheme,
|
||||
`The current theme is reported as expected for the ${location}.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -80,8 +80,8 @@ add_task(async function test_theme_name_no_panel() {
|
||||
info("developer toolbox opened");
|
||||
|
||||
is(await extension.awaitMessage("initial_theme"),
|
||||
"light",
|
||||
"The initial theme is reported as expected.");
|
||||
"light",
|
||||
"The initial theme is reported as expected.");
|
||||
|
||||
await testThemeSwitching(extension);
|
||||
|
||||
@ -201,8 +201,8 @@ add_task(async function test_devtools_page_panels_create() {
|
||||
|
||||
await extension.awaitMessage("devtools_panel_created");
|
||||
is(await extension.awaitMessage("initial_theme_page"),
|
||||
"light",
|
||||
"The initial theme is reported as expected from a devtools page.");
|
||||
"light",
|
||||
"The initial theme is reported as expected from a devtools page.");
|
||||
|
||||
const toolboxAdditionalTools = toolbox.getAdditionalTools();
|
||||
|
||||
@ -220,8 +220,8 @@ add_task(async function test_devtools_page_panels_create() {
|
||||
is(devtoolsPanelTabId, devtoolsPageTabId,
|
||||
"Got the same devtools.inspectedWindow.tabId from devtools page and panel");
|
||||
is(await extension.awaitMessage("initial_theme_panel"),
|
||||
"light",
|
||||
"The initial theme is reported as expected from a devtools panel.");
|
||||
"light",
|
||||
"The initial theme is reported as expected from a devtools panel.");
|
||||
info("Addon Devtools Panel shown");
|
||||
|
||||
await testThemeSwitching(extension, ["page", "panel"]);
|
||||
@ -282,8 +282,8 @@ add_task(async function test_devtools_page_panels_create() {
|
||||
await gDevTools.showToolbox(target, panelId);
|
||||
await extension.awaitMessage("devtools_panel_shown");
|
||||
is(await extension.awaitMessage("initial_theme_panel"),
|
||||
"light",
|
||||
"The initial theme is reported as expected from a devtools panel.");
|
||||
"light",
|
||||
"The initial theme is reported as expected from a devtools panel.");
|
||||
info("Addon Devtools Panel shown - after visibilityswitch toggled");
|
||||
|
||||
info("Wait until the Addon Devtools Panel has been loaded - after visibilityswitch toggled");
|
||||
|
@ -49,7 +49,7 @@ add_task(async function test_legacy_extension_context_contentscript_connection()
|
||||
function contentScript() {
|
||||
browser.runtime.sendMessage("webextension -> legacy_extension message", (reply) => {
|
||||
browser.test.assertEq("legacy_extension -> webextension reply", reply,
|
||||
"Got the expected reply from the LegacyExtensionContext");
|
||||
"Got the expected reply from the LegacyExtensionContext");
|
||||
browser.test.sendMessage("got-reply-message");
|
||||
});
|
||||
|
||||
|
@ -76,11 +76,11 @@ add_task(async function() {
|
||||
let actual = await extension.awaitMessage(event);
|
||||
if (expected.text) {
|
||||
is(actual.text, expected.text,
|
||||
`Expected "${event}" to have fired with text: "${expected.text}".`);
|
||||
`Expected "${event}" to have fired with text: "${expected.text}".`);
|
||||
}
|
||||
if (expected.disposition) {
|
||||
is(actual.disposition, expected.disposition,
|
||||
`Expected "${event}" to have fired with disposition: "${expected.disposition}".`);
|
||||
`Expected "${event}" to have fired with disposition: "${expected.disposition}".`);
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,10 +205,10 @@ add_task(async function() {
|
||||
let item = gURLBar.popup.richlistbox.children[0];
|
||||
|
||||
is(item.getAttribute("title"), expectedText,
|
||||
`Expected heuristic result to have title: "${expectedText}".`);
|
||||
`Expected heuristic result to have title: "${expectedText}".`);
|
||||
|
||||
is(item.getAttribute("displayurl"), `${keyword} ${text}`,
|
||||
`Expected heuristic result to have displayurl: "${keyword} ${text}".`);
|
||||
`Expected heuristic result to have displayurl: "${keyword} ${text}".`);
|
||||
|
||||
let promiseEvent = expectEvent("on-input-entered-fired", {
|
||||
text,
|
||||
@ -250,10 +250,10 @@ add_task(async function() {
|
||||
|
||||
ok(!!item, "Expected item to exist");
|
||||
is(item.getAttribute("title"), description,
|
||||
`Expected suggestion to have title: "${description}".`);
|
||||
`Expected suggestion to have title: "${description}".`);
|
||||
|
||||
is(item.getAttribute("displayurl"), `${keyword} ${content}`,
|
||||
`Expected suggestion to have displayurl: "${keyword} ${content}".`);
|
||||
`Expected suggestion to have displayurl: "${keyword} ${content}".`);
|
||||
}
|
||||
|
||||
let text = await startInputSession(info.suggestions.length - 1);
|
||||
|
@ -41,9 +41,9 @@ add_task(async function testPageActionPopupResize() {
|
||||
|
||||
is(dims.window.innerHeight, expected, `Panel window should be ${expected}px tall`);
|
||||
is(body.clientHeight, body.scrollHeight,
|
||||
"Panel body should be tall enough to fit its contents");
|
||||
"Panel body should be tall enough to fit its contents");
|
||||
is(root.clientHeight, root.scrollHeight,
|
||||
"Panel root should be tall enough to fit its contents");
|
||||
"Panel root should be tall enough to fit its contents");
|
||||
|
||||
// Tolerate if it is 1px too wide, as that may happen with the current resizing method.
|
||||
ok(Math.abs(dims.window.innerWidth - expected) <= 1, `Panel window should be ${expected}px wide`);
|
||||
@ -141,9 +141,9 @@ add_task(async function testPageActionPopupReflow() {
|
||||
`Panel window height (${dims.window.innerHeight}px) should be taller than two lines of text.`);
|
||||
|
||||
is(dims.body.clientHeight, dims.body.scrollHeight,
|
||||
"Panel body should be tall enough to fit its contents");
|
||||
"Panel body should be tall enough to fit its contents");
|
||||
is(dims.root.clientHeight, dims.root.scrollHeight,
|
||||
"Panel root should be tall enough to fit its contents");
|
||||
"Panel root should be tall enough to fit its contents");
|
||||
|
||||
await extension.unload();
|
||||
});
|
||||
|
@ -16,7 +16,7 @@ add_task(async function test_sessions_forget_closed_tab() {
|
||||
},
|
||||
error => {
|
||||
browser.test.assertEq(error.message,
|
||||
`Could not find closed tab using sessionId ${sessionId}.`);
|
||||
`Could not find closed tab using sessionId ${sessionId}.`);
|
||||
browser.test.sendMessage("forget-reject");
|
||||
}
|
||||
);
|
||||
@ -45,8 +45,9 @@ add_task(async function test_sessions_forget_closed_tab() {
|
||||
let recentlyClosedTab = recentlyClosed[0].tab;
|
||||
|
||||
// Check that forgetting a tab works properly
|
||||
extension.sendMessage("forget-tab", recentlyClosedTab.windowId,
|
||||
recentlyClosedTab.sessionId);
|
||||
extension.sendMessage("forget-tab",
|
||||
recentlyClosedTab.windowId,
|
||||
recentlyClosedTab.sessionId);
|
||||
await extension.awaitMessage("forgot-tab");
|
||||
extension.sendMessage("check-sessions");
|
||||
let remainingClosed = await extension.awaitMessage("recentlyClosed");
|
||||
@ -56,8 +57,9 @@ add_task(async function test_sessions_forget_closed_tab() {
|
||||
"The correct tab was forgotten.");
|
||||
|
||||
// Check that re-forgetting the same tab fails properly
|
||||
extension.sendMessage("forget-tab", recentlyClosedTab.windowId,
|
||||
recentlyClosedTab.sessionId);
|
||||
extension.sendMessage("forget-tab",
|
||||
recentlyClosedTab.windowId,
|
||||
recentlyClosedTab.sessionId);
|
||||
await extension.awaitMessage("forget-reject");
|
||||
extension.sendMessage("check-sessions");
|
||||
remainingClosed = await extension.awaitMessage("recentlyClosed");
|
||||
|
@ -22,8 +22,9 @@ add_task(async function test_sessions_forget_closed_window() {
|
||||
browser.test.sendMessage("forgot-window");
|
||||
},
|
||||
error => {
|
||||
browser.test.assertEq(error.message,
|
||||
`Could not find closed window using sessionId ${sessionId}.`);
|
||||
browser.test.assertEq(
|
||||
error.message,
|
||||
`Could not find closed window using sessionId ${sessionId}.`);
|
||||
browser.test.sendMessage("forget-reject");
|
||||
}
|
||||
);
|
||||
|
@ -98,9 +98,11 @@ add_task(async function test_sessions_get_recently_closed_navigated() {
|
||||
function background() {
|
||||
browser.sessions.getRecentlyClosed({maxResults: 1}).then(recentlyClosed => {
|
||||
let tab = recentlyClosed[0].window.tabs[0];
|
||||
browser.test.assertEq("http://example.com/", tab.url,
|
||||
browser.test.assertEq(
|
||||
"http://example.com/", tab.url,
|
||||
"Tab in closed window has the expected url.");
|
||||
browser.test.assertTrue(tab.title.includes("mochitest index"),
|
||||
browser.test.assertTrue(
|
||||
tab.title.includes("mochitest index"),
|
||||
"Tab in closed window has the expected title.");
|
||||
browser.test.notifyPass("getRecentlyClosed with navigation");
|
||||
});
|
||||
|
@ -15,10 +15,10 @@ add_task(async function test_extension_adding_engine() {
|
||||
manifest: {
|
||||
"chrome_settings_overrides": {
|
||||
"search_provider": {
|
||||
"name": "MozSearch",
|
||||
"keyword": "MozSearch",
|
||||
"search_url": kSearchEngineURL,
|
||||
"suggest_url": kSearchSuggestURL,
|
||||
"name": "MozSearch",
|
||||
"keyword": "MozSearch",
|
||||
"search_url": kSearchEngineURL,
|
||||
"suggest_url": kSearchSuggestURL,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -49,9 +49,9 @@ add_task(async function test_extension_adding_engine_with_spaces() {
|
||||
manifest: {
|
||||
"chrome_settings_overrides": {
|
||||
"search_provider": {
|
||||
"name": "MozSearch ",
|
||||
"keyword": "MozSearch",
|
||||
"search_url": "https://example.com/?q={searchTerms}",
|
||||
"name": "MozSearch ",
|
||||
"keyword": "MozSearch",
|
||||
"search_url": "https://example.com/?q={searchTerms}",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -75,14 +75,14 @@ add_task(async function test_upgrade_default_position_engine() {
|
||||
manifest: {
|
||||
"chrome_settings_overrides": {
|
||||
"search_provider": {
|
||||
"name": "MozSearch",
|
||||
"keyword": "MozSearch",
|
||||
"search_url": "https://example.com/?q={searchTerms}",
|
||||
"name": "MozSearch",
|
||||
"keyword": "MozSearch",
|
||||
"search_url": "https://example.com/?q={searchTerms}",
|
||||
},
|
||||
},
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": "testengine@mozilla.com",
|
||||
"id": "testengine@mozilla.com",
|
||||
},
|
||||
},
|
||||
"version": "0.1",
|
||||
@ -94,14 +94,14 @@ add_task(async function test_upgrade_default_position_engine() {
|
||||
manifest: {
|
||||
"chrome_settings_overrides": {
|
||||
"search_provider": {
|
||||
"name": "MozSearch",
|
||||
"keyword": "MozSearch",
|
||||
"search_url": "https://example.com/?q={searchTerms}",
|
||||
"name": "MozSearch",
|
||||
"keyword": "MozSearch",
|
||||
"search_url": "https://example.com/?q={searchTerms}",
|
||||
},
|
||||
},
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": "testengine@mozilla.com",
|
||||
"id": "testengine@mozilla.com",
|
||||
},
|
||||
},
|
||||
"version": "0.2",
|
||||
|
@ -142,7 +142,7 @@ add_task(async function testCaptureVisibleTabPermissions() {
|
||||
|
||||
background() {
|
||||
browser.test.assertEq(undefined, browser.tabs.captureVisibleTab,
|
||||
'Extension without "<all_urls>" permission should not have access to captureVisibleTab');
|
||||
'Extension without "<all_urls>" permission should not have access to captureVisibleTab');
|
||||
browser.test.notifyPass("captureVisibleTabPermissions");
|
||||
},
|
||||
});
|
||||
|
@ -28,9 +28,8 @@ add_task(async function moveMultiple() {
|
||||
async function reset() {
|
||||
let tabs = await browser.tabs.query({url: "http://example.com/*"});
|
||||
await browser.tabs.move(
|
||||
tabs.sort((a, b) => (num(a.url) - num(b.url))).map(tab => tab.id),
|
||||
{index: 0}
|
||||
);
|
||||
tabs.sort((a, b) => (num(a.url) - num(b.url))).map(tab => tab.id),
|
||||
{index: 0});
|
||||
}
|
||||
|
||||
async function move(moveIndexes, moveTo) {
|
||||
|
@ -74,7 +74,7 @@ add_task(async function testTabEvents() {
|
||||
*/
|
||||
async function openTab(windowId) {
|
||||
browser.test.assertEq(0, Object.keys(events).length,
|
||||
"No events remaining before testing openTab.");
|
||||
"No events remaining before testing openTab.");
|
||||
|
||||
let tab = await browser.tabs.create({windowId});
|
||||
|
||||
@ -95,7 +95,7 @@ add_task(async function testTabEvents() {
|
||||
*/
|
||||
async function openWindow(urls) {
|
||||
browser.test.assertEq(0, Object.keys(events).length,
|
||||
"No events remaining before testing openWindow.");
|
||||
"No events remaining before testing openWindow.");
|
||||
|
||||
let window = await browser.windows.create({url: urls});
|
||||
browser.test.log(`Opened new window ${window.id}`);
|
||||
@ -105,9 +105,9 @@ add_task(async function testTabEvents() {
|
||||
tabIds.push(tab.id);
|
||||
|
||||
let expectedEvents = [
|
||||
"onCreated",
|
||||
"onActivated",
|
||||
"onHighlighted",
|
||||
"onCreated",
|
||||
"onActivated",
|
||||
"onHighlighted",
|
||||
];
|
||||
if (i !== 0) {
|
||||
expectedEvents.splice(1);
|
||||
@ -123,7 +123,7 @@ add_task(async function testTabEvents() {
|
||||
*/
|
||||
async function highlightTab(tabId) {
|
||||
browser.test.assertEq(0, Object.keys(events).length,
|
||||
"No events remaining before testing highlightTab.");
|
||||
"No events remaining before testing highlightTab.");
|
||||
|
||||
browser.test.log(`Highlighting tab ${tabId}`);
|
||||
let tab = await browser.tabs.update(tabId, {active: true});
|
||||
|
@ -154,7 +154,7 @@ add_task(async function test_update_reload() {
|
||||
is(history.entries.length, 1,
|
||||
"Tab history contains the expected number of entries.");
|
||||
is(history.entries[0].url, URL,
|
||||
`Tab history contains the expected entry: URL.`);
|
||||
`Tab history contains the expected entry: URL.`);
|
||||
|
||||
extension.sendMessage("update", tabId, {url: `${URL}1/`});
|
||||
await Promise.all([
|
||||
@ -166,7 +166,7 @@ add_task(async function test_update_reload() {
|
||||
is(history.entries.length, 2,
|
||||
"Tab history contains the expected number of entries.");
|
||||
is(history.entries[1].url, `${URL}1/`,
|
||||
`Tab history contains the expected entry: ${URL}1/.`);
|
||||
`Tab history contains the expected entry: ${URL}1/.`);
|
||||
|
||||
extension.sendMessage("update", tabId, {url: `${URL}2/`, loadReplace: true});
|
||||
await Promise.all([
|
||||
@ -178,7 +178,7 @@ add_task(async function test_update_reload() {
|
||||
is(history.entries.length, 2,
|
||||
"Tab history contains the expected number of entries.");
|
||||
is(history.entries[1].url, `${URL}2/`,
|
||||
`Tab history contains the expected entry: ${URL}2/.`);
|
||||
`Tab history contains the expected entry: ${URL}2/.`);
|
||||
|
||||
await extension.unload();
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
|
@ -2,16 +2,16 @@
|
||||
|
||||
const ENCODED_IMAGE_DATA = "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgNjQgNjQiPjxwYXRoIGQ9Im01NS45IDMyLjFsLTIyLjctMTQuOWMwIDAgMTIuOS0xNy40IDE5LjQtMTQuOSAzLjEgMS4xIDUuNCAyNS4xIDMuMyAyOS44IiBmaWxsPSIjM2U0MzQ3Ii8+PHBhdGggZD0ibTU0LjkgMzMuOWwtOS00LjFjMCAwLTUuMy0xNCA2LjEtMjQuMSAyLjQgMiA1LjEgMjUgMi45IDI4LjIiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJtOC4xIDMyLjFsMjIuNi0xNC45YzAgMC0xMi45LTE3LjQtMTkuNC0xNC45LTMgMS4xLTUuMyAyNS4xLTMuMiAyOS44IiBmaWxsPSIjM2U0MzQ3Ii8+PHBhdGggZD0ibTkuMSAzMy45bDktNC4xYzAgMCA1LjMtMTQtNi4xLTI0LjEtMi40IDItNS4xIDI1LTIuOSAyOC4yIiBmaWxsPSIjZmZmIi8+PHBhdGggZD0iTTMyLDEzQzE4LjksMTMsMiwzMy42LDIsNDUuNEMyMC41LDQ1LjQsMTkuNyw2MiwzMiw2MnMxMS41LTE2LjYsMzAtMTYuNkM2MiwzMy42LDQ1LjEsMTMsMzIsMTN6IiBmaWxsPSIjZmY4NzM2Ii8+PGcgZmlsbD0iI2ZmZiI+PHBhdGggZD0iTTMyLDU2LjJjMCw1LjEsOS42LDQuMiw5LjUtMi45YzYuNy05LjQsMTkuOS04LjcsMTkuOS04LjdDMzkuNiwzMi40LDMyLDU2LjIsMzIsNTYuMnoiLz48cGF0aCBkPSJNMzIsNTYuMmMwLDUuMS05LjYsNC4yLTkuNS0yLjlDMTUuOCw0NCwyLjYsNDQuNywyLjYsNDQuN0MyNC40LDMyLjQsMzIsNTYuMiwzMiw1Ni4yeiIvPjwvZz48ZyBmaWxsPSIjZmY4NzM2Ij48cGF0aCBkPSJtNTMuNCAxOC41Yy00IC43LTQuOSA2LjMtNC45IDYuM2w2IDUuM2MtMi4zLTUuOS0xLjEtMTEuNi0xLjEtMTEuNiIvPjxwYXRoIGQ9Im01MS4xIDEzLjVjLTQuNCAzLjktNS4xIDguNy01LjEgOC43bDYgNS4zYy0yLjQtNS44LS45LTE0LS45LTE0Ii8+PHBhdGggZD0ibTEwLjYgMTguNWM0IC43IDQuOSA2LjMgNC45IDYuM2wtNiA1LjNjMi4zLTUuOSAxLjEtMTEuNiAxLjEtMTEuNiIvPjxwYXRoIGQ9Im0xMi45IDEzLjVjNC40IDMuOSA1LjEgOC43IDUuMSA4LjdsLTYgNS4zYzIuNC01LjguOS0xNCAuOS0xNCIvPjwvZz48cGF0aCBkPSJtNTIuOCAzMS4xYy01LjctMS44LTEwLjktMy40LTEzLjguOS0yLjQgMy43LjcgOS40LjcgOS40IDExLjIgMS4yIDEzLjEtMTAuMyAxMy4xLTEwLjMiIGZpbGw9IiMzZTQzNDciLz48ZWxsaXBzZSBjeD0iNDMiIGN5PSIzNi4zIiByeD0iNC4yIiByeT0iNC4xIiBmaWxsPSIjZDVmZjgzIi8+PGcgZmlsbD0iIzNlNDM0NyI+PGVsbGlwc2UgY3g9IjQzIiBjeT0iMzYuMyIgcng9IjIuNyIgcnk9IjIuNyIvPjxwYXRoIGQ9Im0xMS4yIDMxLjFjNS43LTEuOCAxMC45LTMuNCAxMy43LjkgMi40IDMuNy0uNyA5LjQtLjcgOS40LTExLjEgMS4yLTEzLTEwLjMtMTMtMTAuMyIvPjwvZz48ZWxsaXBzZSBjeD0iMjEiIGN5PSIzNi4zIiByeD0iNC4yIiByeT0iNC4xIiBmaWxsPSIjZDVmZjgzIi8+PGcgZmlsbD0iIzNlNDM0NyI+PGVsbGlwc2UgY3g9IjIxIiBjeT0iMzYuMyIgcng9IjIuNyIgcnk9IjIuNyIvPjxwYXRoIGQ9Im00MS4yIDQ3LjljLS43LTIuMy0xLjgtNC40LTMtNi41IDEuMSAyLjEgMiA0LjMgMi41IDYuNi41IDIuMy43IDQuNyAwIDYuOC0uNCAxLTEgMi0xLjggMi42LS44LjYtMS44IDEtMi43IDEtLjkgMC0xLjktLjMtMi41LTEtLjYtLjctLjktMS42LS44LTIuNmwtLjkuMmgtLjljMCAxLS4yIDEuOS0uOCAyLjYtLjYuNy0xLjUgMS0yLjUgMS0uOSAwLTEuOS0uNC0yLjctMS0uOC0uNi0xLjQtMS42LTEuOC0yLjYtLjgtMi4xLS42LTQuNiAwLTYuOC41LTIuMyAxLjUtNC41IDIuNS02LjYtMS4yIDItMi4zIDQuMS0zIDYuNS0uNyAyLjMtMS4xIDQuOC0uNCA3LjMuMyAxLjIgMSAyLjQgMS45IDMuMy45LjkgMi4xIDEuNCAzLjQgMS41IDEuMi4xIDIuNi0uMiAzLjctMS4yLjMtLjIuNS0uNS43LS44LjIuMy40LjYuNy44IDEgMSAyLjQgMS4zIDMuNyAxLjIgMS4zLS4xIDIuNC0uNyAzLjQtMS41LjktLjkgMS42LTIgMS45LTMuMy41LTIuNi4xLTUuMi0uNi03LjUiLz48cGF0aCBkPSJtMzcuNiA1MC4zYy0xLjEtMS4xLTQuNS0xLjItNS42LTEuMi0xIDAtNC41LjEtNS42IDEuMi0uOC44LS4yIDIuOCAxLjkgNC41IDEuMyAxLjEgMi42IDEuNCAzLjYgMS40IDEgMCAyLjMtLjMgMy42LTEuNCAyLjMtMS43IDIuOS0zLjcgMi4xLTQuNSIvPjwvZz48L3N2Zz4=";
|
||||
|
||||
/**
|
||||
* Verifies that the button uses the expected icon.
|
||||
*
|
||||
* @param {string} selector The CSS selector used to find the button
|
||||
* within the DOM.
|
||||
* @param {boolean} shouldHaveCustomStyling True if the button should
|
||||
* have custom styling, False otherwise.
|
||||
* @param {string} message The message that is printed to the console
|
||||
* by the verifyFn.
|
||||
*/
|
||||
/**
|
||||
* Verifies that the button uses the expected icon.
|
||||
*
|
||||
* @param {string} selector The CSS selector used to find the button
|
||||
* within the DOM.
|
||||
* @param {boolean} shouldHaveCustomStyling True if the button should
|
||||
* have custom styling, False otherwise.
|
||||
* @param {string} message The message that is printed to the console
|
||||
* by the verifyFn.
|
||||
*/
|
||||
function verifyButtonProperties(selector, shouldHaveCustomStyling, message) {
|
||||
try {
|
||||
let element = document.querySelector(selector);
|
||||
@ -23,48 +23,50 @@ function verifyButtonProperties(selector, shouldHaveCustomStyling, message) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that the button uses default styling.
|
||||
*
|
||||
* @param {string} selector The CSS selector used to find the button
|
||||
* within the DOM.
|
||||
* @param {string} message The message that is printed to the console
|
||||
* by the verifyFn.
|
||||
*/
|
||||
/**
|
||||
* Verifies that the button uses default styling.
|
||||
*
|
||||
* @param {string} selector The CSS selector used to find the button
|
||||
* within the DOM.
|
||||
* @param {string} message The message that is printed to the console
|
||||
* by the verifyFn.
|
||||
*/
|
||||
function verifyButtonWithoutCustomStyling(selector, message) {
|
||||
verifyButtonProperties(selector, false, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that the button uses non-default styling.
|
||||
*
|
||||
* @param {string} selector The CSS selector used to find the button
|
||||
* within the DOM.
|
||||
* @param {string} message The message that is printed to the console
|
||||
* by the verifyFn.
|
||||
*/
|
||||
/**
|
||||
* Verifies that the button uses non-default styling.
|
||||
*
|
||||
* @param {string} selector The CSS selector used to find the button
|
||||
* within the DOM.
|
||||
* @param {string} message The message that is printed to the console
|
||||
* by the verifyFn.
|
||||
*/
|
||||
function verifyButtonWithCustomStyling(selector, message) {
|
||||
verifyButtonProperties(selector, true, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loops through all of the buttons to confirm that they are styled
|
||||
* as expected (either with or without custom styling).
|
||||
*
|
||||
* @param {object} icons Array of an array that specifies which buttons should
|
||||
* have custom icons.
|
||||
* @param {object} iconInfo An array of arrays that maps API names to
|
||||
* CSS selectors.
|
||||
* @param {string} area The name of the area that the button resides in.
|
||||
*/
|
||||
/**
|
||||
* Loops through all of the buttons to confirm that they are styled
|
||||
* as expected (either with or without custom styling).
|
||||
*
|
||||
* @param {object} icons Array of an array that specifies which buttons should
|
||||
* have custom icons.
|
||||
* @param {object} iconInfo An array of arrays that maps API names to
|
||||
* CSS selectors.
|
||||
* @param {string} area The name of the area that the button resides in.
|
||||
*/
|
||||
function checkButtons(icons, iconInfo, area) {
|
||||
for (let button of iconInfo) {
|
||||
let iconInfo = icons.find(arr => arr[0] == button[0]);
|
||||
if (iconInfo[1]) {
|
||||
verifyButtonWithCustomStyling(button[1],
|
||||
verifyButtonWithCustomStyling(
|
||||
button[1],
|
||||
`The ${button[1]} should have its icon customized in the ${area}`);
|
||||
} else {
|
||||
verifyButtonWithoutCustomStyling(button[1],
|
||||
verifyButtonWithoutCustomStyling(
|
||||
button[1],
|
||||
`The ${button[1]} should not have its icon customized in the ${area}`);
|
||||
}
|
||||
}
|
||||
@ -135,7 +137,8 @@ async function runTestWithIcons(icons) {
|
||||
CustomizableUI.addWidgetToArea(button[2], CustomizableUI.AREA_NAVBAR);
|
||||
}
|
||||
|
||||
verifyButtonWithoutCustomStyling(button[1],
|
||||
verifyButtonWithoutCustomStyling(
|
||||
button[1],
|
||||
`The ${button[1]} should not have its icon customized when the test starts`);
|
||||
|
||||
let iconInfo = icons.find(arr => arr[0] == button[0]);
|
||||
@ -151,7 +154,8 @@ async function runTestWithIcons(icons) {
|
||||
await extension.unload();
|
||||
|
||||
for (let button of ICON_INFO) {
|
||||
verifyButtonWithoutCustomStyling(button[1],
|
||||
verifyButtonWithoutCustomStyling(
|
||||
button[1],
|
||||
`The ${button[1]} should not have its icon customized when the theme is unloaded`);
|
||||
}
|
||||
}
|
||||
|
@ -70,14 +70,14 @@ add_task(async function testWindowTitle() {
|
||||
if (msg === "update") {
|
||||
let win = await browser.windows.get(windowId);
|
||||
browser.test.assertTrue(win.title.startsWith(expected.before.preface),
|
||||
"Window has the expected title preface before update.");
|
||||
"Window has the expected title preface before update.");
|
||||
browser.test.assertTrue(win.title.includes(expected.before.text),
|
||||
"Window has the expected title text before update.");
|
||||
"Window has the expected title text before update.");
|
||||
win = await browser.windows.update(windowId, options);
|
||||
browser.test.assertTrue(win.title.startsWith(expected.after.preface),
|
||||
"Window has the expected title preface after update.");
|
||||
"Window has the expected title preface after update.");
|
||||
browser.test.assertTrue(win.title.includes(expected.after.text),
|
||||
"Window has the expected title text after update.");
|
||||
"Window has the expected title text after update.");
|
||||
browser.test.sendMessage("updated", win);
|
||||
}
|
||||
});
|
||||
|
@ -144,12 +144,15 @@ function promisePossiblyInaccurateContentDimensions(browser) {
|
||||
}
|
||||
|
||||
return {
|
||||
window: copyProps(content,
|
||||
window: copyProps(
|
||||
content,
|
||||
["innerWidth", "innerHeight", "outerWidth", "outerHeight",
|
||||
"scrollX", "scrollY", "scrollMaxX", "scrollMaxY"]),
|
||||
body: copyProps(content.document.body,
|
||||
body: copyProps(
|
||||
content.document.body,
|
||||
["clientWidth", "clientHeight", "scrollWidth", "scrollHeight"]),
|
||||
root: copyProps(content.document.documentElement,
|
||||
root: copyProps(
|
||||
content.document.documentElement,
|
||||
["clientWidth", "clientHeight", "scrollWidth", "scrollHeight"]),
|
||||
isStandards: content.document.compatMode !== "BackCompat",
|
||||
};
|
||||
|
@ -194,10 +194,9 @@ add_task(async function test_bookmarks() {
|
||||
browser.test.assertEq(1, results.length, "getTree returns one result");
|
||||
let bookmark = results[0].children.find(bookmarkItem => bookmarkItem.id == unsortedId);
|
||||
browser.test.assertEq(
|
||||
"Other Bookmarks",
|
||||
bookmark.title,
|
||||
"Folder returned from getTree has the expected title"
|
||||
);
|
||||
"Other Bookmarks",
|
||||
bookmark.title,
|
||||
"Folder returned from getTree has the expected title");
|
||||
browser.test.assertEq("folder", bookmark.type,
|
||||
"Folder returned from getTree has the expected type");
|
||||
|
||||
@ -207,9 +206,8 @@ add_task(async function test_bookmarks() {
|
||||
"Expected error thrown when trying to create a bookmark with an invalid parentId"
|
||||
);
|
||||
browser.test.assertTrue(
|
||||
error.message.includes(`"parentGuid":"invalid"`),
|
||||
"Expected error thrown when trying to create a bookmark with an invalid parentId"
|
||||
);
|
||||
error.message.includes(`"parentGuid":"invalid"`),
|
||||
"Expected error thrown when trying to create a bookmark with an invalid parentId");
|
||||
});
|
||||
}).then(() => {
|
||||
return browser.bookmarks.remove(ourId);
|
||||
@ -695,19 +693,19 @@ add_task(async function test_tree_with_empty_folder() {
|
||||
await browser.bookmarks.create({title: "A bookmark", url: "http://example.com", parentId: nonEmptyFolder.id});
|
||||
|
||||
let tree = await browser.bookmarks.getSubTree(nonEmptyFolder.parentId);
|
||||
browser.test.assertEq(0,
|
||||
tree[0].children[0].children.length,
|
||||
browser.test.assertEq(
|
||||
0, tree[0].children[0].children.length,
|
||||
"The empty folder returns an empty array for children.");
|
||||
browser.test.assertEq(1,
|
||||
tree[0].children[1].children.length,
|
||||
browser.test.assertEq(
|
||||
1, tree[0].children[1].children.length,
|
||||
"The non-empty folder returns a single item array for children.");
|
||||
|
||||
let children = await browser.bookmarks.getChildren(nonEmptyFolder.parentId);
|
||||
// getChildren should only return immediate children. This is not tested in the
|
||||
// monster test above.
|
||||
for (let child of children) {
|
||||
browser.test.assertEq(undefined,
|
||||
child.children,
|
||||
browser.test.assertEq(
|
||||
undefined, child.children,
|
||||
"Child from getChildren does not contain any children.");
|
||||
}
|
||||
|
||||
|
@ -32,15 +32,18 @@ add_task(async function testSettingsProperties() {
|
||||
let settings = await extension.awaitMessage("settings");
|
||||
|
||||
// Verify that we get the keys back we expect.
|
||||
deepEqual(Object.keys(settings.dataToRemove).sort(), SETTINGS_LIST,
|
||||
"dataToRemove contains expected properties.");
|
||||
deepEqual(Object.keys(settings.dataRemovalPermitted).sort(), SETTINGS_LIST,
|
||||
"dataToRemove contains expected properties.");
|
||||
deepEqual(Object.keys(settings.dataToRemove).sort(),
|
||||
SETTINGS_LIST,
|
||||
"dataToRemove contains expected properties.");
|
||||
deepEqual(Object.keys(settings.dataRemovalPermitted).sort(),
|
||||
SETTINGS_LIST,
|
||||
"dataToRemove contains expected properties.");
|
||||
|
||||
let dataTypeSet = settings.dataToRemove;
|
||||
for (let key of Object.keys(dataTypeSet)) {
|
||||
equal(Preferences.get(`${PREF_DOMAIN}${key.toLowerCase()}`), dataTypeSet[key],
|
||||
`${key} property of dataToRemove matches the expected pref.`);
|
||||
equal(Preferences.get(`${PREF_DOMAIN}${key.toLowerCase()}`),
|
||||
dataTypeSet[key],
|
||||
`${key} property of dataToRemove matches the expected pref.`);
|
||||
}
|
||||
|
||||
dataTypeSet = settings.dataRemovalPermitted;
|
||||
|
@ -73,9 +73,10 @@ add_task(async function test_overrides_update_removal() {
|
||||
|
||||
equal(extension.version, "1.0", "The installed addon has the expected version.");
|
||||
ok(getHomePageURL().endsWith(HOMEPAGE_URI),
|
||||
"Home page url is overriden by the extension.");
|
||||
equal(Services.search.currentEngine.name, "DuckDuckGo",
|
||||
"Default engine is overriden by the extension");
|
||||
"Home page url is overriden by the extension.");
|
||||
equal(Services.search.currentEngine.name,
|
||||
"DuckDuckGo",
|
||||
"Default engine is overriden by the extension");
|
||||
|
||||
extensionInfo.manifest = {
|
||||
"version": "2.0",
|
||||
@ -91,10 +92,12 @@ add_task(async function test_overrides_update_removal() {
|
||||
await prefPromise;
|
||||
|
||||
equal(extension.version, "2.0", "The updated addon has the expected version.");
|
||||
equal(getHomePageURL(), defaultHomepageURL,
|
||||
"Home page url reverted to the default after update.");
|
||||
equal(Services.search.currentEngine.name, defaultEngineName,
|
||||
"Default engine reverted to the default after update.");
|
||||
equal(getHomePageURL(),
|
||||
defaultHomepageURL,
|
||||
"Home page url reverted to the default after update.");
|
||||
equal(Services.search.currentEngine.name,
|
||||
defaultEngineName,
|
||||
"Default engine reverted to the default after update.");
|
||||
|
||||
await extension.unload();
|
||||
|
||||
|
@ -6,7 +6,8 @@ add_task(async function() {
|
||||
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
background: () => {
|
||||
browser.test.sendMessage("features",
|
||||
browser.test.sendMessage(
|
||||
"features",
|
||||
Object.values(browser.geckoProfiler.ProfilerFeature));
|
||||
},
|
||||
manifest: {
|
||||
@ -27,16 +28,16 @@ add_task(async function() {
|
||||
|
||||
const allFeaturesAcceptedByProfiler = Services.profiler.GetAllFeatures([]);
|
||||
ok(allFeaturesAcceptedByProfiler.length >= 2,
|
||||
"Either we've massively reduced the profiler's feature set, or something is wrong.");
|
||||
"Either we've massively reduced the profiler's feature set, or something is wrong.");
|
||||
|
||||
// Check that the list of available values in the ProfilerFeature enum
|
||||
// matches the list of features supported by the profiler.
|
||||
for (const feature of allFeaturesAcceptedByProfiler) {
|
||||
ok(acceptedFeatures.includes(feature),
|
||||
`The schema of the geckoProfiler.start() method should accept the "${feature}" feature.`);
|
||||
`The schema of the geckoProfiler.start() method should accept the "${feature}" feature.`);
|
||||
}
|
||||
for (const feature of acceptedFeatures) {
|
||||
ok(allFeaturesAcceptedByProfiler.includes(feature),
|
||||
`The schema of the geckoProfiler.start() method mentions a "${feature}" feature which is not supported by the profiler.`);
|
||||
`The schema of the geckoProfiler.start() method mentions a "${feature}" feature which is not supported by the profiler.`);
|
||||
}
|
||||
});
|
||||
|
@ -309,8 +309,8 @@ add_task(async function test_add_url() {
|
||||
equal(results.result.title, results.details.title, "URL was added with the correct title");
|
||||
if (results.details.visitTime) {
|
||||
equal(results.result.lastVisitTime,
|
||||
Number(ExtensionUtils.normalizeTime(results.details.visitTime)),
|
||||
"URL was added with the correct date");
|
||||
Number(ExtensionUtils.normalizeTime(results.details.visitTime)),
|
||||
"URL was added with the correct date");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,13 +99,13 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() {
|
||||
let ext3 = ExtensionTestUtils.loadExtension(extObj);
|
||||
|
||||
equal(aboutNewTabService.newTabURL, DEFAULT_NEW_TAB_URL,
|
||||
"newTabURL is set to the default.");
|
||||
"newTabURL is set to the default.");
|
||||
|
||||
await promiseStartupManager();
|
||||
|
||||
await ext1.startup();
|
||||
equal(aboutNewTabService.newTabURL, DEFAULT_NEW_TAB_URL,
|
||||
"newTabURL is still set to the default.");
|
||||
"newTabURL is still set to the default.");
|
||||
|
||||
await checkNewTabPageOverride(ext1, aboutNewTabService.newTabURL, NOT_CONTROLLABLE);
|
||||
|
||||
@ -147,7 +147,7 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() {
|
||||
|
||||
await ext3.startup();
|
||||
ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI_3),
|
||||
"newTabURL is overriden by the third extension.");
|
||||
"newTabURL is overriden by the third extension.");
|
||||
await checkNewTabPageOverride(ext2, NEWTAB_URI_3, CONTROLLED_BY_OTHER);
|
||||
|
||||
// Disable the second extension.
|
||||
@ -155,7 +155,7 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() {
|
||||
addon.userDisabled = true;
|
||||
await disabledPromise;
|
||||
ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI_3),
|
||||
"newTabURL is still overriden by the third extension.");
|
||||
"newTabURL is still overriden by the third extension.");
|
||||
await checkNewTabPageOverride(ext3, NEWTAB_URI_3, CONTROLLED_BY_THIS);
|
||||
|
||||
// Re-enable the second extension.
|
||||
@ -163,7 +163,7 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() {
|
||||
addon.userDisabled = false;
|
||||
await enabledPromise;
|
||||
ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI_3),
|
||||
"newTabURL is still overriden by the third extension.");
|
||||
"newTabURL is still overriden by the third extension.");
|
||||
await checkNewTabPageOverride(ext3, NEWTAB_URI_3, CONTROLLED_BY_THIS);
|
||||
|
||||
await ext3.unload();
|
||||
@ -173,7 +173,7 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() {
|
||||
|
||||
await ext2.unload();
|
||||
equal(aboutNewTabService.newTabURL, DEFAULT_NEW_TAB_URL,
|
||||
"newTabURL url is reset to the default.");
|
||||
"newTabURL url is reset to the default.");
|
||||
|
||||
await promiseShutdownManager();
|
||||
});
|
||||
|
@ -73,7 +73,7 @@ add_task(async function testSettings() {
|
||||
is(SETTINGS_LIST.length, Object.keys(dataRemovalPermitted).length, `dataRemovalPermitted contains expected no of keys`);
|
||||
for (let key of SETTINGS_LIST) {
|
||||
is(true, dataRemovalPermitted[key],
|
||||
`${key} property of dataRemovalPermitted matches the expected value.`);
|
||||
`${key} property of dataRemovalPermitted matches the expected value.`);
|
||||
}
|
||||
|
||||
// Verify values of dataToRemove keys are as expected.
|
||||
|
@ -259,7 +259,7 @@ add_task(async function tabsSendAndReceiveMessageTabId0() {
|
||||
browser.test.assertEq("message from tabId 0", msg,
|
||||
"Got the expected message from a content script");
|
||||
browser.test.assertTrue(sender.tab,
|
||||
"Got a sender.tab object as expected");
|
||||
"Got a sender.tab object as expected");
|
||||
browser.test.assertEq(0, sender.tab.id,
|
||||
"Got a sender.tab object with tab.id == 0");
|
||||
|
||||
|
@ -56,7 +56,19 @@ module.exports = {
|
||||
"curly": ["error", "all"],
|
||||
|
||||
// Two space indent
|
||||
"indent-legacy": ["error", 2, {"SwitchCase": 1, "ArrayExpression": "first", "ObjectExpression": "first"}],
|
||||
"indent": [
|
||||
"error", 2,
|
||||
{
|
||||
"ArrayExpression": "first",
|
||||
"CallExpression": {"arguments": "first"},
|
||||
"FunctionDeclaration": {"parameters": "first"},
|
||||
"FunctionExpression": {"parameters": "first"},
|
||||
"MemberExpression": "off",
|
||||
"ObjectExpression": "first",
|
||||
"SwitchCase": 1,
|
||||
"ignoredNodes": ["ConditionalExpression"],
|
||||
},
|
||||
],
|
||||
|
||||
// Always require parenthesis for new calls
|
||||
"new-parens": "error",
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["Extension", "ExtensionData", "Langpack"];
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
/* exported ExtensionChild */
|
||||
@ -25,7 +26,8 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "finalizationService",
|
||||
"@mozilla.org/toolkit/finalizationwitness;1", "nsIFinalizationWitnessService");
|
||||
"@mozilla.org/toolkit/finalizationwitness;1",
|
||||
"nsIFinalizationWitnessService");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
ExtensionContent: "resource://gre/modules/ExtensionContent.jsm",
|
||||
|
@ -1,6 +1,9 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @fileOverview
|
||||
@ -8,8 +11,6 @@
|
||||
* from the child process.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["ExtensionChildDevToolsUtils"];
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["ExtensionContent"];
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
/* exported ExtensionPageChild */
|
||||
@ -126,7 +127,9 @@ class ExtensionBaseContextChild extends BaseContext {
|
||||
sender.frameId = WebNavigationFrames.getFrameId(contentWindow);
|
||||
sender.tabId = tabId;
|
||||
Object.defineProperty(this, "tabId",
|
||||
{value: tabId, enumerable: true, configurable: true});
|
||||
{value: tabId,
|
||||
enumerable: true,
|
||||
configurable: true});
|
||||
}
|
||||
if (uri) {
|
||||
sender.url = uri.spec;
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
@ -820,7 +822,8 @@ ParentAPIManager = {
|
||||
{
|
||||
lowPriority,
|
||||
recipient: {childId},
|
||||
}).then(result => {
|
||||
})
|
||||
.then(result => {
|
||||
return result && result.deserialize(global);
|
||||
});
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
|
@ -1,6 +1,9 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @fileOverview
|
||||
@ -17,8 +20,6 @@
|
||||
* values that correspond to the prefs to be set.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["ExtensionPreferencesManager"];
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
@ -128,8 +129,9 @@ async function processSetting(id, name, action) {
|
||||
let setting = settingsMap.get(name);
|
||||
let expectedPrefs = expectedItem.initialValue
|
||||
|| setting.setCallback(expectedItem.value);
|
||||
if (Object.keys(expectedPrefs).some(
|
||||
pref => expectedPrefs[pref] && Preferences.get(pref) != expectedPrefs[pref])) {
|
||||
if (Object.keys(expectedPrefs)
|
||||
.some(pref => (expectedPrefs[pref] &&
|
||||
Preferences.get(pref) != expectedPrefs[pref]))) {
|
||||
return false;
|
||||
}
|
||||
setPrefs(setting, item);
|
||||
|
@ -1,6 +1,9 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @fileOverview
|
||||
@ -37,8 +40,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["ExtensionSettingsStore"];
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["ExtensionStorage"];
|
||||
@ -351,7 +352,8 @@ this.ExtensionStorage = {
|
||||
},
|
||||
};
|
||||
|
||||
XPCOMUtils.defineLazyGetter(ExtensionStorage, "extensionDir",
|
||||
XPCOMUtils.defineLazyGetter(
|
||||
ExtensionStorage, "extensionDir",
|
||||
() => OS.Path.join(OS.Constants.Path.profileDir, "browser-extension-data"));
|
||||
|
||||
ExtensionStorage.init();
|
||||
|
@ -1,12 +1,13 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
// TODO:
|
||||
// * find out how the Chrome implementation deals with conflicts
|
||||
|
||||
"use strict";
|
||||
|
||||
/* exported extensionIdToCollectionId */
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["ExtensionStorageSync", "extensionStorageSync"];
|
||||
@ -276,7 +277,8 @@ class KeyRingEncryptionRemoteTransformer extends EncryptionRemoteTransformer {
|
||||
let kB = CommonUtils.hexToBytes(user.kB);
|
||||
|
||||
let keyMaterial = CryptoUtils.hkdf(kB, undefined,
|
||||
"identity.mozilla.com/picl/v1/chrome.storage.sync", 2 * 32);
|
||||
"identity.mozilla.com/picl/v1/chrome.storage.sync",
|
||||
2 * 32);
|
||||
let bundle = new BulkKeyBundle();
|
||||
// [encryptionKey, hmacKey]
|
||||
bundle.keyPair = [keyMaterial.slice(0, 32), keyMaterial.slice(32, 64)];
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["ExtensionUtils"];
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["ExtensionTestUtils"];
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["FindContent"];
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["LegacyExtensionsUtils"];
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
@ -982,10 +983,13 @@ this.MessageChannel = {
|
||||
}
|
||||
|
||||
target.sendAsyncMessage(MESSAGE_RESPONSE, response);
|
||||
}).then(cleanup, e => {
|
||||
cleanup();
|
||||
Cu.reportError(e);
|
||||
});
|
||||
})
|
||||
.then(
|
||||
cleanup,
|
||||
e => {
|
||||
cleanup();
|
||||
Cu.reportError(e);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["NativeManifests"];
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["NativeApp"];
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["ProxyScriptContext"];
|
||||
@ -140,12 +141,16 @@ const ProxyInfoData = {
|
||||
// TODO When Bug 1360404 is fixed use ProxyService.newProxyInfoWithAuth() for all types.
|
||||
if (type === PROXY_TYPES.SOCKS || type === PROXY_TYPES.SOCKS4) {
|
||||
return ProxyService.newProxyInfoWithAuth(
|
||||
type, host, port, username, password, proxyDNS ? TRANSPARENT_PROXY_RESOLVES_HOST : 0,
|
||||
failoverTimeout ? failoverTimeout : PROXY_TIMEOUT_SEC, failoverProxy);
|
||||
type, host, port, username, password,
|
||||
proxyDNS ? TRANSPARENT_PROXY_RESOLVES_HOST : 0,
|
||||
failoverTimeout ? failoverTimeout : PROXY_TIMEOUT_SEC,
|
||||
failoverProxy);
|
||||
}
|
||||
return ProxyService.newProxyInfo(
|
||||
type, host, port, proxyDNS ? TRANSPARENT_PROXY_RESOLVES_HOST : 0,
|
||||
failoverTimeout ? failoverTimeout : PROXY_TIMEOUT_SEC, failoverProxy);
|
||||
type, host, port,
|
||||
proxyDNS ? TRANSPARENT_PROXY_RESOLVES_HOST : 0,
|
||||
failoverTimeout ? failoverTimeout : PROXY_TIMEOUT_SEC,
|
||||
failoverProxy);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -325,8 +330,8 @@ class ProxyScriptAPIManager extends SchemaAPIManager {
|
||||
|
||||
lazyInit() {
|
||||
if (!this.initialized) {
|
||||
for (let [/* name */, value] of XPCOMUtils.enumerateCategoryEntries(
|
||||
CATEGORY_EXTENSION_SCRIPTS_CONTENT)) {
|
||||
let entries = XPCOMUtils.enumerateCategoryEntries(CATEGORY_EXTENSION_SCRIPTS_CONTENT);
|
||||
for (let [/* name */, value] of entries) {
|
||||
this.loadScript(value);
|
||||
}
|
||||
this.initialized = true;
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
@ -2169,7 +2170,8 @@ FunctionEntry = class FunctionEntry extends CallEntry {
|
||||
}
|
||||
|
||||
return new this(schema, path, schema.name,
|
||||
Schemas.parseSchema(schema, path,
|
||||
Schemas.parseSchema(
|
||||
schema, path,
|
||||
["name", "unsupported", "returns",
|
||||
"permissions",
|
||||
"allowAmbiguousOptionalArguments"]),
|
||||
|
@ -140,21 +140,20 @@ this.browserSettings = class extends ExtensionAPI {
|
||||
let {extension} = context;
|
||||
return {
|
||||
browserSettings: {
|
||||
allowPopupsForUserEvents: getSettingsAPI(extension,
|
||||
"allowPopupsForUserEvents",
|
||||
allowPopupsForUserEvents: getSettingsAPI(
|
||||
extension, "allowPopupsForUserEvents",
|
||||
() => {
|
||||
return Services.prefs.getCharPref("dom.popup_allowed_events") != "";
|
||||
}),
|
||||
cacheEnabled: getSettingsAPI(extension,
|
||||
"cacheEnabled",
|
||||
cacheEnabled: getSettingsAPI(
|
||||
extension, "cacheEnabled",
|
||||
() => {
|
||||
return Services.prefs.getBoolPref("browser.cache.disk.enable") &&
|
||||
Services.prefs.getBoolPref("browser.cache.memory.enable");
|
||||
}),
|
||||
contextMenuShowEvent: Object.assign(
|
||||
getSettingsAPI(
|
||||
extension,
|
||||
"contextMenuShowEvent",
|
||||
extension, "contextMenuShowEvent",
|
||||
() => {
|
||||
if (AppConstants.platform === "win") {
|
||||
return "mouseup";
|
||||
@ -180,34 +179,34 @@ this.browserSettings = class extends ExtensionAPI {
|
||||
},
|
||||
}
|
||||
),
|
||||
homepageOverride: getSettingsAPI(extension,
|
||||
HOMEPAGE_OVERRIDE_SETTING,
|
||||
homepageOverride: getSettingsAPI(
|
||||
extension, HOMEPAGE_OVERRIDE_SETTING,
|
||||
() => {
|
||||
return Services.prefs.getComplexValue(
|
||||
HOMEPAGE_URL_PREF, Ci.nsIPrefLocalizedString).data;
|
||||
}, undefined, true),
|
||||
imageAnimationBehavior: getSettingsAPI(extension,
|
||||
"imageAnimationBehavior",
|
||||
imageAnimationBehavior: getSettingsAPI(
|
||||
extension, "imageAnimationBehavior",
|
||||
() => {
|
||||
return Services.prefs.getCharPref("image.animation_mode");
|
||||
}),
|
||||
newTabPageOverride: getSettingsAPI(extension,
|
||||
NEW_TAB_OVERRIDE_SETTING,
|
||||
newTabPageOverride: getSettingsAPI(
|
||||
extension, NEW_TAB_OVERRIDE_SETTING,
|
||||
() => {
|
||||
return aboutNewTabService.newTabURL;
|
||||
}, URL_STORE_TYPE, true),
|
||||
openBookmarksInNewTabs: getSettingsAPI(extension,
|
||||
"openBookmarksInNewTabs",
|
||||
openBookmarksInNewTabs: getSettingsAPI(
|
||||
extension, "openBookmarksInNewTabs",
|
||||
() => {
|
||||
return Services.prefs.getBoolPref("browser.tabs.loadBookmarksInTabs");
|
||||
}),
|
||||
openSearchResultsInNewTabs: getSettingsAPI(extension,
|
||||
"openSearchResultsInNewTabs",
|
||||
openSearchResultsInNewTabs: getSettingsAPI(
|
||||
extension, "openSearchResultsInNewTabs",
|
||||
() => {
|
||||
return Services.prefs.getBoolPref("browser.search.openintab");
|
||||
}),
|
||||
webNotificationsDisabled: getSettingsAPI(extension,
|
||||
"webNotificationsDisabled",
|
||||
webNotificationsDisabled: getSettingsAPI(
|
||||
extension, "webNotificationsDisabled",
|
||||
() => {
|
||||
let prefValue =
|
||||
Services.prefs.getIntPref(
|
||||
|
@ -3,9 +3,9 @@
|
||||
Cu.import("resource://gre/modules/ExtensionCommon.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
"resource://gre/modules/Services.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "DevToolsShim",
|
||||
"chrome://devtools-shim/content/DevToolsShim.jsm");
|
||||
"chrome://devtools-shim/content/DevToolsShim.jsm");
|
||||
|
||||
// These are defined on "global" which is used for the same scopes as the other
|
||||
// ext-c-*.js files.
|
||||
|
@ -6,9 +6,9 @@ XPCOMUtils.defineLazyServiceGetter(this, "imgTools",
|
||||
"@mozilla.org/image/tools;1", "imgITools");
|
||||
|
||||
const SupportsInterfacePointer = Components.Constructor(
|
||||
"@mozilla.org/supports-interface-pointer;1", "nsISupportsInterfacePointer");
|
||||
"@mozilla.org/supports-interface-pointer;1", "nsISupportsInterfacePointer");
|
||||
const Transferable = Components.Constructor(
|
||||
"@mozilla.org/widget/transferable;1", "nsITransferable");
|
||||
"@mozilla.org/widget/transferable;1", "nsITransferable");
|
||||
|
||||
this.clipboard = class extends ExtensionAPI {
|
||||
getAPI(context) {
|
||||
|
@ -274,8 +274,7 @@ const downloadQuery = query => {
|
||||
// const endedAfter = normalizeDownloadTime(query.endedAfter, false);
|
||||
|
||||
const totalBytesGreater = query.totalBytesGreater || 0;
|
||||
const totalBytesLess = (query.totalBytesLess != null)
|
||||
? query.totalBytesLess : Number.MAX_VALUE;
|
||||
const totalBytesLess = query.totalBytesLess != null ? query.totalBytesLess : Number.MAX_VALUE;
|
||||
|
||||
// Handle options for which we can have a regular expression and/or
|
||||
// an explicit value to match.
|
||||
@ -362,9 +361,9 @@ const queryHelper = query => {
|
||||
|
||||
let compareFn;
|
||||
if (query.orderBy != null) {
|
||||
const fields = query.orderBy.map(field => field[0] == "-"
|
||||
? {reverse: true, name: field.slice(1)}
|
||||
: {reverse: false, name: field});
|
||||
const fields = query.orderBy.map(field => (field[0] == "-"
|
||||
? {reverse: true, name: field.slice(1)}
|
||||
: {reverse: false, name: field}));
|
||||
|
||||
for (let field of fields) {
|
||||
if (!DOWNLOAD_ITEM_FIELDS.includes(field.name)) {
|
||||
|
@ -194,21 +194,21 @@ this.privacy = class extends ExtensionAPI {
|
||||
return {
|
||||
privacy: {
|
||||
network: {
|
||||
networkPredictionEnabled: getPrivacyAPI(extension,
|
||||
"network.networkPredictionEnabled",
|
||||
networkPredictionEnabled: getPrivacyAPI(
|
||||
extension, "network.networkPredictionEnabled",
|
||||
() => {
|
||||
return Preferences.get("network.predictor.enabled") &&
|
||||
Preferences.get("network.prefetch-next") &&
|
||||
Preferences.get("network.http.speculative-parallel-limit") > 0 &&
|
||||
!Preferences.get("network.dns.disablePrefetch");
|
||||
}),
|
||||
peerConnectionEnabled: getPrivacyAPI(extension,
|
||||
"network.peerConnectionEnabled",
|
||||
peerConnectionEnabled: getPrivacyAPI(
|
||||
extension, "network.peerConnectionEnabled",
|
||||
() => {
|
||||
return Preferences.get("media.peerconnection.enabled");
|
||||
}),
|
||||
webRTCIPHandlingPolicy: getPrivacyAPI(extension,
|
||||
"network.webRTCIPHandlingPolicy",
|
||||
webRTCIPHandlingPolicy: getPrivacyAPI(
|
||||
extension, "network.webRTCIPHandlingPolicy",
|
||||
() => {
|
||||
if (Preferences.get("media.peerconnection.ice.proxy_only")) {
|
||||
return "disable_non_proxied_udp";
|
||||
@ -228,41 +228,40 @@ this.privacy = class extends ExtensionAPI {
|
||||
},
|
||||
|
||||
services: {
|
||||
passwordSavingEnabled: getPrivacyAPI(extension,
|
||||
"services.passwordSavingEnabled",
|
||||
passwordSavingEnabled: getPrivacyAPI(
|
||||
extension, "services.passwordSavingEnabled",
|
||||
() => {
|
||||
return Preferences.get("signon.rememberSignons");
|
||||
}),
|
||||
},
|
||||
|
||||
websites: {
|
||||
hyperlinkAuditingEnabled: getPrivacyAPI(extension,
|
||||
"websites.hyperlinkAuditingEnabled",
|
||||
hyperlinkAuditingEnabled: getPrivacyAPI(
|
||||
extension, "websites.hyperlinkAuditingEnabled",
|
||||
() => {
|
||||
return Preferences.get("browser.send_pings");
|
||||
}),
|
||||
referrersEnabled: getPrivacyAPI(extension,
|
||||
"websites.referrersEnabled",
|
||||
referrersEnabled: getPrivacyAPI(
|
||||
extension, "websites.referrersEnabled",
|
||||
() => {
|
||||
return Preferences.get("network.http.sendRefererHeader") !== 0;
|
||||
}),
|
||||
resistFingerprinting: getPrivacyAPI(extension,
|
||||
"websites.resistFingerprinting",
|
||||
resistFingerprinting: getPrivacyAPI(
|
||||
extension, "websites.resistFingerprinting",
|
||||
() => {
|
||||
return Preferences.get("privacy.resistFingerprinting");
|
||||
}),
|
||||
firstPartyIsolate: getPrivacyAPI(extension,
|
||||
"websites.firstPartyIsolate",
|
||||
firstPartyIsolate: getPrivacyAPI(
|
||||
extension, "websites.firstPartyIsolate",
|
||||
() => {
|
||||
return Preferences.get("privacy.firstparty.isolate");
|
||||
}),
|
||||
trackingProtectionMode: getPrivacyAPI(extension,
|
||||
"websites.trackingProtectionMode",
|
||||
trackingProtectionMode: getPrivacyAPI(
|
||||
extension, "websites.trackingProtectionMode",
|
||||
() => {
|
||||
if (Preferences.get("privacy.trackingprotection.enabled")) {
|
||||
return "always";
|
||||
} else if (
|
||||
Preferences.get("privacy.trackingprotection.pbmode.enabled")) {
|
||||
} else if (Preferences.get("privacy.trackingprotection.pbmode.enabled")) {
|
||||
return "private_browsing";
|
||||
}
|
||||
return "never";
|
||||
|
@ -98,8 +98,8 @@ class Theme {
|
||||
|
||||
LightweightThemeManager.fallbackThemeData = this.lwtStyles;
|
||||
Services.obs.notifyObservers(null,
|
||||
"lightweight-theme-styling-update",
|
||||
JSON.stringify(this.lwtStyles));
|
||||
"lightweight-theme-styling-update",
|
||||
JSON.stringify(this.lwtStyles));
|
||||
} else {
|
||||
this.logger.warn("Your theme doesn't include one of the following required " +
|
||||
"properties: 'headerURL', 'accentcolor' or 'textcolor'");
|
||||
@ -295,8 +295,8 @@ class Theme {
|
||||
}
|
||||
LightweightThemeManager.fallbackThemeData = null;
|
||||
Services.obs.notifyObservers(null,
|
||||
"lightweight-theme-styling-update",
|
||||
JSON.stringify(lwtStyles));
|
||||
"lightweight-theme-styling-update",
|
||||
JSON.stringify(lwtStyles));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,8 +97,7 @@ function WebNavigationEventManager(context, eventName) {
|
||||
let name = `webNavigation.${eventName}`;
|
||||
let register = (fire, urlFilters) => {
|
||||
// Don't create a MatchURLFilters instance if the listener does not include any filter.
|
||||
let filters = urlFilters ?
|
||||
new MatchURLFilters(urlFilters.url) : null;
|
||||
let filters = urlFilters ? new MatchURLFilters(urlFilters.url) : null;
|
||||
|
||||
let listener = data => {
|
||||
if (!data.browser) {
|
||||
|
@ -24,7 +24,7 @@ add_task(async function test_alpha_accentcolor() {
|
||||
let style = window.getComputedStyle(docEl);
|
||||
|
||||
Assert.equal(style.backgroundColor, "rgb(230, 128, 0)",
|
||||
"Window background color should be opaque");
|
||||
"Window background color should be opaque");
|
||||
|
||||
await extension.unload();
|
||||
});
|
||||
|
@ -32,15 +32,15 @@ add_task(async function test_support_theme_frame() {
|
||||
|
||||
Assert.ok(docEl.hasAttribute("lwtheme"), "LWT attribute should be set");
|
||||
Assert.equal(docEl.getAttribute("lwthemetextcolor"), "bright",
|
||||
"LWT text color attribute should be set");
|
||||
"LWT text color attribute should be set");
|
||||
|
||||
let style = window.getComputedStyle(docEl);
|
||||
Assert.ok(style.backgroundImage.includes("face.png"),
|
||||
`The backgroundImage should use face.png. Actual value is: ${style.backgroundImage}`);
|
||||
`The backgroundImage should use face.png. Actual value is: ${style.backgroundImage}`);
|
||||
Assert.equal(style.backgroundColor, "rgb(" + FRAME_COLOR.join(", ") + ")",
|
||||
"Expected correct background color");
|
||||
"Expected correct background color");
|
||||
Assert.equal(style.color, "rgba(" + TAB_TEXT_COLOR.join(", ") + ")",
|
||||
"Expected correct text color");
|
||||
"Expected correct text color");
|
||||
|
||||
await extension.unload();
|
||||
|
||||
|
@ -38,20 +38,26 @@ add_task(async function test_get_current() {
|
||||
};
|
||||
|
||||
function testTheme1(returnedTheme) {
|
||||
browser.test.assertTrue(returnedTheme.images.headerURL.includes("image1.png"),
|
||||
browser.test.assertTrue(
|
||||
returnedTheme.images.headerURL.includes("image1.png"),
|
||||
"Theme 1 header URL should be applied");
|
||||
browser.test.assertEq(ACCENT_COLOR_1, returnedTheme.colors.accentcolor,
|
||||
browser.test.assertEq(
|
||||
ACCENT_COLOR_1, returnedTheme.colors.accentcolor,
|
||||
"Theme 1 accent color should be applied");
|
||||
browser.test.assertEq(TEXT_COLOR_1, returnedTheme.colors.textcolor,
|
||||
browser.test.assertEq(
|
||||
TEXT_COLOR_1, returnedTheme.colors.textcolor,
|
||||
"Theme 1 text color should be applied");
|
||||
}
|
||||
|
||||
function testTheme2(returnedTheme) {
|
||||
browser.test.assertTrue(returnedTheme.images.headerURL.includes("image2.png"),
|
||||
browser.test.assertTrue(
|
||||
returnedTheme.images.headerURL.includes("image2.png"),
|
||||
"Theme 2 header URL should be applied");
|
||||
browser.test.assertEq(ACCENT_COLOR_2, returnedTheme.colors.accentcolor,
|
||||
browser.test.assertEq(
|
||||
ACCENT_COLOR_2, returnedTheme.colors.accentcolor,
|
||||
"Theme 2 accent color should be applied");
|
||||
browser.test.assertEq(TEXT_COLOR_2, returnedTheme.colors.textcolor,
|
||||
browser.test.assertEq(
|
||||
TEXT_COLOR_2, returnedTheme.colors.textcolor,
|
||||
"Theme 2 text color should be applied");
|
||||
}
|
||||
|
||||
|
@ -38,20 +38,26 @@ add_task(async function test_on_updated() {
|
||||
};
|
||||
|
||||
function testTheme1(returnedTheme) {
|
||||
browser.test.assertTrue(returnedTheme.images.headerURL.includes("image1.png"),
|
||||
browser.test.assertTrue(
|
||||
returnedTheme.images.headerURL.includes("image1.png"),
|
||||
"Theme 1 header URL should be applied");
|
||||
browser.test.assertEq(ACCENT_COLOR_1, returnedTheme.colors.accentcolor,
|
||||
browser.test.assertEq(
|
||||
ACCENT_COLOR_1, returnedTheme.colors.accentcolor,
|
||||
"Theme 1 accent color should be applied");
|
||||
browser.test.assertEq(TEXT_COLOR_1, returnedTheme.colors.textcolor,
|
||||
browser.test.assertEq(
|
||||
TEXT_COLOR_1, returnedTheme.colors.textcolor,
|
||||
"Theme 1 text color should be applied");
|
||||
}
|
||||
|
||||
function testTheme2(returnedTheme) {
|
||||
browser.test.assertTrue(returnedTheme.images.headerURL.includes("image2.png"),
|
||||
browser.test.assertTrue(
|
||||
returnedTheme.images.headerURL.includes("image2.png"),
|
||||
"Theme 2 header URL should be applied");
|
||||
browser.test.assertEq(ACCENT_COLOR_2, returnedTheme.colors.accentcolor,
|
||||
browser.test.assertEq(
|
||||
ACCENT_COLOR_2, returnedTheme.colors.accentcolor,
|
||||
"Theme 2 accent color should be applied");
|
||||
browser.test.assertEq(TEXT_COLOR_2, returnedTheme.colors.textcolor,
|
||||
browser.test.assertEq(
|
||||
TEXT_COLOR_2, returnedTheme.colors.textcolor,
|
||||
"Theme 2 text color should be applied");
|
||||
}
|
||||
|
||||
@ -79,16 +85,16 @@ add_task(async function test_on_updated() {
|
||||
updateInfo2 = await updateInfo2;
|
||||
testTheme2(updateInfo2.theme);
|
||||
browser.test.assertEq(secondWin.id, updateInfo2.windowId,
|
||||
"window id on second update");
|
||||
"window id on second update");
|
||||
|
||||
browser.test.log("Testing reset with windowId parameter");
|
||||
let updateInfo3 = onceThemeUpdated();
|
||||
await browser.theme.reset(firstWin.id);
|
||||
updateInfo3 = await updateInfo3;
|
||||
browser.test.assertEq(0, Object.keys(updateInfo3.theme).length,
|
||||
"Empty theme given on reset");
|
||||
"Empty theme given on reset");
|
||||
browser.test.assertEq(firstWin.id, updateInfo3.windowId,
|
||||
"window id on third update");
|
||||
"window id on third update");
|
||||
|
||||
browser.test.log("Testing reset with no windowId parameter");
|
||||
let updateInfo4 = onceThemeUpdated();
|
||||
|
@ -22,7 +22,7 @@ function validateTheme(backgroundImage, accentColor, textColor, isLWT) {
|
||||
if (isLWT) {
|
||||
Assert.ok(docEl.hasAttribute("lwtheme"), "LWT attribute should be set");
|
||||
Assert.equal(docEl.getAttribute("lwthemetextcolor"), "bright",
|
||||
"LWT text color attribute should be set");
|
||||
"LWT text color attribute should be set");
|
||||
}
|
||||
|
||||
Assert.ok(style.backgroundImage.includes(backgroundImage), "Expected correct background image");
|
||||
|
@ -41,18 +41,18 @@ add_task(async function test_getcurrent() {
|
||||
await theme.startup();
|
||||
let receivedTheme = await updatedPromise;
|
||||
Assert.ok(receivedTheme.images.headerURL.includes("image1.png"),
|
||||
"getCurrent returns correct headerURL");
|
||||
"getCurrent returns correct headerURL");
|
||||
Assert.equal(receivedTheme.colors.accentcolor, ACCENT_COLOR,
|
||||
"getCurrent returns correct accentcolor");
|
||||
"getCurrent returns correct accentcolor");
|
||||
Assert.equal(receivedTheme.colors.textcolor, TEXT_COLOR,
|
||||
"getCurrent returns correct textcolor");
|
||||
"getCurrent returns correct textcolor");
|
||||
|
||||
info("Testing getCurrent after static theme unload");
|
||||
updatedPromise = extension.awaitMessage("theme-updated");
|
||||
await theme.unload();
|
||||
receivedTheme = await updatedPromise;
|
||||
Assert.equal(Object.keys(receivedTheme), 0,
|
||||
"getCurrent returns empty theme");
|
||||
"getCurrent returns empty theme");
|
||||
|
||||
await extension.unload();
|
||||
});
|
||||
|
@ -31,13 +31,13 @@ add_task(async function test_support_LWT_properties() {
|
||||
|
||||
Assert.ok(docEl.hasAttribute("lwtheme"), "LWT attribute should be set");
|
||||
Assert.equal(docEl.getAttribute("lwthemetextcolor"), "bright",
|
||||
"LWT text color attribute should be set");
|
||||
"LWT text color attribute should be set");
|
||||
|
||||
Assert.ok(style.backgroundImage.includes("image1.png"), "Expected background image");
|
||||
Assert.equal(style.backgroundColor, "rgb(" + hexToRGB(ACCENT_COLOR).join(", ") + ")",
|
||||
"Expected correct background color");
|
||||
"Expected correct background color");
|
||||
Assert.equal(style.color, "rgb(" + hexToRGB(TEXT_COLOR).join(", ") + ")",
|
||||
"Expected correct text color");
|
||||
"Expected correct text color");
|
||||
|
||||
await extension.unload();
|
||||
|
||||
|
@ -34,18 +34,18 @@ add_task(async function test_support_backgrounds_position() {
|
||||
|
||||
Assert.ok(docEl.hasAttribute("lwtheme"), "LWT attribute should be set");
|
||||
Assert.equal(docEl.getAttribute("lwthemetextcolor"), "bright",
|
||||
"LWT text color attribute should be set");
|
||||
"LWT text color attribute should be set");
|
||||
|
||||
let style = window.getComputedStyle(docEl);
|
||||
let bgImage = style.backgroundImage.split(",")[0].trim();
|
||||
Assert.ok(bgImage.includes("face.png"),
|
||||
`The backgroundImage should use face.png. Actual value is: ${bgImage}`);
|
||||
`The backgroundImage should use face.png. Actual value is: ${bgImage}`);
|
||||
Assert.equal(Array(4).fill(bgImage).join(", "), style.backgroundImage,
|
||||
"The backgroundImage should use face.png four times.");
|
||||
"The backgroundImage should use face.png four times.");
|
||||
Assert.equal(style.backgroundPosition, "100% 0%, 0% 0%, 50% 0%, 100% 100%",
|
||||
"The backgroundPosition should use the four values provided.");
|
||||
"The backgroundPosition should use the four values provided.");
|
||||
Assert.equal(style.backgroundRepeat, "no-repeat",
|
||||
"The backgroundPosition should use the default value.");
|
||||
"The backgroundPosition should use the default value.");
|
||||
|
||||
await extension.unload();
|
||||
|
||||
@ -88,18 +88,18 @@ add_task(async function test_support_backgrounds_repeat() {
|
||||
|
||||
Assert.ok(docEl.hasAttribute("lwtheme"), "LWT attribute should be set");
|
||||
Assert.equal(docEl.getAttribute("lwthemetextcolor"), "bright",
|
||||
"LWT text color attribute should be set");
|
||||
"LWT text color attribute should be set");
|
||||
|
||||
let style = window.getComputedStyle(docEl);
|
||||
let bgImage = style.backgroundImage.split(",")[0].trim();
|
||||
Assert.ok(bgImage.includes("face0.png"),
|
||||
`The backgroundImage should use face.png. Actual value is: ${bgImage}`);
|
||||
`The backgroundImage should use face.png. Actual value is: ${bgImage}`);
|
||||
Assert.equal([0, 1, 2, 3].map(num => bgImage.replace(/face[\d]*/, `face${num}`)).join(", "),
|
||||
style.backgroundImage, "The backgroundImage should use face.png four times.");
|
||||
style.backgroundImage, "The backgroundImage should use face.png four times.");
|
||||
Assert.equal(style.backgroundPosition, "100% 0%",
|
||||
"The backgroundPosition should use the default value.");
|
||||
"The backgroundPosition should use the default value.");
|
||||
Assert.equal(style.backgroundRepeat, "no-repeat, repeat-x, repeat-y, repeat",
|
||||
"The backgroundPosition should use the four values provided.");
|
||||
"The backgroundPosition should use the four values provided.");
|
||||
|
||||
await extension.unload();
|
||||
|
||||
@ -133,18 +133,18 @@ add_task(async function test_additional_images_check() {
|
||||
|
||||
Assert.ok(docEl.hasAttribute("lwtheme"), "LWT attribute should be set");
|
||||
Assert.equal(docEl.getAttribute("lwthemetextcolor"), "bright",
|
||||
"LWT text color attribute should be set");
|
||||
"LWT text color attribute should be set");
|
||||
|
||||
let style = window.getComputedStyle(docEl);
|
||||
let bgImage = style.backgroundImage.split(",")[0];
|
||||
Assert.ok(bgImage.includes("face.png"),
|
||||
`The backgroundImage should use face.png. Actual value is: ${bgImage}`);
|
||||
`The backgroundImage should use face.png. Actual value is: ${bgImage}`);
|
||||
Assert.equal(bgImage + ", none", style.backgroundImage,
|
||||
"The backgroundImage should use face.png only once.");
|
||||
"The backgroundImage should use face.png only once.");
|
||||
Assert.equal(style.backgroundPosition, "100% 0%",
|
||||
"The backgroundPosition should use the default value.");
|
||||
"The backgroundPosition should use the default value.");
|
||||
Assert.equal(style.backgroundRepeat, "no-repeat",
|
||||
"The backgroundPosition should use only one (default) value.");
|
||||
"The backgroundPosition should use only one (default) value.");
|
||||
|
||||
await extension.unload();
|
||||
|
||||
|
@ -34,7 +34,7 @@ add_task(async function test_multiple_windows() {
|
||||
|
||||
Assert.ok(docEl.hasAttribute("lwtheme"), "LWT attribute should be set");
|
||||
Assert.equal(docEl.getAttribute("lwthemetextcolor"), "bright",
|
||||
"LWT text color attribute should be set");
|
||||
"LWT text color attribute should be set");
|
||||
Assert.ok(style.backgroundImage.includes("image1.png"), "Expected background image");
|
||||
|
||||
// Now we'll open a new window to see if the theme is also applied there.
|
||||
@ -44,7 +44,7 @@ add_task(async function test_multiple_windows() {
|
||||
|
||||
Assert.ok(docEl.hasAttribute("lwtheme"), "LWT attribute should be set");
|
||||
Assert.equal(docEl.getAttribute("lwthemetextcolor"), "bright",
|
||||
"LWT text color attribute should be set");
|
||||
"LWT text color attribute should be set");
|
||||
Assert.ok(style.backgroundImage.includes("image1.png"), "Expected background image");
|
||||
|
||||
await BrowserTestUtils.closeWindow(window2);
|
||||
|
@ -40,11 +40,11 @@ add_task(async function test_on_updated() {
|
||||
const {theme: receivedTheme, windowId} = await updatedPromise;
|
||||
Assert.ok(!windowId, "No window id in static theme update event");
|
||||
Assert.ok(receivedTheme.images.headerURL.includes("image1.png"),
|
||||
"Theme header URL should be applied");
|
||||
"Theme header URL should be applied");
|
||||
Assert.equal(receivedTheme.colors.accentcolor, ACCENT_COLOR,
|
||||
"Theme accent color should be applied");
|
||||
"Theme accent color should be applied");
|
||||
Assert.equal(receivedTheme.colors.textcolor, TEXT_COLOR,
|
||||
"Theme text color should be applied");
|
||||
"Theme text color should be applied");
|
||||
|
||||
info("Testing update event on static theme unload");
|
||||
updatedPromise = extension.awaitMessage("theme-updated");
|
||||
@ -52,7 +52,7 @@ add_task(async function test_on_updated() {
|
||||
const updateInfo = await updatedPromise;
|
||||
Assert.ok(!windowId, "No window id in static theme update event on unload");
|
||||
Assert.equal(Object.keys(updateInfo.theme), 0,
|
||||
"unloading theme sends empty theme in update event");
|
||||
"unloading theme sends empty theme in update event");
|
||||
|
||||
await extension.unload();
|
||||
});
|
||||
|
@ -34,7 +34,8 @@ add_task(async function test_support_tab_text_property_css_color() {
|
||||
info("Checking selected tab colors");
|
||||
let selectedTab = document.querySelector(".tabbrowser-tab[selected]");
|
||||
Assert.equal(window.getComputedStyle(selectedTab).color,
|
||||
"rgb(" + hexToRGB(TAB_TEXT_COLOR).join(", ") + ")", "Selected tab text color should be set.");
|
||||
"rgb(" + hexToRGB(TAB_TEXT_COLOR).join(", ") + ")",
|
||||
"Selected tab text color should be set.");
|
||||
|
||||
await extension.unload();
|
||||
});
|
||||
@ -64,7 +65,8 @@ add_task(async function test_support_tab_text_chrome_array() {
|
||||
info("Checking selected tab colors");
|
||||
let selectedTab = document.querySelector(".tabbrowser-tab[selected]");
|
||||
Assert.equal(window.getComputedStyle(selectedTab).color,
|
||||
"rgb(" + TAB_TEXT_COLOR.join(", ") + ")", "Selected tab text color should be set.");
|
||||
"rgb(" + TAB_TEXT_COLOR.join(", ") + ")",
|
||||
"Selected tab text color should be set.");
|
||||
|
||||
await extension.unload();
|
||||
});
|
||||
|
@ -12,13 +12,17 @@ add_task(async function setup() {
|
||||
|
||||
function testBorderColor(element, expected) {
|
||||
Assert.equal(window.getComputedStyle(element).borderLeftColor,
|
||||
"rgb(" + hexToRGB(expected).join(", ") + ")", "Field left border color should be set.");
|
||||
hexToCSS(expected),
|
||||
"Field left border color should be set.");
|
||||
Assert.equal(window.getComputedStyle(element).borderRightColor,
|
||||
"rgb(" + hexToRGB(expected).join(", ") + ")", "Field right border color should be set.");
|
||||
hexToCSS(expected),
|
||||
"Field right border color should be set.");
|
||||
Assert.equal(window.getComputedStyle(element).borderTopColor,
|
||||
"rgb(" + hexToRGB(expected).join(", ") + ")", "Field top border color should be set.");
|
||||
hexToCSS(expected),
|
||||
"Field top border color should be set.");
|
||||
Assert.equal(window.getComputedStyle(element).borderBottomColor,
|
||||
"rgb(" + hexToRGB(expected).join(", ") + ")", "Field bottom border color should be set.");
|
||||
hexToCSS(expected),
|
||||
"Field bottom border color should be set.");
|
||||
}
|
||||
|
||||
add_task(async function test_support_toolbar_field_properties() {
|
||||
@ -66,9 +70,11 @@ add_task(async function test_support_toolbar_field_properties() {
|
||||
for (let field of fields) {
|
||||
info(`Testing ${field.id || field.className}`);
|
||||
Assert.equal(window.getComputedStyle(field).backgroundColor,
|
||||
"rgb(" + hexToRGB(TOOLBAR_FIELD_BACKGROUND).join(", ") + ")", "Field background should be set.");
|
||||
hexToCSS(TOOLBAR_FIELD_BACKGROUND),
|
||||
"Field background should be set.");
|
||||
Assert.equal(window.getComputedStyle(field).color,
|
||||
"rgb(" + hexToRGB(TOOLBAR_FIELD_COLOR).join(", ") + ")", "Field color should be set.");
|
||||
hexToCSS(TOOLBAR_FIELD_COLOR),
|
||||
"Field color should be set.");
|
||||
testBorderColor(field, TOOLBAR_FIELD_BORDER);
|
||||
}
|
||||
|
||||
|
@ -43,15 +43,18 @@ add_task(async function test_support_toolbar_property() {
|
||||
for (let toolbar of toolbars) {
|
||||
info(`Testing ${toolbar.id}`);
|
||||
Assert.equal(window.getComputedStyle(toolbar).backgroundColor,
|
||||
"rgb(" + hexToRGB(TOOLBAR_COLOR).join(", ") + ")", "Toolbar background color should be set.");
|
||||
hexToCSS(TOOLBAR_COLOR),
|
||||
"Toolbar background color should be set.");
|
||||
Assert.equal(window.getComputedStyle(toolbar).color,
|
||||
"rgb(" + hexToRGB(TOOLBAR_TEXT_COLOR).join(", ") + ")", "Toolbar text color should be set.");
|
||||
hexToCSS(TOOLBAR_TEXT_COLOR),
|
||||
"Toolbar text color should be set.");
|
||||
}
|
||||
|
||||
info("Checking selected tab colors");
|
||||
let selectedTab = document.querySelector(".tabbrowser-tab[selected]");
|
||||
Assert.equal(window.getComputedStyle(selectedTab).color,
|
||||
"rgb(" + hexToRGB(TOOLBAR_TEXT_COLOR).join(", ") + ")", "Selected tab text color should be set.");
|
||||
hexToCSS(TOOLBAR_TEXT_COLOR),
|
||||
"Selected tab text color should be set.");
|
||||
|
||||
await extension.unload();
|
||||
});
|
||||
@ -90,14 +93,15 @@ add_task(async function test_bookmark_text_property() {
|
||||
for (let toolbar of toolbars) {
|
||||
info(`Testing ${toolbar.id}`);
|
||||
Assert.equal(window.getComputedStyle(toolbar).color,
|
||||
"rgb(" + TOOLBAR_TEXT_COLOR.join(", ") + ")",
|
||||
"bookmark_text should be an alias for toolbar_text");
|
||||
rgbToCSS(TOOLBAR_TEXT_COLOR),
|
||||
"bookmark_text should be an alias for toolbar_text");
|
||||
}
|
||||
|
||||
info("Checking selected tab colors");
|
||||
let selectedTab = document.querySelector(".tabbrowser-tab[selected]");
|
||||
Assert.equal(window.getComputedStyle(selectedTab).color,
|
||||
"rgb(" + TOOLBAR_TEXT_COLOR.join(", ") + ")", "Selected tab text color should be set.");
|
||||
rgbToCSS(TOOLBAR_TEXT_COLOR),
|
||||
"Selected tab text color should be set.");
|
||||
|
||||
await extension.unload();
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* exported ACCENT_COLOR, BACKGROUND, ENCODED_IMAGE_DATA, FRAME_COLOR, TAB_TEXT_COLOR,
|
||||
TEXT_COLOR, BACKGROUND_TAB_TEXT_COLOR, imageBufferFromDataURI, hexToRGB */
|
||||
TEXT_COLOR, BACKGROUND_TAB_TEXT_COLOR, imageBufferFromDataURI, hexToCSS, hexToRGB */
|
||||
|
||||
"use strict";
|
||||
|
||||
@ -41,6 +41,14 @@ function hexToRGB(hex) {
|
||||
return [hex >> 16, (hex & 0x00FF00) >> 8, (hex & 0x0000FF)];
|
||||
}
|
||||
|
||||
function rgbToCSS(rgb) {
|
||||
return `rgb(${rgb.join(", ")})`;
|
||||
}
|
||||
|
||||
function hexToCSS(hex) {
|
||||
return rgbToCSS(hexToRGB(hex));
|
||||
}
|
||||
|
||||
function imageBufferFromDataURI(encodedImageData) {
|
||||
let decodedImageData = atob(encodedImageData);
|
||||
return Uint8Array.from(decodedImageData, byte => byte.charCodeAt(0)).buffer;
|
||||
|
@ -15,7 +15,7 @@
|
||||
add_task(async function test_downloads_open_permission() {
|
||||
function backgroundScript() {
|
||||
browser.test.assertEq(browser.downloads.open, undefined,
|
||||
"`downloads.open` permission is required.");
|
||||
"`downloads.open` permission is required.");
|
||||
browser.test.notifyPass("downloads tests");
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ add_task(async function test_background_reload_and_unload() {
|
||||
}
|
||||
|
||||
let chromeScript = SpecialPowers.loadChromeScript(
|
||||
SimpleTest.getTestFileURL("file_teardown_test.js"));
|
||||
SimpleTest.getTestFileURL("file_teardown_test.js"));
|
||||
await chromeScript.promiseOneMessage("chromescript-startup");
|
||||
|
||||
let extensionData = {
|
||||
@ -41,30 +41,30 @@ add_task(async function test_background_reload_and_unload() {
|
||||
|
||||
let contextEvents = await getContextEvents();
|
||||
is(contextEvents.length, 1,
|
||||
"ExtensionContext state change after loading an extension");
|
||||
"ExtensionContext state change after loading an extension");
|
||||
is(contextEvents[0].eventType, "load");
|
||||
is(contextEvents[0].url, backgroundUrl,
|
||||
"The ExtensionContext should be the background page");
|
||||
"The ExtensionContext should be the background page");
|
||||
|
||||
extension.sendMessage("reload-background");
|
||||
await extension.awaitMessage("background-url");
|
||||
|
||||
contextEvents = await getContextEvents();
|
||||
is(contextEvents.length, 2,
|
||||
"ExtensionContext state changes after reloading the background page");
|
||||
"ExtensionContext state changes after reloading the background page");
|
||||
is(contextEvents[0].eventType, "unload",
|
||||
"Unload ExtensionContext of background page");
|
||||
"Unload ExtensionContext of background page");
|
||||
is(contextEvents[0].url, backgroundUrl, "ExtensionContext URL = background");
|
||||
is(contextEvents[1].eventType, "load",
|
||||
"Create new ExtensionContext for background page");
|
||||
"Create new ExtensionContext for background page");
|
||||
is(contextEvents[1].url, backgroundUrl, "ExtensionContext URL = background");
|
||||
await extension.unload();
|
||||
|
||||
contextEvents = await getContextEvents();
|
||||
is(contextEvents.length, 1,
|
||||
"ExtensionContext state change after unloading the extension");
|
||||
"ExtensionContext state change after unloading the extension");
|
||||
is(contextEvents[0].eventType, "unload",
|
||||
"Unload ExtensionContext for background page after extension unloads");
|
||||
"Unload ExtensionContext for background page after extension unloads");
|
||||
is(contextEvents[0].url, backgroundUrl, "ExtensionContext URL = background");
|
||||
|
||||
chromeScript.sendAsyncMessage("cleanup");
|
||||
|
@ -34,9 +34,9 @@ function shared() {
|
||||
add_task(async function test_background_clipboard_permissions() {
|
||||
function backgroundScript() {
|
||||
browser.test.assertEq(false, doCopy("whatever"),
|
||||
"copy should be denied without permission");
|
||||
"copy should be denied without permission");
|
||||
browser.test.assertEq(false, doPaste(),
|
||||
"paste should be denied without permission");
|
||||
"paste should be denied without permission");
|
||||
browser.test.sendMessage("ready");
|
||||
}
|
||||
let extensionData = {
|
||||
@ -85,9 +85,9 @@ add_task(function* test_background_clipboard_copy() {
|
||||
add_task(async function test_contentscript_clipboard_permissions() {
|
||||
function contentScript() {
|
||||
browser.test.assertEq(false, doCopy("whatever"),
|
||||
"copy should be denied without permission");
|
||||
"copy should be denied without permission");
|
||||
browser.test.assertEq(false, doPaste(),
|
||||
"paste should be denied without permission");
|
||||
"paste should be denied without permission");
|
||||
browser.test.sendMessage("ready");
|
||||
}
|
||||
let extensionData = {
|
||||
@ -116,7 +116,7 @@ add_task(async function test_contentscript_clipboard_copy() {
|
||||
function contentScript() {
|
||||
browser.test.onMessage.addListener(txt => {
|
||||
browser.test.assertEq(true, doCopy(txt),
|
||||
"copy should be allowed with permission");
|
||||
"copy should be allowed with permission");
|
||||
});
|
||||
browser.test.sendMessage("ready");
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ add_task(async function test_without_clipboard_permission() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
background() {
|
||||
browser.test.assertEq(undefined, browser.clipboard,
|
||||
"clipboard API requires the clipboardWrite permission.");
|
||||
"clipboard API requires the clipboardWrite permission.");
|
||||
browser.test.notifyPass();
|
||||
},
|
||||
manifest: {
|
||||
|
@ -44,7 +44,7 @@ add_task(async function test_contentscript_create_iframe() {
|
||||
let {applications: {gecko: {id: testGetManifestGeckoId}}} = testGetManifest;
|
||||
|
||||
browser.test.assertEq(testGetManifestGeckoId, expectedManifestGeckoId,
|
||||
"GET_MANIFEST() returns manifest data before extension unload"
|
||||
"GET_MANIFEST() returns manifest data before extension unload"
|
||||
);
|
||||
|
||||
browser.test.sendMessage(name);
|
||||
|
@ -24,10 +24,10 @@ add_task(async function test_contentscript_exportHelpers() {
|
||||
exportFunction(() => value, window, {defineAs: "precisePi"});
|
||||
|
||||
browser.test.assertEq("undefined", typeof precisePi,
|
||||
"exportFunction should export to the page's scope only");
|
||||
"exportFunction should export to the page's scope only");
|
||||
|
||||
browser.test.assertEq("undefined", typeof window.precisePi,
|
||||
"exportFunction should export to the page's scope only");
|
||||
"exportFunction should export to the page's scope only");
|
||||
|
||||
let results = [];
|
||||
exportFunction(pi => results.push(pi), window, {defineAs: "reportPi"});
|
||||
@ -54,12 +54,12 @@ add_task(async function test_contentscript_exportHelpers() {
|
||||
// Inline script ought to run synchronously.
|
||||
|
||||
browser.test.assertEq(3.14, results[0],
|
||||
"exportFunction on window should define a global function");
|
||||
"exportFunction on window should define a global function");
|
||||
browser.test.assertEq(3.14, results[1],
|
||||
"exportFunction on window should export a property to window.");
|
||||
"exportFunction on window should export a property to window.");
|
||||
|
||||
browser.test.assertEq(2, results.length,
|
||||
"Expecting the number of results to match the number of method calls");
|
||||
"Expecting the number of results to match the number of method calls");
|
||||
|
||||
browser.test.notifyPass("export helper test completed");
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ add_task(async function test_contentscript_reload_and_unload() {
|
||||
let removedTabs = 0;
|
||||
browser.tabs.onRemoved.addListener(() => {
|
||||
browser.test.assertEq(1, ++removedTabs,
|
||||
"Expected only one tab to be removed during the test");
|
||||
"Expected only one tab to be removed during the test");
|
||||
browser.test.sendMessage("tab-closed");
|
||||
});
|
||||
}
|
||||
@ -44,7 +44,7 @@ add_task(async function test_contentscript_reload_and_unload() {
|
||||
await extension.startup();
|
||||
|
||||
let chromeScript = SpecialPowers.loadChromeScript(
|
||||
SimpleTest.getTestFileURL("file_teardown_test.js"));
|
||||
SimpleTest.getTestFileURL("file_teardown_test.js"));
|
||||
await chromeScript.promiseOneMessage("chromescript-startup");
|
||||
async function getContextEvents() {
|
||||
chromeScript.sendAsyncMessage("get-context-events");
|
||||
@ -58,9 +58,9 @@ add_task(async function test_contentscript_reload_and_unload() {
|
||||
|
||||
let contextEvents = await getContextEvents();
|
||||
is(contextEvents.length, 1,
|
||||
"ExtensionContext state change after loading a content script");
|
||||
"ExtensionContext state change after loading a content script");
|
||||
is(contextEvents[0].eventType, "load",
|
||||
"Create ExtensionContext for content script");
|
||||
"Create ExtensionContext for content script");
|
||||
is(contextEvents[0].url, tabUrl, "ExtensionContext URL = page");
|
||||
|
||||
let promiseReload = extension.awaitMessage("contentscript-run");
|
||||
@ -68,11 +68,11 @@ add_task(async function test_contentscript_reload_and_unload() {
|
||||
await promiseReload;
|
||||
contextEvents = await getContextEvents();
|
||||
is(contextEvents.length, 2,
|
||||
"ExtensionContext state changes after reloading a content script");
|
||||
"ExtensionContext state changes after reloading a content script");
|
||||
is(contextEvents[0].eventType, "unload", "Unload old ExtensionContext");
|
||||
is(contextEvents[0].url, tabUrl, "ExtensionContext URL = page");
|
||||
is(contextEvents[1].eventType, "load",
|
||||
"Create new ExtensionContext for content script");
|
||||
"Create new ExtensionContext for content script");
|
||||
is(contextEvents[1].url, tabUrl, "ExtensionContext URL = page");
|
||||
|
||||
let tabClosePromise = extension.awaitMessage("tab-closed");
|
||||
@ -81,9 +81,9 @@ add_task(async function test_contentscript_reload_and_unload() {
|
||||
|
||||
contextEvents = await getContextEvents();
|
||||
is(contextEvents.length, 1,
|
||||
"ExtensionContext state change after unloading a content script");
|
||||
"ExtensionContext state change after unloading a content script");
|
||||
is(contextEvents[0].eventType, "unload",
|
||||
"Unload ExtensionContext after closing the tab with the content script");
|
||||
"Unload ExtensionContext after closing the tab with the content script");
|
||||
is(contextEvents[0].url, tabUrl, "ExtensionContext URL = page");
|
||||
|
||||
chromeScript.sendAsyncMessage("cleanup");
|
||||
|
@ -20,7 +20,7 @@ add_task(async function test_connect_bidirectionally_and_postMessage() {
|
||||
// 3. onConnect by connect() from CS.
|
||||
browser.test.assertEq("from-cs", port.name);
|
||||
browser.test.assertEq(1, ++onConnectCount,
|
||||
"BG onConnect should be called once");
|
||||
"BG onConnect should be called once");
|
||||
|
||||
let tabId = port.sender.tab.id;
|
||||
browser.test.assertTrue(tabId, "content script must have a tab ID");
|
||||
@ -31,7 +31,7 @@ add_task(async function test_connect_bidirectionally_and_postMessage() {
|
||||
// 11. port.onMessage by port.postMessage in CS.
|
||||
browser.test.assertEq("from CS to port", msg);
|
||||
browser.test.assertEq(1, ++postMessageCount1,
|
||||
"BG port.onMessage should be called once");
|
||||
"BG port.onMessage should be called once");
|
||||
|
||||
// 12. should trigger port2.onMessage in CS.
|
||||
port2.postMessage("from BG to port2");
|
||||
@ -44,7 +44,7 @@ add_task(async function test_connect_bidirectionally_and_postMessage() {
|
||||
// 7. onMessage by port2.postMessage in CS.
|
||||
browser.test.assertEq("from CS to port2", msg);
|
||||
browser.test.assertEq(1, ++postMessageCount2,
|
||||
"BG port2.onMessage should be called once");
|
||||
"BG port2.onMessage should be called once");
|
||||
|
||||
// 8. Should trigger port.onMessage in CS.
|
||||
port.postMessage("from BG to port");
|
||||
@ -62,14 +62,14 @@ add_task(async function test_connect_bidirectionally_and_postMessage() {
|
||||
// 5. onConnect by connect() from BG.
|
||||
browser.test.assertEq("from-bg", port2.name);
|
||||
browser.test.assertEq(1, ++onConnectCount,
|
||||
"CS onConnect should be called once");
|
||||
"CS onConnect should be called once");
|
||||
|
||||
let postMessageCount2 = 0;
|
||||
port2.onMessage.addListener(msg => {
|
||||
// 12. port2.onMessage by port2.postMessage in BG.
|
||||
browser.test.assertEq("from BG to port2", msg);
|
||||
browser.test.assertEq(1, ++postMessageCount2,
|
||||
"CS port2.onMessage should be called once");
|
||||
"CS port2.onMessage should be called once");
|
||||
|
||||
// TODO(robwu): Do not explicitly disconnect, it should not be a problem
|
||||
// if we keep the ports open. However, not closing the ports causes the
|
||||
@ -90,7 +90,7 @@ add_task(async function test_connect_bidirectionally_and_postMessage() {
|
||||
// 9. onMessage by port.postMessage in BG.
|
||||
browser.test.assertEq("from BG to port", msg);
|
||||
browser.test.assertEq(1, ++postMessageCount1,
|
||||
"CS port.onMessage should be called once");
|
||||
"CS port.onMessage should be called once");
|
||||
|
||||
// 10. should trigger port.onMessage in BG.
|
||||
port.postMessage("from CS to port");
|
||||
|
@ -54,7 +54,7 @@ async function contentScript(checkGet) {
|
||||
|
||||
browser.storage.onChanged.addListener((changes, areaName) => {
|
||||
browser.test.assertEq(expectedAreaName, areaName,
|
||||
"Expected area name received by listener");
|
||||
"Expected area name received by listener");
|
||||
gResolve(changes);
|
||||
});
|
||||
|
||||
@ -85,7 +85,8 @@ async function contentScript(checkGet) {
|
||||
// Set some data and then test getters.
|
||||
try {
|
||||
await storage.set({"test-prop1": "value1", "test-prop2": "value2"});
|
||||
await checkChanges(areaName,
|
||||
await checkChanges(
|
||||
areaName,
|
||||
{"test-prop1": {newValue: "value1"}, "test-prop2": {newValue: "value2"}},
|
||||
"set (a)");
|
||||
|
||||
@ -118,7 +119,8 @@ async function contentScript(checkGet) {
|
||||
browser.test.assertEq(data["test-prop2"], "value2", "prop2 correct (c)");
|
||||
|
||||
await storage.remove(["test-prop1", "test-prop2"]);
|
||||
await checkChanges(areaName,
|
||||
await checkChanges(
|
||||
areaName,
|
||||
{"test-prop1": {oldValue: "value1"}, "test-prop2": {oldValue: "value2"}},
|
||||
"remove array");
|
||||
|
||||
@ -135,7 +137,8 @@ async function contentScript(checkGet) {
|
||||
clearGlobalChanges();
|
||||
await storage.clear();
|
||||
|
||||
await checkChanges(areaName,
|
||||
await checkChanges(
|
||||
areaName,
|
||||
{"test-prop1": {oldValue: "value1"}, "test-prop2": {oldValue: "value2"}},
|
||||
"clear");
|
||||
data = await storage.get(["test-prop1", "test-prop2"]);
|
||||
|
@ -132,7 +132,7 @@ add_task(async function test_webext_contentscript_iframe_subframe_privileges() {
|
||||
browser.test.assertFalse(hasTabsAPI,
|
||||
"Subframe of a content script privileged iframes has no access to privileged APIs");
|
||||
browser.test.assertTrue(hasStorageAPI,
|
||||
"Subframe of a content script privileged iframes has access to content script APIs");
|
||||
"Subframe of a content script privileged iframes has access to content script APIs");
|
||||
|
||||
browser.test.notifyPass("webext-contentscript-subframe-privileges");
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
// Test for tabs opened using tabs.create and window.open
|
||||
async function runTabReloadAndCloseTest(extension) {
|
||||
let chromeScript = SpecialPowers.loadChromeScript(
|
||||
SimpleTest.getTestFileURL("file_teardown_test.js"));
|
||||
SimpleTest.getTestFileURL("file_teardown_test.js"));
|
||||
await chromeScript.promiseOneMessage("chromescript-startup");
|
||||
async function getContextEvents() {
|
||||
chromeScript.sendAsyncMessage("get-context-events");
|
||||
@ -32,22 +32,22 @@ async function runTabReloadAndCloseTest(extension) {
|
||||
is(contextEvents.length, 1, "ExtensionContext change for opening a tab");
|
||||
is(contextEvents[0].eventType, "load", "create ExtensionContext for tab");
|
||||
is(contextEvents[0].url, extensionPageUrl,
|
||||
"ExtensionContext URL after tab creation should be tab URL");
|
||||
"ExtensionContext URL after tab creation should be tab URL");
|
||||
|
||||
extension.sendMessage("reload extension page");
|
||||
let extensionPageUrl2 = await extension.awaitMessage("extension page loaded");
|
||||
|
||||
is(extensionPageUrl, extensionPageUrl2,
|
||||
"The tab's URL is expected to not change after a page reload");
|
||||
"The tab's URL is expected to not change after a page reload");
|
||||
|
||||
contextEvents = await getContextEvents();
|
||||
is(contextEvents.length, 2, "ExtensionContext change after tab reload");
|
||||
is(contextEvents[0].eventType, "unload", "unload old ExtensionContext");
|
||||
is(contextEvents[0].url, extensionPageUrl,
|
||||
"ExtensionContext URL before reload should be tab URL");
|
||||
"ExtensionContext URL before reload should be tab URL");
|
||||
is(contextEvents[1].eventType, "load", "create new ExtensionContext for tab");
|
||||
is(contextEvents[1].url, extensionPageUrl2,
|
||||
"ExtensionContext URL after reload should be tab URL");
|
||||
"ExtensionContext URL after reload should be tab URL");
|
||||
|
||||
extension.sendMessage("close extension page");
|
||||
await extension.awaitMessage("closed extension page");
|
||||
@ -56,7 +56,7 @@ async function runTabReloadAndCloseTest(extension) {
|
||||
is(contextEvents.length, 1, "ExtensionContext after closing tab");
|
||||
is(contextEvents[0].eventType, "unload", "unload tab's ExtensionContext");
|
||||
is(contextEvents[0].url, extensionPageUrl2,
|
||||
"ExtensionContext URL at closing tab should be tab URL");
|
||||
"ExtensionContext URL at closing tab should be tab URL");
|
||||
|
||||
chromeScript.sendAsyncMessage("cleanup");
|
||||
chromeScript.destroy();
|
||||
|
@ -369,7 +369,7 @@ add_task(async function webnav_transitions_props() {
|
||||
"Got transitionQualifiers in the onHistoryStateUpdated event");
|
||||
}
|
||||
|
||||
// Test transitions properties on onReferenceFragmentUpdated events.
|
||||
// Test transitions properties on onReferenceFragmentUpdated events.
|
||||
|
||||
received = [];
|
||||
await loadAndWait(win, "onReferenceFragmentUpdated", `${FRAME2}/pushState#ref2`, () => {
|
||||
@ -383,7 +383,7 @@ add_task(async function webnav_transitions_props() {
|
||||
|
||||
if (found) {
|
||||
is(typeof found.details.transitionType, "string",
|
||||
"Got transitionType in the onReferenceFragmentUpdated event");
|
||||
"Got transitionType in the onReferenceFragmentUpdated event");
|
||||
ok(Array.isArray(found.details.transitionQualifiers),
|
||||
"Got transitionQualifiers in the onReferenceFragmentUpdated event");
|
||||
}
|
||||
@ -596,7 +596,7 @@ add_task(async function webnav_error_event() {
|
||||
|
||||
if (found) {
|
||||
ok(found.details.error.match(/Error code [0-9]+/),
|
||||
"Got the expected error string in the onErrorOccurred event");
|
||||
"Got the expected error string in the onErrorOccurred event");
|
||||
}
|
||||
|
||||
// cleanup phase
|
||||
|
@ -78,7 +78,8 @@ add_task(async function test_hsts_request() {
|
||||
|
||||
// simple redirect
|
||||
let sample = "https://example.org/tests/toolkit/components/extensions/test/mochitest/file_sample.html";
|
||||
extension.sendMessage(`https://${testPath}/redirect_auto.sjs?redirect_uri=${sample}`,
|
||||
extension.sendMessage(
|
||||
`https://${testPath}/redirect_auto.sjs?redirect_uri=${sample}`,
|
||||
["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders",
|
||||
"onHeadersReceived", "onBeforeRedirect", "onBeforeRequest",
|
||||
"onBeforeSendHeaders", "onSendHeaders", "onHeadersReceived",
|
||||
@ -88,7 +89,8 @@ add_task(async function test_hsts_request() {
|
||||
ok((await extension.awaitMessage("onCompleted")).startsWith(sample), "redirection ok");
|
||||
|
||||
// priming hsts
|
||||
extension.sendMessage(`https://${testPath}/hsts.sjs`,
|
||||
extension.sendMessage(
|
||||
`https://${testPath}/hsts.sjs`,
|
||||
["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders",
|
||||
"onHeadersReceived", "onResponseStarted", "onCompleted"]);
|
||||
is(await extension.awaitMessage("tabs-done"),
|
||||
@ -98,7 +100,8 @@ add_task(async function test_hsts_request() {
|
||||
"https://example.org/tests/toolkit/components/extensions/test/mochitest/hsts.sjs");
|
||||
|
||||
// test upgrade
|
||||
extension.sendMessage(`http://${testPath}/hsts.sjs`,
|
||||
extension.sendMessage(
|
||||
`http://${testPath}/hsts.sjs`,
|
||||
["onBeforeRequest", "onBeforeRedirect", "onBeforeRequest",
|
||||
"onBeforeSendHeaders", "onSendHeaders", "onHeadersReceived",
|
||||
"onResponseStarted", "onCompleted"]);
|
||||
|
@ -411,23 +411,24 @@ add_task(async function() {
|
||||
add_task(async function test_cachedResponse() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
background() {
|
||||
browser.webRequest.onHeadersReceived.addListener(data => {
|
||||
let filter = browser.webRequest.filterResponseData(data.requestId);
|
||||
browser.webRequest.onHeadersReceived.addListener(
|
||||
data => {
|
||||
let filter = browser.webRequest.filterResponseData(data.requestId);
|
||||
|
||||
filter.onstop = event => {
|
||||
filter.close();
|
||||
};
|
||||
filter.ondata = event => {
|
||||
filter.write(event.data);
|
||||
};
|
||||
filter.onstop = event => {
|
||||
filter.close();
|
||||
};
|
||||
filter.ondata = event => {
|
||||
filter.write(event.data);
|
||||
};
|
||||
|
||||
if (data.fromCache) {
|
||||
browser.test.sendMessage("from-cache");
|
||||
}
|
||||
}, {
|
||||
urls: ["http://mochi.test/*/file_sample.html?r=*"],
|
||||
},
|
||||
["blocking"]);
|
||||
if (data.fromCache) {
|
||||
browser.test.sendMessage("from-cache");
|
||||
}
|
||||
}, {
|
||||
urls: ["http://mochi.test/*/file_sample.html?r=*"],
|
||||
},
|
||||
["blocking"]);
|
||||
},
|
||||
|
||||
manifest: {
|
||||
@ -453,25 +454,26 @@ add_task(async function test_cachedResponse() {
|
||||
add_task(async function test_late_close() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
background() {
|
||||
browser.webRequest.onBeforeRequest.addListener(data => {
|
||||
let filter = browser.webRequest.filterResponseData(data.requestId);
|
||||
browser.webRequest.onBeforeRequest.addListener(
|
||||
data => {
|
||||
let filter = browser.webRequest.filterResponseData(data.requestId);
|
||||
|
||||
filter.onstop = event => {
|
||||
browser.test.fail("Should not receive onstop after close()");
|
||||
browser.test.assertEq("closed", filter.status,
|
||||
"Filter status should still be 'closed'");
|
||||
browser.test.assertThrows(() => { filter.close(); });
|
||||
};
|
||||
filter.ondata = event => {
|
||||
filter.write(event.data);
|
||||
filter.close();
|
||||
filter.onstop = event => {
|
||||
browser.test.fail("Should not receive onstop after close()");
|
||||
browser.test.assertEq("closed", filter.status,
|
||||
"Filter status should still be 'closed'");
|
||||
browser.test.assertThrows(() => { filter.close(); });
|
||||
};
|
||||
filter.ondata = event => {
|
||||
filter.write(event.data);
|
||||
filter.close();
|
||||
|
||||
browser.test.sendMessage(`done-${data.url}`);
|
||||
};
|
||||
}, {
|
||||
urls: ["http://mochi.test/*/file_sample.html?*"],
|
||||
},
|
||||
["blocking"]);
|
||||
browser.test.sendMessage(`done-${data.url}`);
|
||||
};
|
||||
}, {
|
||||
urls: ["http://mochi.test/*/file_sample.html?*"],
|
||||
},
|
||||
["blocking"]);
|
||||
},
|
||||
|
||||
manifest: {
|
||||
@ -502,8 +504,9 @@ add_task(async function test_permissions() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
background() {
|
||||
browser.test.assertEq(
|
||||
undefined, browser.webRequest.filterResponseData,
|
||||
"filterResponseData is undefined without blocking permissions");
|
||||
undefined,
|
||||
browser.webRequest.filterResponseData,
|
||||
"filterResponseData is undefined without blocking permissions");
|
||||
},
|
||||
|
||||
manifest: {
|
||||
|
@ -18,12 +18,14 @@ add_task(async function test_xhr_capabilities() {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", browser.extension.getURL("bad.xml"));
|
||||
|
||||
browser.test.sendMessage("result",
|
||||
browser.test.sendMessage(
|
||||
"result",
|
||||
{name: "Background script XHRs should not be privileged",
|
||||
result: xhr.channel === undefined});
|
||||
|
||||
xhr.onload = () => {
|
||||
browser.test.sendMessage("result",
|
||||
browser.test.sendMessage(
|
||||
"result",
|
||||
{name: "Background script XHRs should not yield <parsererrors>",
|
||||
result: xhr.responseXML === null});
|
||||
};
|
||||
@ -34,12 +36,14 @@ add_task(async function test_xhr_capabilities() {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", browser.extension.getURL("bad.xml"));
|
||||
|
||||
browser.test.sendMessage("result",
|
||||
browser.test.sendMessage(
|
||||
"result",
|
||||
{name: "Content script XHRs should not be privileged",
|
||||
result: xhr.channel === undefined});
|
||||
|
||||
xhr.onload = () => {
|
||||
browser.test.sendMessage("result",
|
||||
browser.test.sendMessage(
|
||||
"result",
|
||||
{name: "Content script XHRs should not yield <parsererrors>",
|
||||
result: xhr.responseXML === null});
|
||||
};
|
||||
|
@ -130,7 +130,7 @@ add_task(async function test_browser_settings() {
|
||||
// This setting is a no-op on Android.
|
||||
if (AppConstants.platform === "android") {
|
||||
await testNoOpSetting("contextMenuShowEvent", "mouseup",
|
||||
{"ui.context_menus.after_mouseup": false});
|
||||
{"ui.context_menus.after_mouseup": false});
|
||||
} else {
|
||||
await testSetting(
|
||||
"contextMenuShowEvent", "mouseup",
|
||||
@ -139,7 +139,8 @@ add_task(async function test_browser_settings() {
|
||||
|
||||
// "mousedown" is also a no-op on Windows.
|
||||
if (["android", "win"].includes(AppConstants.platform)) {
|
||||
await testNoOpSetting("contextMenuShowEvent", "mousedown",
|
||||
await testNoOpSetting(
|
||||
"contextMenuShowEvent", "mousedown",
|
||||
{"ui.context_menus.after_mouseup": AppConstants.platform === "win"});
|
||||
} else {
|
||||
await testSetting(
|
||||
|
@ -120,6 +120,17 @@ add_task(async function test_contentscript_window_open() {
|
||||
return;
|
||||
}
|
||||
|
||||
let script = async () => {
|
||||
/* globals x */
|
||||
browser.test.assertEq(1, x, "Should only run once");
|
||||
|
||||
if (top !== window) {
|
||||
await new Promise(resolve => setTimeout(resolve, 0));
|
||||
}
|
||||
|
||||
browser.test.sendMessage("content-script", [location.href, top === window]);
|
||||
};
|
||||
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
applications: {gecko: {id: "contentscript@tests.mozilla.org"}},
|
||||
@ -137,16 +148,7 @@ add_task(async function test_contentscript_window_open() {
|
||||
files: {
|
||||
"content_script.js": `
|
||||
var x = (x || 0) + 1;
|
||||
(${async () => {
|
||||
/* globals x */
|
||||
browser.test.assertEq(1, x, "Should only run once");
|
||||
|
||||
if (top !== window) {
|
||||
await new Promise(resolve => setTimeout(resolve, 0));
|
||||
}
|
||||
|
||||
browser.test.sendMessage("content-script", [location.href, top === window]);
|
||||
}})();
|
||||
(${script})();
|
||||
`,
|
||||
},
|
||||
});
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user