[Webkit-unassigned] [Bug 166879] Calling async arrow function which is in a class's member function will cause error

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jan 11 00:02:04 PST 2017


https://bugs.webkit.org/show_bug.cgi?id=166879

--- Comment #6 from GSkachkov <gskachkov at gmail.com> ---
(In reply to comment #5)
> I see this issue is solved, but there's another problem. I have updated the
> test code:
> 
> function runSomething(callback) {
> 	callback();
> }
> 
> class Test {
> 	testFunc() {
> 		this.prop = "123";
> 		runSomething(async () => {
> 			console.log("callback " + this.prop); // It's ok here
> 			await sleep(2);
> 			console.log("callback end " + this.prop); // TypeError: undefined is not
> an object (evaluating 'this.prop')
> 		});
> 	}
> }
> 
> let t = new Test();
> t.testFunc();
> 
> Is it another bug? The code above is ok with V8.

Yeah, unfortunately it is another bug. Async arrow function 'lost' _this_, by some reason, during restore state after await.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170111/30a2503d/attachment.html>


More information about the webkit-unassigned mailing list