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

Projects
None yet
2 participants
@Infocatcher
Copy link
Owner

commented Aug 10, 2016

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

This comment has been minimized.

Copy link
Owner Author

commented Aug 10, 2016

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

Fix this.windows getter in Firefox 51.0a1+
(SyntaxError: non-generator method definitions may not contain yield)
(#228)

Infocatcher added a commit that referenced this issue Aug 10, 2016

Update changelog:
* 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

Update changelog:
* 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

Update changelog:
* 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

This comment has been minimized.

Copy link
Owner Author

commented Aug 10, 2016

@Infocatcher Infocatcher added the fixed? label Aug 10, 2016

@mikhoul

This comment has been minimized.

Copy link

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

Fix this.windows getter in Firefox 51.0a1+
(SyntaxError: non-generator method definitions may not contain yield)
(see Infocatcher/Private_Tab#228)
@Infocatcher

This comment has been minimized.

Copy link
Owner Author

commented Aug 11, 2016

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

This comment has been minimized.

Copy link

commented Aug 12, 2016

Thanx for the reply ! 😄

Infocatcher added a commit to Infocatcher/Bookmarks_Menu_Filter that referenced this issue Aug 15, 2016

Fix this.windows getter in Firefox 51.0a1+
(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

Fix this.windows getter in Firefox 51.0a1+
(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
You can’t perform that action at this time.