1 // META: script=/common/get-host-info.sub.js
2 // META: script=./resources/common.js
6 assert_true(self.crossOriginIsolated);
8 promise_test(async testCase => {
9 const {iframes, windows} = await build([
67 url: window.location.href,
72 url: 'cross-origin-url',
73 scope: 'cross-origin-aggregated',
76 src: iframes['cross-site-1'].src,
80 url: windows['same-origin-2'].location.href,
84 src: iframes['cross-site-1'].src,
88 url: windows['same-origin-3'].location.href,
92 src: iframes['same-origin-3'].src,
96 url: windows['same-origin-4'].location.href,
100 src: iframes['same-origin-4'].src,
104 url: 'cross-origin-url',
105 scope: 'cross-origin-aggregated',
107 id: 'cross-origin-5',
108 src: iframes['cross-origin-5'].src,
112 url: windows['same-origin-6'].location.href,
115 id: 'cross-origin-5',
116 src: iframes['cross-origin-5'].src,
120 url: windows['same-origin-8'].location.href,
124 src: iframes['same-origin-8'].src,
128 url: windows['same-origin-7'].location.href,
133 url: windows['same-origin-11'].location.href,
138 url: windows['same-origin-12'].location.href,
143 url: windows['same-origin-13'].location.href,
148 const keep = sameOriginContexts(frames).concat(sameOriginContexts(windows));
150 // 1) By setting src attribute:
151 iframes['cross-site-1'].src =
152 iframes['cross-site-1'].src.replace('iframe.sub', 'iframe.secret.sub');
153 // 2) By setting location attribute:
154 let url = iframes['same-origin-3'].contentWindow.location.href;
155 url = url.replace('iframe.sub', 'iframe.secret.sub');
156 iframes['same-origin-3'].contentWindow.location.href = url;
157 // 3) By removing from the DOM tree:
158 iframes['cross-origin-5'].parentNode.removeChild(iframes['cross-origin-5']);
161 // 1) By setting document.location attribute:
162 url = windows['same-origin-7'].location.href;
163 url = url.replace('window.sub', 'window.secret.sub');
164 windows['same-origin-7'].location.href = url;
165 // 2) By closing the window:
166 windows['same-origin-10'].parent.close();
168 await waitForMessage('cross-site-1');
169 await waitForMessage('same-origin-3');
170 await waitForMessage('same-origin-7');
173 url: 'cross-origin-url',
174 scope: 'cross-origin-aggregated',
177 src: iframes['cross-site-1'].src,
182 url: windows['same-origin-3'].location.href,
186 src: iframes['same-origin-3'].src,
190 url: windows['same-origin-7'].location.href,
194 const result = await performance.measureMemory();
195 checkMeasureMemory(result, expected);
196 }, 'performance.measureMemory URLs within a cross-site iframe.');