Closed Bug 1120470 Opened 5 years ago Closed 5 years ago

Handle uncaught promise rejections in protocol.js

Categories

(DevTools :: General, defect)

x86
macOS
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 38

People

(Reporter: ejpbruel, Assigned: ejpbruel)

References

Details

Attachments

(1 file)

While attempting to remove the deprecated-sync-thenables from protocol.js (bug 1096490), I ran into a unhandled promise rejection within protocol.js. The problem seems to be that we're trying to send a packet after the connection has closed. Protocol.js needs to report these errors rather than silently ignore them.
Assignee: nobody → ejpbruel
Attachment #8547630 - Flags: review?(dcamp)
Attachment #8547630 - Attachment is patch: true
Attachment #8547630 - Attachment mime type: text/x-patch → text/plain
Try run for the above patch:
https://tbpl.mozilla.org/?tree=Try&rev=51cda441842a
Comment on attachment 8547630 [details] [diff] [review]
Handle uncaught promise rejections

Review of attachment 8547630 [details] [diff] [review]:
-----------------------------------------------------------------

::: toolkit/devtools/server/protocol.js
@@ +1148,5 @@
>      } else {
>        this.actor().then(actorID => {
>          packet.to = actorID;
>          this.conn._transport.send(packet);
> +      }).then(null, Cu.reportError);

This should be:

    e => DevToolsUtils.reportException("Front.prototype.send", e)

(Sorry for the drive-by)
(Instead of `Cu.reportError`)
Comment on attachment 8547630 [details] [diff] [review]
Handle uncaught promise rejections

r+ with fitzgen's comment addressed.
Attachment #8547630 - Flags: review?(dcamp) → review+
Try push for patch with comments addressed, just in case:
https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=096a5ed7a9aa
Try push looks green, but just discovered that another try push caused oranges on windows because I forgot to require DevToolsUtils. Here's another try push that includes windows builds with that problem addressed:
https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=0f9945a7f502
Try push looks green, pushing to fx-team:
https://hg.mozilla.org/integration/fx-team/rev/e5540f8b4a2a
https://hg.mozilla.org/mozilla-central/rev/e5540f8b4a2a
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 38
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.