Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime.getURL fixes #35136

Merged
merged 3 commits into from
Aug 5, 2024
Merged

runtime.getURL fixes #35136

merged 3 commits into from
Aug 5, 2024

Conversation

rebloor
Copy link
Contributor

@rebloor rebloor commented Jul 26, 2024

Description

Adds a release note for the changes made in Bug 1795082 browser.runtime.getURL() may return a non-extension URL and a clarifying example in runtime.getURL())

@rebloor rebloor added the Content:WebExt WebExtensions docs label Jul 26, 2024
@rebloor rebloor requested a review from dotproto July 26, 2024 04:13
@rebloor rebloor self-assigned this Jul 26, 2024
@rebloor rebloor requested review from a team as code owners July 26, 2024 04:13
@rebloor rebloor requested review from pepelsbey and removed request for a team July 26, 2024 04:13
@github-actions github-actions bot added Content:Firefox Content in the Mozilla/Firefox subtree size/xs [PR only] 0-5 LoC changed labels Jul 26, 2024
Copy link
Contributor

github-actions bot commented Jul 26, 2024

Preview URLs

External URLs (1)

URL: /en-US/docs/Mozilla/Firefox/Releases/130
Title: Firefox 130 for developers

(comment last updated: 2024-08-01 02:43:40)

@rebloor rebloor requested a review from dotproto August 1, 2024 02:42
Copy link
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks @rebloor

@hamishwillee hamishwillee merged commit 157de3a into mdn:main Aug 5, 2024
8 checks passed
@rebloor rebloor deleted the runtime.getURL-fixes branch August 5, 2024 02:58
Copy link
Member

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rebloor Could you open a new PR to address the issues from this review?

@@ -58,6 +58,8 @@ This article provides information about the changes in Firefox 130 that affect d

## Changes for add-on developers

- {{WebExtAPIRef("runtime.getURL")}} (and the deprecated {{WebExtAPIRef("extension.getURL")}}) have been updated to prefix the supplied path string with the extension's `moz-extension:` origin (in line with the behavior of Chrome). In addition, {{WebExtAPIRef("runtime.getURL")}} no longer strips `/.`, `./`, and `../.` strings from the input URL ([Firefox bug 1795082](https://bugzil.la/1795082)).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description here does not highlight the difference in comparison with the previous implementation.

A better description is to write that the extension origin is now always prepended to the path, without further normalization. Previously, when an absolute URL was provided instead of a relatively URL, that absolute URL was returned. "Without further normalization" captures changes like "/../" and "/./"

@@ -26,7 +26,7 @@ browser.runtime.getURL(

### Return value

`string`. The fully-qualified URL to the resource.
`string`. The fully-qualified URL to the resource. For example, `moz-extension://e15cdd35-f9b7-4786-a39d-7d801bd2709e/help/open-in-container.html`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's drop this example. It is not obvious from just this description how the URL is derived from the input.

Furthermore, the code example below already offers a comment showing the format of the return value in Firefox specifically.

Suggested change
`string`. The fully-qualified URL to the resource. For example, `moz-extension://e15cdd35-f9b7-4786-a39d-7d801bd2709e/help/open-in-container.html`.
`string`. The fully-qualified URL to the resource within the extension.

@rebloor
Copy link
Contributor Author

rebloor commented Aug 7, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Firefox Content in the Mozilla/Firefox subtree Content:WebExt WebExtensions docs size/xs [PR only] 0-5 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants