Bug 1528419 - Remove text-link XBL implementation, r=bgrins
authorAlexander Surkov <surkov.alexander@gmail.com>
Tue, 19 Feb 2019 18:04:11 +0000
changeset 517812 3d7db94c5a9f2fd1efe5b09030f10a6d691cfe87
parent 517811 38a2302d1e0755c960e20342904d36f0f4c30496
child 517813 a70b3affe802a1904806536bbab19df57923f98a
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins
bugs1528419
milestone67.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 1528419 - Remove text-link XBL implementation, r=bgrins Differential Revision: https://phabricator.services.mozilla.com/D20346
toolkit/content/widgets/text.xml
--- a/toolkit/content/widgets/text.xml
+++ b/toolkit/content/widgets/text.xml
@@ -251,101 +251,9 @@
         if (controlElement.localName == "checkbox") {
           controlElement.checked = !controlElement.checked;
         } else if (controlElement.localName == "radio") {
           controlElement.control.selectedItem = controlElement;
         }
       ]]></handler>
     </handlers>
   </binding>
-
-  <binding id="text-link">
-    <implementation>
-      <property name="href" onget="return this.getAttribute('href');"
-                            onset="this.setAttribute('href', val); return val;" />
-      <method name="open">
-        <parameter name="aEvent"/>
-        <body>
-        <![CDATA[
-          var href = this.href;
-          if (!href || this.disabled || aEvent.defaultPrevented)
-            return;
-
-          var uri = null;
-          try {
-            const nsISSM = Ci.nsIScriptSecurityManager;
-            const secMan =
-                     Cc["@mozilla.org/scriptsecuritymanager;1"]
-                       .getService(nsISSM);
-
-            const ioService =
-                     Cc["@mozilla.org/network/io-service;1"]
-                       .getService(Ci.nsIIOService);
-
-            uri = ioService.newURI(href);
-
-            let principal;
-            if (this.getAttribute("useoriginprincipal") == "true") {
-              principal = this.nodePrincipal;
-            } else {
-              principal = secMan.createNullPrincipal({});
-            }
-            try {
-              secMan.checkLoadURIWithPrincipal(principal, uri,
-                                               nsISSM.DISALLOW_INHERIT_PRINCIPAL);
-            } catch (ex) {
-              var msg = "Error: Cannot open a " + uri.scheme + ": link using \
-                         the text-link binding.";
-              Cu.reportError(msg);
-              return;
-            }
-
-            const cID = "@mozilla.org/uriloader/external-protocol-service;1";
-            const nsIEPS = Ci.nsIExternalProtocolService;
-            var protocolSvc = Cc[cID].getService(nsIEPS);
-
-            // if the scheme is not an exposed protocol, then opening this link
-            // should be deferred to the system's external protocol handler
-            if (!protocolSvc.isExposedProtocol(uri.scheme)) {
-              protocolSvc.loadURI(uri);
-              aEvent.preventDefault();
-              return;
-            }
-          } catch (ex) {
-            Cu.reportError(ex);
-          }
-
-          aEvent.preventDefault();
-          href = uri ? uri.spec : href;
-
-          // Try handing off the link to the host application, e.g. for
-          // opening it in a tabbed browser.
-          var linkHandled = Cc["@mozilla.org/supports-PRBool;1"]
-                              .createInstance(Ci.nsISupportsPRBool);
-          linkHandled.data = false;
-          let {shiftKey, ctrlKey, metaKey, altKey, button} = aEvent;
-          let data = {shiftKey, ctrlKey, metaKey, altKey, button, href};
-          Cc["@mozilla.org/observer-service;1"]
-            .getService(Ci.nsIObserverService)
-            .notifyObservers(linkHandled, "handle-xul-text-link", JSON.stringify(data));
-          if (linkHandled.data)
-            return;
-
-          // otherwise, fall back to opening the anchor directly
-          var win = window;
-          if (window.isChromeWindow) {
-            while (win.opener && !win.opener.closed)
-              win = win.opener;
-          }
-          win.open(href);
-        ]]>
-        </body>
-      </method>
-    </implementation>
-
-    <handlers>
-      <handler event="click" phase="capturing" button="0" action="this.open(event)"/>
-      <handler event="click" phase="capturing" button="1" action="this.open(event)"/>
-      <handler event="keypress" preventdefault="true" keycode="VK_RETURN" action="this.click()" />
-    </handlers>
-  </binding>
-
 </bindings>