Bug 1543041 - Port bug 1355073 to quantumbar. r=mak
authorphoenixabhishek <phoenixgyaan@gmail.com>
Mon, 06 May 2019 16:36:28 +0000
changeset 472732 d499ab0ad0da468509074f5d46bfb9b57995e4ea
parent 472731 2f0db0b04a913275f91ede9fc984a40065c08266
child 472733 53628848cf17ab7bed1ebe2c54def1bf1a4b22c5
push id84806
push usermak77@bonardo.net
push dateMon, 06 May 2019 16:59:01 +0000
treeherderautoland@d499ab0ad0da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1543041, 1355073
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1543041 - Port bug 1355073 to quantumbar. r=mak Differential Revision: https://phabricator.services.mozilla.com/D29838
browser/components/urlbar/UrlbarInput.jsm
--- a/browser/components/urlbar/UrlbarInput.jsm
+++ b/browser/components/urlbar/UrlbarInput.jsm
@@ -1550,30 +1550,30 @@ class UrlbarInput {
   _on_dragover(event) {
     if (!getDroppableData(event)) {
       event.dataTransfer.dropEffect = "none";
     }
   }
 
   _on_drop(event) {
     let droppedItem = getDroppableData(event);
-    if (!droppedItem) {
-      return;
+    let droppedURL = droppedItem instanceof URL ? droppedItem.href : droppedItem;
+    if (droppedURL && (droppedURL !== this.window.gBrowser.currentURI.spec)) {
+      let principal = Services.droppedLinkHandler.getTriggeringPrincipal(event);
+      this.value = droppedURL;
+      this.window.SetPageProxyState("invalid");
+      this.focus();
+      this.handleCommand(null, undefined, undefined, principal);
+      // For safety reasons, in the drop case we don't want to immediately show
+      // the the dropped value, instead we want to keep showing the current page
+      // url until an onLocationChange happens.
+      // See the handling in URLBarSetURI for further details.
+      this.window.gBrowser.userTypedValue = null;
+      this.window.URLBarSetURI(null, true);
     }
-    let principal = Services.droppedLinkHandler.getTriggeringPrincipal(event);
-    this.value = droppedItem instanceof URL ? droppedItem.href : droppedItem;
-    this.window.SetPageProxyState("invalid");
-    this.focus();
-    this.handleCommand(null, undefined, undefined, principal);
-    // For safety reasons, in the drop case we don't want to immediately show
-    // the the dropped value, instead we want to keep showing the current page
-    // url until an onLocationChange happens.
-    // See the handling in URLBarSetURI for further details.
-    this.window.gBrowser.userTypedValue = null;
-    this.window.URLBarSetURI(null, true);
   }
 }
 
 /**
  * Tries to extract droppable data from a DND event.
  * @param {Event} event The DND event to examine.
  * @returns {URL|string|null}
  *          null if there's a security reason for which we should do nothing.