Skip to content

Commit

Permalink
Merge autoland to mozilla-central. a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
CosminSabou committed Oct 18, 2021
2 parents 49f2f21 + 591d2d3 commit 36aa22c
Show file tree
Hide file tree
Showing 177 changed files with 3,795 additions and 3,588 deletions.
2 changes: 1 addition & 1 deletion .clang-format-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build/clang-plugin/.*
config/gcc-stl-wrapper.template.h
config/msvc-stl-wrapper.template.h
# Generated code
js/src/builtin/intl/LanguageTagGenerated.cpp
intl/components/src/LocaleGenerated.cpp
js/src/builtin/intl/TimeZoneDataGenerated.h

# Don't want to reformat irregexp (third-party code)
Expand Down
2 changes: 0 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ module.exports = {
"no-nested-ternary": "off",
"no-new-object": "off",
"no-new-wrappers": "off",
"no-octal": "off",
"no-redeclare": "off",
"no-return-await": "off",
"no-restricted-globals": "off",
Expand Down Expand Up @@ -474,7 +473,6 @@ module.exports = {
"no-empty": "off",
"no-eval": "off",
"no-lone-blocks": "off",
"no-octal": "off",
"no-redeclare": "off",
"no-shadow": "off",
"no-throw-literal": "off",
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ tps_result.json
# Ignore files created when running a reftest.
lextab.py

# Ignore Visual Studio Code workspace files.
# Ignore Visual Studio/Visual Studio Code workspace files.
.vs/
.vscode/
!.vscode/extensions.json
!.vscode/tasks.json
Expand Down
3 changes: 2 additions & 1 deletion .hgignore
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ _OPT\.OBJ/
tps\.log
tps_result\.json

# Ignore Visual Studio Code workspace files.
# Ignore Visual Studio/Visual Studio Code workspace files.
\.vs/
\.vscode/(?!extensions\.json|tasks\.json)

# https://bz.mercurial-scm.org/show_bug.cgi?id=5322
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ add_task(async function testIncognitoPopup() {
}
});

let awaitPopup = windowId => {
const awaitPopup = windowId => {
return new Promise(resolve => {
resolveMessage = resolve;
}).then(msg => {
Expand All @@ -36,8 +36,8 @@ add_task(async function testIncognitoPopup() {
});
};

let testWindow = async window => {
let [tab] = await browser.tabs.query({
const testWindow = async window => {
const [tab] = await browser.tabs.query({
active: true,
windowId: window.id,
});
Expand All @@ -62,44 +62,53 @@ add_task(async function testIncognitoPopup() {
);
};

const URL = "https://example.com/incognito";
let windowReady = new Promise(resolve => {
browser.tabs.onUpdated.addListener(function listener(
tabId,
changed,
tab
) {
if (changed.status == "complete" && tab.url == URL) {
browser.tabs.onUpdated.removeListener(listener);
resolve();
}
});
});

try {
{
let window = await browser.windows.getCurrent();

await testWindow(window);
}
const testNonPrivateWindow = async () => {
const window = await browser.windows.getCurrent();
await testWindow(window);
};

{
let window = await browser.windows.create({
incognito: true,
url: URL,
const testPrivateWindow = async () => {
const URL = "https://example.com/incognito";
const windowReady = new Promise(resolve => {
browser.tabs.onUpdated.addListener(function listener(
tabId,
changed,
tab
) {
if (changed.status == "complete" && tab.url == URL) {
browser.tabs.onUpdated.removeListener(listener);
resolve();
}
});
await windowReady;
});

await testWindow(window);
const window = await browser.windows.create({
incognito: true,
url: URL,
});
await windowReady;

await browser.windows.remove(window.id);
await testWindow(window);
};

browser.test.onMessage.addListener(async msg => {
switch (msg) {
case "test-nonprivate-window":
await testNonPrivateWindow();
break;
case "test-private-window":
await testPrivateWindow();
break;
default:
browser.test.fail(
`Unexpected test message: ${JSON.stringify(msg)}`
);
}

browser.test.notifyPass("incognito");
} catch (error) {
browser.test.fail(`Error: ${error} :: ${error.stack}`);
browser.test.notifyFail("incognito");
}
browser.test.sendMessage(`${msg}:done`);
});

browser.test.sendMessage("bgscript:ready");
},

files: {
Expand All @@ -118,22 +127,43 @@ add_task(async function testIncognitoPopup() {
},
});

extension.onMessage("click-browserAction", () => {
clickBrowserAction(
extension,
Services.wm.getMostRecentWindow("navigator:browser")
);
});

extension.onMessage("click-pageAction", () => {
clickPageAction(
extension,
Services.wm.getMostRecentWindow("navigator:browser")
);
});

await extension.startup();
await extension.awaitFinish("incognito");
await extension.awaitMessage("bgscript:ready");

info("Run test on non private window");
extension.sendMessage("test-nonprivate-window");
await extension.awaitMessage("click-pageAction");
const win = Services.wm.getMostRecentWindow("navigator:browser");
ok(!PrivateBrowsingUtils.isWindowPrivate(win), "Got a nonprivate window");
await clickPageAction(extension, win);

await extension.awaitMessage("click-browserAction");
await clickBrowserAction(extension, win);

await extension.awaitMessage("test-nonprivate-window:done");
await closeBrowserAction(extension, win);
await closePageAction(extension, win);

info("Run test on private window");
extension.sendMessage("test-private-window");
await extension.awaitMessage("click-pageAction");
const privateWin = Services.wm.getMostRecentWindow("navigator:browser");
ok(PrivateBrowsingUtils.isWindowPrivate(privateWin), "Got a private window");
await clickPageAction(extension, privateWin);

await extension.awaitMessage("click-browserAction");
await clickBrowserAction(extension, privateWin);

await extension.awaitMessage("test-private-window:done");
// Wait for the private window chrome document to be flushed before
// closing the browserACtion, pageAction and the entire private window,
// to prevent intermittent failures.
await privateWin.promiseDocumentFlushed(() => {});

await closeBrowserAction(extension, privateWin);
await closePageAction(extension, privateWin);
await BrowserTestUtils.closeWindow(privateWin);

await extension.unload();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ add_task(async function test_sidebar_click_isAppTab_behavior() {

// This test fails if docShell.isAppTab has not been set to true.
let content = SidebarUI.browser.contentWindow;

// Wait for the layout to be flushed, otherwise this test may
// fail intermittently if synthesizeMouseAtCenter is being called
// while the sidebar is still opening and the browser window layout
// being recomputed.
await content.promiseDocumentFlushed(() => {});

info("Clicking link in extension sidebar");
await BrowserTestUtils.synthesizeMouseAtCenter(
"#testlink",
{},
Expand Down
8 changes: 8 additions & 0 deletions browser/components/extensions/test/browser/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,14 @@ async function openContextMenuInSidebar(selector = "body") {
contentAreaContextMenu,
"popupshown"
);

// Wait for the layout to be flushed, otherwise this test may
// fail intermittently if synthesizeMouseAtCenter is being called
// while the sidebar is still opening and the browser window layout
// being recomputed.
await SidebarUI.browser.contentWindow.promiseDocumentFlushed(() => {});

info("Opening context menu in sidebarAction panel");
await BrowserTestUtils.synthesizeMouseAtCenter(
selector,
{ type: "mousedown", button: 2 },
Expand Down
2 changes: 1 addition & 1 deletion browser/components/urlbar/UrlbarMuxerUnifiedComplete.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ class MuxerUnifiedComplete extends UrlbarMuxer {
while (summedFillableLimit != fillableLimit) {
if (!fractionalDataArray.length) {
// This shouldn't happen, but don't let it break us.
Cu.reportError("fractionalDataArray is empty!");
logger.error("fractionalDataArray is empty!");
break;
}
let data = flexDataArray[fractionalDataArray.shift().index];
Expand Down
11 changes: 6 additions & 5 deletions browser/components/urlbar/UrlbarProviderExtension.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,10 @@ class UrlbarProviderExtension extends UrlbarProvider {
let extResults = await this._notifyListener("resultsRequested", context);
if (extResults) {
for (let extResult of extResults) {
let result = await this._makeUrlbarResult(context, extResult).catch(
Cu.reportError
);
let result = await this._makeUrlbarResult(
context,
extResult
).catch(ex => this.logger.error(ex));
if (result) {
addCallback(this, result);
}
Expand Down Expand Up @@ -282,7 +283,7 @@ class UrlbarProviderExtension extends UrlbarProvider {
try {
result = listener(...args);
} catch (error) {
Cu.reportError(error);
this.logger.error(error);
return undefined;
}
if (result.catch) {
Expand All @@ -296,7 +297,7 @@ class UrlbarProviderExtension extends UrlbarProvider {
});
result = await Promise.race([
timer.promise,
result.catch(Cu.reportError),
result.catch(ex => this.logger.error(ex)),
]);
timer.cancel();
}
Expand Down
4 changes: 2 additions & 2 deletions browser/components/urlbar/UrlbarProviderOmnibox.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ class ProviderOmnibox extends UrlbarProvider {
time: MAXIMUM_ALLOWED_EXTENSION_TIME_MS,
logger: this.logger,
}).promise;
await Promise.race([timeoutPromise, this._resultsPromise]).catch(
Cu.reportError
await Promise.race([timeoutPromise, this._resultsPromise]).catch(ex =>
this.logger.error(ex)
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions browser/components/urlbar/UrlbarProviderPlaces.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ class ProviderPlaces extends UrlbarProvider {
return conn;
})().catch(ex => {
dump("Couldn't get database handle: " + ex + "\n");
Cu.reportError(ex);
this.logger.error(ex);
});
}
return this._promiseDatabase;
Expand Down Expand Up @@ -1529,7 +1529,7 @@ class ProviderPlaces extends UrlbarProvider {
.then(conn => search.execute(conn))
.catch(ex => {
dump(`Query failed: ${ex}\n`);
Cu.reportError(ex);
this.logger.error(ex);
})
.then(() => {
if (search == this._currentSearch) {
Expand Down
2 changes: 1 addition & 1 deletion browser/components/urlbar/UrlbarProviderPreloadedSites.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ProviderPreloadedSites extends UrlbarProvider {
fetch("chrome://browser/content/urlbar/preloaded-top-urls.json")
.then(response => response.json())
.then(sites => PreloadedSiteStorage.populate(sites))
.catch(ex => Cu.reportError(ex));
.catch(ex => this.logger.error(ex));
}
}

Expand Down
10 changes: 5 additions & 5 deletions browser/components/urlbar/UrlbarProviderQuickSuggest.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class ProviderQuickSuggest extends UrlbarProvider {
r => r.providerName == this.name
);
if (resultIndex < 0) {
Cu.reportError(`Could not find quick suggest result`);
this.logger.error(`Could not find quick suggest result`);
return;
}
result = queryContext.results[resultIndex];
Expand Down Expand Up @@ -346,7 +346,7 @@ class ProviderQuickSuggest extends UrlbarProvider {
try {
this._merinoFetchController?.abort();
} catch (error) {
Cu.reportError(error);
this.logger.error(error);
}
this._merinoFetchController = null;
}
Expand Down Expand Up @@ -382,7 +382,7 @@ class ProviderQuickSuggest extends UrlbarProvider {
} catch (error) {
TelemetryStopwatch.cancel(TELEMETRY_MERINO_LATENCY, queryContext);
if (error.name != "AbortError") {
Cu.reportError(error);
this.logger.error(error);
}
} finally {
if (controller == this._merinoFetchController) {
Expand All @@ -402,7 +402,7 @@ class ProviderQuickSuggest extends UrlbarProvider {
return null;
}
} catch (error) {
Cu.reportError(error);
this.logger.error(error);
}

if (!body?.suggestions?.length) {
Expand All @@ -411,7 +411,7 @@ class ProviderQuickSuggest extends UrlbarProvider {

let { suggestions } = body;
if (!Array.isArray(suggestions)) {
Cu.reportError("Unexpected Merino response: " + JSON.stringify(body));
this.logger.error("Unexpected Merino response: " + JSON.stringify(body));
return null;
}

Expand Down
6 changes: 3 additions & 3 deletions browser/components/urlbar/UrlbarProviderSearchSuggestions.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ class ProviderSearchSuggestions extends UrlbarProvider {
}

if (entry.tail && entry.tailOffsetIndex < 0) {
Cu.reportError(
this.logger.error(
`Error in tail suggestion parsing. Value: ${entry.value}, tail: ${entry.tail}.`
);
continue;
Expand All @@ -393,7 +393,7 @@ class ProviderSearchSuggestions extends UrlbarProvider {
}

if (!tail) {
await tailTimer.fire().catch(Cu.reportError);
await tailTimer.fire().catch(ex => this.logger.error(ex));
}

try {
Expand All @@ -415,7 +415,7 @@ class ProviderSearchSuggestions extends UrlbarProvider {
)
);
} catch (err) {
Cu.reportError(err);
this.logger.error(err);
continue;
}
}
Expand Down
2 changes: 1 addition & 1 deletion browser/components/urlbar/UrlbarProviderSearchTips.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ class ProviderSearchTips extends UrlbarProvider {
return;
}

this._maybeShowTipForUrl(uri.spec).catch(Cu.reportError);
this._maybeShowTipForUrl(uri.spec).catch(ex => this.logger.error(ex));
}

/**
Expand Down
Loading

0 comments on commit 36aa22c

Please sign in to comment.