[Pkg-mozext-commits] [autofill-forms] 02/10: possible fix for the recent crash reports

David Prévot taffit at moszumanska.debian.org
Fri May 27 19:28:27 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository autofill-forms.

commit e3873e15ef6037852340a41f57ead20a8b7a32e6
Author: Sarah Avilov <sarah.avilov at gmail.com>
Date:   Mon May 23 18:06:56 2016 +0430

    possible fix for the recent crash reports
---
 aff.xpi                         | Bin 153765 -> 153786 bytes
 chrome/content/autofillForms.js |  37 +++++++++++++++++++------------------
 chrome/content/inject.js        |   9 +++++----
 chrome/content/sdk.js           |   9 +++++----
 install.rdf                     |   6 +++---
 5 files changed, 32 insertions(+), 29 deletions(-)

diff --git a/aff.xpi b/aff.xpi
index 33c30c7..8d23539 100644
Binary files a/aff.xpi and b/aff.xpi differ
diff --git a/chrome/content/autofillForms.js b/chrome/content/autofillForms.js
index 3791ede..1854ac5 100644
--- a/chrome/content/autofillForms.js
+++ b/chrome/content/autofillForms.js
@@ -8,7 +8,7 @@
 
 var autofillForms = {
   require: (function () {
-    var {require} = Cu.import("resource://gre/modules/commonjs/toolkit/require.js", {});
+    var {require} = Components.utils.import("resource://gre/modules/commonjs/toolkit/require.js", {});
     return require ? {
       Worker: require('sdk/content/worker').Worker,
       utils: require('sdk/tabs/utils'),
@@ -100,11 +100,10 @@ var autofillForms = {
   version: "1.0.4",
 
   action: function (elem, cmd, val) {
+    console.error(cmd);
     elem.setAttribute('data-aff-' + cmd, val);
 
     var doc = elem.ownerDocument;
-    var contentWindow = doc.defaultView || doc.parentWindow;
-
 
     function oldMethod () {
       console.error('old Method');
@@ -119,24 +118,26 @@ var autofillForms = {
       mm.sendAsyncMessage(cmd);
     }
 
-    if ('Worker' in autofillForms.require && contentWindow) {
-      var tab = autofillForms.require.utils.getTabForContentWindow(contentWindow);
-      if (tab) {
-        var tabId = autofillForms.require.utils.getTabId(tab);
-        for each (let sdkTab in autofillForms.require.tabs) {
-          if (sdkTab.id === tabId) {
-            let worker = sdkTab.attach({
-              contentScriptFile: 'resource://autofillforms/sdk.js',
-            });
-            worker.port.on('done', function () {
-              worker.destroy();
-            });
-            worker.port.emit(cmd, val);
-            return;
+    if ('Worker' in autofillForms.require && doc) {
+      var contentWindow = doc.defaultView || doc.parentWindow;
+      if (contentWindow) {
+        var tab = autofillForms.require.utils.getTabForContentWindow(contentWindow);
+        if (tab) {
+          var tabId = autofillForms.require.utils.getTabId(tab);
+          for each (let sdkTab in autofillForms.require.tabs) {
+            if (sdkTab && sdkTab.id === tabId) {
+              let worker = sdkTab.attach({
+                contentScriptFile: 'resource://autofillforms/sdk.js',
+              });
+              worker.port.on('done', function () {
+                worker.destroy();
+              });
+              worker.port.emit(cmd, val);
+              return;
+            }
           }
         }
       }
-
       oldMethod();
     }
     else {
diff --git a/chrome/content/inject.js b/chrome/content/inject.js
index 5e28fa2..32f83ba 100644
--- a/chrome/content/inject.js
+++ b/chrome/content/inject.js
@@ -16,6 +16,7 @@ function toList (att) {
     [content.document],
     [].map.call(content.document.getElementsByTagName('iframe'), f => f.contentDocument)
   )
+  .filter(doc => doc)
   .map(function (doc) {
     return [].slice.call(doc.querySelectorAll(att), 0);
   })
@@ -25,26 +26,26 @@ function toList (att) {
 }
 
 addMessageListener('click', function () {
-  toList('[data-aff-click=true]').forEach(function (elem) {
+  toList('[data-aff-click]').forEach(function (elem) {
     elem.removeAttribute('data-aff-click');
     elem.click();
   });
 });
 addMessageListener('submit', function () {
-  toList('[data-aff-submit=true]').forEach(function (elem) {
+  toList('[data-aff-submit]').forEach(function (elem) {
     elem.removeAttribute('data-aff-submit');
     elem.submit();
   });
 });
 addMessageListener('focus', function () {
-  toList('[data-aff-focus=true]').forEach(function (elem) {
+  toList('[data-aff-focus]').forEach(function (elem) {
     elem.removeAttribute('data-aff-focus');
     elem.focus();
     onchange(elem);
   });
 });
 addMessageListener('change', function () {
-  toList('[data-aff-change=true]').forEach(function (elem) {
+  toList('[data-aff-change]').forEach(function (elem) {
     elem.removeAttribute('data-aff-change');
     onchange(elem);
   });
diff --git a/chrome/content/sdk.js b/chrome/content/sdk.js
index 62df9ac..35d56d0 100644
--- a/chrome/content/sdk.js
+++ b/chrome/content/sdk.js
@@ -16,6 +16,7 @@ function toList (att) {
     [window.document],
     [].map.call(window.document.getElementsByTagName('iframe'), f => f.contentDocument)
   )
+  .filter(doc => doc)
   .map(function (doc) {
     return [].slice.call(doc.querySelectorAll(att), 0);
   })
@@ -25,21 +26,21 @@ function toList (att) {
 }
 
 self.port.on('click', function () {
-  toList('[data-aff-click=true]').forEach(function (elem) {
+  toList('[data-aff-click]').forEach(function (elem) {
     elem.removeAttribute('data-aff-click');
     elem.click();
   });
   self.port.emit('done');
 });
 self.port.on('submit', function () {
-  toList('[data-aff-submit=true]').forEach(function (elem) {
+  toList('[data-aff-submit]').forEach(function (elem) {
     elem.removeAttribute('data-aff-submit');
     elem.submit();
   });
   self.port.emit('done');
 });
 self.port.on('focus', function () {
-  toList('[data-aff-focus=true]').forEach(function (elem) {
+  toList('[data-aff-focus]').forEach(function (elem) {
     elem.removeAttribute('data-aff-focus');
     elem.focus();
     onchange(elem);
@@ -47,7 +48,7 @@ self.port.on('focus', function () {
   self.port.emit('done');
 });
 self.port.on('change', function () {
-  toList('[data-aff-change=true]').forEach(function (elem) {
+  toList('[data-aff-change]').forEach(function (elem) {
     elem.removeAttribute('data-aff-change');
     onchange(elem);
   });
diff --git a/install.rdf b/install.rdf
index acf8e47..10fe722 100644
--- a/install.rdf
+++ b/install.rdf
@@ -9,14 +9,14 @@
     <em:iconURL>chrome://autofillForms/skin/icon.png</em:iconURL>
     <em:optionsURL>chrome://autofillForms/content/autofillFormsOptions.xul</em:optionsURL>
     <em:homepageURL>http://firefox.add0n.com/autofill-forms.html</em:homepageURL>
-    <em:version>1.1.1</em:version>
+    <em:version>1.1.3b1</em:version>
     <em:type>2</em:type>
     <em:targetApplication>
       <Description>
         <!-- Firefox -->
         <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
-        <em:minVersion>17.0</em:minVersion>
-        <em:maxVersion>35.0</em:maxVersion>
+        <em:minVersion>29.0</em:minVersion>
+        <em:maxVersion>*</em:maxVersion>
       </Description>
     </em:targetApplication>
     <em:targetApplication>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/autofill-forms.git



More information about the Pkg-mozext-commits mailing list