Bug 1111960. r=gavin a=sylvestre
authorFelipe Gomes <felipc@gmail.com>
Mon, 09 Feb 2015 15:47:40 -0200
changeset 243727 5d37d11b64f2
parent 243726 05befa69d765
child 243728 8174cebcfbbd
push id4453
push userfelipc@gmail.com
push date2015-02-09 17:49 +0000
treeherdermozilla-beta@5d37d11b64f2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin, sylvestre
bugs1111960
milestone36.0
Bug 1111960. r=gavin a=sylvestre
browser/base/content/content.js
browser/components/nsBrowserGlue.js
browser/modules/ContentClick.jsm
browser/modules/moz.build
--- a/browser/base/content/content.js
+++ b/browser/base/content/content.js
@@ -535,45 +535,16 @@ let ClickEventHandler = {
       this.onAboutCertError(originalTarget, ownerDoc);
       return;
     } else if (ownerDoc.documentURI.startsWith("about:blocked")) {
       this.onAboutBlocked(originalTarget, ownerDoc);
       return;
     } else if (ownerDoc.documentURI.startsWith("about:neterror")) {
       this.onAboutNetError(originalTarget, ownerDoc);
     }
-
-    let [href, node] = this._hrefAndLinkNodeForClickEvent(event);
-
-    let json = { button: event.button, shiftKey: event.shiftKey,
-                 ctrlKey: event.ctrlKey, metaKey: event.metaKey,
-                 altKey: event.altKey, href: null, title: null,
-                 bookmark: false };
-
-    if (href) {
-      json.href = href;
-      if (node) {
-        json.title = node.getAttribute("title");
-        if (event.button == 0 && !event.ctrlKey && !event.shiftKey &&
-            !event.altKey && !event.metaKey) {
-          json.bookmark = node.getAttribute("rel") == "sidebar";
-          if (json.bookmark) {
-            event.preventDefault(); // Need to prevent the pageload.
-          }
-        }
-      }
-
-      sendAsyncMessage("Content:Click", json);
-      return;
-    }
-
-    // This might be middle mouse navigation.
-    if (event.button == 1) {
-      sendAsyncMessage("Content:Click", json);
-    }
   },
 
   onAboutCertError: function (targetElement, ownerDoc) {
     let docshell = ownerDoc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
                                        .getInterface(Ci.nsIWebNavigation)
                                        .QueryInterface(Ci.nsIDocShell);
     let serhelper = Cc["@mozilla.org/network/serialization-helper;1"]
                      .getService(Ci.nsISerializationHelper);
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -18,19 +18,16 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource:///modules/AboutHome.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "UITour",
                                   "resource:///modules/UITour.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
                                   "resource://gre/modules/AddonManager.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, "ContentClick",
-                                  "resource:///modules/ContentClick.jsm");
-
 XPCOMUtils.defineLazyModuleGetter(this, "DirectoryLinksProvider",
                                   "resource:///modules/DirectoryLinksProvider.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
                                   "resource://gre/modules/NetUtil.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
                                   "resource://gre/modules/FileUtils.jsm");
@@ -583,17 +580,16 @@ BrowserGlue.prototype = {
 #endif
     webrtcUI.init();
     AboutHome.init();
     SessionStore.init();
     BrowserUITelemetry.init();
     ContentSearch.init();
     FormValidationHandler.init();
 
-    ContentClick.init();
     RemotePrompt.init();
     ContentPrefServiceParent.init();
 
     LoginManagerParent.init();
 
 #ifdef NIGHTLY_BUILD
     Services.prefs.addObserver(POLARIS_ENABLED, this, false);
 #endif
deleted file mode 100644
--- a/browser/modules/ContentClick.jsm
+++ /dev/null
@@ -1,82 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-let Cc = Components.classes;
-let Ci = Components.interfaces;
-let Cu = Components.utils;
-
-this.EXPORTED_SYMBOLS = [ "ContentClick" ];
-
-Cu.import("resource:///modules/PlacesUIUtils.jsm");
-Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-
-let ContentClick = {
-  init: function() {
-    let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
-    mm.addMessageListener("Content:Click", this);
-  },
-
-  receiveMessage: function (message) {
-    switch (message.name) {
-      case "Content:Click":
-        this.contentAreaClick(message.json, message.target)
-        break;
-    }
-  },
-
-  contentAreaClick: function (json, browser) {
-    // This is heavily based on contentAreaClick from browser.js (Bug 903016)
-    // The json is set up in a way to look like an Event.
-    let window = browser.ownerDocument.defaultView;
-
-    if (!json.href) {
-      // Might be middle mouse navigation.
-      if (Services.prefs.getBoolPref("middlemouse.contentLoadURL") &&
-          !Services.prefs.getBoolPref("general.autoScroll")) {
-        window.middleMousePaste(json);
-      }
-      return;
-    }
-
-    if (json.bookmark) {
-      // This is the Opera convention for a special link that, when clicked,
-      // allows to add a sidebar panel.  The link's title attribute contains
-      // the title that should be used for the sidebar panel.
-      PlacesUIUtils.showBookmarkDialog({ action: "add"
-                                       , type: "bookmark"
-                                       , uri: Services.io.newURI(json.href, null, null)
-                                       , title: json.title
-                                       , loadBookmarkInSidebar: true
-                                       , hiddenRows: [ "description"
-                                                     , "location"
-                                                     , "keyword" ]
-                                       }, window);
-      return;
-    }
-
-    // Note: We don't need the sidebar code here.
-
-    // This part is based on handleLinkClick.
-    var where = window.whereToOpenLink(json);
-    if (where == "current")
-      return false;
-
-    // Todo(903022): code for where == save
-
-    window.openLinkIn(json.href, where, { referrerURI: browser.documentURI,
-                                          charset: browser.characterSet });
-
-    // Mark the page as a user followed link.  This is done so that history can
-    // distinguish automatic embed visits from user activated ones.  For example
-    // pages loaded in frames are embed visits and lost with the session, while
-    // visits across frames should be preserved.
-    try {
-      if (!PrivateBrowsingUtils.isWindowPrivate(window))
-        PlacesUIUtils.markPageAsFollowedLink(href);
-    } catch (ex) { /* Skip invalid URIs. */ }
-  }
-};
--- a/browser/modules/moz.build
+++ b/browser/modules/moz.build
@@ -10,17 +10,16 @@ XPCSHELL_TESTS_MANIFESTS += [
     'test/xpcshell/xpcshell.ini',
 ]
 
 EXTRA_JS_MODULES += [
     'BrowserNewTabPreloader.jsm',
     'BrowserUITelemetry.jsm',
     'CastingApps.jsm',
     'Chat.jsm',
-    'ContentClick.jsm',
     'ContentLinkHandler.jsm',
     'ContentSearch.jsm',
     'ContentWebRTC.jsm',
     'CustomizationTabPreloader.jsm',
     'DirectoryLinksProvider.jsm',
     'E10SUtils.jsm',
     'Feeds.jsm',
     'FormSubmitObserver.jsm',