Bug 1410900 - Allow using shift-click on the Reload Frame context menuitem to skip the cache when reloading the frame. r?johannh draft
authorJared Wein <jwein@mozilla.com>
Thu, 26 Oct 2017 19:42:18 -0400
changeset 699873 6ff62b80b4b4412d0c7bedb2621d6fa0b9e0c4ed
parent 698447 e070277ec199fa96fa490ed52d33646a376d0d80
child 740754 f587f428009d46f1d5cb5c1da39402af77fb6475
push id89708
push userbmo:jaws@mozilla.com
push dateFri, 17 Nov 2017 20:52:30 +0000
reviewersjohannh
bugs1410900
milestone59.0a1
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
browser/base/content/browser-context.inc
browser/base/content/nsContextMenu.js
browser/modules/ContextMenu.jsm
--- 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();
     }