-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Do not XHR intercept first party (1P) CDN resources #16650
Conversation
src/service/xhr-impl.js
Outdated
@@ -185,7 +187,8 @@ export class Xhr { | |||
} | |||
const viewer = Services.viewerForDoc(this.ampdocSingle_); | |||
const whenFirstVisible = viewer.whenFirstVisible(); | |||
if (!viewer.hasCapability('xhrInterceptor')) { | |||
const firstPartyResource = urls.cdnProxyRegex.test(new URL(input).origin); |
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.
URL
is not supported everywhere. Use our helper functions in url.js
.
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.
done. thanks.
src/service/xhr-impl.js
Outdated
@@ -185,7 +187,9 @@ export class Xhr { | |||
} | |||
const viewer = Services.viewerForDoc(this.ampdocSingle_); | |||
const whenFirstVisible = viewer.whenFirstVisible(); | |||
if (!viewer.hasCapability('xhrInterceptor')) { | |||
const firstPartyResource = | |||
urls.cdnProxyRegex.test(parseUrlDeprecated(input).origin); |
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.
Use isProxyOrigin
from src/url.js
.
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.
perfect. Thanks!
src/service/xhr-impl.js
Outdated
@@ -21,7 +21,7 @@ import {fromIterator} from '../utils/array'; | |||
import { | |||
getCorsUrl, | |||
getSourceOrigin, | |||
getWinOrigin, |
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.
Why was this deleted?
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.
argh. was not intended. reverted.
Codecov Report
@@ Coverage Diff @@
## master #16650 +/- ##
==========================================
- Coverage 78.13% 78.12% -0.01%
==========================================
Files 553 553
Lines 40318 40318
==========================================
- Hits 31503 31500 -3
- Misses 8815 8818 +3
Continue to review full report at Codecov.
|
THANKS! |
fixes #16601