Bug 579340 - Miscellaneous code cleanup [r=vingtetun]
authorMark Finkle <mfinkle@mozilla.com>
Fri, 16 Jul 2010 11:48:52 -0400
changeset 66369 02e4b4ed3fa2bb679befd891a19e6ea907e4bb75
parent 66368 4d5b9427101ebfc18d850756ebc20da383a32766
child 66370 cbf83ee8e2b10f074894988985510482b7f3ee03
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvingtetun
bugs579340
Bug 579340 - Miscellaneous code cleanup [r=vingtetun]
mobile/chrome/content/BrowserView.js
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/BrowserView.js
+++ b/mobile/chrome/content/BrowserView.js
@@ -522,21 +522,21 @@ BrowserView.prototype = {
 
   _ignorePageScroll: false,
   ignorePageScroll: function ignorePageScroll(aIgnoreScroll) {
     this._ignorePageScroll = aIgnoreScroll;
   },
 
   updateScrolledArea: function updateScrolledArea(aMessage) {
     let browser = aMessage.target;
-    if (!browser)
-      throw "MozScrolledAreaChanged: Could not find browser";
+    let tab = Browser.getTabForBrowser(browser);
+    if (!browser || !tab)
+      return;
 
     let json = aMessage.json;
-    let tab = Browser.getTabForBrowser(browser);
     let bvs = tab.browserViewportState;
 
     let vis = this.getVisibleRect();
     let viewport = bvs.viewportRect;
     let oldRight = viewport.right;
     let oldBottom = viewport.bottom;
     viewport.right  = bvs.zoomLevel * json.width;
     viewport.bottom = bvs.zoomLevel * json.height;
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -2094,58 +2094,55 @@ var MemoryObserver = {
     Components.utils.forceGC();
   }
 };
 
 function getNotificationBox(aWindow) {
   return Browser.getNotificationBox();
 }
 
-function importDialog(parent, src, arguments) {
+function importDialog(aParent, aSrc, aArguments) {
   // load the dialog with a synchronous XHR
   let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance();
-  xhr.open("GET", src, false);
+  xhr.open("GET", aSrc, false);
   xhr.overrideMimeType("text/xml");
   xhr.send(null);
   if (!xhr.responseXML)
     return null;
 
   let currentNode;
-  let nodeIterator = xhr.responseXML.createNodeIterator(xhr.responseXML,
-                                                    NodeFilter.SHOW_TEXT,
-                                                    null,
-                                                    false);
+  let nodeIterator = xhr.responseXML.createNodeIterator(xhr.responseXML, NodeFilter.SHOW_TEXT, null, false);
   while (currentNode = nodeIterator.nextNode()) {
     let trimmed = currentNode.nodeValue.replace(/^\s\s*/, "").replace(/\s\s*$/, "");
     if (!trimmed.length)
       currentNode.parentNode.removeChild(currentNode);
   }
 
   let doc = xhr.responseXML.documentElement;
 
   var dialog  = null;
 
   // we need to insert before select-container if we want it to show correctly
   let selectContainer = document.getElementById("select-container");
-  let parent = selectContainer.parentNode;
+  let parentNode = selectContainer.parentNode;
 
   // emit DOMWillOpenModalDialog event
   let event = document.createEvent("Events");
   event.initEvent("DOMWillOpenModalDialog", true, false);
-  let dispatcher = parent || getBrowser();
+  let dispatcher = aParent || getBrowser();
   dispatcher.dispatchEvent(event);
 
   // create a full-screen semi-opaque box as a background
   let back = document.createElement("box");
   back.setAttribute("class", "modal-block");
   dialog = back.appendChild(document.importNode(doc, true));
-  parent.insertBefore(back, selectContainer);
-
-  dialog.arguments = arguments;
-  dialog.parent = parent;
+  parentNode.insertBefore(back, selectContainer);
+
+  dialog.arguments = aArguments;
+  dialog.parent = aParent;
   return dialog;
 }
 
 function showDownloadManager(aWindowContext, aID, aReason) {
   BrowserUI.showPanel("downloads-container");
   // TODO: select the download with aID
 }