Bug 1410900 - Allow using shift-click on the Reload Frame context menuitem to skip the cache when reloading the frame. r?johannh
This patch uses the same logic as BrowserReloadOrDuplicate to determine if the cache should be skipped. I didn't extract out the logic to a separate function because I didn't want to add another function to the global namespace of browser.js.
MozReview-Commit-ID: 15kztsqMnAM
--- a/browser/base/content/browser-context.inc
+++ b/browser/base/content/browser-context.inc
@@ -327,17 +327,17 @@
<menuitem id="context-openframe"
label="&openFrameCmd.label;"
accesskey="&openFrameCmd.accesskey;"
oncommand="gContextMenu.openFrame();"/>
<menuseparator id="open-frame-sep"/>
<menuitem id="context-reloadframe"
label="&reloadFrameCmd.label;"
accesskey="&reloadFrameCmd.accesskey;"
- oncommand="gContextMenu.reloadFrame();"/>
+ oncommand="gContextMenu.reloadFrame(event);"/>
<menuseparator/>
<menuitem id="context-bookmarkframe"
label="&bookmarkThisFrameCmd.label;"
accesskey="&bookmarkThisFrameCmd.accesskey;"
oncommand="gContextMenu.addBookmarkForFrame();"/>
<menuitem id="context-saveframe"
label="&saveFrameCmd.label;"
accesskey="&saveFrameCmd.accesskey;"
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -827,19 +827,20 @@ nsContextMenu.prototype = {
openFrameInTab() {
let referrer = gContextMenuContentData.referrer;
openLinkIn(gContextMenuContentData.docLocation, "tab",
{ charset: gContextMenuContentData.charSet,
referrerURI: referrer ? makeURI(referrer) : null });
},
// Reload clicked-in frame.
- reloadFrame() {
+ reloadFrame(aEvent) {
+ let forceReload = aEvent.shiftKey;
this.browser.messageManager.sendAsyncMessage("ContextMenu:ReloadFrame",
- null, { target: this.target });
+ null, { target: this.target, forceReload });
},
// Open clicked-in frame in its own window.
openFrame() {
let referrer = gContextMenuContentData.referrer;
openLinkIn(gContextMenuContentData.docLocation, "window",
{ charset: gContextMenuContentData.charSet,
referrerURI: referrer ? makeURI(referrer) : null });
--- a/browser/modules/ContextMenu.jsm
+++ b/browser/modules/ContextMenu.jsm
@@ -100,17 +100,18 @@ const messageListeners = {
break;
}
}
);
},
"ContextMenu:ReloadFrame": function(aMessage) {
- this.getTarget(aMessage).ownerDocument.location.reload();
+ let forceReload = aMessage.objects && aMessage.objects.forceReload;
+ this.getTarget(aMessage).ownerDocument.location.reload(forceReload);
},
"ContextMenu:ReloadImage": function(aMessage) {
let image = this.getTarget(aMessage);
if (image instanceof Ci.nsIImageLoadingContent) {
image.forceReload();
}