Closed Bug 904477 Opened 12 years ago Closed 12 years ago

Add missing error handlers for promises used in SessionStore

Categories

(Firefox :: Session Restore, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 27

People

(Reporter: ttaubert, Assigned: drakain)

References

Details

(Whiteboard: [good first bug][mentor=ttaubert][lang=js])

Attachments

(1 file, 2 obsolete files)

As reported in bug 902866 we are missing a couple of error handlers when using promises, let's fix that. Here's what we need to do: --> SessionStore.jsm + SessionStore.init() calls gSessionStartup.onceInitialized.then() http://hg.mozilla.org/mozilla-central/file/3d20597e0a07/browser/components/sessionstore/src/SessionStore.jsm#l390 + SessionStore._saveStateObject() calls _SessionFile.write() http://hg.mozilla.org/mozilla-central/file/3d20597e0a07/browser/components/sessionstore/src/SessionStore.jsm#l3775 --> nsSessionStartup.js + nsSessionStartup.init() calls _SessionFile.read() http://hg.mozilla.org/mozilla-central/file/3d20597e0a07/browser/components/sessionstore/src/nsSessionStartup.js#l83 In order to fix this we need to pass Cu.reportError to .then() to convert calls like this: > _SessionFile.read(() => next()); to this: > _SessionFile.read(() => next(), Cu.reportError);
Awww, shoot. The examples at the bottom should have been: > _SessionFile.read().then(() => next()); and: > _SessionFile.read().then(() => next(), Cu.reportError);
Blocks: 904480
No longer blocks: 904480
Is this issue obsoleted? Seems like an easy first bug to fix.
i am interested to solve this as my first bug.How do i go about this thanks in advance.
Sorry for the late response here, this slipped off my radar. Thanks for your interest in fixing this however! comment #0 describes the three files that need to be fixed and what needs to be done. If any of you wants to take this I can assign the bug to you.
IPlease assign the ticket to me and I will try to fix this tonight between 500 UTC and 1000 UTC as my first fix.
No hurry! It's yours now :)
Assignee: nobody → drakain
Status: NEW → ASSIGNED
Attached patch Bug904477.patch (obsolete) — Splinter Review
Some of the areas you had mentioned changed since the report, so I grepped the directory for `.then(` calls and added `Cu.reportError` everywhere a `function onError` wasn't already provided. Some calls were not using using arrow functions as in the example, I'm mostly confident this is fine but if it's explicitly just those instances I can re-patch this.
Attachment #796388 - Flags: review?(ttaubert)
Comment on attachment 796388 [details] [diff] [review] Bug904477.patch Review of attachment 796388 [details] [diff] [review]: ----------------------------------------------------------------- Thank you and sorry for the changes that happened in between. This looks good if we remove the one thing mentioned below. ::: browser/components/sessionstore/src/_SessionFile.jsm @@ +205,5 @@ > read: function () { > return SessionWorker.post("read").then(msg => { > this._recordTelemetry(msg.telemetry); > return msg.ok; > + }, Cu.reportError); No need to add an error handler here, we expect the caller to do that. See your change to nsSessionStartup.js.
Attachment #796388 - Flags: review?(ttaubert) → feedback+
Ah. The new patch is attached.
Attachment #796388 - Attachment is obsolete: true
Attachment #802627 - Flags: review?(ttaubert)
Comment on attachment 802627 [details] [diff] [review] Bug904477.v2.patch -- Without error handler on SessionWorker.post("read"). Review of attachment 802627 [details] [diff] [review]: ----------------------------------------------------------------- Thanks a lot, Brian! Sorry for the review delay, I was out for a couple of days. Can you please prepare your patch for checkin-needed and mark it as such?
Attachment #802627 - Flags: review?(ttaubert) → review+
Comment on attachment 802627 [details] [diff] [review] Bug904477.v2.patch -- Without error handler on SessionWorker.post("read"). I believe this patch follows all the steps on the wiki[1] for checking in a patch. Let me know if this isn't the correct format and I will revise it. Thanks! [1] https://developer.mozilla.org/en-US/docs/Mercurial_FAQ#How_can_I_generate_a_patch_for_somebody_else_to_check-in_for_me.3F unless
Attachment #802627 - Flags: checkin?(ttaubert)
Brian, the patch looks good but it's missing a tiny thing. Can you please add the reviewer's handle to the end of the patch description? Like so: Bug 904477 - Add missing error handlers for promises used in SessionStore r=ttaubert Thanks!
Attachment #802627 - Flags: checkin?(ttaubert)
Now with r=ttaubert in commit message.
Attachment #802627 - Attachment is obsolete: true
Attachment #805940 - Flags: checkin?(ttaubert)
Comment on attachment 805940 [details] [diff] [review] Bug904477.reviewed.patch Thanks for the patch, Brian! In the future, you can just use the checkin-needed bug keyword for your request. The checkin? flag is more intended for situations where there are multiple patches that aren't all landing at the same time.
Attachment #805940 - Flags: checkin?(ttaubert) → checkin+
Whiteboard: [good first bug][mentor=ttaubert][lang=js] → [good first bug][mentor=ttaubert][lang=js][fixed-in-fx-team]
Thanks Tim and Ryan. I'll take better note of the process here for the next one!
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [good first bug][mentor=ttaubert][lang=js][fixed-in-fx-team] → [good first bug][mentor=ttaubert][lang=js]
Target Milestone: --- → Firefox 27
(In reply to Brian Graham from comment #17) > Thanks Tim and Ryan. I'll take better note of the process here for the next > one! No worries, the process is something we all had to get used to :) Thank you for your contribution!
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: