New issue
Advanced search Search tips

Issue 876248 link

Starred by 2 users

Issue metadata

Status: Fixed
Merged: issue 655694
Owner:
Closed: Sep 6
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 3
Type: Bug



Sign in to add a comment

unhanlded promise rejection is not catched by unhandledrejection event

Reported by teaz...@gmail.com, Aug 21

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36

Steps to reproduce the problem:
1. click 『run case 1』
2. click 『run case 2』
3. click 『run case 3』

What is the expected behavior?
1. click 『run case 1』, we will see alert message which means that error is catched correctly.
2. click 『run case 2』, we will see alert message which means that error is catched correctly.
3. click 『run case 3』, we will see no alert.

What went wrong?
there is an error in case 3 since there still exist a unhandledpromiserejection in case 3, but the error isn't catched correctly with unhandledrejection event.

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 68.0.3440.106  Channel: stable
OS Version: OS X 10.13.6
Flash Version:
 
unhandledrejection.html
1.4 KB View Download
Labels: Needs-Triage-M68
Components: -Blink>HTML Blink>Bindings
Cc: swarnasree.mukkala@chromium.org
Labels: Triaged-ET Target-70 M-70 FoundIn-70 OS-Linux OS-Windows
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on chrome version 60.0.3072.0 ,reported version #68.0.3440.106 and on latest chrome #70.0.3530.0 using Mac OS 10.13.6,Windows 10 and Ubuntu 17.10 by following below steps.

Steps:
=====
1.Launched chrome.
2.Downloaded and opened the file unhandledrejection.html.
3.Clicked on run case 1, run case 2 and run case 3, observed that when clicked on run case 1 and run case 2 a alert message "unhandledrejection catched: promise reject in constructor" and no alert message on clicking run case 3.

This is a non regression issue and this behaviour is observed from old M-60 builds. Hence marking it as untriaged and requesting dev team to look into the issue.
Thanks.!
Owner: yukishiino@chromium.org
Status: Available (was: Untriaged)
Shiino-san, could you take a look on this?
Cc: yukishiino@chromium.org
Owner: yhirano@chromium.org
Hirano san, would you triage this issue?  This issue seems a promise's issue.

I can reproduce the issue with 70.0.3534.4, but NOT on the ToT.  A recent change might have already fixed the issue.

I cannot reproduce the issue with Version 68.0.3440.106 (Official Build) (64-bit) on Linux.
Now I can reproduce the issue. The issue is reproducible if the HTML file is accessed as a file:// URL.
Cc: yhirano@chromium.org
Labels: -Pri-2 Pri-3
Owner: ----
Status: Available (was: Duplicate)
Re-opening.

yukishiino@ pointed out that the inconsistency among three cases is probably a bug.

One correction: It is reproducible on ToT. yukishiino@ ran the test with --allow-file-access-from-files, which hid the problem
Components: -Blink>Bindings Blink>SecurityFeature>CORS
Components: -Blink>SecurityFeature>CORS Blink>Bindings
This is a binding issue. CORS itself it not related.
"CORS itself is not related", I mean.
Specifically, it seems we fail to set the "muted errors" flag correctly.
https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-classic-script
Cc: domenic@chromium.org jochen@chromium.org
I found that the issue goes away if we reject a promise with an Error instance.

 window.runCase3 = function (){
   new Promise((resolve) => {
     resolve(1);
   }).then(() => {
     return Promise.reject(Error('promise reject in then & return'));
   }).then(() => {});
 }

This is because the stack frames are stored in the Error instance at the construction time.

Domenic, is it what we want to rely on?
No, the `reason` property should be set to the rejection reason, regardless of what the reason's JS type is.
Project Member

Comment 16 by bugdroid1@chromium.org, Sep 6

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/c4bffcd56d2fe3111c9937b359ce01e4e02c875e

commit c4bffcd56d2fe3111c9937b359ce01e4e02c875e
Author: Yutaka Hirano <yhirano@chromium.org>
Date: Thu Sep 06 07:12:20 2018

Use ScriptOriginOptions with IsSharedCrossOrigin set for empty script

Currently, neither IsSharedCrossOrigin nor IsOpaque is set for an empty
script. Hence an exception thrown from it (e.g., an exception thrown
from native promise implementation) is treated as an error with
blink::kNotSharableCrossOrigin. On the other hand, as the script is
empty, there is no meaningful URL attached, which means the
ExecutionContext's URL is used as the script's name in
blink::SourceLocation::FromMessage. In other words, it works virtually
as same as blink::kSharableCrossOrigin corresponding to
ScriptOriginOptions with IsSharedCrossOrigin set and IsOpaque unset.

With this CL, a ScriptOriginOptions with IsSharedCrossOrigin is set
and IsOpaque is not set is attached to the empty script, as a
preliminary step to deprecate kNotSharableCrossOrigin.

Bug: chromium:875153, chromium:876248 
Change-Id: I39279a43994337329b8bd9d28b6ca29f0ac30d9c
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Reviewed-on: https://chromium-review.googlesource.com/1201689
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55673}
[modify] https://crrev.com/c4bffcd56d2fe3111c9937b359ce01e4e02c875e/src/heap/setup-heap-internal.cc
[modify] https://crrev.com/c4bffcd56d2fe3111c9937b359ce01e4e02c875e/test/cctest/test-api.cc

Owner: yhirano@chromium.org
Status: Fixed (was: Available)
The behavior difference between file:// and http[s]:// is fixed.

Sign in to add a comment