Bug 1311358 - Add error notification for RDM with container tabs. r=ntim

MozReview-Commit-ID: DPDGaHQzuYq

--HG--
extra : rebase_source : d8bed58d827e05756c11a364de769643313152a8
This commit is contained in:
J. Ryan Stinnett 2016-10-19 08:53:10 -05:00
Родитель 6563a0fbab
Коммит 88f0263be8
2 изменённых файлов: 22 добавлений и 3 удалений

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

@ -59,6 +59,11 @@ responsive.screenshotGeneratedFilename=Screen Shot %1$S at %2$S
# non-remote tab.
responsive.remoteOnly=Responsive Design Mode is only available for remote browser tabs, such as those used for web content in multi-process Firefox.
# LOCALIZATION NOTE (responsive.noContainerTabs): Message displayed in the tab's
# notification box if a user tries to open Responsive Design Mode in a
# container tab.
responsive.noContainerTabs=Responsive Design Mode is currently unavailable in container tabs.
# LOCALIZATION NOTE (responsive.noThrottling): UI option in a menu to configure
# network throttling. This option is the default and disables throttling so you
# just have normal network conditions. There is not very much room in the UI

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

@ -76,6 +76,11 @@ const ResponsiveUIManager = exports.ResponsiveUIManager = {
this.showRemoteOnlyNotification(window, tab, options);
return promise.reject(new Error("RDM only available for remote tabs."));
}
// Remove this once we support this case in bug 1306975.
if (tab.linkedBrowser.hasAttribute("usercontextid")) {
this.showNoContainerTabsNotification(window, tab, options);
return promise.reject(new Error("RDM not available for container tabs."));
}
if (!this.isActiveForTab(tab)) {
this.initMenuCheckListenerFor(window);
@ -213,7 +218,16 @@ const ResponsiveUIManager = exports.ResponsiveUIManager = {
}
}),
showRemoteOnlyNotification(window, tab, { command } = {}) {
showRemoteOnlyNotification(window, tab, options) {
this.showErrorNotification(window, tab, options, getStr("responsive.remoteOnly"));
},
showNoContainerTabsNotification(window, tab, options) {
this.showErrorNotification(window, tab, options,
getStr("responsive.noContainerTabs"));
},
showErrorNotification(window, tab, { command } = {}, msg) {
// Default to using the browser's per-tab notification box
let nbox = window.gBrowser.getNotificationBox(tab.linkedBrowser);
@ -228,14 +242,14 @@ const ResponsiveUIManager = exports.ResponsiveUIManager = {
}
}
let value = "devtools-responsive-remote-only";
let value = "devtools-responsive-error";
if (nbox.getNotificationWithValue(value)) {
// Notification already displayed
return;
}
nbox.appendNotification(
getStr("responsive.remoteOnly"),
msg,
value,
null,
nbox.PRIORITY_CRITICAL_MEDIUM,