Merge mozilla-central to inbound. a=merge CLOSED TREE

This commit is contained in:
Gurzau Raul 2018-02-17 00:13:16 +02:00
commit 3daf5ac131
1129 changed files with 5232 additions and 6518 deletions

View File

@ -1613,8 +1613,6 @@ pref("reader.parse-node-limit", 0);
// and because (normally) these errors are not persisted anywhere.
pref("reader.errors.includeURLs", true);
pref("view_source.tab", true);
pref("dom.serviceWorkers.enabled", true);
// Enable Push API.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 898 B

After

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -2576,58 +2576,53 @@ function BrowserViewSourceOfDocument(aArgsOrDocument) {
}
let viewInternal = () => {
let inTab = Services.prefs.getBoolPref("view_source.tab");
if (inTab) {
let tabBrowser = gBrowser;
let preferredRemoteType;
if (args.browser) {
preferredRemoteType = args.browser.remoteType;
} else {
if (!tabBrowser) {
throw new Error("BrowserViewSourceOfDocument should be passed the " +
"subject browser if called from a window without " +
"gBrowser defined.");
}
// Some internal URLs (such as specific chrome: and about: URLs that are
// not yet remote ready) cannot be loaded in a remote browser. View
// source in tab expects the new view source browser's remoteness to match
// that of the original URL, so disable remoteness if necessary for this
// URL.
preferredRemoteType =
E10SUtils.getRemoteTypeForURI(args.URL, gMultiProcessBrowser);
}
// In the case of popups, we need to find a non-popup browser window.
if (!tabBrowser || !window.toolbar.visible) {
// This returns only non-popup browser windows by default.
let browserWindow = RecentWindow.getMostRecentBrowserWindow();
tabBrowser = browserWindow.gBrowser;
}
// `viewSourceInBrowser` will load the source content from the page
// descriptor for the tab (when possible) or fallback to the network if
// that fails. Either way, the view source module will manage the tab's
// location, so use "about:blank" here to avoid unnecessary redundant
// requests.
let tab = tabBrowser.loadOneTab("about:blank", {
relatedToCurrent: true,
inBackground: false,
preferredRemoteType,
sameProcessAsFrameLoader: args.browser ? args.browser.frameLoader : null,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
args.viewSourceBrowser = tabBrowser.getBrowserForTab(tab);
top.gViewSourceUtils.viewSourceInBrowser(args);
let tabBrowser = gBrowser;
let preferredRemoteType;
if (args.browser) {
preferredRemoteType = args.browser.remoteType;
} else {
top.gViewSourceUtils.viewSource(args);
if (!tabBrowser) {
throw new Error("BrowserViewSourceOfDocument should be passed the " +
"subject browser if called from a window without " +
"gBrowser defined.");
}
// Some internal URLs (such as specific chrome: and about: URLs that are
// not yet remote ready) cannot be loaded in a remote browser. View
// source in tab expects the new view source browser's remoteness to match
// that of the original URL, so disable remoteness if necessary for this
// URL.
preferredRemoteType =
E10SUtils.getRemoteTypeForURI(args.URL, gMultiProcessBrowser);
}
// In the case of popups, we need to find a non-popup browser window.
if (!tabBrowser || !window.toolbar.visible) {
// This returns only non-popup browser windows by default.
let browserWindow = RecentWindow.getMostRecentBrowserWindow();
tabBrowser = browserWindow.gBrowser;
}
// `viewSourceInBrowser` will load the source content from the page
// descriptor for the tab (when possible) or fallback to the network if
// that fails. Either way, the view source module will manage the tab's
// location, so use "about:blank" here to avoid unnecessary redundant
// requests.
let tab = tabBrowser.loadOneTab("about:blank", {
relatedToCurrent: true,
inBackground: false,
preferredRemoteType,
sameProcessAsFrameLoader: args.browser ? args.browser.frameLoader : null,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
args.viewSourceBrowser = tabBrowser.getBrowserForTab(tab);
top.gViewSourceUtils.viewSourceInBrowser(args);
};
// Check if external view source is enabled. If so, try it. If it fails,
// fallback to internal view source.
if (Services.prefs.getBoolPref("view_source.editor.external")) {
top.gViewSourceUtils
.openInExternalEditor(args, null, null, null, result => {
.openInExternalEditor(args, result => {
if (!result) {
viewInternal();
}
@ -4487,8 +4482,7 @@ var XULBrowserWindow = {
if (location.scheme == "keyword" && aWebProgress.isTopLevel)
gBrowser.userTypedValue = null;
canViewSource = !Services.prefs.getBoolPref("view_source.tab") ||
location.scheme != "view-source";
canViewSource = location.scheme != "view-source";
if (location.spec != "about:blank") {
switch (aStatus) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 KiB

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 896 B

After

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 751 KiB

After

Width:  |  Height:  |  Size: 648 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 731 B

After

Width:  |  Height:  |  Size: 665 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -866,9 +866,8 @@ nsContextMenu.prototype = {
// View Partial Source
viewPartialSource(aContext) {
let inWindow = !Services.prefs.getBoolPref("view_source.tab");
let {browser} = this;
let openSelectionFn = inWindow ? null : function() {
let openSelectionFn = function() {
let tabBrowser = gBrowser;
// In the case of popups, we need to find a non-popup browser window.
// We might also not have a tabBrowser reference (if this isn't in a

Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 B

After

Width:  |  Height:  |  Size: 224 B

View File

@ -1,24 +1,23 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_keyword_bookmarklet() {
let bm = await PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
title: "bookmarklet",
url: "javascript:'1';" });
let tab = gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
let bm = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
title: "bookmarklet",
url: "javascript:'1';"
});
registerCleanupFunction(async function() {
gBrowser.removeTab(tab);
await BrowserTestUtils.removeTab(tab);
await PlacesUtils.bookmarks.remove(bm);
});
await promisePageShow();
let originalPrincipal = gBrowser.contentPrincipal;
function getPrincipalURI() {
return ContentTask.spawn(tab.linkedBrowser, null, function() {
return content.document.nodePrincipal.URI.spec;
});
}
let originalPrincipalURI = await getPrincipalURI();
let originalPrincipalURI = await getPrincipalURI(tab.linkedBrowser);
await PlacesUtils.keywords.insert({ keyword: "bm", url: "javascript:'1';" });
@ -27,9 +26,9 @@ add_task(async function test_keyword_bookmarklet() {
gURLBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
await promisePageShow();
await BrowserTestUtils.waitForContentEvent(gBrowser.selectedBrowser, "pageshow");
let newPrincipalURI = await getPrincipalURI();
let newPrincipalURI = await getPrincipalURI(tab.linkedBrowser);
is(newPrincipalURI, originalPrincipalURI, "content has the same principal");
// In e10s, null principals don't round-trip so the same null principal sent
@ -44,6 +43,8 @@ add_task(async function test_keyword_bookmarklet() {
}
});
function promisePageShow() {
return BrowserTestUtils.waitForContentEvent(gBrowser.selectedBrowser, "pageshow");
function getPrincipalURI(browser) {
return ContentTask.spawn(browser, null, function() {
return content.document.nodePrincipal.URI.spec;
});
}

View File

@ -22,12 +22,6 @@ var with_new_tab_opened = async function(options, taskFn) {
gBrowser.removeTab(tab);
};
add_task(async function() {
await SpecialPowers.pushPrefEnv({"set": [
["view_source.tab", true],
]});
});
add_task(async function test_regular_page() {
function test_expect_view_source_enabled(browser) {
ok(!XULBrowserWindow.canViewSource.hasAttribute("disabled"),

View File

@ -1,26 +0,0 @@
<?xml version="1.0"?>
# 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/.
<?xul-overlay href="chrome://browser/content/baseMenuOverlay.xul"?>
<overlay id="viewSourceOverlay"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<window id="viewSource">
<commandset id="baseMenuCommandSet"/>
<keyset id="baseMenuKeyset"/>
<stringbundleset id="stringbundleset"/>
</window>
<menubar id="viewSource-main-menubar">
#ifdef XP_MACOSX
<menu id="windowMenu"/>
<menupopup id="menu_ToolsPopup"/>
#endif
<menu id="helpMenu"/>
</menubar>
</overlay>

View File

@ -3,8 +3,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
browser.jar:
% content browser %content/browser/ contentaccessible=yes
% overlay chrome://global/content/viewSource.xul chrome://browser/content/viewSourceOverlay.xul
% overlay chrome://global/content/viewPartialSource.xul chrome://browser/content/viewSourceOverlay.xul
content/browser/aboutDialog-appUpdater.js (content/aboutDialog-appUpdater.js)
* content/browser/aboutDialog.xul (content/aboutDialog.xul)
@ -134,7 +132,6 @@ browser.jar:
#ifdef XP_MACOSX
* content/browser/macBrowserOverlay.xul (content/macBrowserOverlay.xul)
#endif
* content/browser/viewSourceOverlay.xul (content/viewSourceOverlay.xul)
#ifndef XP_MACOSX
* content/browser/webrtcIndicator.xul (content/webrtcIndicator.xul)
content/browser/webrtcIndicator.js (content/webrtcIndicator.js)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 901 B

After

Width:  |  Height:  |  Size: 831 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -47,7 +47,7 @@ const getTree = (rootGuid, onlyChildren) => {
function convert(node, parent) {
let treenode = {
id: node.guid,
title: node.title || "",
title: PlacesUtils.bookmarks.getLocalizedTitle(node) || "",
index: node.index,
dateAdded: node.dateAdded / 1000,
type: BOOKMARKS_TYPES_TO_API_TYPES_MAP.get(node.typeCode),
@ -91,7 +91,7 @@ const getTree = (rootGuid, onlyChildren) => {
const convertBookmarks = result => {
let node = {
id: result.guid,
title: result.title || "",
title: PlacesUtils.bookmarks.getLocalizedTitle(result) || "",
index: result.index,
dateAdded: result.dateAdded.getTime(),
type: BOOKMARKS_TYPES_TO_API_TYPES_MAP.get(result.type),

View File

@ -114,7 +114,6 @@ global.TabContext = class extends EventEmitter {
this.getDefaults = getDefaults;
this.tabData = new WeakMap();
this.lastLocation = new WeakMap();
windowTracker.addListener("progress", this);
windowTracker.addListener("TabSelect", this);
@ -140,24 +139,14 @@ global.TabContext = class extends EventEmitter {
}
}
onStateChange(browser, webProgress, request, stateFlags, statusCode) {
let flags = Ci.nsIWebProgressListener;
if (!(~stateFlags & (flags.STATE_IS_WINDOW | flags.STATE_START) ||
this.lastLocation.has(browser))) {
this.lastLocation.set(browser, request.URI);
}
}
onLocationChange(browser, webProgress, request, locationURI, flags) {
let gBrowser = browser.ownerGlobal.gBrowser;
let lastLocation = this.lastLocation.get(browser);
if (browser === gBrowser.selectedBrowser &&
!(lastLocation && lastLocation.equalsExceptRef(browser.currentURI))) {
let nativeTab = gBrowser.getTabForBrowser(browser);
this.emit("location-change", nativeTab, true);
if (browser === gBrowser.selectedBrowser) {
let tab = gBrowser.getTabForBrowser(browser);
// fromBrowse will be false in case of e.g. a hash change or history.pushState
let fromBrowse = !(flags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT);
this.emit("location-change", tab, fromBrowse);
}
this.lastLocation.set(browser, browser.currentURI);
}
shutdown() {

View File

@ -226,6 +226,17 @@ add_task(async function testTabSwitchContext() {
"disabled": false},
];
let promiseTabLoad = details => {
return new Promise(resolve => {
browser.tabs.onUpdated.addListener(function listener(tabId, changed) {
if (tabId == details.id && changed.url == details.url) {
browser.tabs.onUpdated.removeListener(listener);
resolve();
}
});
});
};
return [
async expect => {
browser.test.log("Initial state, expect default properties.");
@ -245,6 +256,13 @@ add_task(async function testTabSwitchContext() {
let tab = await browser.tabs.create({active: true, url: "about:blank?0"});
tabs.push(tab.id);
browser.test.log("Await tab load.");
let promise = promiseTabLoad({id: tabs[1], url: "about:blank?0"});
let {url} = await browser.tabs.get(tabs[1]);
if (url === "about:blank") {
await promise;
}
await expectDefaults(details[0]);
expect(details[0]);
},

View File

@ -100,8 +100,13 @@ add_task(async function testTabSwitchContext() {
tabs.push(tab.id);
expect(null);
},
expect => {
async expect => {
browser.test.log("Await tab load. No icon visible.");
let promise = promiseTabLoad({id: tabs[1], url: "about:blank?0"});
let {url} = await browser.tabs.get(tabs[1]);
if (url === "about:blank") {
await promise;
}
expect(null);
},
async expect => {
@ -193,3 +198,96 @@ add_task(async function testTabSwitchContext() {
},
});
});
add_task(async function testNavigationClearsData() {
let url = "http://example.com/";
let default_title = "Default title";
let tab_title = "Tab title";
let {Management: {global: {tabTracker}}} = ChromeUtils.import("resource://gre/modules/Extension.jsm", {});
let extension, tab, tabId, tabs = [];
async function addTab(...args) {
tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, ...args);
tabId = tabTracker.getId(tab);
tabs.push(tab);
}
async function locationChange(url, task) {
let locationChanged = BrowserTestUtils.waitForLocationChange(gBrowser, url);
await ContentTask.spawn(tab.linkedBrowser, url, task);
await locationChanged;
}
function setUrl(url) {
return locationChange(url, (url) => { content.location.href = url; });
}
function historyPushState(url) {
return locationChange(url, (url) => { content.history.pushState(null, null, url); });
}
async function sendMessage(method, param, expect, msg) {
extension.sendMessage({method, param, expect, msg});
await extension.awaitMessage("done");
}
async function expectTabSpecificData(msg) {
await sendMessage("isShown", {tabId}, true, msg);
await sendMessage("getTitle", {tabId}, tab_title, msg);
}
async function expectDefaultData(msg) {
await sendMessage("isShown", {tabId}, false, msg);
await sendMessage("getTitle", {tabId}, default_title, msg);
}
async function setTabSpecificData() {
await expectDefaultData("Expect default data before setting tab-specific data.");
await sendMessage("show", tabId);
await sendMessage("setTitle", {tabId, title: tab_title});
await expectTabSpecificData("Expect tab-specific data after setting it.");
}
info("Load a tab before installing the extension");
await addTab(url, true, true);
extension = ExtensionTestUtils.loadExtension({
manifest: {
page_action: {default_title},
},
background: function() {
browser.test.onMessage.addListener(async ({method, param, expect, msg}) => {
let result = await browser.pageAction[method](param);
if (expect !== undefined) {
browser.test.assertEq(expect, result, msg);
}
browser.test.sendMessage("done");
});
},
});
await extension.startup();
info("Set tab-specific data to the existing tab.");
await setTabSpecificData();
info("Add a hash. Does not cause navigation.");
await setUrl(url + "#hash");
await expectTabSpecificData("Adding a hash does not clear tab-specific data");
info("Remove the hash. Causes navigation.");
await setUrl(url);
await expectDefaultData("Removing hash clears tab-specific data");
info("Open a new tab, set tab-specific data to it.");
await addTab("about:newtab", false, false);
await setTabSpecificData();
info("Load a page in that tab.");
await setUrl(url);
await expectDefaultData("Loading a page clears tab-specific data.");
info("Set tab-specific data.");
await setTabSpecificData();
info("Push history state. Does not cause navigation.");
await historyPushState(url + "/path");
await expectTabSpecificData("history.pushState() does not clear tab-specific data");
for (let tab of tabs) {
await BrowserTestUtils.removeTab(tab);
}
await extension.unload();
});

View File

@ -101,8 +101,13 @@ add_task(async function testTabSwitchContext() {
tabs.push(tab.id);
expect(null);
},
expect => {
async expect => {
browser.test.log("Await tab load. No icon visible.");
let promise = promiseTabLoad({id: tabs[1], url: "about:blank?0"});
let {url} = await browser.tabs.get(tabs[1]);
if (url === "about:blank") {
await promise;
}
expect(null);
},
async expect => {

View File

@ -435,7 +435,10 @@ var gEditItemOverlay = {
var lastUsed =
PlacesUtils.annotations.getItemAnnotation(folderId, LAST_USED_ANNO);
let guid = await PlacesUtils.promiseItemGuid(folderId);
let title = (await PlacesUtils.bookmarks.fetch(guid)).title;
let bm = await PlacesUtils.bookmarks.fetch(guid);
// Since this could be a root mobile folder, we should get the proper
// title.
let title = PlacesUtils.bookmarks.getLocalizedTitle(bm);
this._recentFolders.push({ folderId, guid, title, lastUsed });
}
this._recentFolders.sort(function(a, b) {

View File

@ -23,12 +23,8 @@ add_task(async function() {
// Check that name picker is read only
let namepicker = dialogWin.document.getElementById("editBMPanel_namePicker");
Assert.ok(namepicker.readOnly, "Name field is read-only");
let bookmark = await PlacesUtils.bookmarks.fetch(PlacesUtils.bookmarks.unfiledGuid);
Assert.equal(namepicker.value, bookmark.title, "Node title is correct");
// Blur the field and ensure root's name has not been changed.
namepicker.blur();
bookmark = await PlacesUtils.bookmarks.fetch(PlacesUtils.bookmarks.unfiledGuid);
Assert.equal(namepicker.value, bookmark.title, "Root title is correct");
Assert.equal(namepicker.value,
PlacesUtils.getString("OtherBookmarksFolderTitle"), "Node title is correct");
}
);
});

View File

@ -18,8 +18,6 @@ function onLibraryReady(organizer) {
// Check titles have been fixed.
for (var i = 0; i < leftPaneQueries.length; i++) {
var query = leftPaneQueries[i];
is(PlacesUtils.bookmarks.getItemTitle(query.itemId),
query.correctTitle, "Title is correct for query " + query.name);
if ("concreteId" in query) {
is(PlacesUtils.bookmarks.getItemTitle(query.concreteId),
query.concreteTitle, "Concrete title is correct for query " + query.name);

View File

@ -12,6 +12,8 @@ ChromeUtils.import("resource://gre/modules/PromiseUtils.jsm");
ChromeUtils.import("resource://services-common/utils.js");
ChromeUtils.import("resource://gre/modules/Http.jsm");
Cu.importGlobalProperties(["XMLHttpRequest"]);
// The maximum amount of net data allowed per request on Bing's API.
const MAX_REQUEST_DATA = 5000; // Documentation says 10000 but anywhere
// close to that is refused by the service.
@ -129,7 +131,7 @@ this.BingTranslator.prototype = {
* @param aError [optional] The XHR object of the request that failed.
*/
_chunkFailed(aError) {
if (aError instanceof Ci.nsIXMLHttpRequest &&
if (aError instanceof XMLHttpRequest &&
[400, 401].includes(aError.status)) {
let body = aError.responseText;
if (body && body.includes("TranslateApiException") &&

View File

@ -12,6 +12,8 @@ ChromeUtils.import("resource://gre/modules/PromiseUtils.jsm");
ChromeUtils.import("resource://services-common/utils.js");
ChromeUtils.import("resource://gre/modules/Http.jsm");
Cu.importGlobalProperties(["XMLHttpRequest"]);
// The maximum amount of net data allowed per request on Bing's API.
const MAX_REQUEST_DATA = 5000; // Documentation says 10000 but anywhere
// close to that is refused by the service.
@ -138,7 +140,7 @@ this.YandexTranslator.prototype = {
* @param aError [optional] The XHR object of the request that failed.
*/
_chunkFailed(aError) {
if (aError instanceof Ci.nsIXMLHttpRequest) {
if (aError instanceof XMLHttpRequest) {
let body = aError.responseText;
let json = { code: 0 };
try {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -9,6 +9,7 @@ ac_add_options --enable-optimize="-O1"
ac_add_options --enable-valgrind
. $topsrcdir/build/unix/mozconfig.asan
ac_add_options --disable-elf-hack
# Enable Telemetry
export MOZ_TELEMETRY_REPORTING=1

View File

@ -8,6 +8,7 @@ ac_add_options --enable-optimize="-O2 -g"
ac_add_options --enable-valgrind
. $topsrcdir/build/unix/mozconfig.asan
ac_add_options --disable-elf-hack
# Package js shell.
export MOZ_PACKAGE_JSSHELL=1

View File

@ -9,6 +9,7 @@ ac_add_options --enable-optimize="-O1"
ac_add_options --enable-valgrind
. $topsrcdir/build/unix/mozconfig.asan
ac_add_options --disable-elf-hack
# Enable Telemetry
export MOZ_TELEMETRY_REPORTING=1

View File

@ -8,6 +8,7 @@ ac_add_options --enable-optimize="-O2 -gline-tables-only"
ac_add_options --enable-valgrind
. $topsrcdir/build/unix/mozconfig.asan
ac_add_options --disable-elf-hack
# Package js shell.
export MOZ_PACKAGE_JSSHELL=1

View File

@ -8,6 +8,7 @@ ac_add_options --enable-optimize="-O2 -gline-tables-only"
ac_add_options --enable-valgrind
. $topsrcdir/build/unix/mozconfig.asan
ac_add_options --disable-elf-hack
ac_add_options --enable-address-sanitizer-reporter

View File

@ -12,7 +12,8 @@ ac_add_options "MOZ_ALLOW_LEGACY_EXTENSIONS=1"
# ASan specific options on Linux
ac_add_options --enable-valgrind
. $topsrcdir/build/unix/mozconfig.fuzzing
. $topsrcdir/build/unix/mozconfig.asan
ac_add_options --disable-elf-hack
ac_add_options --enable-fuzzing
unset MOZ_STDCXX_COMPAT

View File

@ -16,4 +16,9 @@ export MOZ_PACKAGE_JSSHELL=1
export MOZ_PKG_SPECIAL=asan
. "$topsrcdir/build/macosx/mozconfig.common"
# This is disabled by mozconfig.asan and reenabled by mozconfig.common.
# Ensure it is disabled since it conflicts with ASan.
ac_add_options --disable-crashreporter
. "$topsrcdir/build/mozconfig.common.override"

View File

@ -0,0 +1,2 @@
. "$topsrcdir/browser/config/mozconfigs/macosx64/nightly-asan"
ac_add_options --enable-fuzzing

View File

@ -14,6 +14,8 @@ ChromeUtils.import("resource://gre/modules/osfile.jsm");
ChromeUtils.import("resource://gre/modules/Log.jsm");
ChromeUtils.import("resource://gre/modules/AsyncShutdown.jsm");
Cu.importGlobalProperties(["XMLHttpRequest"]);
ChromeUtils.defineModuleGetter(this, "UpdateUtils",
"resource://gre/modules/UpdateUtils.jsm");
ChromeUtils.defineModuleGetter(this, "AddonManager",
@ -937,7 +939,7 @@ Experiments.Experiments.prototype = {
*/
_httpGetRequest(url) {
this._log.trace("httpGetRequest(" + url + ")");
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
let xhr = new XMLHttpRequest();
this._networkRequest = xhr;
return new Promise((resolve, reject) => {

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