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

Implement HostPromiseRejectionTracker (#2530) #4608

Merged
merged 1 commit into from
Feb 13, 2018

Conversation

rhuanjl
Copy link
Collaborator

@rhuanjl rhuanjl commented Jan 27, 2018

Responding to #2530

This PR contains:

  1. Internal CC machinery for HostPromiseRejectionTracker ecmaspec 25.4.1.9 - this should enable any host to implement a handler for uncaught promise rejections e.g. the method defined here WhatW spec 8.1.3.12
  2. A very simplistic implementation in ch (behind a command line flag)
  3. Test case

I'm expecting feedback/changes before this is merged but wanted to get other people's thoughts on it in this state. Please give me your thoughts/comments.

Cross ref: Edge uservoice request for this feature - note this PR will not put the feature in edge - it just creates the hooks the edge development team would have to track them through.

cc @liminzhu @saschanaz @fatcerberus @MSLaguana

Notes:
1. Not spec compliant for "await" EDIT: snip - re-read spec this comment was wrong what I've done in this PR is correct

2. The ch implementation I've done is pretty bad, it simply prints to the terminal whenever a notification is made, either handled or rejected - reasonable for testing that the interface is operational but certainly not what the WhatW spec would have a Host do.

3. Parameters passed to the callback function - per spec HostPromiseRejectionTracker should be passed the Promise and rejected/handled. I've gone for:
a) the promise
b) the promise's result - I know this could be retrieved from the promise object but I've added it for implementer's convenience
c) rejected/handled boolean - true for handled false for rejected - possibly should be an int or an enum of some kind

@rhuanjl
Copy link
Collaborator Author

rhuanjl commented Jan 27, 2018

So all the windows test/debug builds are failing on the test I've written. Please could someone tell me how to make a baseline file that will pass on windows? (Reading the output shows that it's printing the right text)

My guess is that this is something to do with line endings but I've tried setting my text editor to do CRLF line endings and it's still not working.

Copy link
Contributor

@boingoing boingoing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice addition. Thanks a lot for taking the time to implement this support.

I gave it a look over and have a couple of cursory questions.

We only call SetIsHandled in JavascriptPromise::CreateThenPromise right now. Is that the only time we know that a promise is definitely handled?

I'm a little confused about the third argument (rejected) to the promise rejection tracker function. It looks like this indicates handled? All of the promises we pass to this function were rejected, yes?

Otherwise, seems sound. Don't worry too much about ch test hook quality - as long as it's on-par with other stuff in there shouldn't be a problem.

Your line-endings may be a problem. Ideally, try to make the baselines and commit them on windows. 😁 We have some settings in our gitconfig which may be messing up your files. I guess you could run unix2dos on them.

As for where to check-in, you retarget onto master. We won't be able to take this in release/1.8 and it's unlikely we'll cut more Node-ChakraCore releases using release/1.9.

I will give this a closer look and provide some more specific feedbacks but thanks again for digging in and contributing here.

@rhuanjl rhuanjl changed the base branch from release/1.8 to master January 28, 2018 12:52
@rhuanjl
Copy link
Collaborator Author

rhuanjl commented Jan 28, 2018

@boingoing thanks for the comments:

  1. As far as I can see CreateThenPromise is the only place we need SetIsHandled other than possibly an extra point for async functions. Both .then and .catch go through CreateThenPromise. await (for async) also goes through it but too late - see my longer comment above.

  2. The third argument should probably change or at least be reversed - it's currently true when an unhandled rejection is notified and false for a "handled" notification - should perhaps be an int to allow for more options in the future - wasn't sure how to do an enum that would work from within JavascriptLibrary.cpp and also be visible from ChakraCore.h - hence not using an enum for this.

  3. Thanks for the tip - unix2dos seems to have done the trick with the baseline

  4. I've retargeted and rebased to master as requested

@fatcerberus
Copy link
Contributor

I'm a little confused about the third argument (rejected) to the promise rejection tracker function. It looks like this indicates handled? All of the promises we pass to this function were rejected, yes?

To answer that question, yes, all promises passed to the callback are rejected. The third parameter indicates whether the promise has just been rejected without a handler, or if it was rejected previously and is only now having a handler attached. It corresponds to the operation parameter in the spec here:
https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker

@liminzhu
Copy link
Collaborator

liminzhu commented Jan 31, 2018

(only here to comment on the API surface change, not implementation)

Thanks for this very welcomed API addition @rhuanjl ! It looks nice and I appreciate it directly mirroring concepts in the spec. Couple of comments -

  1. @bterlson from the ecma spec perspective, how stable is https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker and the likelihood/risk it will be modified? I'm asking for guidance for @rhuanjl 's early comment of whether the reject bool in JsHostPromiseRejectionTrackerCallback (mirroring operation in HostPromiseRejectionTracker) should be as-is or changed to perhaps a var for reflexibility but more complexity to read the value.

  2. @rhuanjl can you move the APIs to ChakraCore.h? ChakraCommon is for APIs living in both inbox Chakra and ChakraCore. We do want to put it in Chakra some time, but to put it there we'll have to go through a review process internally with the Windows API champions which will take some time, so it's a good idea to put them in ChakraCore.h first where all ChakraCore-only APIs lie.

  3. Just to be clear on what resolution is, if I have let p = Promise.reject(1), I shall see resolution with value 1?

@rhuanjl
Copy link
Collaborator Author

rhuanjl commented Jan 31, 2018

@liminzhu thanks for the comments:
2. I've moved it offline, will test and ensure nothing breaks and re-push later
3. That is correct

@rhuanjl rhuanjl force-pushed the HostPromiseRejection branch 3 times, most recently from c1af310 to e7c64ab Compare February 1, 2018 00:15
Copy link
Contributor

@fatcerberus fatcerberus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of naming/semantic issues and a copy/paste mishap. Other than that the change looks good, nice and clean. Works great in miniSphere, too. 🐖

/// A Promise Rejection Tracker callback may be set - which will then be called when this occurs.
/// </remarks>
/// <param name="promise">The promise object, represented as a JsValueRef.</param>
/// <param name="resolution">The value/cause of the rejection, represented as a JsValueRef.</param>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolution should be renamed, to either reason--or if you want something more generic, value. As far as promises go, "resolve" usually only refers to fulfillment (e.g. Promise.resolve() is never a rejection unless you specifically pass it a rejected promise) so the current name is maybe a bit confusing.

/// </remarks>
/// <param name="promise">The promise object, represented as a JsValueRef.</param>
/// <param name="resolution">The value/cause of the rejection, represented as a JsValueRef.</param>
/// <param name="reject">Boolean - true if the promise has just been rejected with no handler,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline I'm still of the opinion that if we keep this as a boolean, the meaning should be reversed, i.e. it should be false for "rejected" and true for "handler attached".

/// Requires an active script context.
/// </para>
/// </remarks>
/// <param name="callbackState"> The callback function being set.</param>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

/// <param name="promiseRejectionTrackerCallback"> ... </param>

Correct?

@rhuanjl rhuanjl force-pushed the HostPromiseRejection branch 3 times, most recently from 8a15dc3 to abf54d1 Compare February 1, 2018 08:34
@rhuanjl
Copy link
Collaborator Author

rhuanjl commented Feb 1, 2018

@liminzhu I've adjusted for my friend @fatcerberus 's comments which seemed sensible to me which included:

  1. changing resolution to reason - as the value given as that parameter is the reason the promise was rejected per spec.
  2. swapping the 3rd parameter so that true indicates rejectionHandled and false indicates promiseRejected

I have also moved the API to chakracore.h

@akroshg do you know when you will have a chance to review this?

CI failure appears to be unrelated (I can repro the fail with a clean download of master or 1.9 without applying this PR) I think CI on both master and 1.9 has been blocked since this PR: #4625

@obastemur
Copy link
Collaborator

#4632 should fix it

Copy link
Contributor

@jackhorton jackhorton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor nitpicks. @boingoing one benefit of putting this in release/1.9 would be that we could fix Node-ChakraCore's feature gap around this sooner? Not sure if that matters.

void JavascriptLibrary::SetNativeHostPromiseRejectionTrackerCallback(HostPromiseRejectionTrackerCallback function)
{
this->nativeHostPromiseRejectionTracker = function;
this->hostShouldTrackPromiseRejections = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: set nativeHostPromiseRejectionTracker to nullptr upfront so that you can avoid this bool and just check if the function pointer is nullptr or not.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - though I've now added a callbackState in the place of this.

@@ -461,6 +461,8 @@ namespace Js
PromiseStatusCode_HasRejection
};

bool GetIsHandled() {return isHandled;}
void SetIsHandled() {isHandled = true;}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: spacing

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -993,5 +1008,26 @@ CHAKRA_API
_In_ JsValueRef object,
_In_ JsValueRef key,
_Out_ bool *hasOwnProperty);


Copy link
Contributor

@kfarnung kfarnung Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: extra newline #Closed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@@ -949,6 +953,9 @@ namespace Js
JavascriptFunction* GetThrowerFunction() const { return throwerFunction; }

void SetNativeHostPromiseContinuationFunction(PromiseContinuationCallback function, void *state);
void SetNativeHostPromiseRejectionTrackerCallback(HostPromiseRejectionTrackerCallback function);
void CallNativeHostPromiseRejectionTracker(Var promise, Var reason, bool handled);

Copy link
Contributor

@kfarnung kfarnung Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: extra newline #Closed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

bin/ch/ch.cpp Outdated
if(HostConfigFlags::flags.TrackRejectedPromises)
{
ChakraRTInterface::JsSetHostPromiseRejectionTracker(WScriptJsrt::PromiseRejectionTrackerCallback);
}
len = strlen(fullPath);
Copy link
Contributor

@kfarnung kfarnung Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add a newline here #Closed

Copy link
Contributor

@kfarnung kfarnung Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Between the closing curly and the next line #Closed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Assert(reason != JS_INVALID_REFERENCE);
if(!handled)
{
wprintf(_u("Uncaught promise rejection\n"));
Copy link
Contributor

@kfarnung kfarnung Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also print out the message to ensure that the reason is being set correctly? #Closed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I may add further commentary to this, it might make more sense to say "Promise rejected with no handler attached" rather than "Uncaught promise rejection". We don't know whether or not it will remain uncaught at this time.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated to print the reason.

I've left it as "Uncaught promise rejection" - as at the time of notification it is uncaught - it may be handled later but it is not at the moment of notification.

Copy link
Contributor

@kfarnung kfarnung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor fixes

@@ -60,3 +60,5 @@ JsLessThan
JsLessThanOrEqual

JsCreateEnhancedFunction

JsSetHostPromiseRejectionTracker
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be a newline at end of file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -356,6 +358,7 @@ class ChakraRTInterface
static JsErrorCode WINAPI JsGetValueType(JsValueRef value, JsValueType *type) { return HOOK_JS_API(GetValueType(value, type)); }
static JsErrorCode WINAPI JsSetIndexedProperty(JsValueRef object, JsValueRef index, JsValueRef value) { return HOOK_JS_API(SetIndexedProperty(object, index, value)); }
static JsErrorCode WINAPI JsSetPromiseContinuationCallback(JsPromiseContinuationCallback callback, void *callbackState) { return HOOK_JS_API(SetPromiseContinuationCallback(callback, callbackState)); }
static JsErrorCode WINAPI JsSetHostPromiseRejectionTracker(JsHostPromiseRejectionTrackerCallback callback) { return HOOK_JS_API(SetHostPromiseRejectionTracker(callback)); }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the diff and seeing that literally all the other callbacks surrounding this get a callbackState argument, I think we should have it here for consistency too, even if I question its real-world utility in this case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Assert(reason != JS_INVALID_REFERENCE);
if(!handled)
{
wprintf(_u("Uncaught promise rejection\n"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I may add further commentary to this, it might make more sense to say "Promise rejected with no handler attached" rather than "Uncaught promise rejection". We don't know whether or not it will remain uncaught at this time.

@rhuanjl
Copy link
Collaborator Author

rhuanjl commented Feb 2, 2018

Thanks for the reviews @kfarnung @jackhorton @fatcerberus
I think I've addressed everything. I haven't squashed yet in case anyone wants to check my new changes against their review points.

@kfarnung
Copy link
Contributor

kfarnung commented Feb 2, 2018

@curtisman @akroshg Can one of you take a look? #Closed

@rhuanjl
Copy link
Collaborator Author

rhuanjl commented Feb 4, 2018

@kfarnung sorry I didn't respond on Friday, I was away without a computer.

I've updated to latest master and squashed including your commit and adding some extra tests as requested by @MSLaguana

@MSLaguana
Copy link
Contributor

Thanks for adding those additional tests, looks good to me!


let tests = [
{
name: "Reject promise with no reactions.",
Copy link
Contributor

@kfarnung kfarnung Feb 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit: looks like you used tabs here, can you switch over to spaces to match the majority of the files in the same directory? #Closed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that, fixed.

@rhuanjl
Copy link
Collaborator Author

rhuanjl commented Feb 5, 2018

@dotnet-bot test Windows arm_test please

@rhuanjl
Copy link
Collaborator Author

rhuanjl commented Feb 7, 2018

@kfarnung any update on this?

Copy link
Contributor

@kfarnung kfarnung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more nit fixes

JsValueRef strValue;
JsErrorCode error = ChakraRTInterface::JsConvertValueToString(reason, &strValue);

if(!handled)
Copy link
Contributor

@kfarnung kfarnung Feb 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: spacing between if and condition #Closed

bin/ch/ch.cpp Outdated
@@ -757,6 +757,11 @@ HRESULT ExecuteTest(const char* fileName)
IfFailGo(E_FAIL);
}

if(HostConfigFlags::flags.TrackRejectedPromises)
Copy link
Contributor

@kfarnung kfarnung Feb 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: space between if and condition #Closed


void JavascriptLibrary::CallNativeHostPromiseRejectionTracker(Var promise, Var reason, bool handled)
{
if(nativeHostPromiseRejectionTracker != nullptr)
Copy link
Contributor

@kfarnung kfarnung Feb 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: space between if and condition #Closed


void JavascriptLibrary::CallNativeHostPromiseRejectionTracker(Var promise, Var reason, bool handled)
{
if(nativeHostPromiseRejectionTracker != nullptr)
Copy link
Contributor

@kfarnung kfarnung Feb 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this->nativeHostPromiseRejectionTracker #Closed

BEGIN_LEAVE_SCRIPT(scriptContext);
try
{
nativeHostPromiseRejectionTracker(promise, reason, handled, this->nativeHostPromiseContinuationFunctionState);
Copy link
Contributor

@kfarnung kfarnung Feb 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this->nativeHostPromiseRejectionTracker #Closed

@@ -660,6 +661,10 @@ namespace Js
{
reactions = this->GetRejectReactions();
newStatus = PromiseStatusCode_HasRejection;
if(!GetIsHandled())
Copy link
Contributor

@kfarnung kfarnung Feb 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: space between if and condition #Closed

@@ -838,13 +843,19 @@ namespace Js
EnqueuePromiseReactionTask(resolveReaction, sourcePromise->result, scriptContext);
break;
case PromiseStatusCode_HasRejection:
if(!sourcePromise->GetIsHandled())
Copy link
Contributor

@kfarnung kfarnung Feb 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: space between if and condition #Closed

@kfarnung
Copy link
Contributor

kfarnung commented Feb 7, 2018

Hey @rhuanjl, thanks for your patience. I'm still doing some local testing. I pushed a minor commit to exclude the new test from one of our suites. #Closed

@rhuanjl
Copy link
Collaborator Author

rhuanjl commented Feb 7, 2018

@kfarnung I fixed the new nits, I'll hold off on squashing for now as I assume there's more testing and at least one more review to come?

@kfarnung
Copy link
Contributor

kfarnung commented Feb 7, 2018

@liminzhu @bterlson Any concerns with the API surface for this change? I didn't see any follow up on the previous question:

@bterlson from the ecma spec perspective, how stable is https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker and the likelihood/risk it will be modified? I'm asking for guidance for @rhuanjl 's early comment of whether the reject bool in JsHostPromiseRejectionTrackerCallback (mirroring operation in HostPromiseRejectionTracker) should be as-is or changed to perhaps a var for reflexibility but more complexity to read the value.

@rhuanjl I don't see any other issues with this change, I'm just trying to make sure I cover all the bases. #Closed

@rhuanjl
Copy link
Collaborator Author

rhuanjl commented Feb 9, 2018

@kfarnung thanks very much for the help with this. Do you know if there is any chance of this getting landed soon.

I was hoping to prepare a PR for Promise.prototype.finally this weekend but it will be affecting several of the same files and nervous I'll end up with merge conflicts

@kfarnung
Copy link
Contributor

kfarnung commented Feb 9, 2018

I'm still waiting for feedback from @liminzhu and @akroshg before landing this. I don't have any concerns with the change and will land it as soon as I have approval from them. #Closed

@@ -470,6 +472,7 @@ namespace Js
protected:
Field(PromiseStatus) status;
Field(Var) result;
Field(bool) isHandled;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move this up above var just to get better packing? instead of 40 bytes it can be in 32 bytes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

<files>PromiseRejectionTracking.js</files>
<compile-flags>-TrackRejectedPromises -args summary -endargs -nodeferparse</compile-flags>
<baseline>PromiseRejectionTracking.baseline</baseline>
<tags>exclude_jshost</tags>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exclude_jshost [](start = 12, length = 14)

Great. Thanks for covering with detailed test cases. @taylor.woll@microsoft.com should we be implementing this in jshost just to get consistency.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was the one who added the tag. I think this is something we should do in the near future, it's just a matter of scheduling.

/cc @boingoing

@akroshg
Copy link
Contributor

akroshg commented Feb 12, 2018

@rhuanjl thanks for PR. Looks good to me. (apologize for adding a late comment).

@liminzhu
Copy link
Collaborator

Looks good to me too!

1. Internal CC machinary for unhandled promise rejection.
2. Simplisitic implimentation in ch
3. Test case
@rhuanjl
Copy link
Collaborator Author

rhuanjl commented Feb 12, 2018

Fixed last point and updated to latest.

Thanks for reviews everyone; sorry for the number of style issues, I'll try and be more consistent in future.

@chakrabot chakrabot merged commit 0b61d16 into chakra-core:master Feb 13, 2018
chakrabot pushed a commit that referenced this pull request Feb 13, 2018
Merge pull request #4608 from rhuanjl:HostPromiseRejection

Responding to #2530

This PR contains:
1. Internal CC machinery for HostPromiseRejectionTracker [ecmaspec 25.4.1.9](https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker) - this should enable any host to implement a handler for uncaught promise rejections e.g. the method defined here [WhatW spec 8.1.3.12](https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections)
2. A very simplistic implementation in ch (behind a command line flag)
3. Test case

I'm expecting feedback/changes before this is merged but wanted to get other people's thoughts on it in this state. Please give me your thoughts/comments.

Cross ref: [Edge uservoice request for this feature](https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/16665397-detect-unhandled-promise-rejection?tracking_code=4f4e218df62afae7db37fb5be5f4ff1c) - note this PR will not put the feature in edge - it just creates the hooks the edge development team would have to track them through.

**cc** @liminzhu @saschanaz @fatcerberus @MSLaguana

**Notes:**
**1. Not spec compliant for "await" EDIT: snip - re-read spec this comment was wrong what I've done in this PR is correct**

**2. The ch implementation I've done is pretty bad,** it simply prints to the terminal whenever a notification is made, either handled or rejected - reasonable for testing that the interface is operational but certainly not what the WhatW spec would have a Host do.

**3. Parameters passed to the callback function** - per spec HostPromiseRejectionTracker should be passed the Promise and rejected/handled. I've gone for:
a) the promise
b) the promise's result - I know this could be retrieved from the promise object but I've added it for implementer's convenience
c) rejected/handled boolean - true for handled false for rejected - possibly should be an int or an enum of some kind
@kfarnung
Copy link
Contributor

@rhuanjl Thanks for your contribution!

@rhuanjl rhuanjl deleted the HostPromiseRejection branch February 13, 2018 00:31
@liminzhu
Copy link
Collaborator

liminzhu commented Feb 13, 2018

Thanks @rhuanjl ! Now that this has been merged, can I ask you to send a quick PR to https://github.com/Microsoft/ChakraCore-wiki to update the docs as well (this should be an example for where to make the changes). I'm happy to do that as well so let me know.

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

Successfully merging this pull request may close these issues.