[Bug 22982] New: Synchronous flag and stack consumption of DOM/Promises

[email protected]
Newsgroups gmane.comp.web.dom.general
Message-ID <[email protected]/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=22982

            Bug ID: 22982
           Summary: Synchronous flag and stack consumption of DOM/Promises
    Classification: Unclassified
           Product: WebAppsWG
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DOM
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
                CC: [email protected], [email protected]

fulfill, resolve and reject algorithms take the synchronous flag.
If it is set the callbacks are processed synchronously i.e. simply called.
If we chain promises and fulfill the original resolver, the promises will be
resolved synchronously, which means stack frames in proportion to the length of
the chain will be consumed.

For example, the following statements leads to a stack overflow error in
Chrome.

var resolver;
var id = 0;
var N = 10000;
var promise = new Promise(function(r) {resolver = r;});
for (var i = 0; i < N; ++i) {
  promise = promise.then(function() {console.log(id++)});
}
resolver.resolve(4);

Promise.every(Promise.every(...(Promise.every(promise))...)) has the same
problem.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.