Bug 864891 - b2g/chrome/content/forms.js can dispatch a 'change' event on the wrong window in a single process build. r=fabrice
authorVivien Nicolas <21@vingtetun.org>
Fri, 26 Apr 2013 12:17:25 +0200
changeset 129947 d168bdf3730ad9e5637b7d2260ed6a746a1c924d
parent 129946 10c026f436ed4503950c0c1331132e6580d41aeb
child 129948 4c3d16be564598c58c177f3a2fbc7481e6a0b10e
push id1552
push userttaubert@mozilla.com
push dateSat, 27 Apr 2013 15:33:29 +0000
treeherderfx-team@40dafc376794 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs864891
milestone23.0a1
Bug 864891 - b2g/chrome/content/forms.js can dispatch a 'change' event on the wrong window in a single process build. r=fabrice
b2g/chrome/content/forms.js
--- a/b2g/chrome/content/forms.js
+++ b/b2g/chrome/content/forms.js
@@ -346,17 +346,17 @@ let FormAssistant = {
       return;
     }
 
     let json = msg.json;
     switch (msg.name) {
       case "Forms:Input:Value": {
         target.value = json.value;
 
-        let event = content.document.createEvent('HTMLEvents');
+        let event = target.ownerDocument.createEvent('HTMLEvents');
         event.initEvent('input', true, false);
         target.dispatchEvent(event);
         break;
       }
 
       case "Forms:Select:Choice":
         let options = target.options;
         let valueChanged = false;
@@ -372,17 +372,17 @@ let FormAssistant = {
               options.item(i).selected = newValue;
               valueChanged = true;
             }
           }
         }
 
         // only fire onchange event if any selected option is changed
         if (valueChanged) {
-          let event = content.document.createEvent('HTMLEvents');
+          let event = target.ownerDocument.createEvent('HTMLEvents');
           event.initEvent('change', true, true);
           target.dispatchEvent(event);
         }
         break;
 
       case "Forms:Select:Blur": {
         this.setFocusedElement(null);
         break;