-
Notifications
You must be signed in to change notification settings - Fork 2
GPII-4410: Making links work without the extension #2
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
Open
stegru
wants to merge
6
commits into
GPII:master
Choose a base branch
from
stegru:GPII-4410
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1b315c6
GPII-4410: Changed the url to specify the full destination url.
stegru c893cc3
GPII-4410: Updated tests to work with new changes.
stegru 2031d29
GPII-4410: Made the exception handling clearer.
stegru 1718730
GPII-4410: Added a test for an invalid url.
stegru 4c727d1
GPII-4410: Made the URL validation flow clearerer
stegru ea1a2c1
GPII-4410: Linter fix
stegru File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,7 +96,7 @@ | |
| blankTab: { | ||
| id: 1 | ||
| }, | ||
| url: "https://actual.org/url", | ||
| url: new URL("https://actual.org/url"), | ||
| queryURL: "*://actual.org/url" | ||
| }; | ||
|
|
||
|
|
@@ -134,7 +134,7 @@ | |
| jqUnit.assertTrue("Tab isn't highlighted", browser.tabs.highlight.notCalled); | ||
| jqUnit.assertTrue("Loading tab isnt' removed", browser.tabs.remove.notCalled); | ||
| jqUnit.assertTrue("Tab isn't reloaded", browser.tabs.reload.notCalled); | ||
| let isUpdatedCalled = browser.tabs.update.calledOnceWithExactly(loadingTab.id, {url: openTabTestsProps.url}); | ||
| let isUpdatedCalled = browser.tabs.update.calledOnceWithExactly(loadingTab.id, {url: openTabTestsProps.url.href}); | ||
| jqUnit.assertTrue("Loading tab is updated with correct URL", isUpdatedCalled); | ||
| } | ||
|
|
||
|
|
@@ -151,29 +151,29 @@ | |
| const handlestRequestTestCases = [{ | ||
| name: "Open same tab", | ||
| details: { | ||
| url: "https://opensametab.morphic.org/actual.org/url" | ||
| url: "https://opensametab.morphic.org/redirect/https%3A%2F%2Factual.org/url" | ||
| }, | ||
| expected: { | ||
| response: {cancel: true}, | ||
| args: ["https://actual.org/url", false] | ||
| args: [new URL("https://actual.org/url"), false] | ||
| } | ||
| }, { | ||
| name: "Refresh tab", | ||
| details: { | ||
| url: "http://refreshsametab.morphic.org/actual.org/url" | ||
| url: "http://refreshsametab.morphic.org/redirect/http%3A%2F%2Factual.org/url" | ||
| }, | ||
| expected: { | ||
| response: {cancel: true}, | ||
| args: ["http://actual.org/url", true] | ||
| args: [new URL("http://actual.org/url"), true] | ||
| } | ||
| }, { | ||
| name: "Unfiltered URL", | ||
| details: { | ||
| url: "http://morphic.org/actual.org/url" | ||
| url: "http://morphic.org/redirect/https%3A%2F%2Factual.org/url" | ||
| }, | ||
| expected: { | ||
| response: {cancel: true}, | ||
| args: ["http://morphic.org/actual.org/url", false] | ||
| args: [new URL("http://morphic.org/redirect/https%3A%2F%2Factual.org/url"), false] | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need test cases for when the response is
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
| }]; | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that this try/catch block is to guard against malformed URLs used for the destinationUrl. e.g.
refresh/https%3A%2F%2Fexample.com%2F. However,openURLsis anasyncfunction. So I don't believe that it will wait to make sure that it doesn't throw an error. You could useawaiton openURLs but will need to convert openURLs.handleRequest into anasyncfunction as well. According to webRequest.onBeforeRequest the handler can return a promise that resolves with a BlockingResponse. You'll also have to test that the polyfill can handle this feature for use in Chrome.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YEs. In fact, that's why I moved the url parsing out of
openURLs.However, I've now moved the call outside of the try block to make my intention clearer.