Skip to content

Commit 7208581

Browse files
Revert "šŸ› Bug fix: Permissions Policy syntax for sync-xhr to eliminate console violations (#40378)" (#40380)
This reverts commit 8bb4ac0.
1 parent 8bb4ac0 commit 7208581

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

ā€Žextensions/amp-a4a/0.1/amp-a4a.jsā€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,13 +2071,13 @@ export class AmpA4A extends AMP.BaseElement {
20712071
// Block synchronous XHR in ad. These are very rare, but super bad for UX
20722072
// as they block the UI thread for the arbitrary amount of time until the
20732073
// request completes.
2074-
let permissionPolicies = 'sync-xhr=()';
2074+
let featurePolicies = "sync-xhr 'none';";
20752075

20762076
if (isAttributionReportingAllowed(this.win.document)) {
2077-
permissionPolicies += ";attribution-reporting 'src';";
2077+
featurePolicies += "attribution-reporting 'src';";
20782078
}
20792079

2080-
mergedAttributes['allow'] = permissionPolicies;
2080+
mergedAttributes['allow'] = featurePolicies;
20812081

20822082
this.maybeDestroyIframe_();
20832083
this.iframe = /** @type {!HTMLIFrameElement} */ (

ā€Žextensions/amp-a4a/0.1/test/test-amp-a4a.jsā€Ž

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ describes.realWin('amp-a4a', {amp: true}, (env) => {
918918
a4a.onLayoutMeasure();
919919
await a4a.layoutCallback();
920920
verifyCachedContentIframeRender(a4aElement, TEST_URL, true);
921-
expect(a4a.iframe.getAttribute('allow')).to.include('sync-xhr=();');
921+
expect(a4a.iframe.getAttribute('allow')).to.include("sync-xhr 'none';");
922922
});
923923

924924
it('should set feature policy for attribution-reporting when supported', async () => {
@@ -929,7 +929,7 @@ describes.realWin('amp-a4a', {amp: true}, (env) => {
929929
a4a.onLayoutMeasure();
930930
await a4a.layoutCallback();
931931
verifyCachedContentIframeRender(a4aElement, TEST_URL, true);
932-
expect(a4a.iframe.getAttribute('allow')).to.include('sync-xhr=();');
932+
expect(a4a.iframe.getAttribute('allow')).to.include("sync-xhr 'none';");
933933
expect(a4a.iframe.getAttribute('allow')).to.include(
934934
"attribution-reporting 'src';"
935935
);
@@ -943,7 +943,7 @@ describes.realWin('amp-a4a', {amp: true}, (env) => {
943943
a4a.onLayoutMeasure();
944944
await a4a.layoutCallback();
945945
verifyCachedContentIframeRender(a4aElement, TEST_URL, true);
946-
expect(a4a.iframe.getAttribute('allow')).to.include('sync-xhr=()');
946+
expect(a4a.iframe.getAttribute('allow')).to.include("sync-xhr 'none';");
947947
expect(a4a.iframe.getAttribute('allow')).to.not.include(
948948
"attribution-reporting 'src';"
949949
);
@@ -1046,7 +1046,7 @@ describes.realWin('amp-a4a', {amp: true}, (env) => {
10461046
await a4a.layoutCallback();
10471047
verifyNameFrameRender(a4aElement, false /* shouldSandbox */);
10481048
expect(a4a.iframe.getAttribute('allow')).to.equal(
1049-
"sync-xhr=();attribution-reporting 'src';"
1049+
"sync-xhr 'none';attribution-reporting 'src';"
10501050
);
10511051
});
10521052

@@ -1058,7 +1058,7 @@ describes.realWin('amp-a4a', {amp: true}, (env) => {
10581058
a4a.onLayoutMeasure();
10591059
await a4a.layoutCallback();
10601060
verifyNameFrameRender(a4aElement, false /* shouldSandbox */);
1061-
expect(a4a.iframe.getAttribute('allow')).to.equal('sync-xhr=()');
1061+
expect(a4a.iframe.getAttribute('allow')).to.equal("sync-xhr 'none';");
10621062
});
10631063

10641064
['', 'client_cache', 'safeframe', 'some_random_thing'].forEach(
@@ -1183,7 +1183,7 @@ describes.realWin('amp-a4a', {amp: true}, (env) => {
11831183
false /* shouldSandbox */
11841184
);
11851185
expect(a4a.iframe.getAttribute('allow')).to.equal(
1186-
"sync-xhr=();attribution-reporting 'src';"
1186+
"sync-xhr 'none';attribution-reporting 'src';"
11871187
);
11881188
});
11891189

@@ -1199,7 +1199,7 @@ describes.realWin('amp-a4a', {amp: true}, (env) => {
11991199
DEFAULT_SAFEFRAME_VERSION,
12001200
false /* shouldSandbox */
12011201
);
1202-
expect(a4a.iframe.getAttribute('allow')).to.equal('sync-xhr=()');
1202+
expect(a4a.iframe.getAttribute('allow')).to.equal("sync-xhr 'none';");
12031203
});
12041204

12051205
['', 'client_cache', 'nameframe', 'some_random_thing'].forEach(

ā€Žsrc/3p-frame.jsā€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export function getIframe(
132132
// Block synchronous XHR in ad. These are very rare, but super bad for UX
133133
// as they block the UI thread for the arbitrary amount of time until the
134134
// request completes.
135-
iframe.setAttribute('allow', 'sync-xhr=();');
135+
iframe.setAttribute('allow', "sync-xhr 'none';");
136136
const excludeFromSandbox = ['facebook'];
137137
if (!excludeFromSandbox.includes(opt_type)) {
138138
applySandbox(iframe);

ā€Žsrc/preact/component/3p-frame.jsā€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const countGenerators = {};
2828
// Block synchronous XHR in ad. These are very rare, but super bad for UX
2929
// as they block the UI thread for the arbitrary amount of time until the
3030
// request completes.
31-
const BLOCK_SYNC_XHR = 'sync-xhr=()';
31+
const BLOCK_SYNC_XHR = "sync-xhr 'none'";
3232

3333
// TODO(wg-bento): UA check for required flags without iframe element
3434
const DEFAULT_SANDBOX =

ā€Žtest/unit/3p/test-3p-frame.jsā€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ describes.realWin('3p-frame', {amp: true}, (env) => {
263263
setupElementFunctions(div);
264264
container.appendChild(div);
265265
const iframe = getIframe(window, div, 'none');
266-
expect(iframe.getAttribute('allow')).to.equal('sync-xhr=();');
266+
expect(iframe.getAttribute('allow')).to.equal("sync-xhr 'none';");
267267
});
268268

269269
it('should set sandbox', () => {

0 commit comments

Comments
Ā (0)