Closed Bug 1320412 Opened 9 years ago Closed 8 years ago

tabs.onUpdated does not fire for title changes

Categories

(WebExtensions :: Frontend, defect, P2)

defect

Tracking

(firefox53 fixed)

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed
webextensions +

People

(Reporter: 21Naown, Assigned: zombie)

Details

(Whiteboard: triaged)

Attachments

(1 file)

Related to: https://developer.chrome.com/extensions/tabs#event-onUpdated Firefox has not "title" for example. Moreover, if you are not restricted by Chrome's specs, what about add a filter like https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/webRequest/onBeforeRequest#Parameters ?
Flags: needinfo?(kmaglione+bmo)
Status: UNCONFIRMED → NEW
Component: WebExtensions: Untriaged → WebExtensions: Frontend
Ever confirmed: true
Flags: needinfo?(kmaglione+bmo)
Summary: tabs.onUpdated updatedInfo should contain more triggers and filter (may be) → tabs.onUpdated does not fire for title changes
Priority: -- → P2
Whiteboard: triaged
Assignee: nobody → tomica
Status: NEW → ASSIGNED
There are two approaches to this bug: - simpler one, observing the changes of the tab's label attribute, or - alternatively, observe "DOMTitleChanged" messages that wouldn't include things like "Connecting..." and "New Tab" which come from the browser UI. I opted for the first one, because it makes more sense to me semantically. This is about _tab_ title changes, not only document's title changes. Also, we already return tab.label as tab's title if you query a tab at just the right time [1]. 1) http://searchfox.org/mozilla-central/source/browser/components/extensions/ext-utils.js#686
Attachment #8824166 - Flags: review?(kmaglione+bmo)
Comment on attachment 8824166 [details] Bug 1320412 - Emit tabs.onUpdated event for title changes https://reviewboard.mozilla.org/r/102702/#review103050 ::: browser/components/extensions/ext-tabs.js:436 (Diff revision 1) > } else if (event.type == "TabUnpinned") { > needed.push("pinned"); > } > > if (needed.length && !extension.hasPermission("tabs")) { > needed = needed.filter(attr => attr != "url" && attr != "favIconUrl"); We also need to filter out "title" here. Please add a test that it's filtered out when tabs permissions are missing. ::: browser/components/extensions/test/browser/browser_ext_tabs_onUpdated.js:185 (Diff revision 1) > + const url = "http://mochi.test:8888/browser/browser/components/extensions/test/browser/context_tabs_onUpdated_page.html"; > + const tab = await browser.tabs.create({url}); > + > + browser.tabs.onUpdated.addListener(function onUpdated(tabId, changeInfo) { > + browser.test.assertEq(tabId, tab.id, "Check tab id"); > + browser.test.log("onUpdate: " + JSON.stringify(changeInfo)); Nit: onUpdated, and please use a template string. ::: browser/components/extensions/test/browser/browser_ext_tabs_onUpdated.js:187 (Diff revision 1) > + > + browser.tabs.onUpdated.addListener(function onUpdated(tabId, changeInfo) { > + browser.test.assertEq(tabId, tab.id, "Check tab id"); > + browser.test.log("onUpdate: " + JSON.stringify(changeInfo)); > + if ("title" in changeInfo) { > + if (changeInfo.title === url) { if ("title" in changeInfo && changeInfo.title !== ...)
Attachment #8824166 - Flags: review?(kmaglione+bmo) → review+
webextensions: --- → +
Comment on attachment 8824166 [details] Bug 1320412 - Emit tabs.onUpdated event for title changes https://reviewboard.mozilla.org/r/102702/#review103050 > We also need to filter out "title" here. Please add a test that it's filtered out when tabs permissions are missing. That was sloppy of me, sorry. > if ("title" in changeInfo && changeInfo.title !== ...) Turns out we also get "Connectiong..." on some platforms...
Keywords: checkin-needed
Pushed by ryanvm@gmail.com: https://hg.mozilla.org/integration/autoland/rev/ec8836909060 Emit tabs.onUpdated event for title changes r=kmag
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
> Moreover, if you are not restricted by Chrome's specs, what about add a filter like > https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/webRequest/onBeforeRequest#Parameters > ? I assume you cannot check for this? Or should I create a specific report?
Yeah, this bug got renamed to just fix the existing bug. You should file a separate one to request the enhancements, so that a design decision can be made.
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: