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

Doesn't work in Firefox 51.0a1+ (SyntaxError: non-generator method definitions may not contain yield) #228

Closed
Infocatcher opened this issue Aug 10, 2016 · 5 comments

Comments

@Infocatcher
Copy link
Owner

Currently used (and doesn't work anymore):

var o = {
    get windows() {
        var ws = Services.wm.getEnumerator("navigator:browser");
        while(ws.hasMoreElements())
            yield ws.getNext(); // SyntaxError: non-generator method definitions may not contain yield
    }
};
for(var w in o.windows)
    alert(w.document.title);

Alternatives:

// Legacy generator, will be removed: https://bugzilla.mozilla.org/show_bug.cgi?id=1083482
var o = {
    windows: function() {
        var ws = Services.wm.getEnumerator("navigator:browser");
        while(ws.hasMoreElements())
            yield ws.getNext();
    }
};
for(var w in o.windows())
    alert(w.document.title);
// Modern generator, Firefox 26+
var o = {
    windows: function*() {
        var ws = Services.wm.getEnumerator("navigator:browser");
        while(ws.hasMoreElements())
            yield ws.getNext();
    }
};
for(var w of o.windows())
    alert(w.document.title);
// Old-school array (Firefox 1.5+) + for-of (Firefox 13+)
var o = {
    get windows() {
        var windows = [];
        var ws = Services.wm.getEnumerator("navigator:browser");
        while(ws.hasMoreElements())
            windows.push(ws.getNext());
        return windows;
    }
};
for(var w of o.windows)
    alert(w.document.title);
@Infocatcher
Copy link
Owner Author

Yet another trick:

var o = {
    get windows() {
        return (function*() {
            var ws = Services.wm.getEnumerator("navigator:browser");
            while(ws.hasMoreElements())
                yield ws.getNext();
        })();
    }
};
for(var w of o.windows)
    alert(w.document.title);

Infocatcher added a commit that referenced this issue Aug 10, 2016
(SyntaxError: non-generator method definitions may not contain yield)
(#228)
Infocatcher added a commit that referenced this issue Aug 10, 2016
* unsafe CPOW usage (#208)
* updated pt-PT locale (#210)
* e10s: fixed private protocol (#211)
* e10s: tweaks and fixes (#162)
* e10s: single frame script (#213)
* fixed recursion in wrapper for tab.setAttribute("image", …) (#214)
* compatibility with Firefox 51+: broked this.windows getter (#228)
* small internal enhancements and fixes
Infocatcher added a commit that referenced this issue Aug 10, 2016
* unsafe CPOW usage (#208)
* updated pt-PT locale (#210)
* e10s: fixed private protocol (#211)
* e10s: tweaks and fixes (#162)
* e10s: single frame script (#213)
* fixed recursion in wrapper for tab.setAttribute("image", …) (#214)
* compatibility with Firefox 51+: broked this.windows getter (#228)
* small internal enhancements and fixes
Infocatcher added a commit that referenced this issue Aug 10, 2016
* unsafe CPOW usage (#208)
* updated pt-PT locale (#210)
* e10s: fixed private protocol (#211)
* e10s: tweaks and fixes (#162)
* e10s: single frame script (#213)
* fixed recursion in wrapper for tab.setAttribute("image", …) (#214)
* compatibility with Firefox 51+: broked this.windows getter (#228)
* small internal enhancements and fixes
@Infocatcher
Copy link
Owner Author

Test version: private_tab-0.1.9.2pre4-fx-sm.xpi (source code).

@mikhoul
Copy link

mikhoul commented Aug 10, 2016

Test Version work under 47.0.1 version.

Will this "test" version will update automatically or it's better to update to the release to have automatic update ?

Regards 🐸

Infocatcher added a commit to Infocatcher/Download_Panel_Tweaker that referenced this issue Aug 11, 2016
(SyntaxError: non-generator method definitions may not contain yield)
(see Infocatcher/Private_Tab#228)
@Infocatcher
Copy link
Owner Author

Will this "test" version will update automatically or it's better to update to the release to have automatic update ?

There is custom update URL in test versions:

Private_Tab/install.rdf

Lines 14 to 17 in 78ce514

<em:updateURL>http://infocatcher.ucoz.net/ext/fx/private_tab/update.rdf</em:updateURL>
<em:updateKey>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLgtEbrhCdZetIAanFNvkT441WwBgXcg1Zzlo5s5
j9VLByj/L6UXAVqSria1dejjkKfxVbRXvqalJ7mENRambKpZ4AfV3dBCKUDjME56CMaAK7+DxMqaM3
KEDKXn8XfqL2qkFsgcVjqh6AfltKRcyLGkU9+YQ82EXo6xm47hywoQIDAQAB</em:updateKey>

But for now I'm configure this only to update to release versions (so, test version will be auto-updated to next non-test release).

@mikhoul
Copy link

mikhoul commented Aug 12, 2016

Thanx for the reply ! 😄

Infocatcher added a commit to Infocatcher/Bookmarks_Menu_Filter that referenced this issue Aug 15, 2016
(SyntaxError: non-generator method definitions may not contain yield)
(see Infocatcher/Private_Tab#228)
Infocatcher added a commit to Infocatcher/Close_Download_Tabs that referenced this issue Aug 15, 2016
(SyntaxError: non-generator method definitions may not contain yield)
(see Infocatcher/Private_Tab#228)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants