Skip to content

🐛 Use source relative URLs in navigateTo#23698

Merged
jridgewell merged 2 commits intoampproject:masterfrom
jridgewell:navigateTo-origin
Aug 6, 2019
Merged

🐛 Use source relative URLs in navigateTo#23698
jridgewell merged 2 commits intoampproject:masterfrom
jridgewell:navigateTo-origin

Conversation

@jridgewell
Copy link
Copy Markdown
Contributor

Fixes #22376.

'https://cdn.ampproject.org/c/s/www.pub.com/dir/page.html';
const urlService = Services.urlForDoc(doc.documentElement);

sandbox.stub(urlService, 'getSourceUrl').callsFake(url => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

shall we just install urlService to avoid this stub? that makes the test more robust to any future refactoring.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I follow. urlService is already installed on the amp doc. I chose to stub the method because the internal anchor tag it uses is tied to the test runner's URL, not the fake window we'd expect.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i thought it would read from the fake URL you just set in L638?

Copy link
Copy Markdown

@dreamofabear dreamofabear left a comment

Choose a reason for hiding this comment

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

Tangent: how close are we to removing parseUrlDeprecated? We've been in limbo awhile.

@jridgewell
Copy link
Copy Markdown
Contributor Author

Planning on working on it a bit this week.

@jridgewell jridgewell merged commit 0bf92fc into ampproject:master Aug 6, 2019
@jridgewell jridgewell deleted the navigateTo-origin branch August 6, 2019 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AMP.navigateTo does not handle relative URL correctly on CDN

4 participants