Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty popup in Chrome #2

Merged
merged 1 commit into from
May 25, 2019
Merged

Conversation

tyru
Copy link
Contributor

@tyru tyru commented May 25, 2019

Fix #1
Ref.
KeithHenry/chromeExtensionAsync#10
KeithHenry/chromeExtensionAsync#13

Another fix

Which fix do you like?

diff --git a/src/js/polyfill.js b/src/js/polyfill.js
index 4377236..f2bf59e 100644
--- a/src/js/polyfill.js
+++ b/src/js/polyfill.js
@@ -1,7 +1,7 @@
 
 
 function generateBrowser() {
-  function modifyFunction(f) {
+  function modifyFunction(f, self) {
     return (...args) => {
       return new Promise((resolve, reject) => {
         args.push(items => {
@@ -12,7 +12,7 @@ function generateBrowser() {
             resolve(items);
           }
         })
-        return f.apply(null, args);
+        return f.apply(self, args);
       });
     };
   }
@@ -23,7 +23,7 @@ function generateBrowser() {
 
     let result = {};
     for (let name of definitions) {
-      result[name] = modifyFunction(original[name]);
+      result[name] = modifyFunction(original[name], original);
     }
     return result;
   }

@anekos anekos merged commit c1db909 into anekos:master May 25, 2019
@anekos
Copy link
Owner

anekos commented May 25, 2019

Thanks!

@tyru tyru deleted the fix-empty-popup-chrome branch May 26, 2019 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty popup appears in Chrome when clicking extension icon
2 participants