Bug 822845 - Use 'this' rather than 'self' in gPluginHandler.handleEvent. r=jaws
authorDão Gottwald <dao@mozilla.com>
Wed, 19 Dec 2012 19:39:45 +0100
changeset 116541 ec3653e1a0328eb8c464cfab45b94cccb5341ba6
parent 116540 850b6458a7f09102d0c641c7e32098a7cd0cb7c1
child 116542 1a7f21d5a95aed87cd24852973286cdfd1ba1af6
push id24058
push useremorley@mozilla.com
push dateThu, 20 Dec 2012 21:06:10 +0000
treeherdermozilla-central@868b21bed3eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs822845
milestone20.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 822845 - Use 'this' rather than 'self' in gPluginHandler.handleEvent. r=jaws
browser/base/content/browser-plugins.js
--- a/browser/base/content/browser-plugins.js
+++ b/browser/base/content/browser-plugins.js
@@ -139,17 +139,16 @@ var gPluginHandler = {
         return "PluginPlayPreview";
       default:
         // Not all states map to a handler
         return null;
     }
   },
 
   handleEvent : function(event) {
-    let self = gPluginHandler;
     let plugin = event.target;
     let doc = plugin.ownerDocument;
 
     // We're expecting the target to be a plugin.
     if (!(plugin instanceof Ci.nsIObjectLoadingContent))
       return;
 
     let eventType = event.type;
@@ -159,98 +158,98 @@ var gPluginHandler = {
       // and make sure we don't handle it twice
       let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
       if (!overlay || overlay._bindingHandled) {
         return;
       }
       overlay._bindingHandled = true;
 
       // Lookup the handler for this binding
-      eventType = self._getBindingType(plugin);
+      eventType = this._getBindingType(plugin);
       if (!eventType) {
         // Not all bindings have handlers
         return;
       }
     }
 
     switch (eventType) {
       case "PluginCrashed":
-        self.pluginInstanceCrashed(plugin, event);
+        this.pluginInstanceCrashed(plugin, event);
         break;
 
       case "PluginNotFound":
         // For non-object plugin tags, register a click handler to install the
         // plugin. Object tags can, and often do, deal with that themselves,
         // so don't stomp on the page developers toes.
         if (!(plugin instanceof HTMLObjectElement)) {
           // We don't yet check to see if there's actually an installer available.
           let installStatus = doc.getAnonymousElementByAttribute(plugin, "class", "installStatus");
           installStatus.setAttribute("status", "ready");
           let iconStatus = doc.getAnonymousElementByAttribute(plugin, "class", "icon");
           iconStatus.setAttribute("status", "ready");
 
           let installLink = doc.getAnonymousElementByAttribute(plugin, "class", "installPluginLink");
-          self.addLinkClickCallback(installLink, "installSinglePlugin", plugin);
+          this.addLinkClickCallback(installLink, "installSinglePlugin", plugin);
         }
         /* FALLTHRU */
 
       case "PluginBlocklisted":
       case "PluginOutdated":
 #ifdef XP_MACOSX
       case "npapi-carbon-event-model-failure":
 #endif
-        self.pluginUnavailable(plugin, eventType);
+        this.pluginUnavailable(plugin, eventType);
         break;
 
       case "PluginVulnerableUpdatable":
         let updateLink = doc.getAnonymousElementByAttribute(plugin, "class", "checkForUpdatesLink");
-        self.addLinkClickCallback(updateLink, "openPluginUpdatePage");
+        this.addLinkClickCallback(updateLink, "openPluginUpdatePage");
         /* FALLTHRU */
 
       case "PluginVulnerableNoUpdate":
       case "PluginClickToPlay":
-        self._handleClickToPlayEvent(plugin);
+        this._handleClickToPlayEvent(plugin);
         let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
-        let pluginName = self._getPluginInfo(plugin).pluginName;
+        let pluginName = this._getPluginInfo(plugin).pluginName;
         let messageString = gNavigatorBundle.getFormattedString("PluginClickToPlay", [pluginName]);
         let overlayText = doc.getAnonymousElementByAttribute(plugin, "class", "msg msgClickToPlay");
         overlayText.textContent = messageString;
         if (eventType == "PluginVulnerableUpdatable" ||
             eventType == "PluginVulnerableNoUpdate") {
           let vulnerabilityString = gNavigatorBundle.getString(eventType);
           let vulnerabilityText = doc.getAnonymousElementByAttribute(plugin, "anonid", "vulnerabilityStatus");
           vulnerabilityText.textContent = vulnerabilityString;
         }
         break;
 
       case "PluginPlayPreview":
-        self._handlePlayPreviewEvent(plugin);
+        this._handlePlayPreviewEvent(plugin);
         break;
 
       case "PluginDisabled":
         let manageLink = doc.getAnonymousElementByAttribute(plugin, "class", "managePluginsLink");
-        self.addLinkClickCallback(manageLink, "managePlugins");
+        this.addLinkClickCallback(manageLink, "managePlugins");
         break;
 
       case "PluginScripted":
         let browser = gBrowser.getBrowserForDocument(doc.defaultView.top.document);
         if (browser._pluginScriptedState == this.PLUGIN_SCRIPTED_STATE_NONE) {
           browser._pluginScriptedState = this.PLUGIN_SCRIPTED_STATE_FIRED;
           setTimeout(function() {
             gPluginHandler.handlePluginScripted(this);
           }.bind(browser), 500);
         }
         break;
     }
 
     // Hide the in-content UI if it's too big. The crashed plugin handler already did this.
     if (eventType != "PluginCrashed") {
       let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
-      if (overlay != null && self.isTooSmall(plugin, overlay))
-          overlay.style.visibility = "hidden";
+      if (overlay != null && this.isTooSmall(plugin, overlay))
+        overlay.style.visibility = "hidden";
     }
   },
 
   _notificationDisplayedOnce: false,
   handlePluginScripted: function PH_handlePluginScripted(aBrowser) {
     let contentWindow = aBrowser.contentWindow;
     if (!contentWindow)
       return;