Bug 685440 - Silence undefined property warnings in Fennec [r=fabrice]
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 08 Sep 2011 09:02:08 -0700
changeset 76739 4e42672330243afad3b5edbe51feba9bc4f1c48f
parent 76738 5e508e52e82451379146d7216675a8d1da8f10e0
child 76740 817c2b9dc11d7d39d91cd1f376e673cb87dc9b77
child 76753 f6d9507d6f6e053e99ef802588fca57830ed7248
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersfabrice
bugs685440
milestone9.0a1
Bug 685440 - Silence undefined property warnings in Fennec [r=fabrice]
mobile/chrome/content/Util.js
mobile/chrome/content/bindings/browser.xml
mobile/chrome/content/browser.js
mobile/chrome/content/content.js
mobile/chrome/content/input.js
--- a/mobile/chrome/content/Util.js
+++ b/mobile/chrome/content/Util.js
@@ -177,16 +177,23 @@ let Util = {
     return (screen.width <= screen.height);
 #elifdef ANDROID
     return (screen.width <= screen.height);
 #else
     return (window.innerWidth <= window.innerHeight);
 #endif
   },
 
+  modifierMaskFromEvent: function modifierMaskFromEvent(aEvent) {
+    return (aEvent.altKey   ? Ci.nsIDOMNSEvent.ALT_MASK     : 0) |
+           (aEvent.ctrlKey  ? Ci.nsIDOMNSEvent.CONTROL_MASK : 0) |
+           (aEvent.shiftKey ? Ci.nsIDOMNSEvent.SHIFT_MASK   : 0) |
+           (aEvent.metaKey  ? Ci.nsIDOMNSEvent.META_MASK    : 0);
+  },
+
   get isKeyboardOpened() {
     // This might get called from the child process, or from a frame script in the
     // parent process (which does not have access to the main "window" global).
     let isChromeWindow = this.isParentProcess() && typeof window == "object" && window["ViewableAreaObserver"];
     if (isChromeWindow)
       return ViewableAreaObserver.isKeyboardOpened;
 
     return (sendSyncMessage("Content:IsKeyboardOpened", {}))[0];
--- a/mobile/chrome/content/bindings/browser.xml
+++ b/mobile/chrome/content/bindings/browser.xml
@@ -373,16 +373,18 @@
           ]]>
         </body>
       </method>
 
       <field name="_frameLoader">null</field>
       <field name="_contentViewManager">null</field>
 
       <!-- Dimensions of content window -->
+      <field name="_contentWindowWidth">0</field>
+      <field name="_contentWindowHeight">0</field>
       <property name="contentWindowWidth"
                 onget="return this._contentWindowWidth;"
                 readonly="true"/>
       <property name="contentWindowHeight"
                 onget="return this._contentWindowHeight;"
                 readonly="true"/>
 
       <!-- Dimensions of content document -->
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -1791,17 +1791,17 @@ const ContentTouchHandler = {
             this.tapDown(aEvent.clientX, aEvent.clientY);
             break;
           case "TapOver":
             this.tapOver(aEvent.clientX, aEvent.clientY);
             break;
           case "TapUp":
             if (aEvent.isClick) {
               if (!Browser.selectedTab.allowZoom) {
-                this.tapSingle(aEvent.clientX, aEvent.clientY, aEvent.modifiers);
+                this.tapSingle(aEvent.clientX, aEvent.clientY, Util.modifierMaskFromEvent(aEvent));
                 aEvent.preventDefault();
               }
             }
             this._dispatchMouseEvent("Browser:MouseUp", aEvent.clientX, aEvent.clientY);
             break;
           case "TapSingle":
             this.tapSingle(aEvent.clientX, aEvent.clientY, aEvent.modifiers);
             this._dispatchMouseEvent("Browser:MouseUp", aEvent.clientX, aEvent.clientY);
@@ -2847,18 +2847,20 @@ Tab.prototype = {
     let browser = this._createBrowser(aURI, null);
 
     // Should we fully load the new browser, or wait until later
     if ("delayLoad" in aParams && aParams.delayLoad)
       return;
 
     try {
       let flags = aParams.flags || Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
-      let postData = aParams.postData ? aParams.postData.value : null;
-      browser.loadURIWithFlags(aURI, flags, aParams.referrerURI, aParams.charset, postData);
+      let postData = "postData" in aParams ? aParams.postData.value : null;
+      let referrerURI = "referrerURI" in aParams ? aParams.referrerURI : null;
+      let charset = "charset" in aParams ? aParams.charset : null;
+      browser.loadURIWithFlags(aURI, flags, referrerURI, charset, postData);
     } catch(e) {
       dump("Error: " + e + "\n");
     }
   },
 
   destroy: function destroy() {
     document.getElementById("tabs").removeTab(this._chromeTab);
     this._chromeTab = null;
@@ -3044,16 +3046,18 @@ Tab.prototype = {
     let screenW = aScreenWidth || this._browser.getBoundingClientRect().width;
     return screenW / browserW;
   },
 
   get allowZoom() {
     return this.metadata.allowZoom && !Util.isURLEmpty(this.browser.currentURI.spec);
   },
 
+  _thumbnailWindowId: null,
+
   updateThumbnail: function updateThumbnail(options) {
     let options = options || {};
     let browser = this._browser;
 
     if (this._loading) {
       this._drawThumb = true;
       return;
     }
--- a/mobile/chrome/content/content.js
+++ b/mobile/chrome/content/content.js
@@ -1272,16 +1272,17 @@ var TouchEventHandler = {
 
   receiveMessage: function(aMessage) {
     let json = aMessage.json;
     if (Util.isParentProcess())
       return;
 
     if (!content.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).mayHaveTouchEventListeners) {
       sendAsyncMessage("Browser:CaptureEvents", {
+        type: null,
         messageId: json.messageId,
         click: false, panning: false,
         contentMightCaptureMouse: false
       });
       return;
     }
 
     let type;
--- a/mobile/chrome/content/input.js
+++ b/mobile/chrome/content/input.js
@@ -501,28 +501,21 @@ MouseModule.prototype = {
       this._dispatchTap("TapDouble", mouseUp1);
     } else {
       this._dispatchTap("TapSingle", mouseUp1);
       this._dispatchTap("TapSingle", mouseUp2);
     }
   },
 
   _dispatchTap: function _dispatchTap(aType, aMouseEvent) {
-    // borrowed from nsIDOMNSEvent.idl
-    let modifiers =
-      (aMouseEvent.altKey   ? Ci.nsIDOMNSEvent.ALT_MASK     : 0) |
-      (aMouseEvent.ctrlKey  ? Ci.nsIDOMNSEvent.CONTROL_MASK : 0) |
-      (aMouseEvent.shiftKey ? Ci.nsIDOMNSEvent.SHIFT_MASK   : 0) |
-      (aMouseEvent.metaKey  ? Ci.nsIDOMNSEvent.META_MASK    : 0);
-
     let event = document.createEvent("Events");
     event.initEvent(aType, true, false);
     event.clientX = aMouseEvent.clientX;
     event.clientY = aMouseEvent.clientY;
-    event.modifiers = modifiers;
+    event.modifiers = Util.modifierMaskFromEvent(aMouseEvent);
     aMouseEvent.originalTarget.dispatchEvent(event);
   },
 
   /**
    * Record a mousedown/mouseup event for later redispatch via
    * _redispatchDownUpEvents()
    */
   _recordEvent: function _recordEvent(aEvent) {