Merge inbound to mozilla-central. a=merge

This commit is contained in:
Margareta Eliza Balazs 2018-08-10 12:17:09 +03:00
Родитель e40aaf2b8f 3956b572e1
Коммит f617807241
1009 изменённых файлов: 101390 добавлений и 63052 удалений

Просмотреть файл

@ -304,26 +304,24 @@ package-generated-sources:
#XXX: this is a hack, since we don't want to clobber for MSVC
# PGO support, but we can't do this test in client.mk
ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
# No point in clobbering if PGO has been explicitly disabled.
ifndef NO_PROFILE_GUIDED_OPTIMIZE
maybe_clobber_profiledbuild: clean
else
ifdef NO_PROFILE_GUIDED_OPTIMIZE
maybe_clobber_profiledbuild:
endif
else
ifdef CLANG_CL
ifneq ($(CC_TYPE),msvc)
maybe_clobber_profiledbuild: clean
# 32-bit PGO is currently blocked by bug 1479800
ifeq ($(CPU_ARCH),x86_64)
ifneq (,$(findstring clang,$(CC_TYPE)))
# 32-bit Windows PGO is currently blocked by bug 1479800
ifneq ($(CC_TYPE)_$(CPU_ARCH),clang-cl_x86)
$(LLVM_PROFDATA) merge -o $(DEPTH)/merged.profdata $(DEPTH)/*.profraw
endif
endif
else
maybe_clobber_profiledbuild:
$(RM) $(DIST)/bin/*.pgc
find $(DIST)/$(MOZ_APP_NAME) -name '*.pgc' -exec mv {} $(DIST)/bin \;
endif # CLANG_CL
endif
endif # msvc
endif # NO_PROFILE_GUIDED_OPTIMIZE
.PHONY: maybe_clobber_profiledbuild

Просмотреть файл

@ -678,7 +678,7 @@ getRoleCB(AtkObject *aAtkObj)
#endif
#define ROLE(geckoRole, stringRole, atkRole, macRole, \
msaaRole, ia2Role, nameRule) \
msaaRole, ia2Role, androidClass, nameRule) \
case roles::geckoRole: \
aAtkObj->role = atkRole; \
break;

Просмотреть файл

@ -11,7 +11,7 @@
using namespace mozilla::a11y;
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, nameRule) \
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, androidClass, nameRule) \
static_assert(static_cast<uint32_t>(roles::geckoRole) \
== static_cast<uint32_t>(nsIAccessibleRole::ROLE_ ## geckoRole), \
"internal and xpcom roles differ!");

Просмотреть файл

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -13,6 +13,7 @@ EXPORTS.mozilla.a11y += [
'AccTypes.h',
'DocManager.h',
'FocusManager.h',
'IDSet.h',
'Platform.h',
'RelationType.h',
'Role.h',

Просмотреть файл

@ -786,7 +786,7 @@ void
nsAccessibilityService::GetStringRole(uint32_t aRole, nsAString& aString)
{
#define ROLE(geckoRole, stringRole, atkRole, \
macRole, msaaRole, ia2Role, nameRule) \
macRole, msaaRole, ia2Role, androidClass, nameRule) \
case roles::geckoRole: \
aString.AssignLiteral(stringRole); \
return;
@ -1393,7 +1393,7 @@ nsAccessibilityService::Init()
gApplicationAccessible->Init();
CrashReporter::
AnnotateCrashReport(NS_LITERAL_CSTRING("Accessibility"),
AnnotateCrashReport(CrashReporter::Annotation::Accessibility,
NS_LITERAL_CSTRING("Active"));
#ifdef XP_WIN

Просмотреть файл

@ -352,7 +352,7 @@ uint32_t
nsTextEquivUtils::GetRoleRule(role aRole)
{
#define ROLE(geckoRole, stringRole, atkRole, \
macRole, msaaRole, ia2Role, nameRule) \
macRole, msaaRole, ia2Role, androidClass, nameRule) \
case roles::geckoRole: \
return nameRule;

Просмотреть файл

@ -713,7 +713,7 @@ ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
return nil;
}
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, nameRule) \
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, androidClass, nameRule) \
case roles::geckoRole: \
return macRole;

Просмотреть файл

@ -32,7 +32,7 @@
this.invoke = function addTab_invoke()
{
tabBrowser().addTab(aURL);
tabBrowser().addTrustedTab(aURL);
}
this.getID = function addTab_getID()

Просмотреть файл

@ -168,7 +168,7 @@ ia2Accessible::role(long* aRole)
return CO_E_OBJNOTCONNECTED;
#define ROLE(_geckoRole, stringRole, atkRole, macRole, \
msaaRole, ia2Role, nameRule) \
msaaRole, ia2Role, androidClass, nameRule) \
case roles::_geckoRole: \
*aRole = ia2Role; \
break;

Просмотреть файл

@ -476,7 +476,7 @@ AccessibleWrap::get_accRole(
uint32_t msaaRole = 0;
#define ROLE(_geckoRole, stringRole, atkRole, macRole, \
_msaaRole, ia2Role, nameRule) \
_msaaRole, ia2Role, androidClass, nameRule) \
case roles::_geckoRole: \
msaaRole = _msaaRole; \
break;

Просмотреть файл

@ -242,7 +242,7 @@ Compatibility::Init()
InitConsumers();
CrashReporter::
AnnotateCrashReport(NS_LITERAL_CSTRING("AccessibilityInProcClient"),
AnnotateCrashReport(CrashReporter::Annotation::AccessibilityInProcClient,
nsPrintfCString("0x%X", sConsumers));
// Gather telemetry
@ -436,8 +436,9 @@ UseIAccessibleProxyStub()
// If we reach this point then something is seriously wrong with the
// IAccessible configuration in the computer's registry. Let's annotate this
// so that we can easily determine this condition during crash analysis.
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IAccessibleConfig"),
NS_LITERAL_CSTRING("NoSystemTypeLibOrPS"));
CrashReporter::AnnotateCrashReport(
CrashReporter::Annotation::IAccessibleConfig,
NS_LITERAL_CSTRING("NoSystemTypeLibOrPS"));
return false;
}

Просмотреть файл

@ -17,7 +17,6 @@
#include "nsAccessibilityService.h"
#include "nsWindowsHelpers.h"
#include "nsCOMPtr.h"
#include "nsExceptionHandler.h"
#include "nsIFile.h"
#include "nsXPCOM.h"
#include "RootAccessibleWrap.h"

Просмотреть файл

@ -358,7 +358,7 @@ AccumulateInstantiatorTelemetry(const nsAString& aValue)
#endif // defined(MOZ_TELEMETRY_REPORTING)
#if defined(MOZ_CRASHREPORTER)
CrashReporter::
AnnotateCrashReport(NS_LITERAL_CSTRING("AccessibilityClient"),
AnnotateCrashReport(CrashReporter::Annotation::AccessibilityClient,
NS_ConvertUTF16toUTF8(aValue));
#endif // defined(MOZ_CRASHREPORTER)
}

Просмотреть файл

@ -12,7 +12,6 @@ EXPORTS.mozilla.a11y += [
'AccessibleWrap.h',
'Compatibility.h',
'HyperTextAccessibleWrap.h',
'IDSet.h',
'LazyInstantiator.h',
'MsaaIdGenerator.h',
'nsWinUtils.h',

Просмотреть файл

@ -247,7 +247,12 @@ var CaptivePortalWatcher = {
// If the tab is gone or going, we need to open a new one.
if (!tab || tab.closing || !tab.parentNode) {
tab = gBrowser.addTab(this.canonicalURL, { ownerTab: gBrowser.selectedTab });
tab = gBrowser.addWebTab(this.canonicalURL, {
ownerTab: gBrowser.selectedTab,
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({
userContextId: gBrowser.contentPrincipal.userContextId,
}),
});
this._captivePortalTab = Cu.getWeakReference(tab);
}

Просмотреть файл

@ -308,7 +308,7 @@
accesskey="&keywordfield.accesskey;"
oncommand="AddKeywordForSearchField();"/>
<menuitem id="context-searchselect"
oncommand="BrowserSearch.loadSearchFromContext(this.searchTerms);"/>
oncommand="BrowserSearch.loadSearchFromContext(this.searchTerms, this.principal);"/>
<menuseparator id="context-sep-sendlinktodevice" class="sync-ui-item"
hidden="true"/>
<menu id="context-sendlinktodevice"

Просмотреть файл

@ -538,7 +538,8 @@ const gStoragePressureObserver = {
accessKey: prefStrBundle.getString("spaceAlert.learnMoreButton.accesskey"),
callback(notificationBar, button) {
let learnMoreURL = Services.urlFormatter.formatURLPref("app.support.baseURL") + "storage-permissions";
gBrowser.selectedTab = gBrowser.addTab(learnMoreURL);
// This is a content URL, loaded from trusted UX.
gBrowser.selectedTab = gBrowser.addTrustedTab(learnMoreURL);
}
});
if (usage < USAGE_THRESHOLD_BYTES) {
@ -3971,8 +3972,11 @@ const BrowserSearch = {
* @return engine The search engine used to perform a search, or null if no
* search was performed.
*/
_loadSearch(searchText, useNewTab, purpose) {
_loadSearch(searchText, useNewTab, purpose, triggeringPrincipal) {
let engine;
if (!triggeringPrincipal) {
throw new Error("Required argument triggeringPrincipal missing within _loadSearch");
}
// If the search bar is visible, use the current engine, otherwise, fall
// back to the default engine.
@ -3996,33 +4000,20 @@ const BrowserSearch = {
useNewTab ? "tab" : "current",
{ postData: submission.postData,
inBackground,
relatedToCurrent: true });
relatedToCurrent: true,
triggeringPrincipal });
return engine;
},
/**
* Just like _loadSearch, but preserving an old API.
*
* @return string Name of the search engine used to perform a search or null
* if a search was not performed.
*/
loadSearch: function BrowserSearch_search(searchText, useNewTab, purpose) {
let engine = BrowserSearch._loadSearch(searchText, useNewTab, purpose);
if (!engine) {
return null;
}
return engine.name;
},
/**
* Perform a search initiated from the context menu.
*
* This should only be called from the context menu. See
* BrowserSearch.loadSearch for the preferred API.
*/
loadSearchFromContext(terms) {
let engine = BrowserSearch._loadSearch(terms, true, "contextmenu");
loadSearchFromContext(terms, triggeringPrincipal) {
let engine = BrowserSearch._loadSearch(terms, true, "contextmenu", triggeringPrincipal);
if (engine) {
BrowserSearch.recordSearchInTelemetry(engine, "contextmenu");
}
@ -7097,7 +7088,7 @@ function BrowserOpenAddonsMgr(aView) {
}
function BeginRecordExecution() {
gBrowser.selectedTab = gBrowser.addTab("about:blank", { recordExecution: "*" });
gBrowser.selectedTab = gBrowser.addWebTab("about:blank", { recordExecution: "*" });
}
function SaveRecordedExecution() {
@ -7120,7 +7111,7 @@ function BeginReplayExecution() {
fp.init(window, null, Ci.nsIFilePicker.modeOpen);
fp.open(rv => {
if (rv == Ci.nsIFilePicker.returnOK || rv == Ci.nsIFilePicker.returnReplace) {
gBrowser.selectedTab = gBrowser.addTab(null, { replayExecution: fp.file.path });
gBrowser.selectedTab = gBrowser.addWebTab(null, { replayExecution: fp.file.path });
}
});
}
@ -7389,7 +7380,8 @@ const gAccessibilityServiceIndicator = {
type === "click") {
let a11yServicesSupportURL =
Services.urlFormatter.formatURLPref("accessibility.support.url");
gBrowser.selectedTab = gBrowser.addTab(a11yServicesSupportURL);
// This is a known URL coming from trusted UI
gBrowser.selectedTab = gBrowser.addTrustedTab(a11yServicesSupportURL);
Services.telemetry.scalarSet("a11y.indicator_acted_on", true);
}
},

Просмотреть файл

@ -1502,6 +1502,7 @@ nsContextMenu.prototype = {
// Store searchTerms in context menu item so we know what to search onclick
menuItem.searchTerms = selectedText;
menuItem.principal = this.principal;
// Copied to alert.js' prefillAlertInfo().
// If the JS character after our truncation point is a trail surrogate,

Просмотреть файл

@ -1373,6 +1373,11 @@ window._gBrowser = {
aName = params.name;
}
// all callers of loadOneTab need to pass a valid triggeringPrincipal.
if (!aTriggeringPrincipal) {
throw new Error("Required argument triggeringPrincipal missing within loadOneTab");
}
var bgLoad = (aLoadInBackground != null) ? aLoadInBackground :
Services.prefs.getBoolPref("browser.tabs.loadInBackground");
var owner = bgLoad ? null : this.selectedTab;
@ -2134,6 +2139,30 @@ window._gBrowser = {
tab.dispatchEvent(evt);
},
/**
* Loads a tab with a default null principal unless specified
*/
addWebTab(aURI, params = {}) {
if (!params.triggeringPrincipal) {
params.triggeringPrincipal = Services.scriptSecurityManager.createNullPrincipal({
userContextId: params.userContextId,
});
}
if (Services.scriptSecurityManager.isSystemPrincipal(params.triggeringPrincipal)) {
throw new Error("System principal should never be passed into addWebTab()");
}
return this.addTab(aURI, params);
},
/**
* Must only be used sparingly for content that came from Chrome context
* If in doubt use addWebTab
*/
addTrustedTab(aURI, params = {}) {
params.triggeringPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
return this.addTab(aURI, params);
},
// eslint-disable-next-line complexity
addTab(aURI, {
allowMixedContent,
@ -2169,6 +2198,13 @@ window._gBrowser = {
recordExecution,
replayExecution,
} = {}) {
// all callers of addTab that pass a params object need to pass
// a valid triggeringPrincipal.
if (!triggeringPrincipal) {
throw new Error("Required argument triggeringPrincipal missing within addTab");
}
// if we're adding tabs, we're past interrupt mode, ditch the owner
if (this.selectedTab.owner) {
this.selectedTab.owner = null;
@ -2824,7 +2860,9 @@ window._gBrowser = {
aTab._mouseleave();
if (newTab)
this.addTab(BROWSER_NEW_TAB_URL, { skipAnimation: true });
this.addTrustedTab(BROWSER_NEW_TAB_URL, {
skipAnimation: true,
});
else
TabBarVisibility.update();
@ -3605,7 +3643,7 @@ window._gBrowser = {
// new tab must have the same usercontextid as the old one
params.userContextId = aTab.getAttribute("usercontextid");
}
let newTab = this.addTab("about:blank", params);
let newTab = this.addWebTab("about:blank", params);
let newBrowser = this.getBrowserForTab(newTab);
// Stop the about:blank load.
@ -5287,10 +5325,22 @@ var TabContextMenu = {
});
},
reopenInContainer(event) {
let userContextId = parseInt(event.target.getAttribute("data-usercontextid"));
/* Create a triggering principal that is able to load the new tab
For codebase principals that are about: chrome: or resource: we need system to load them.
Anything other than system principal needs to have the new userContextId.
*/
let triggeringPrincipal = this.contextTab.linkedBrowser.contentPrincipal;
if (triggeringPrincipal.isNullPrincipal) {
triggeringPrincipal = Services.scriptSecurityManager.createNullPrincipal({ userContextId });
} else if (triggeringPrincipal.isCodebasePrincipal) {
triggeringPrincipal = Services.scriptSecurityManager.createCodebasePrincipal(triggeringPrincipal.URI, { userContextId });
}
let newTab = gBrowser.addTab(this.contextTab.linkedBrowser.currentURI.spec, {
userContextId: parseInt(event.target.getAttribute("data-usercontextid")),
userContextId,
pinned: this.contextTab.pinned,
index: this.contextTab._tPos + 1,
triggeringPrincipal,
});
if (gBrowser.selectedTab == this.contextTab) {

Просмотреть файл

@ -45,7 +45,7 @@ add_task(async function closeWindowWithMultipleTabsIncludingOneBeforeUnload() {
let newWin = await promiseOpenAndLoadWindow({}, true);
let firstTab = newWin.gBrowser.selectedTab;
await promiseTabLoadEvent(firstTab, TEST_PAGE);
await promiseTabLoadEvent(newWin.gBrowser.addTab(), "http://example.com/");
await promiseTabLoadEvent(BrowserTestUtils.addTab(newWin.gBrowser), "http://example.com/");
let windowClosedPromise = BrowserTestUtils.domWindowClosed(newWin);
expectingDialog = true;
newWin.BrowserTryToCloseWindow();

Просмотреть файл

@ -26,6 +26,14 @@ add_task(async function setup() {
});
});
function mouseout() {
let mouseOutPromise = BrowserTestUtils.waitForEvent(bookmarkPanel, "mouseout");
EventUtils.synthesizeMouse(bookmarkPanel, 0, 0, {type: "mouseout"});
EventUtils.synthesizeMouseAtCenter(gURLBar, {type: "mousemove"});
info("Waiting for mouseout event");
return mouseOutPromise;
}
async function test_bookmarks_popup({isNewBookmark, popupShowFn, popupEditFn,
shouldAutoClose, popupHideFn, isBookmarkRemoved}) {
await BrowserTestUtils.withNewTab({gBrowser, url: TEST_URL}, async function(browser) {
@ -170,11 +178,7 @@ add_task(async function panel_shown_for_new_bookmarks_mousemove_mouseout() {
is(bookmarkPanel.state, "open", "Panel should still be open on mousemove");
},
async popupHideFn() {
let mouseOutPromise = BrowserTestUtils.waitForEvent(bookmarkPanel, "mouseout");
EventUtils.synthesizeMouse(bookmarkPanel, 0, 0, {type: "mouseout"});
EventUtils.synthesizeMouseAtCenter(document.documentElement, {type: "mousemove"});
info("Waiting for mouseout event");
await mouseOutPromise;
await mouseout();
info("Got mouseout event, should autoclose now");
},
shouldAutoClose: false,
@ -269,11 +273,7 @@ add_task(async function panel_shown_for_new_bookmark_compositionstart_mouseout_n
await compositionStartPromise;
info("Got compositionstart event");
let mouseOutPromise = BrowserTestUtils.waitForEvent(bookmarkPanel, "mouseout");
EventUtils.synthesizeMouse(bookmarkPanel, 0, 0, {type: "mouseout"});
EventUtils.synthesizeMouseAtCenter(document.documentElement, {type: "mousemove"});
info("Waiting for mouseout event");
await mouseOutPromise;
await mouseout();
info("Got mouseout event, but shouldn't run autoclose");
},
shouldAutoClose: false,
@ -433,11 +433,7 @@ add_task(async function ctrl_d_new_bookmark_mousedown_mouseout_no_autoclose() {
EventUtils.synthesizeMouseAtCenter(bookmarkPanelTitle, {button: 1, type: "mousedown"});
let mouseOutPromise = BrowserTestUtils.waitForEvent(bookmarkPanel, "mouseout");
EventUtils.synthesizeMouse(bookmarkPanel, 0, 0, {type: "mouseout"});
EventUtils.synthesizeMouseAtCenter(document.documentElement, {type: "mousemove"});
info("Waiting for mouseout event");
await mouseOutPromise;
await mouseout();
},
shouldAutoClose: false,
popupHideFn() {

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function() {
let tab = win.gBrowser.tabContainer.firstChild;
await promiseTabLoadEvent(tab, getRootDirectory(gTestPath) + "test_bug462673.html");
var newTab = win.gBrowser.addTab();
var newTab = BrowserTestUtils.addTab(win.gBrowser);
var newBrowser = newTab.linkedBrowser;
win.gBrowser.removeTab(tab);
ok(!win.closed, "Window stays open");

Просмотреть файл

@ -10,7 +10,7 @@
add_task(async function test() {
let win = await BrowserTestUtils.openNewBrowserWindow({private: true});
let tab = win.gBrowser.selectedTab = win.gBrowser.addTab("about:addons");
let tab = win.gBrowser.selectedTab = BrowserTestUtils.addTab(win.gBrowser, "about:addons");
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
await promiseWaitForFocus(win);

Просмотреть файл

@ -17,7 +17,7 @@ add_task(async function() {
ok(true, "tests succeeded");
// Create a second tab so that we can move the original one out.
win.gBrowser.addTab("about:blank", {skipAnimation: true});
BrowserTestUtils.addTab(win.gBrowser, "about:blank", {skipAnimation: true});
// Tear off the original tab.
let browser = win.gBrowser.selectedBrowser;

Просмотреть файл

@ -97,7 +97,7 @@ add_task(async function testExceptionAddition() {
testTrackingPageUnblocked();
info("Test that the exception is remembered across tabs in the same private window");
tab = browser.selectedTab = browser.addTab();
tab = browser.selectedTab = BrowserTestUtils.addTab(browser);
info("Load a test page containing tracking elements");
await promiseTabLoadEvent(tab, TRACKING_PAGE);

Просмотреть файл

@ -90,7 +90,7 @@ function test_getBoolPref() {
}
function test_openNewTabWith() {
openNewTabWith("http://example.com/");
openNewTabWith("http://example.com/", null, {triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({})});
let tab = gBrowser.selectedTab = gBrowser.tabs[1];
BrowserTestUtils.browserLoaded(tab.linkedBrowser).then(() => {
is(tab.linkedBrowser.currentURI.spec, "http://example.com/", "example.com loaded");

Просмотреть файл

@ -32,7 +32,7 @@ add_task(async function multiple_tabs() {
// Add a background tab to cause another page to load *without* putting the
// desired URL in a background tab, which results in its timers being throttled.
gBrowser.addTab();
BrowserTestUtils.addTab(gBrowser);
// Wait until places has stored the page info
const pageInfo = await waitForPageInfo(TEST_PATH);

Просмотреть файл

@ -303,7 +303,10 @@ async function createTabs(howMany) {
uris.push("about:blank");
}
gBrowser.loadTabs(uris, { inBackground: true });
gBrowser.loadTabs(uris, {
inBackground: true,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
await BrowserTestUtils.waitForCondition(() => {
return Array.from(gBrowser.tabs).every(tab => tab._fullyOpen);

Просмотреть файл

@ -210,7 +210,7 @@ function referrerTestCaseLoaded(aTestNumber, aParams) {
"&cross=" + escape(test.cross || "");
let browser = gTestWindow.gBrowser;
return BrowserTestUtils.openNewForegroundTab(browser, () => {
browser.selectedTab = browser.addTab(url, aParams);
browser.selectedTab = BrowserTestUtils.addTab(browser, url, aParams);
}, false, true);
}

Просмотреть файл

@ -154,7 +154,10 @@ async function doTest(aInsertRelatedAfterCurrent, aInsertAfterCurrent) {
// loadTabs will insertAfterCurrent
let nextTab = aInsertAfterCurrent ? gBrowser.selectedTab._tPos + 1 : gBrowser.tabs.length;
gBrowser.loadTabs(bulkLoad, { inBackground: true });
gBrowser.loadTabs(bulkLoad, {
inBackground: true,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
await loadPromises;
for (let i = nextTab, j = 0; j < bulkLoad.length; i++, j++) {
is(gBrowser.tabs[i].linkedBrowser.currentURI.spec, bulkLoad[j], `bulkLoad tab pos ${i} matched`);

Просмотреть файл

@ -21,7 +21,7 @@ function test() {
testState(false);
let pinnedTab = gBrowser.addTab();
let pinnedTab = BrowserTestUtils.addTab(gBrowser);
gBrowser.pinTab(pinnedTab);
// Just pinning the tab shouldn't change the key state.
@ -45,7 +45,7 @@ function test() {
testState(true);
// Test that accel+w in a pinned tab selects the next tab.
let pinnedTab2 = gBrowser.addTab();
let pinnedTab2 = BrowserTestUtils.addTab(gBrowser);
gBrowser.pinTab(pinnedTab2);
gBrowser.selectedTab = pinnedTab;

Просмотреть файл

@ -5,7 +5,9 @@
var tabs = [];
function addTab(aURL) {
tabs.push(gBrowser.addTab(aURL, {skipAnimation: true}));
tabs.push(BrowserTestUtils.addTab(gBrowser, aURL, {
skipAnimation: true,
}));
}
function switchTab(index) {
@ -24,13 +26,13 @@ add_task(async function setup() {
addTab("http://mochi.test:8888/#1");
addTab("http://mochi.test:8888/#2");
addTab("http://mochi.test:8888/#3");
is(gBrowser.tabs.length, 5, "five tabs are open after setup");
});
// Add several new tabs in sequence, hiding some, to ensure that the
// correct attributes get set
add_task(async function test() {
await switchTab(0);
testAttrib(0, "first-visible-tab", true);
testAttrib(4, "last-visible-tab", true);
testAttrib(0, "visuallyselected", true);

Просмотреть файл

@ -14,7 +14,7 @@ add_task(async function testShieldAnimation() {
await UrlClassifierTestUtils.addTestTrackers();
Services.prefs.setBoolPref(TP_PREF, true);
let tab = gBrowser.selectedTab = gBrowser.addTab();
let tab = gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
let animationIcon = document.getElementById("tracking-protection-icon-animatable-image");
let noAnimationIcon = document.getElementById("tracking-protection-icon");

Просмотреть файл

@ -231,7 +231,7 @@ add_task(async function testNormalBrowsing() {
await UrlClassifierTestUtils.addTestTrackers();
tabbrowser = gBrowser;
let tab = tabbrowser.selectedTab = tabbrowser.addTab();
let tab = tabbrowser.selectedTab = BrowserTestUtils.addTab(tabbrowser);
TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
ok(TrackingProtection, "TP is attached to the browser window");
@ -252,7 +252,7 @@ add_task(async function testNormalBrowsing() {
add_task(async function testPrivateBrowsing() {
let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
tabbrowser = privateWin.gBrowser;
let tab = tabbrowser.selectedTab = tabbrowser.addTab();
let tab = tabbrowser.selectedTab = BrowserTestUtils.addTab(tabbrowser);
TrackingProtection = tabbrowser.ownerGlobal.TrackingProtection;
ok(TrackingProtection, "TP is attached to the private window");

Просмотреть файл

@ -67,7 +67,7 @@ var tests = [
function loadTabInWindow(win, callback) {
info("Loading tab");
let url = "http://user:pass@example.com/";
let tab = win.gBrowser.selectedTab = win.gBrowser.addTab(url);
let tab = win.gBrowser.selectedTab = BrowserTestUtils.addTab(win.gBrowser, url);
BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, url).then(() => {
info("Tab loaded");
is(win.gURLBar.textValue, "example.com", "URL bar had user/pass stripped initially");

Просмотреть файл

@ -162,7 +162,7 @@ function get_test_function_for_localhost_with_hostname(hostName, isPrivate) {
browser.removeTab(tab);
// Now try again with the pref set.
tab = browser.selectedTab = browser.addTab("about:blank");
tab = browser.selectedTab = BrowserTestUtils.addTab(browser, "about:blank");
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
// In a private window, the notification should appear again.
await runURLBarSearchTest({

Просмотреть файл

@ -212,6 +212,9 @@ function openWebLinkIn(url, where, params) {
if (!params.triggeringPrincipal) {
params.triggeringPrincipal = Services.scriptSecurityManager.createNullPrincipal({});
}
if (Services.scriptSecurityManager.isSystemPrincipal(params.triggeringPrincipal)) {
throw new Error("System principal should never be passed into openWebLinkIn()");
}
openUILinkIn(url, where, params);
}
@ -256,7 +259,8 @@ function openUILinkIn(url, where, aAllowThirdPartyFixup, aPostData, aReferrerURI
if (arguments.length == 3 && typeof arguments[2] == "object") {
params = aAllowThirdPartyFixup;
} else {
}
if (!params || !params.triggeringPrincipal) {
throw new Error("Required argument triggeringPrincipal missing within openUILinkIn");
}

Просмотреть файл

@ -54,7 +54,11 @@ global.tabGetSender = getSender;
extensions.on("uninstalling", (msg, extension) => {
if (extension.uninstallURL) {
let browser = windowTracker.topWindow.gBrowser;
browser.addTab(extension.uninstallURL, {relatedToCurrent: true});
browser.addTab(extension.uninstallURL, {
disallowInheritPrincipal: true,
relatedToCurrent: true,
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
}
});

Просмотреть файл

@ -527,18 +527,8 @@ this.tabs = class extends ExtensionAPI {
}
}).then(window => {
let url;
let principal = context.principal;
if (createProperties.url !== null) {
url = context.uri.resolve(createProperties.url);
if (!context.checkLoadURL(url, {dontReportErrors: true})) {
return Promise.reject({message: `Illegal URL: ${url}`});
}
if (createProperties.openInReaderMode) {
url = `about:reader?url=${encodeURIComponent(url)}`;
}
}
if (createProperties.cookieStoreId && !extension.hasPermission("cookies")) {
return Promise.reject({message: `No permission for cookieStoreId: ${createProperties.cookieStoreId}`});
@ -569,6 +559,19 @@ this.tabs = class extends ExtensionAPI {
}
}
if (createProperties.url !== null) {
url = context.uri.resolve(createProperties.url);
if (!context.checkLoadURL(url, {dontReportErrors: true})) {
return Promise.reject({message: `Illegal URL: ${url}`});
}
if (createProperties.openInReaderMode) {
url = `about:reader?url=${encodeURIComponent(url)}`;
}
} else {
url = window.BROWSER_NEW_TAB_URL;
}
// Only set disallowInheritPrincipal on non-discardable urls as it
// will override creating a lazy browser. Setting triggeringPrincipal
// will ensure other cases are handled, but setting it may prevent
@ -578,8 +581,11 @@ this.tabs = class extends ExtensionAPI {
// Make sure things like about:blank and data: URIs never inherit,
// and instead always get a NullPrincipal.
options.disallowInheritPrincipal = true;
} else {
options.triggeringPrincipal = context.principal;
// Falling back to codebase here as about: requires it, however is safe.
principal = Services.scriptSecurityManager.createCodebasePrincipal(Services.io.newURI(url), {
userContextId: options.userContextId,
privateBrowsingId: PrivateBrowsingUtils.isBrowserPrivate(window.gBrowser) ? 1 : 0,
});
}
tabListener.initTabReady();
@ -618,13 +624,14 @@ this.tabs = class extends ExtensionAPI {
return Promise.reject({message: `Title may only be set for discarded tabs.`});
}
let nativeTab = window.gBrowser.addTab(url || window.BROWSER_NEW_TAB_URL, options);
options.triggeringPrincipal = principal;
let nativeTab = window.gBrowser.addTab(url, options);
if (createProperties.discarded) {
SessionStore.setTabState(nativeTab, {
entries: [{
url: url,
title: options.title,
triggeringPrincipal_base64: Utils.serializePrincipal(context.principal),
triggeringPrincipal_base64: Utils.serializePrincipal(principal),
}],
});
}

Просмотреть файл

@ -167,6 +167,7 @@ skip-if = !e10s || debug || asan
[browser_ext_tabs_captureVisibleTab.js]
[browser_ext_tabs_create.js]
skip-if = os == "linux" && debug && bits == 32 # Bug 1350189
[browser_ext_tabs_create_url.js]
[browser_ext_tabs_create_invalid_url.js]
[browser_ext_tabs_detectLanguage.js]
[browser_ext_tabs_discard.js]

Просмотреть файл

@ -175,57 +175,6 @@ add_task(async function test_create_options() {
BrowserTestUtils.removeTab(tab);
});
add_task(async function test_urlbar_focus() {
const extension = ExtensionTestUtils.loadExtension({
background() {
browser.tabs.onUpdated.addListener(function onUpdated(_, info) {
if (info.status === "complete") {
browser.test.sendMessage("complete");
browser.tabs.onUpdated.removeListener(onUpdated);
}
});
browser.test.onMessage.addListener(async (cmd, ...args) => {
const result = await browser.tabs[cmd](...args);
browser.test.sendMessage("result", result);
});
},
});
await extension.startup();
// Test content is focused after opening a regular url
extension.sendMessage("create", {url: "https://example.com"});
const [tab1] = await Promise.all([
extension.awaitMessage("result"),
extension.awaitMessage("complete"),
]);
is(document.activeElement.tagName, "browser", "Content focused after opening a web page");
extension.sendMessage("remove", tab1.id);
await extension.awaitMessage("result");
// Test urlbar is focused after opening an empty tab
extension.sendMessage("create", {});
const tab2 = await extension.awaitMessage("result");
const active = document.activeElement;
info(`Active element: ${active.tagName}, id: ${active.id}, class: ${active.className}`);
const parent = active.parentNode;
info(`Parent element: ${parent.tagName}, id: ${parent.id}, class: ${parent.className}`);
info(`After opening an empty tab, gURLBar.focused: ${gURLBar.focused}`);
is(active.tagName, "html:input", "Input element focused");
ok(active.classList.contains("urlbar-input"), "Urlbar focused");
extension.sendMessage("remove", tab2.id);
await extension.awaitMessage("result");
await extension.unload();
});
add_task(async function test_create_with_popup() {
const extension = ExtensionTestUtils.loadExtension({
async background() {

Просмотреть файл

@ -0,0 +1,55 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
add_task(async function test_urlbar_focus() {
const extension = ExtensionTestUtils.loadExtension({
background() {
browser.tabs.onUpdated.addListener(function onUpdated(_, info) {
if (info.status === "complete") {
browser.test.sendMessage("complete");
browser.tabs.onUpdated.removeListener(onUpdated);
}
});
browser.test.onMessage.addListener(async (cmd, ...args) => {
const result = await browser.tabs[cmd](...args);
browser.test.sendMessage("result", result);
});
},
});
await extension.startup();
// Test content is focused after opening a regular url
extension.sendMessage("create", {url: "https://example.com"});
const [tab1] = await Promise.all([
extension.awaitMessage("result"),
extension.awaitMessage("complete"),
]);
is(document.activeElement.tagName, "browser", "Content focused after opening a web page");
extension.sendMessage("remove", tab1.id);
await extension.awaitMessage("result");
// Test urlbar is focused after opening an empty tab
extension.sendMessage("create", {});
const tab2 = await extension.awaitMessage("result");
const active = document.activeElement;
info(`Active element: ${active.tagName}, id: ${active.id}, class: ${active.className}`);
const parent = active.parentNode;
info(`Parent element: ${parent.tagName}, id: ${parent.id}, class: ${parent.className}`);
info(`After opening an empty tab, gURLBar.focused: ${gURLBar.focused}`);
is(active.tagName, "html:input", "Input element focused");
ok(active.classList.contains("urlbar-input"), "Urlbar focused");
extension.sendMessage("remove", tab2.id);
await extension.awaitMessage("result");
await extension.unload();
});

Просмотреть файл

@ -171,7 +171,9 @@ class TestFirefoxRefresh(MarionetteTestCase):
});
let expectedTabs = new Set();
for (let url of expectedURLs) {
expectedTabs.add(gBrowser.addTab(url));
expectedTabs.add(gBrowser.addTab(url, {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
}));
}
// Close any other tabs that might be open:
let allTabs = Array.from(gBrowser.tabs);

Просмотреть файл

@ -2355,7 +2355,7 @@ BrowserGlue.prototype = {
let tabs = win.gBrowser.tabs;
tab = tabs[tabs.length - 1];
} else {
tab = win.gBrowser.addTab(URI.uri);
tab = win.gBrowser.addWebTab(URI.uri);
}
tab.setAttribute("attention", true);
return tab;
@ -2435,7 +2435,7 @@ BrowserGlue.prototype = {
let tabs = win.gBrowser.tabs;
tab = tabs[tabs.length - 1];
} else {
tab = win.gBrowser.addTab(url);
tab = win.gBrowser.addWebTab(url);
}
tab.setAttribute("attention", true);
let clickCallback = (subject, topic, data) => {
@ -2468,7 +2468,7 @@ BrowserGlue.prototype = {
if (!win) {
this._openURLInNewWindow(url);
} else {
win.gBrowser.addTab(url);
win.gBrowser.addWebTab(url);
}
};

Просмотреть файл

@ -731,7 +731,7 @@ var gMainPane = {
return;
}
let url = await FxAccounts.config.promiseSignInURI("dev-edition-setup");
let accountsTab = win.gBrowser.addTab(url);
let accountsTab = win.gBrowser.addWebTab(url);
win.gBrowser.selectedTab = accountsTab;
},

Просмотреть файл

@ -9,7 +9,7 @@ add_task(async function testNoSessionRestoreButton() {
(await BrowserTestUtils.openNewBrowserWindow({private: true})).close();
let win = await BrowserTestUtils.openNewBrowserWindow({private: true});
let tab = win.gBrowser.addTab("about:sessionrestore");
let tab = BrowserTestUtils.addTab(win.gBrowser, "about:sessionrestore");
let browser = tab.linkedBrowser;
await BrowserTestUtils.browserLoaded(browser);

Просмотреть файл

@ -61,7 +61,7 @@ function get_cache_for_private_window() {
ok(true, "The private window got loaded");
let tab = win.gBrowser.addTab("http://example.org");
let tab = BrowserTestUtils.addTab(win.gBrowser, "http://example.org");
win.gBrowser.selectedTab = tab;
let newTabBrowser = win.gBrowser.getBrowserForTab(tab);

Просмотреть файл

@ -159,7 +159,7 @@ async function assignCookies(aBrowser, aURL, aCookieValue) {
}
async function openTab(aBrowser, aURL) {
let tab = aBrowser.addTab(aURL);
let tab = BrowserTestUtils.addTab(aBrowser, aURL);
// Select tab and make sure its browser is focused.
aBrowser.selectedTab = tab;

Просмотреть файл

@ -11,7 +11,7 @@ add_task(async function test() {
function checkGeolocation(aPrivateMode, aWindow) {
return (async function() {
aWindow.gBrowser.selectedTab = aWindow.gBrowser.addTab(testPageURL);
aWindow.gBrowser.selectedTab = BrowserTestUtils.addTab(aWindow.gBrowser, testPageURL);
await BrowserTestUtils.browserLoaded(aWindow.gBrowser.selectedBrowser);
let notification = aWindow.PopupNotifications.getNotification("geolocation");

Просмотреть файл

@ -9,7 +9,7 @@
let win = await BrowserTestUtils.openNewBrowserWindow({private: true});
win.gBrowser.selectedTab = win.gBrowser.addTab(page1);
win.gBrowser.selectedTab = BrowserTestUtils.addTab(win.gBrowser, page1);
let browser = win.gBrowser.selectedBrowser;
await BrowserTestUtils.browserLoaded(browser);

Просмотреть файл

@ -15,7 +15,7 @@ add_task(async function test() {
// Step 1.
let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
let privateBrowser = privateWin.gBrowser.addTab(
let privateBrowser = BrowserTestUtils.addTab(privateWin.gBrowser,
prefix + "browser_privatebrowsing_localStorage_before_after_page.html").linkedBrowser;
await BrowserTestUtils.browserLoaded(privateBrowser);
@ -23,7 +23,7 @@ add_task(async function test() {
// Step 2.
let win = await BrowserTestUtils.openNewBrowserWindow();
let browser = win.gBrowser.addTab(
let browser = BrowserTestUtils.addTab(win.gBrowser,
prefix + "browser_privatebrowsing_localStorage_before_after_page2.html").linkedBrowser;
await BrowserTestUtils.browserLoaded(browser);

Просмотреть файл

@ -8,7 +8,7 @@
add_task(async function test_no_session_restore_menu_option() {
let win = await BrowserTestUtils.openNewBrowserWindow({ private: true });
ok(true, "The first private window got loaded");
win.gBrowser.addTab("about:mozilla");
BrowserTestUtils.addTab(win.gBrowser, "about:mozilla");
await BrowserTestUtils.closeWindow(win);
win = await BrowserTestUtils.openNewBrowserWindow({ private: true });

Просмотреть файл

@ -12,7 +12,7 @@ add_task(async function test() {
"browser/components/privatebrowsing/test/browser/browser_privatebrowsing_protocolhandler_page.html";
let doTest = async function(aIsPrivateMode, aWindow) {
let tab = aWindow.gBrowser.selectedTab = aWindow.gBrowser.addTab(testURI);
let tab = aWindow.gBrowser.selectedTab = BrowserTestUtils.addTab(aWindow.gBrowser, testURI);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
let promiseFinished = PromiseUtils.defer();

Просмотреть файл

@ -27,7 +27,7 @@ function testWhitelistedPage(window) {
add_task(async function testNormalBrowsing() {
tabbrowser = gBrowser;
let tab = tabbrowser.selectedTab = tabbrowser.addTab();
let tab = tabbrowser.selectedTab = BrowserTestUtils.addTab(tabbrowser);
info("Load a test page that's whitelisted");
Services.prefs.setCharPref(PREF_WHITELISTED_HOSTNAMES, "example.com,www.ItIsaTrap.org,example.net");

Просмотреть файл

@ -33,8 +33,8 @@ add_task(async function test() {
container.addEventListener("TabOpen", tabAdded);
BrowserTestUtils.addTab(gBrowser, "about:blank");
BrowserSearch.loadSearchFromContext("mozilla");
BrowserSearch.loadSearchFromContext("firefox");
BrowserSearch.loadSearchFromContext("mozilla", Services.scriptSecurityManager.getSystemPrincipal());
BrowserSearch.loadSearchFromContext("firefox", Services.scriptSecurityManager.getSystemPrincipal());
// Wait for all the tabs to open.
await tabsLoadedDeferred.promise;

Просмотреть файл

@ -93,7 +93,7 @@ async function testSearchEngine(engineDetails) {
run() {
// Simulate a contextmenu search
// FIXME: This is a bit "low-level"...
BrowserSearch.loadSearch("foo", false, "contextmenu");
BrowserSearch._loadSearch("foo", false, "contextmenu", Services.scriptSecurityManager.getSystemPrincipal());
}
},
{

Просмотреть файл

@ -111,7 +111,7 @@ async function testSearchEngine(engineDetails) {
run() {
// Simulate a contextmenu search
// FIXME: This is a bit "low-level"...
BrowserSearch.loadSearch("foo", false, "contextmenu");
BrowserSearch._loadSearch("foo", false, "contextmenu", Services.scriptSecurityManager.getSystemPrincipal());
}
},
{

Просмотреть файл

@ -2431,9 +2431,12 @@ var SessionStoreInternal = {
// Create a new tab.
let userContextId = aTab.getAttribute("usercontextid");
let newTab = aTab == aWindow.gBrowser.selectedTab ?
aWindow.gBrowser.addTab(null, {relatedToCurrent: true, ownerTab: aTab, userContextId}) :
aWindow.gBrowser.addTab(null, {userContextId});
let tabOptions = {
userContextId,
...(aTab == aWindow.gBrowser.selectedTab ? {relatedToCurrent: true, ownerTab: aTab} : {})
};
let newTab = aWindow.gBrowser.addTrustedTab(null, tabOptions);
// Start the throbber to pretend we're doing something while actually
// waiting for data from the frame script.
@ -2522,7 +2525,7 @@ var SessionStoreInternal = {
// create a new tab
let tabbrowser = aWindow.gBrowser;
let tab = tabbrowser.selectedTab =
tabbrowser.addTab(null, {
tabbrowser.addTrustedTab(null, {
index: pos,
pinned: state.pinned,
userContextId: state.userContextId,
@ -3492,13 +3495,13 @@ var SessionStoreInternal = {
// Setting noInitialLabel is a perf optimization. Rendering tab labels
// would make resizing the tabs more expensive as we're adding them.
// Each tab will get its initial label set in restoreTab.
tab = tabbrowser.addTab(url,
{ createLazyBrowser,
skipAnimation: true,
noInitialLabel: true,
userContextId,
skipBackgroundNotify: true,
bulkOrderedOpen: true });
tab = tabbrowser.addTrustedTab(url,
{ createLazyBrowser,
skipAnimation: true,
noInitialLabel: true,
userContextId,
skipBackgroundNotify: true,
bulkOrderedOpen: true });
if (select) {
let leftoverTab = tabbrowser.selectedTab;

Просмотреть файл

@ -264,7 +264,7 @@ function toggleRowChecked(aIx) {
function restoreSingleTab(aIx, aShifted) {
var tabbrowser = getBrowserWindow().gBrowser;
var newTab = tabbrowser.addTab();
var newTab = tabbrowser.addWebTab();
var item = gTreeData[aIx];
var tabState = gStateObject.windows[item.parent.ix]

Просмотреть файл

@ -97,7 +97,7 @@ function test() {
let state = { entries: [{ url: testURL }], extData: { key: value } };
// public session, add new tab: (A)
let tab_A = aWin.gBrowser.addTab(testURL);
let tab_A = BrowserTestUtils.addTab(aWin.gBrowser, testURL);
ss.setTabState(tab_A, JSON.stringify(state));
promiseBrowserLoaded(tab_A.linkedBrowser).then(() => {
// make sure that the next closed tab will increase getClosedTabCount
@ -134,7 +134,7 @@ function test() {
entries: [{ url: testURL2 }], extData: { key1: value1 }
};
let tab_B = win.gBrowser.addTab(testURL2);
let tab_B = BrowserTestUtils.addTab(win.gBrowser, testURL2);
promiseTabState(tab_B, state1).then(() => {
// populate tab: (B) with different form data
for (let item in fieldList)

Просмотреть файл

@ -163,7 +163,7 @@ let setupTest = async function(options, testFunction) {
* The browser window to load the tabs in
*/
function injectTestTabs(win) {
let promises = TEST_URLS.map(url => win.gBrowser.addTab(url))
let promises = TEST_URLS.map(url => BrowserTestUtils.addTab(win.gBrowser, url))
.map(tab => BrowserTestUtils.browserLoaded(tab.linkedBrowser));
return Promise.all(promises);
}
@ -313,7 +313,7 @@ add_task(async function test_open_close_window_and_popup() {
openDialog(location, "popup2", POPUP_FEATURES, TEST_URLS[1]);
let popup2 = await popup2Promise;
popup2.gBrowser.addTab(TEST_URLS[0]);
BrowserTestUtils.addTab(popup2.gBrowser, TEST_URLS[0]);
let closed = await closeWindowForRestoration(newWin);
ok(closed, "Should be able to close the window");
@ -378,7 +378,7 @@ add_task(async function test_open_close_only_popup() {
openDialog(location, "popup", POPUP_FEATURES, TEST_URLS[1]);
popup = await popupPromise;
popup.gBrowser.addTab(TEST_URLS[0]);
BrowserTestUtils.addTab(popup.gBrowser, TEST_URLS[0]);
is(popup.gBrowser.browsers.length, 2,
"Did not restore to the popup window (2)");

Просмотреть файл

@ -25,7 +25,7 @@ function test() {
forgetClosedWindows();
provideWindow(function onTestURLLoaded(newWin) {
newWin.gBrowser.addTab().linkedBrowser.stop();
BrowserTestUtils.addTab(newWin.gBrowser).linkedBrowser.stop();
// Mark the window with some unique data to be restored later on.
ss.setWindowValue(newWin, uniqueKey, uniqueValue);

Просмотреть файл

@ -172,8 +172,8 @@ function onStateRestored(aSubject, aTopic, aData) {
// new window is opened below (in onWindowUnloaded). On OS X we'll just
// restore the pinned tabs, leaving the unpinned tab in the closedWindowsData.
if (shouldOpenTabs) {
let newTab = newWin.gBrowser.addTab("about:config");
let newTab2 = newWin.gBrowser.addTab("about:buildconfig");
let newTab = BrowserTestUtils.addTab(newWin.gBrowser, "about:config");
let newTab2 = BrowserTestUtils.addTab(newWin.gBrowser, "about:buildconfig");
newTab.linkedBrowser.addEventListener("load", function() {
if (shouldCloseTab == "one") {

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function test_close_last_nonpopup_window() {
// Open a new window with a tab.
let win = await BrowserTestUtils.openNewBrowserWindow({private: false});
let tab = win.gBrowser.addTab("http://example.com/");
let tab = BrowserTestUtils.addTab(win.gBrowser, "http://example.com/");
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
// Make sure sessionstore sees this window.

Просмотреть файл

@ -25,7 +25,7 @@ add_task(async function new_window() {
let newWin;
try {
newWin = await promiseNewWindowLoaded();
let tab = newWin.gBrowser.addTab("http://example.com/browser_625016.js?" + Math.random());
let tab = BrowserTestUtils.addTab(newWin.gBrowser, "http://example.com/browser_625016.js?" + Math.random());
await promiseBrowserLoaded(tab.linkedBrowser);
// Double check that we have no closed windows

Просмотреть файл

@ -113,7 +113,7 @@ add_task(async function test_3() {
});
async function promiseTabLoad(win, url) {
let tab = win.gBrowser.addTab(url);
let tab = BrowserTestUtils.addTab(win.gBrowser, url);
await promiseBrowserLoaded(tab.linkedBrowser);
await TabStateFlusher.flush(tab.linkedBrowser);
}

Просмотреть файл

@ -116,7 +116,7 @@ function promiseNewWindow() {
}
async function createTabWithStorageData(urls, win = window) {
let tab = win.gBrowser.addTab();
let tab = BrowserTestUtils.addTab(win.gBrowser);
let browser = tab.linkedBrowser;
for (let url of urls) {

Просмотреть файл

@ -50,7 +50,7 @@ add_task(async function test_open_and_close() {
await promiseBrowserLoaded(newTab2.linkedBrowser);
let newWin = await promiseNewWindowLoaded();
let tab = newWin.gBrowser.addTab(URL_NEWWIN);
let tab = BrowserTestUtils.addTab(newWin.gBrowser, URL_NEWWIN);
await promiseBrowserLoaded(tab.linkedBrowser);

Просмотреть файл

@ -300,7 +300,7 @@ add_task(async function test_revive_all_tabs_from_session_store() {
// a second window, since only selected tabs will show
// about:tabcrashed.
let win2 = await BrowserTestUtils.openNewBrowserWindow();
let newTab2 = win2.gBrowser.addTab(PAGE_1, { sameProcessAsFrameLoader: browser.frameLoader });
let newTab2 = BrowserTestUtils.addTab(win2.gBrowser, PAGE_1, { sameProcessAsFrameLoader: browser.frameLoader });
win2.gBrowser.selectedTab = newTab2;
let browser2 = newTab2.linkedBrowser;
ok(browser2.isRemoteBrowser, "Should be a remote browser");
@ -407,7 +407,7 @@ add_task(async function test_hide_restore_all_button() {
// Load up a second window so we can get another tab to show
// about:tabcrashed
let win2 = await BrowserTestUtils.openNewBrowserWindow();
let newTab3 = win2.gBrowser.addTab(PAGE_2, { sameProcessAsFrameLoader: browser.frameLoader });
let newTab3 = BrowserTestUtils.addTab(win2.gBrowser, PAGE_2, { sameProcessAsFrameLoader: browser.frameLoader });
win2.gBrowser.selectedTab = newTab3;
let otherWinBrowser = newTab3.linkedBrowser;
await promiseBrowserLoaded(otherWinBrowser);

Просмотреть файл

@ -16,7 +16,7 @@ add_task(async function test() {
await promiseBrowserLoaded(win.gBrowser.selectedBrowser);
// Open a second tab and close the first one.
let tab = win.gBrowser.addTab("about:mozilla");
let tab = BrowserTestUtils.addTab(win.gBrowser, "about:mozilla");
await promiseBrowserLoaded(tab.linkedBrowser);
await TabStateFlusher.flush(tab.linkedBrowser);
await promiseRemoveTabAndSessionState(win.gBrowser.tabs[0]);

Просмотреть файл

@ -72,7 +72,7 @@ add_task(async function() {
mm.loadFrameScript(FRAME_SCRIPT, true);
// Create a new tab in the new window that will load the frame script.
let tab = win.gBrowser.addTab("about:mozilla");
let tab = BrowserTestUtils.addTab(win.gBrowser, "about:mozilla");
let browser = tab.linkedBrowser;
await promiseBrowserLoaded(browser);
await TabStateFlusher.flush(browser);
@ -86,7 +86,7 @@ add_task(async function() {
is(ss.getClosedTabCount(win), 0, "no tabs to restore");
// Create a new tab in the new window that will load the frame script.
tab = win.gBrowser.addTab("about:mozilla");
tab = BrowserTestUtils.addTab(win.gBrowser, "about:mozilla");
browser = tab.linkedBrowser;
await promiseBrowserLoaded(browser);
await TabStateFlusher.flush(browser);
@ -109,7 +109,7 @@ add_task(async function() {
let win = await promiseNewWindowLoaded({private: true});
// Create a new tab in the new window that will load the frame script.
let tab = win.gBrowser.addTab("about:mozilla");
let tab = BrowserTestUtils.addTab(win.gBrowser, "about:mozilla");
let browser = tab.linkedBrowser;
await promiseBrowserLoaded(browser);
await TabStateFlusher.flush(browser);

Просмотреть файл

@ -116,7 +116,7 @@ add_task(async function test_scroll_background_tabs() {
pushPrefs(["browser.sessionstore.restore_on_demand", true]);
let newWin = await BrowserTestUtils.openNewBrowserWindow();
let tab = newWin.gBrowser.addTab(URL);
let tab = BrowserTestUtils.addTab(newWin.gBrowser, URL);
let browser = tab.linkedBrowser;
await BrowserTestUtils.browserLoaded(browser);

Просмотреть файл

@ -21,7 +21,7 @@ add_task(async function test_scroll_background_about_reader_tabs() {
pushPrefs(["browser.sessionstore.restore_on_demand", true]);
let newWin = await BrowserTestUtils.openNewBrowserWindow();
let tab = newWin.gBrowser.addTab(READER_MODE_URL);
let tab = BrowserTestUtils.addTab(newWin.gBrowser, READER_MODE_URL);
let browser = tab.linkedBrowser;
await Promise.all([
BrowserTestUtils.browserLoaded(browser),

Просмотреть файл

@ -16,7 +16,7 @@ add_task(async function() {
let win = await promiseNewWindowLoaded();
// Add a new tab.
let tab = win.gBrowser.addTab("about:blank");
let tab = BrowserTestUtils.addTab(win.gBrowser, "about:blank");
let browser = tab.linkedBrowser;
await promiseBrowserLoaded(browser);
ok(browser.isRemoteBrowser, "browser is remote");

Просмотреть файл

@ -8,7 +8,7 @@
ChromeUtils.import("resource:///modules/sessionstore/SessionStore.jsm");
async function openAndCloseTab(window, url) {
let tab = window.gBrowser.addTab(url);
let tab = BrowserTestUtils.addTab(window.gBrowser, url);
await promiseBrowserLoaded(tab.linkedBrowser, true, url);
await TabStateFlusher.flush(tab.linkedBrowser);
await promiseRemoveTabAndSessionState(tab);

Просмотреть файл

@ -13,7 +13,9 @@ add_task(async function() {
// Create 4 tabs with different userContextId.
for (let userContextId = 1; userContextId < 5; userContextId++) {
let tab = win.gBrowser.addTab("http://example.com/", {userContextId});
let tab = BrowserTestUtils.addTab(win.gBrowser, "http://example.com/", {
userContextId,
});
await promiseBrowserLoaded(tab.linkedBrowser);
await TabStateFlusher.flush(tab.linkedBrowser);
}
@ -36,7 +38,9 @@ add_task(async function() {
// Create tabs with different userContextId, but this time we create them with
// fewer tabs and with different order with win.
for (let userContextId = 3; userContextId > 0; userContextId--) {
let tab = win2.gBrowser.addTab("http://example.com/", {userContextId});
let tab = BrowserTestUtils.addTab(win2.gBrowser, "http://example.com/", {
userContextId,
});
await promiseBrowserLoaded(tab.linkedBrowser);
await TabStateFlusher.flush(tab.linkedBrowser);
}
@ -76,7 +80,9 @@ add_task(async function() {
let win = await BrowserTestUtils.openNewBrowserWindow();
await TabStateFlusher.flush(win.gBrowser.selectedBrowser);
let tab = win.gBrowser.addTab("http://example.com/", { userContextId: 1 });
let tab = BrowserTestUtils.addTab(win.gBrowser, "http://example.com/", {
userContextId: 1,
});
await promiseBrowserLoaded(tab.linkedBrowser);
await TabStateFlusher.flush(tab.linkedBrowser);
@ -92,7 +98,9 @@ add_task(async function() {
let win2 = await BrowserTestUtils.openNewBrowserWindow();
let tab2 = win2.gBrowser.addTab("http://example.com/", { userContextId: 1 });
let tab2 = BrowserTestUtils.addTab(win2.gBrowser, "http://example.com/", {
userContextId: 1,
});
await promiseBrowserLoaded(tab2.linkedBrowser);
await TabStateFlusher.flush(tab2.linkedBrowser);

Просмотреть файл

@ -40,13 +40,21 @@ var Tabs = {
async applyConfig() {
fiveTabsHelper();
let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
let tab = browserWindow.gBrowser.addTab(PREFS_TAB);
let tab = browserWindow.gBrowser.addTab(PREFS_TAB, {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
browserWindow.gBrowser.pinTab(tab);
tab = browserWindow.gBrowser.addTab(CUST_TAB);
tab = browserWindow.gBrowser.addTab(CUST_TAB, {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
browserWindow.gBrowser.pinTab(tab);
tab = browserWindow.gBrowser.addTab("about:privatebrowsing");
tab = browserWindow.gBrowser.addTab("about:privatebrowsing", {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
browserWindow.gBrowser.pinTab(tab);
tab = browserWindow.gBrowser.addTab("about:home");
tab = browserWindow.gBrowser.addTab("about:home", {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
browserWindow.gBrowser.pinTab(tab);
browserWindow.gBrowser.selectTabAtIndex(5);
hoverTab(browserWindow.gBrowser.tabs[2]);

Просмотреть файл

@ -124,6 +124,9 @@ def install_libgcc(gcc_dir, clang_dir):
libgcc_dir = os.path.join(gcc_dir, "lib64")
clang_lib_dir = os.path.join(clang_dir, "lib")
copy_tree(libgcc_dir, clang_lib_dir)
libgcc_dir = os.path.join(gcc_dir, "lib32")
clang_lib_dir = os.path.join(clang_dir, "lib32")
copy_tree(libgcc_dir, clang_lib_dir)
include_dir = os.path.join(gcc_dir, "include")
clang_include_dir = os.path.join(clang_dir, "include")
copy_tree(include_dir, clang_include_dir)
@ -294,7 +297,7 @@ def get_tool(config, key):
# run-clang-tidy.py
def prune_final_dir_for_clang_tidy(final_dir):
# Make sure we only have what we expect.
dirs = ("bin", "include", "lib", "libexec", "msbuild-bin", "share", "tools")
dirs = ("bin", "include", "lib", "lib32", "libexec", "msbuild-bin", "share", "tools")
for f in glob.glob("%s/*" % final_dir):
if os.path.basename(f) not in dirs:
raise Exception("Found unknown file %s in the final directory" % f)

Просмотреть файл

@ -1250,7 +1250,7 @@ def pgo_flags(compiler, build_env, target):
if topobjdir.endswith('/js/src'):
topobjdir = topobjdir[:-7]
if compiler.type in ('gcc', 'clang'):
if compiler.type == 'gcc':
return namespace(
gen_cflags=['-fprofile-generate'],
gen_ldflags=['-fprofile-generate'],
@ -1259,18 +1259,26 @@ def pgo_flags(compiler, build_env, target):
use_ldflags=['-fprofile-use'],
)
if compiler.type == 'clang-cl':
if compiler.type in ('clang-cl', 'clang'):
profdata = os.path.join(topobjdir, 'merged.profdata')
# 32-bit PGO is currently blocked by bug 1479800
if target.cpu == 'x86_64':
return namespace(
gen_cflags=['-fprofile-instr-generate'],
gen_ldflags=['clang_rt.profile-x86_64.lib'],
use_cflags=['-fprofile-instr-use=%s' % profdata,
'-Wno-error=profile-instr-out-of-date',
'-Wno-error=profile-instr-unprofiled'],
use_ldflags=[],
)
if compiler.type == 'clang-cl':
# 32-bit PGO is currently blocked by bug 1479800
if target.cpu == 'x86_64':
gen_ldflags = ['clang_rt.profile-x86_64.lib']
else:
gen_ldflags = None
else:
gen_ldflags = ['-fprofile-instr-generate']
if gen_ldflags:
return namespace(
gen_cflags=['-fprofile-instr-generate'],
gen_ldflags=gen_ldflags,
use_cflags=['-fprofile-instr-use=%s' % profdata,
'-Wno-error=profile-instr-out-of-date',
'-Wno-error=profile-instr-unprofiled'],
use_ldflags=[],
)
if compiler.type == 'msvc':
num_cores = min(8, multiprocessing.cpu_count())
@ -1745,10 +1753,12 @@ js_option('--enable-stdcxx-compat', env='MOZ_STDCXX_COMPAT',
@template
def libstdcxx_version(var, compiler):
@depends(compiler, when='--enable-stdcxx-compat')
def libstdcxx_version(var, compiler, host_or_target):
@depends(compiler, host_or_target, when='--enable-stdcxx-compat')
@imports(_from='mozbuild.configure.libstdcxx', _import='find_version')
def version(compiler):
def version(compiler, host_or_target):
if host_or_target.os == 'Android':
return None
result = find_version(
compiler.wrapper + [compiler.compiler] + compiler.flags)
if result:
@ -1760,10 +1770,12 @@ def libstdcxx_version(var, compiler):
add_gcc_flag(
'-D_GLIBCXX_USE_CXX11_ABI=0', cxx_compiler,
when=libstdcxx_version('MOZ_LIBSTDCXX_TARGET_VERSION', cxx_compiler))
when=libstdcxx_version(
'MOZ_LIBSTDCXX_TARGET_VERSION', cxx_compiler, target))
add_gcc_flag(
'-D_GLIBCXX_USE_CXX11_ABI=0', host_cxx_compiler,
when=libstdcxx_version('MOZ_LIBSTDCXX_HOST_VERSION', host_cxx_compiler))
when=libstdcxx_version(
'MOZ_LIBSTDCXX_HOST_VERSION', host_cxx_compiler, host))
@depends(c_compiler.try_compile(flags=['-fsanitize=fuzzer-no-link'],

Просмотреть файл

@ -625,6 +625,8 @@ ifdef MSMANIFEST_TOOL
@if test -f $@.manifest; then \
$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
rm -f $@.manifest; \
elif test -f '$(srcdir)/$(notdir $@).manifest'; then \
$(MT) -NOLOGO -MANIFEST '$(win_srcdir)/$(notdir $@).manifest' -OUTPUTRESOURCE:$@\;1; \
fi
endif # MSVC with manifest tool
else

Просмотреть файл

@ -71,7 +71,7 @@ var { helpers, assert } = (function () {
options.isFirefox = true;
var tabbrowser = options.chromeWindow.gBrowser;
options.tab = tabbrowser.addTab();
options.tab = BrowserTestUtils.addTab(tabbrowser);
tabbrowser.selectedTab = options.tab;
options.browser = tabbrowser.getBrowserForTab(options.tab);
options.target = TargetFactory.forTab(options.tab);
@ -117,7 +117,7 @@ var { helpers, assert } = (function () {
options.isFirefox = true;
var tabbrowser = options.chromeWindow.gBrowser;
options.tab = tabbrowser.addTab();
options.tab = BrowserTestUtils.addTab(tabbrowser);
tabbrowser.selectedTab = options.tab;
options.browser = tabbrowser.getBrowserForTab(options.tab);
options.target = TargetFactory.forTab(options.tab);

Просмотреть файл

@ -1,9 +1,9 @@
This is the debugger.html project output.
See https://github.com/devtools-html/debugger.html
Version 79
Version 80
Comparison: https://github.com/devtools-html/debugger.html/compare/release-78...release-79
Comparison: https://github.com/devtools-html/debugger.html/compare/release-79...release-80
Packages:
- babel-plugin-transform-es2015-modules-commonjs @6.26.2

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -125,7 +125,11 @@ function setPausePoints(sourceId) {
}) => {
const source = (0, _selectors.getSourceFromId)(getState(), sourceId);
if (!_prefs.features.pausePoints || !source || !source.text || source.isWasm) {
if (!_prefs.features.pausePoints || !source || !source.text) {
return;
}
if (source.isWasm) {
return;
}

Просмотреть файл

@ -26,6 +26,7 @@ async function addBreakpointPromise(getState, client, sourceMaps, breakpoint) {
const state = getState();
const source = (0, _selectors.getSource)(state, breakpoint.location.sourceId);
const location = { ...breakpoint.location,
sourceId: source.id,
sourceUrl: source.url
};
const generatedLocation = await (0, _sourceMaps.getGeneratedLocation)(state, source, location, sourceMaps);

Просмотреть файл

@ -219,10 +219,10 @@ function getMappedExpression(expression) {
const mappings = (0, _selectors.getSelectedScopeMappings)(getState());
const bindings = (0, _selectors.getSelectedFrameBindings)(getState());
if (!mappings && !bindings) {
if (!mappings && !bindings && !expression.includes("await")) {
return expression;
}
return parser.mapExpression(expression, mappings, bindings, _prefs.features.mapExpressionBindings);
return parser.mapExpression(expression, mappings, bindings || [], _prefs.features.mapExpressionBindings, _prefs.features.mapAwaitExpression);
};
}

Просмотреть файл

@ -209,7 +209,7 @@ function hasAwait(source, pauseLocation) {
column
} = pauseLocation;
if (!source.text) {
if (source.isWasm || !source.text) {
return false;
}

Просмотреть файл

@ -54,7 +54,7 @@ function updatePreview(target, tokenPos, codeMirror) {
}) => {
const cursorPos = target.getBoundingClientRect();
if ((0, _selectors.getCanRewind)(getState()) || !(0, _selectors.isSelectedFrameVisible)(getState()) || !(0, _selectors.isLineInScope)(getState(), tokenPos.line)) {
if (!(0, _selectors.isSelectedFrameVisible)(getState()) || !(0, _selectors.isLineInScope)(getState(), tokenPos.line)) {
return;
}

Просмотреть файл

@ -87,6 +87,7 @@ function loadSourceMap(sourceId) {
// If this source doesn't have a sourcemap, enable it for pretty printing
dispatch({
type: "UPDATE_SOURCE",
// NOTE: Flow https://github.com/facebook/flow/issues/6342 issue
source: { ...source,
sourceMapURL: ""
}

Просмотреть файл

@ -44,16 +44,19 @@ function createFrame(frame) {
function createSource(source, {
supportsWasm
}) {
return {
const createdSource = {
id: source.actor,
url: source.url,
relativeUrl: source.url,
isPrettyPrinted: false,
isWasm: supportsWasm && source.introductionType === "wasm",
isWasm: false,
sourceMapURL: source.sourceMapURL,
isBlackBoxed: false,
loadedState: "unloaded"
};
return Object.assign(createdSource, {
isWasm: supportsWasm && source.introductionType === "wasm"
});
}
function createPause(packet, response) {

Просмотреть файл

@ -74,8 +74,15 @@ function addBreakpoint(state, action) {
const {
breakpoint
breakpoint,
previousLocation
} = action.value;
if (previousLocation) {
const previousLocationId = (0, _breakpoint.makePendingLocationId)(previousLocation);
state = deleteBreakpoint(state, previousLocationId);
}
const locationId = (0, _breakpoint.makePendingLocationId)(breakpoint.location);
const pendingBreakpoint = (0, _breakpoint.createPendingBreakpoint)(breakpoint);
return { ...state,

Просмотреть файл

@ -18,7 +18,7 @@ var _source = require("../utils/source");
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
function getBreakpointsForSource(source, breakpoints) {
const bpList = breakpoints.valueSeq();
return bpList.filter(bp => bp.location.sourceId == source.id && !bp.hidden && (bp.text || bp.originalText || bp.condition)).sortBy(bp => bp.location.line).toJS();
return bpList.filter(bp => bp.location.sourceId == source.id && !bp.hidden && (bp.text || bp.originalText || bp.condition || bp.disabled)).sortBy(bp => bp.location.line).toJS();
}
function findBreakpointSources(sources, breakpoints) {

Просмотреть файл

@ -32,6 +32,7 @@ function getRelativeUrl(source, root) {
}
function formatSource(source, root) {
// NOTE: Flow https://github.com/facebook/flow/issues/6342 issue
return { ...source,
relativeUrl: getRelativeUrl(source, root)
};

Просмотреть файл

@ -19,7 +19,7 @@ function findFunctionText(line, source, symbols) {
column: Infinity
});
if (!func || !source.text) {
if (source.isWasm || !func || !source.text) {
return null;
}

Просмотреть файл

@ -20,6 +20,10 @@ function isMinified(source) {
return _minifiedCache.get(source.id);
}
if (source.isWasm) {
return false;
}
let text = source.text;
if (!text) {

Просмотреть файл

@ -69,6 +69,7 @@ if ((0, _devtoolsEnvironment.isDevelopment)()) {
pref("devtools.debugger.features.component-pane", false);
pref("devtools.debugger.features.autocomplete-expressions", false);
pref("devtools.debugger.features.map-expression-bindings", true);
pref("devtools.debugger.features.map-await-expression", true);
}
const prefs = exports.prefs = new _devtoolsModules.PrefsHelper("devtools", {
@ -117,6 +118,7 @@ const features = exports.features = new _devtoolsModules.PrefsHelper("devtools.d
skipPausing: ["Bool", "skip-pausing"],
autocompleteExpression: ["Bool", "autocomplete-expressions"],
mapExpressionBindings: ["Bool", "map-expression-bindings"],
mapAwaitExpression: ["Bool", "map-await-expression"],
componentPane: ["Bool", "component-pane"]
});
const asyncStore = exports.asyncStore = (0, _asyncStoreHelper.asyncStoreHelper)("debugger", {

Просмотреть файл

@ -197,7 +197,7 @@ function getDisplayPath(mySource, sources) {
const filename = getFilename(mySource); // Find sources that have the same filename, but different paths
// as the original source
const similarSources = sources.filter(source => mySource.url != source.url && filename == getFilename(source));
const similarSources = sources.filter(source => getRawSourceURL(mySource.url) != getRawSourceURL(source.url) && filename == getFilename(source));
if (similarSources.length == 0) {
return undefined;
@ -295,7 +295,11 @@ function getSourcePath(url) {
function getSourceLineCount(source) {
if (source.isWasm && !source.error) {
if (source.error) {
return 0;
}
if (source.isWasm) {
const {
binary
} = source.text;
@ -325,14 +329,19 @@ function getSourceLineCount(source) {
function getMode(source, symbols) {
if (source.isWasm) {
return {
name: "text"
};
}
const {
contentType,
text,
isWasm,
url
} = source;
if (!text || isWasm) {
if (!text) {
return {
name: "text"
};
@ -451,7 +460,7 @@ function isLoading(source) {
}
function getTextAtPosition(source, location) {
if (!source || !source.text || source.isWasm) {
if (!source || source.isWasm || !source.text) {
return "";
}

Просмотреть файл

@ -78,7 +78,7 @@ function addSourceToNode(node, url, source) {
const isFile = !(0, _utils.isPathDirectory)(url.path);
if (node.type == "source") {
throw new Error(`wtf ${node.name}`);
throw new Error(`Unexpected type "source" at: ${node.name}`);
} // if we have a file, and the subtree has no elements, overwrite the
// subtree contents with the source

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше