Closed Bug 1589734 Opened 5 years ago Closed 2 years ago

browser.tabs.create does not set URL before running callback

Categories

(WebExtensions :: Untriaged, defect, P3)

69 Branch
defect

Tracking

(firefox69 affected, firefox70 affected, firefox71 affected, firefox72 affected)

RESOLVED INVALID
Tracking Status
firefox69 --- affected
firefox70 --- affected
firefox71 --- affected
firefox72 --- affected

People

(Reporter: oliver, Unassigned)

Details

Attachments

(1 file)

1.22 KB, application/zip
Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36

Steps to reproduce:

Add the following code to your extension's background page:

browser.browserAction.onClicked.addListener(() => {
browser.tabs.create({ url: "https://example.com" }, tab => {
console.log(tab.url);
});
});

Make sure your manifest defines the action icon, includes the background script, and includes the "tabs" permission.

Then, run the extension and click the action icon.

Actual results:

When you click the icon, about:blank is printed to the background page's log.

Expected results:

When you click the icon, https://example.com should be printed to the background page.

Product: Firefox → WebExtensions
Version: 69 Branch → Firefox 69
Version: Firefox 69 → 69 Branch

Hi Oliver,

Could you please provide a simple extension that has all the needed requirements to reproduce the issue?
Please attach it to the bug report so we can check it out.

Thanks!

Flags: needinfo?(oliver)
Attached file Repro

Please find a repro case attached.

Flags: needinfo?(oliver)

Hello,

Thank you for the provided extension. I've been able to make use of it, however, when I check the background page's console loge (even looked into the browser console) there is no output when clicking the extension icon.
I've tried to reproduce on macOS Catalina 10.15 on Fx 69.0, Build ID:20190827005903 and on Windows 10 PRo x 64 bit with Fx version 69.0.3, Build ID: 20191009172106 by loading the extension .xpi into about:debugging and the navigating to addons.mozilla.org, opening the console and clicking on the extension icon.
In the end I think I've managed to reproduce this issue by loading the extension in about:debugging, inspecting the temporary extension and then clicking on the extension toolbar icon. The "about:blank" log is emitted when opening the "https://example.com/" page in the extension's devtools console.
Could you confirm this the same behavior described in the actual results?
Thanks

Flags: needinfo?(oliver)

Hi Miruna,

That behaviour matches the actual results exactly! Glad you were able to reproduce it.

Let me know if I can do anything more to help.

Flags: needinfo?(oliver)

That is all, thank you, Oliver.
Managed to reproduce using STR in Firefox Release 70.0 (20191016161957) , Beta 71.0b3 (20191021164841) and Nightly 72.0a1 (20191022214314) .
Tested on Windows 10 Pro x 64 bit and Ubuntu 18.04.3 LTS and on macOS catalina 10.15.
Marking this as NEW.

Status: UNCONFIRMED → NEW
Ever confirmed: true

The priority flag is not set for this bug.
:jimm, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jmathies)
Flags: needinfo?(jmathies)
Priority: -- → P3
Severity: normal → S3

This behavior is compatible with Chromium. (tested on Edge 107.0).
Chromium tabs have 2 URL-related fields:
url- "The last committed URL of the main frame of the tab."
pendingUrl- "The URL the tab is navigating to, before it has committed.
"https://developer.chrome.com/docs/extensions/reference/tabs/
I think we should close this bug, changing this behavior will reduce compatibility.
It is better to add the pendingUrl field to the FireFox tabs API. The pendingUrl is set before running the callback .

Thanks for testing Artur. I feel like I did spot a difference between Firefox and Chrome but as you point out, what I described here does feel consistent with what you would expect and what is documented. Closing for now.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: