Bug 682048 - Change Metro frame script handling to support anon/global scope (r=jimm,mbrubeck)
☠☠ backed out by 874788e2239c ☠ ☠
authorBill McCloskey <wmccloskey@mozilla.com>
Sat, 23 Nov 2013 21:32:32 -0800
changeset 174323 bc00eed50b7d58bc620ecb6d68d0ae976044caaf
parent 174322 30a8127b9277deb536cafa063649fefff9af34e4
child 174324 e7aa50b699940b168766e40359b5deb8443d2e9f
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm, mbrubeck
bugs682048
milestone28.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 682048 - Change Metro frame script handling to support anon/global scope (r=jimm,mbrubeck)
browser/metro/base/content/Util.js
browser/metro/base/content/bindings/browser.js
browser/metro/base/content/contenthandlers/ConsoleAPIObserver.js
browser/metro/base/content/contenthandlers/Content.js
browser/metro/base/content/contenthandlers/ContextMenuHandler.js
browser/metro/base/content/contenthandlers/FindHandler.js
browser/metro/base/content/contenthandlers/FormHelper.js
browser/metro/base/content/contenthandlers/SelectionHandler.js
browser/metro/base/content/library/SelectionPrototype.js
--- a/browser/metro/base/content/Util.js
+++ b/browser/metro/base/content/Util.js
@@ -1,12 +1,15 @@
 /* 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/. */
 
+let Cc = Components.classes;
+let Ci = Components.interfaces;
+
 Components.utils.import("resource:///modules/ContentUtil.jsm");
 
 let Util = {
   /*
    * General purpose utilities
    */
 
   getWindowUtils: function getWindowUtils(aWindow) {
@@ -403,8 +406,10 @@ Util.Timeout.prototype = {
 // Mixin the ContentUtil module exports
 {
   for (let name in ContentUtil) {
     let copy = ContentUtil[name];
     if (copy !== undefined)
       Util[name] = copy;
   }
 }
+
+this.Util = Util;
--- a/browser/metro/base/content/bindings/browser.js
+++ b/browser/metro/base/content/bindings/browser.js
@@ -659,16 +659,17 @@ let ContentScroll =  {
     // composition.
     sendSyncMessage("Browser:ContentScroll",
       { presShellId: presShellId.value,
         viewId: viewId,
         scrollOffset: scrollOffset,
         isRoot: isRoot });
   }
 };
+this.ContentScroll = ContentScroll;
 
 ContentScroll.init();
 
 let ContentActive =  {
   init: function() {
     addMessageListener("Content:Activate", this);
     addMessageListener("Content:Deactivate", this);
   },
--- a/browser/metro/base/content/contenthandlers/ConsoleAPIObserver.js
+++ b/browser/metro/base/content/contenthandlers/ConsoleAPIObserver.js
@@ -1,12 +1,15 @@
 /* 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/. */
 
+let Ci = Components.interfaces;
+let Cc = Components.classes;
+
 dump("### ConsoleAPIObserver.js loaded\n");
 
 /*
  * ConsoleAPIObserver
  *
  */ 
 
 var ConsoleAPIObserver = {
@@ -111,11 +114,12 @@ var ConsoleAPIObserver = {
     // Remove all but the last path component.
     let slashIndex = aSourceURL.lastIndexOf("/");
     if (slashIndex > -1)
       aSourceURL = aSourceURL.substring(slashIndex + 1);
 
     return aSourceURL;
   }
 };
+this.ConsoleAPIObserver = ConsoleAPIObserver;
 
 ConsoleAPIObserver.init();
 
--- a/browser/metro/base/content/contenthandlers/Content.js
+++ b/browser/metro/base/content/contenthandlers/Content.js
@@ -32,23 +32,23 @@ XPCOMUtils.defineLazyModuleGetter(this, 
   "resource://gre/modules/LoginManagerContent.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(this, "gFocusManager",
   "@mozilla.org/focus-manager;1", "nsIFocusManager");
 
 XPCOMUtils.defineLazyServiceGetter(this, "gDOMUtils",
   "@mozilla.org/inspector/dom-utils;1", "inIDOMUtils");
 
-let XULDocument = Ci.nsIDOMXULDocument;
-let HTMLHtmlElement = Ci.nsIDOMHTMLHtmlElement;
-let HTMLIFrameElement = Ci.nsIDOMHTMLIFrameElement;
-let HTMLFrameElement = Ci.nsIDOMHTMLFrameElement;
-let HTMLFrameSetElement = Ci.nsIDOMHTMLFrameSetElement;
-let HTMLSelectElement = Ci.nsIDOMHTMLSelectElement;
-let HTMLOptionElement = Ci.nsIDOMHTMLOptionElement;
+this.XULDocument = Ci.nsIDOMXULDocument;
+this.HTMLHtmlElement = Ci.nsIDOMHTMLHtmlElement;
+this.HTMLIFrameElement = Ci.nsIDOMHTMLIFrameElement;
+this.HTMLFrameElement = Ci.nsIDOMHTMLFrameElement;
+this.HTMLFrameSetElement = Ci.nsIDOMHTMLFrameSetElement;
+this.HTMLSelectElement = Ci.nsIDOMHTMLSelectElement;
+this.HTMLOptionElement = Ci.nsIDOMHTMLOptionElement;
 
 const kReferenceDpi = 240; // standard "pixel" size used in some preferences
 
 const kStateActive = 0x00000001; // :active pseudoclass for elements
 
 const kZoomToElementMargin = 16; // in px
 
 /*
@@ -77,16 +77,17 @@ function getBoundingContentRect(aElement
     let rect = frame.frameElement.getBoundingClientRect();
     let left = frame.getComputedStyle(frame.frameElement, "").borderLeftWidth;
     let top = frame.getComputedStyle(frame.frameElement, "").borderTopWidth;
     offset.add(rect.left + parseInt(left), rect.top + parseInt(top));
   }
 
   return new Rect(r.left + offset.x, r.top + offset.y, r.width, r.height);
 }
+this.getBoundingContentRect = getBoundingContentRect;
 
 /*
  * getOverflowContentBoundingRect
  *
  * @param aElement
  * @return Bounding content rect adjusted for scroll and frame offsets.
  */
 
@@ -103,16 +104,17 @@ function getOverflowContentBoundingRect(
   }
 
   for (let i = 0; i < aElement.childElementCount; i++) {
     r = r.union(getBoundingContentRect(aElement.children[i]));
   }
 
   return r;
 }
+this.getOverflowContentBoundingRect = getOverflowContentBoundingRect;
 
 /*
  * Content
  *
  * Browser event receiver for content.
  */
 let Content = {
   _debugEvents: false,
@@ -579,10 +581,11 @@ var FormSubmitObserver = {
   QueryInterface : function(aIID) {
     if (!aIID.equals(Ci.nsIFormSubmitObserver) &&
         !aIID.equals(Ci.nsISupportsWeakReference) &&
         !aIID.equals(Ci.nsISupports))
       throw Cr.NS_ERROR_NO_INTERFACE;
     return this;
   }
 };
+this.Content = Content;
 
 FormSubmitObserver.init();
--- a/browser/metro/base/content/contenthandlers/ContextMenuHandler.js
+++ b/browser/metro/base/content/contenthandlers/ContextMenuHandler.js
@@ -1,13 +1,16 @@
 /* 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/. */
 
-const kXLinkNamespace = "http://www.w3.org/1999/xlink";
+let Ci = Components.interfaces;
+let Cc = Components.classes;
+
+this.kXLinkNamespace = "http://www.w3.org/1999/xlink";
 
 dump("### ContextMenuHandler.js loaded\n");
 
 var ContextMenuHandler = {
   _types: [],
   _previousState: null,
 
   init: function ch_init() {
@@ -378,10 +381,11 @@ var ContextMenuHandler = {
     this._types.push({name: aName, handler: aHandler});
   },
 
   /** Remove all handlers registered for a given type. */
   unregisterType: function unregisterType(aName) {
     this._types = this._types.filter(function(type) type.name != aName);
   }
 };
+this.ContextMenuHandler = ContextMenuHandler;
 
 ContextMenuHandler.init();
--- a/browser/metro/base/content/contenthandlers/FindHandler.js
+++ b/browser/metro/base/content/contenthandlers/FindHandler.js
@@ -1,12 +1,15 @@
 /* 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/. */
 
+let Ci = Components.interfaces;
+let Cc = Components.classes;
+
 dump("### FindHandler.js loaded\n");
 
 var FindHandler = {
   get _fastFind() {
     delete this._fastFind;
     this._fastFind = Cc["@mozilla.org/typeaheadfind;1"].createInstance(Ci.nsITypeAheadFind);
     this._fastFind.init(docShell);
     return this._fastFind;
@@ -78,10 +81,11 @@ var FindHandler = {
         rect: rect.isEmpty() ? null: rect,
         contentHeight: content.document.documentElement.scrollHeight,
         result: findResult
       });
     });
     timer.once(0);
   }
 };
+this.FindHandler = FindHandler;
 
 FindHandler.init();
--- a/browser/metro/base/content/contenthandlers/FormHelper.js
+++ b/browser/metro/base/content/contenthandlers/FormHelper.js
@@ -571,16 +571,17 @@ FormAssistant.prototype = {
       let node = aNodes[i];
       if (node.type == "radio" && chosenRadios[node.name] != node)
         continue;
       result.push(node);
     }
     return result;
   }
 };
+this.FormAssistant = FormAssistant;
 
 
 /******************************************************************************
  * The next classes wraps some forms elements such as different type of list to
  * abstract the difference between html and xul element while manipulating them
  *  - SelectWrapper   : <html:select>
  *  - MenulistWrapper : <xul:menulist>
  *****************************************************************************/
@@ -699,16 +700,17 @@ SelectWrapper.prototype = {
     evt.initEvent("change", true, true, this._control.ownerDocument.defaultView, 0,
                   false, false,
                   false, false, null);
     content.setTimeout(function() {
       control.dispatchEvent(evt);
     }, 0);
   }
 };
+this.SelectWrapper = SelectWrapper;
 
 
 // bug 559792
 // Use wrappedJSObject when control is in content for extra protection
 function MenulistWrapper(aControl) {
   this._control = aControl;
 }
 
@@ -756,8 +758,9 @@ MenulistWrapper.prototype = {
     evt.initCommandEvent("command", true, true, window, 0,
                          false, false,
                          false, false, null);
     content.setTimeout(function() {
       control.dispatchEvent(evt);
     }, 0);
   }
 };
+this.MenulistWrapper = MenulistWrapper;
--- a/browser/metro/base/content/contenthandlers/SelectionHandler.js
+++ b/browser/metro/base/content/contenthandlers/SelectionHandler.js
@@ -1,12 +1,15 @@
 /* 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/. */
 
+let Ci = Components.interfaces;
+let Cc = Components.classes;
+
 dump("### SelectionHandler.js loaded\n");
 
 var SelectionHandler = {
   init: function init() {
     this.type = kContentSelector;
     this.snap = true;
     this.lastYPos = this.lastXPos = null;
     addMessageListener("Browser:SelectionStart", this);
@@ -591,12 +594,13 @@ var SelectionHandler = {
       if (docShell == null)
         return null;
       return docShell.QueryInterface(Ci.nsIInterfaceRequestor)
                      .getInterface(Ci.nsISelectionDisplay)
                      .QueryInterface(Ci.nsISelectionController);
     }
   },
 };
+this.SelectionHandler = SelectionHandler;
 
 SelectionHandler.__proto__ = new SelectionPrototype();
 SelectionHandler.init();
 
--- a/browser/metro/base/content/library/SelectionPrototype.js
+++ b/browser/metro/base/content/library/SelectionPrototype.js
@@ -1,24 +1,27 @@
 /* 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 Ci = Components.interfaces;
+let Cc = Components.classes;
+
 /*
  * SelectionPrototype - common base class used by both chrome and content selection logic.
  */
 
 // selection node parameters for various apis
-const kSelectionNodeAnchor = 1;
-const kSelectionNodeFocus = 2;
+this.kSelectionNodeAnchor = 1;
+this.kSelectionNodeFocus = 2;
 
 // selection type property constants
-const kChromeSelector = 1;
-const kContentSelector = 2;
+this.kChromeSelector = 1;
+this.kContentSelector = 2;
 
 dump("### SelectionPrototype.js loaded\n");
 
 /*
   http://mxr.mozilla.org/mozilla-central/source/docshell/base/nsIDocShell.idl
   http://mxr.mozilla.org/mozilla-central/source/content/base/public/nsISelectionDisplay.idl
   http://mxr.mozilla.org/mozilla-central/source/content/base/public/nsISelectionListener.idl
   http://mxr.mozilla.org/mozilla-central/source/content/base/public/nsISelectionPrivate.idl
@@ -946,8 +949,9 @@ SelectionPrototype.prototype = {
    * in init().
    */
   _setDebugPoint: function _setDebugPoint(aX, aY, aColor) {
     let rect = { left: aX - 2, top: aY - 2,
                  right: aX + 2, bottom: aY + 2 };
     this._setDebugRect(rect, aColor, true);
   },
 };
+this.SelectionPrototype = SelectionPrototype;