зеркало из 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",
|
name: "provider 1",
|
||||||
origin: "https://example.com",
|
origin: "https://example.com",
|
||||||
sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
|
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",
|
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"
|
iconURL: "https://example.com/browser/browser/base/content/test/general/moz.png"
|
||||||
};
|
};
|
||||||
runSocialTestWithProvider(manifest, function (finishcb) {
|
runSocialTestWithProvider(manifest, function (finishcb) {
|
||||||
|
@ -68,10 +70,26 @@ var tests = {
|
||||||
info("checking private window ui");
|
info("checking private window ui");
|
||||||
ok(!pbwin.SocialUI.enabled, "social is disabled in a PB window");
|
ok(!pbwin.SocialUI.enabled, "social is disabled in a PB window");
|
||||||
checkSocialUI(pbwin);
|
checkSocialUI(pbwin);
|
||||||
|
|
||||||
// but they should all remain enabled in the initial window
|
// but they should all remain enabled in the initial window
|
||||||
info("checking main window ui");
|
info("checking main window ui");
|
||||||
ok(window.SocialUI.enabled, "social is still enabled in normal window");
|
ok(window.SocialUI.enabled, "social is still enabled in normal window");
|
||||||
checkSocialUI(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...
|
// that's all folks...
|
||||||
pbwin.close();
|
pbwin.close();
|
||||||
next();
|
next();
|
||||||
|
|
|
@ -25,6 +25,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "SocialService",
|
||||||
"resource://gre/modules/SocialService.jsm");
|
"resource://gre/modules/SocialService.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
||||||
"resource://gre/modules/PlacesUtils.jsm");
|
"resource://gre/modules/PlacesUtils.jsm");
|
||||||
|
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
||||||
|
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||||
"resource://gre/modules/Promise.jsm");
|
"resource://gre/modules/Promise.jsm");
|
||||||
|
|
||||||
|
@ -398,6 +400,9 @@ function CreateSocialStatusWidget(aId, aProvider) {
|
||||||
node.setAttribute("tooltiptext", aProvider.name);
|
node.setAttribute("tooltiptext", aProvider.name);
|
||||||
node.setAttribute("oncommand", "SocialStatus.showPopup(this);");
|
node.setAttribute("oncommand", "SocialStatus.showPopup(this);");
|
||||||
|
|
||||||
|
if (PrivateBrowsingUtils.isWindowPrivate(aDocument.defaultView))
|
||||||
|
node.setAttribute("disabled", "true");
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Загрузка…
Ссылка в новой задаче