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

Symbol bug set unconfigure object trigger stack overflow #163

Closed
ghost opened this issue Jan 23, 2016 · 10 comments
Closed

Symbol bug set unconfigure object trigger stack overflow #163

ghost opened this issue Jan 23, 2016 · 10 comments
Labels

Comments

@ghost
Copy link

ghost commented Jan 23, 2016

function set_(o, k, d) {
    Object.defineProperty(o, k, Object.assign({
        enumerable: true,
        configurable: true
    }, d));
    return o;
}

function set(k) {
    set_(Object.prototype, k, {
        set: function (v) {
            console.info('set %s of %O to %s', k, this, v);
            set_(this, k, {value: v, writable: true});
        }
    });
    return function (o, v) {
        o[k] = v;
        return o;
    };
}

set('a')({}, 7).a // 7
set('a')(localStorage, 7).a // stackoverflow for IE 11
@ghost ghost changed the title Symbol bug set not configure object trigger stack overflow Symbol bug set unconfigure object trigger stack overflow Jan 23, 2016
@zloirock
Copy link
Owner

I don't quite understand what do you mean. I see this problem in IE11 without core-js too.

@ghost
Copy link
Author

ghost commented Jan 24, 2016

@zloirock
Copy link
Owner

Yep, usage Symbol polyfill with the current approach on IE11 localStorage is not a good idea. Exotic environment objects (and their non-standard / buggy implementations) out of the core-js scope. Or you can propose any solution?

@ghost
Copy link
Author

ghost commented Jan 24, 2016

There is no solution seems

Supplement recommended in the document

@zloirock
Copy link
Owner

Thanks for the report. Added note about it.

@zloirock zloirock added the ie label Feb 6, 2016
@ghost
Copy link
Author

ghost commented Feb 16, 2016

var Test = Symbol();
var connection = new WebSocket('wss://echo.websocket.org/')
connection[Test] = 'Test'; // stackoverflow for IE 11 (Symbol.useSetter only)

check is WebSocket object use Symbol.useSimple ?

@zloirock
Copy link
Owner

@LiaoSept thanks for the warning. It's a very specific case, I think the note in the readme enough.

@ghost
Copy link
Author

ghost commented Mar 16, 2016

var TestObject = {};
Object.seal(TestObject);
TestObject[Test] = 'Test'; // Cannot define property 'Symbol()_m.*': object is not extensible
var TestObject = {};
Object.freeze(TestObject);
TestObject[Test] = 'Test'; // Cannot define property 'Symbol()_m.*': object is not extensible

@ghost
Copy link
Author

ghost commented Apr 19, 2016

@zloirock

@zloirock
Copy link
Owner

zloirock commented Apr 19, 2016

@LiaoSept sorry, I missed your comment.

Symbol polyfill uses defineProperty and defined in the strict mode, we can't detect the mode of caller code. I don't think something can be done here, you can propose something or add PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant