Closed Bug 1214040 Opened 9 years ago Closed 9 years ago

tabs.sendMessage should not raise an exception on unexistent tabId

Categories

(WebExtensions :: Untriaged, defect)

defect
Not set
normal

Tracking

(firefox44 fixed)

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: rpl, Assigned: rpl)

References

Details

(Whiteboard: [tabs])

Attachments

(1 file, 1 obsolete file)

browser.tabs.sendMessage currently raises an exception when the passed tabId doesn't exists in the tab manager because it tries to use an "undefined" tab.

I was going to raise an Error with a more descriptive message but I noticed that on Chrome it doesn't currently raise any error, it simply becames a no-op.
Attached patch fix-and-testcase.patch (obsolete) — Splinter Review
The attached patch contains a small change (tabs.sendMessage turned into a no-op if there is no tab with the defined tabId) and a related testcase.
Attachment #8672863 - Flags: review?(wmccloskey)
Whiteboard: [tabs]
Attachment #8672863 - Flags: review?(wmccloskey) → review+
Assignee: nobody → luca.greco
I've checked that this patch applies cleanly on a recent mozilla-central and I've updated the commit message.
Attachment #8672863 - Attachment is obsolete: true
Blocks: webext
Hi Luca, is this ready for checkin?

Also, you can set the r+ flag on your own patch if I've reviewed a previous version and it hasn't changed significantly.
Flags: needinfo?(luca.greco)
yes, it is

I was waiting for the "try build" to be completed:

https://treeherder.mozilla.org/#/jobs?repo=try&revision=63ac198f56f8

and the failures are unrelated to this change.

I'm going to add the r+ and the checkin-needed.
Flags: needinfo?(luca.greco)
Attachment #8674816 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/bf9a0354bc7c
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
Flags: blocking-webextensions+
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: