зеркало из https://github.com/mozilla/gecko-dev.git
Bug 965265 - Opening a new private window shows social provider buttons which don't do anything, r=mixedpuppy.
This commit is contained in:
Родитель
5b5cdd7f84
Коммит
ee1aa885d8
|
@ -38,7 +38,9 @@ function test() {
|
|||
name: "provider 1",
|
||||
origin: "https://example.com",
|
||||
sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
|
||||
statusURL: "https://example.com/browser/browser/base/content/test/social/social_panel.html",
|
||||
workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
|
||||
markURL: "https://example.com/browser/browser/base/content/test/social/social_mark.html?url=%{url}",
|
||||
iconURL: "https://example.com/browser/browser/base/content/test/general/moz.png"
|
||||
};
|
||||
runSocialTestWithProvider(manifest, function (finishcb) {
|
||||
|
@ -68,10 +70,26 @@ var tests = {
|
|||
info("checking private window ui");
|
||||
ok(!pbwin.SocialUI.enabled, "social is disabled in a PB window");
|
||||
checkSocialUI(pbwin);
|
||||
|
||||
// but they should all remain enabled in the initial window
|
||||
info("checking main window ui");
|
||||
ok(window.SocialUI.enabled, "social is still enabled in normal window");
|
||||
checkSocialUI(window);
|
||||
|
||||
// Check that the status button is disabled on the private
|
||||
// browsing window and not on the normal window.
|
||||
let id = SocialStatus._toolbarHelper.idFromOrigin("https://example.com");
|
||||
let widget = CustomizableUI.getWidget(id);
|
||||
ok(widget.forWindow(pbwin).node.disabled, "status button disabled on private window");
|
||||
ok(!widget.forWindow(window).node.disabled, "status button enabled on normal window");
|
||||
|
||||
// Check that the mark button is disabled on the private
|
||||
// browsing window and not on the normal window.
|
||||
id = SocialMarks._toolbarHelper.idFromOrigin("https://example.com");
|
||||
widget = CustomizableUI.getWidget(id);
|
||||
ok(widget.forWindow(pbwin).node.disabled, "mark button disabled on private window");
|
||||
ok(!widget.forWindow(window).node.disabled, "mark button enabled on normal window");
|
||||
|
||||
// that's all folks...
|
||||
pbwin.close();
|
||||
next();
|
||||
|
|
|
@ -25,6 +25,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "SocialService",
|
|||
"resource://gre/modules/SocialService.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
||||
"resource://gre/modules/PlacesUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||
"resource://gre/modules/Promise.jsm");
|
||||
|
||||
|
@ -398,6 +400,9 @@ function CreateSocialStatusWidget(aId, aProvider) {
|
|||
node.setAttribute("tooltiptext", aProvider.name);
|
||||
node.setAttribute("oncommand", "SocialStatus.showPopup(this);");
|
||||
|
||||
if (PrivateBrowsingUtils.isWindowPrivate(aDocument.defaultView))
|
||||
node.setAttribute("disabled", "true");
|
||||
|
||||
return node;
|
||||
}
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче