зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1325014 - Adding tab related to current tab inherits current tab's container usercontextid unless otherwise specified. r=gijs
MozReview-Commit-ID: FJ1oKDRp9Dn --HG-- extra : rebase_source : ac0749c5d5cb076110dea5cb434dee92dc90481a
This commit is contained in:
Родитель
2dae4fbcea
Коммит
3b6772f065
|
@ -2182,6 +2182,13 @@
|
|||
t.setAttribute("hidden", "true");
|
||||
}
|
||||
|
||||
// Related tab inherits current tab's user context unless a different
|
||||
// usercontextid is specified
|
||||
if (aUserContextId == null &&
|
||||
(aRelatedToCurrent == null ? aReferrerURI : aRelatedToCurrent)) {
|
||||
aUserContextId = this.mCurrentTab.getAttribute("usercontextid") || 0;
|
||||
}
|
||||
|
||||
if (aUserContextId) {
|
||||
t.setAttribute("usercontextid", aUserContextId);
|
||||
ContextualIdentityService.setTabStyle(t);
|
||||
|
|
|
@ -28,3 +28,4 @@ tags = openwindow
|
|||
[browser_middleClick.js]
|
||||
[browser_imageCache.js]
|
||||
[browser_count_and_remove.js]
|
||||
[browser_relatedTab.js]
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
|
||||
/*
|
||||
* Bug 1325014 - Adding tab related to current tab inherits current tab's container usercontextid unless otherwise specified
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let tab = gBrowser.addTab("about:blank", {userContextId: 1});
|
||||
|
||||
gBrowser.selectedTab = tab;
|
||||
let relatedTab = gBrowser.addTab("about:blank", {relatedToCurrent: true});
|
||||
is(relatedTab.getAttribute('usercontextid'), 1, "Related tab (relatedToCurrent) inherits current tab's usercontextid");
|
||||
yield BrowserTestUtils.removeTab(relatedTab);
|
||||
|
||||
gBrowser.selectedTab = tab;
|
||||
relatedTab = gBrowser.addTab("about:blank", {relatedToCurrent: true, userContextId: 2});
|
||||
is(relatedTab.getAttribute('usercontextid'), 2, "Related tab (relatedToCurrent) with overridden usercontextid");
|
||||
yield BrowserTestUtils.removeTab(relatedTab);
|
||||
|
||||
gBrowser.selectedTab = tab;
|
||||
relatedTab = gBrowser.addTab("about:blank", {referrerURI: gBrowser.currentURI});
|
||||
is(relatedTab.getAttribute('usercontextid'), 1, "Related tab (referrer) inherits current tab's usercontextid");
|
||||
yield BrowserTestUtils.removeTab(relatedTab);
|
||||
|
||||
gBrowser.selectedTab = tab;
|
||||
relatedTab = gBrowser.addTab("about:blank", {referrerURI: gBrowser.currentURI, userContextId: 2});
|
||||
is(relatedTab.getAttribute('usercontextid'), 2, "Related tab (referrer) with overridden usercontextid");
|
||||
yield BrowserTestUtils.removeTab(relatedTab);
|
||||
|
||||
yield BrowserTestUtils.removeTab(tab);
|
||||
});
|
Загрузка…
Ссылка в новой задаче