Bug 1246907 - Open link in a Container Tab - in the context menu, r=Gijs

This commit is contained in:
Andrea Marchesini 2016-02-12 11:16:41 +00:00
Родитель fa2a4428e4
Коммит 1674c865bc
3 изменённых файлов: 29 добавлений и 2 удалений

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

@ -57,7 +57,29 @@
<menuitem id="context-openlinkintab" <menuitem id="context-openlinkintab"
label="&openLinkCmdInTab.label;" label="&openLinkCmdInTab.label;"
accesskey="&openLinkCmdInTab.accesskey;" accesskey="&openLinkCmdInTab.accesskey;"
oncommand="gContextMenu.openLinkInTab();"/> usercontextid="0"
oncommand="gContextMenu.openLinkInTab(event);"/>
<menu id="context-openlinkinusercontext-menu"
label="&openLinkCmdInContainerTab.label;"
accesskey="&openLinkCmdInContainerTab.accesskey;"
hidden="true">
<menupopup oncommand="gContextMenu.openLinkInTab(event);">
<menuitem label="&userContextPersonal.label;"
usercontextid="1"
accesskey="&userContextPersonal.accesskey;"/>
<menuitem label="&userContextWork.label;"
usercontextid="2"
accesskey="&userContextWork.accesskey;"/>
<menuitem label="&userContextBanking.label;"
usercontextid="3"
accesskey="&userContextBanking.accesskey;"/>
<menuitem label="&userContextShopping.label;"
usercontextid="4"
accesskey="&userContextShopping.accesskey;"/>
</menupopup>
</menu>
<menuitem id="context-openlink" <menuitem id="context-openlink"
label="&openLinkCmd.label;" label="&openLinkCmd.label;"
accesskey="&openLinkCmd.accesskey;" accesskey="&openLinkCmd.accesskey;"

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

@ -144,9 +144,11 @@ nsContextMenu.prototype = {
var shouldShow = this.onSaveableLink || isMailtoInternal || this.onPlainTextLink; var shouldShow = this.onSaveableLink || isMailtoInternal || this.onPlainTextLink;
var isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(window); var isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(window);
var showContainers = Services.prefs.getBoolPref("privacy.userContext.enabled");
this.showItem("context-openlink", shouldShow && !isWindowPrivate); this.showItem("context-openlink", shouldShow && !isWindowPrivate);
this.showItem("context-openlinkprivate", shouldShow); this.showItem("context-openlinkprivate", shouldShow);
this.showItem("context-openlinkintab", shouldShow); this.showItem("context-openlinkintab", shouldShow);
this.showItem("context-openlinkinusercontext-menu", shouldShow && showContainers);
this.showItem("context-openlinkincurrent", this.onPlainTextLink); this.showItem("context-openlinkincurrent", this.onPlainTextLink);
this.showItem("context-sep-open", shouldShow); this.showItem("context-sep-open", shouldShow);
}, },
@ -960,7 +962,7 @@ nsContextMenu.prototype = {
}, },
// Open linked-to URL in a new tab. // Open linked-to URL in a new tab.
openLinkInTab: function() { openLinkInTab: function(event) {
urlSecurityCheck(this.linkURL, this.principal); urlSecurityCheck(this.linkURL, this.principal);
let referrerURI = gContextMenuContentData.documentURIObject; let referrerURI = gContextMenuContentData.documentURIObject;
@ -981,6 +983,7 @@ nsContextMenu.prototype = {
let params = this._openLinkInParameters({ let params = this._openLinkInParameters({
allowMixedContent: persistAllowMixedContentInChildTab, allowMixedContent: persistAllowMixedContentInChildTab,
userContextId: event.target.getAttribute('usercontextid'),
}); });
openLinkIn(this.linkURL, "tab", params); openLinkIn(this.linkURL, "tab", params);
}, },

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

@ -528,6 +528,8 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY openFrameCmdInTab.accesskey "T"> <!ENTITY openFrameCmdInTab.accesskey "T">
<!ENTITY openFrameCmd.label "Open Frame in New Window"> <!ENTITY openFrameCmd.label "Open Frame in New Window">
<!ENTITY openFrameCmd.accesskey "W"> <!ENTITY openFrameCmd.accesskey "W">
<!ENTITY openLinkCmdInContainerTab.label "Open Link in New Container Tab">
<!ENTITY openLinkCmdInContainerTab.accesskey "C">
<!ENTITY showOnlyThisFrameCmd.label "Show Only This Frame"> <!ENTITY showOnlyThisFrameCmd.label "Show Only This Frame">
<!ENTITY showOnlyThisFrameCmd.accesskey "S"> <!ENTITY showOnlyThisFrameCmd.accesskey "S">
<!ENTITY reloadCmd.commandkey "r"> <!ENTITY reloadCmd.commandkey "r">