Skip to content

Commit 998c0f7

Browse files
committed
[self] add log for iframe testing, which must be test under same origin.
1 parent d551d2e commit 998c0f7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

sw.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const RUNTIME = 'runtime';
1111
const HOSTNAME_WHITELIST = [
1212
self.location.hostname,
1313
"huangxuan.me",
14+
"yanshuo.io",
1415
"cdnjs.cloudflare.com"
1516
]
1617

@@ -53,6 +54,7 @@ self.addEventListener('activate', event => {
5354
*/
5455
self.addEventListener('fetch', event => {
5556
// Skip some of cross-origin requests, like those for Google Analytics.
57+
console.log("fetch", event.request.url)
5658
if (HOSTNAME_WHITELIST.indexOf(new URL(event.request.url).hostname) > -1) {
5759
// Stale-while-revalidate
5860
// similar to HTTP's stale-while-revalidate: https://www.mnot.net/blog/2007/12/12/stale
@@ -80,4 +82,10 @@ self.addEventListener('fetch', event => {
8082
})
8183
);
8284
}
83-
});
85+
});
86+
87+
88+
89+
self.addEventListener('foreighfetch', event => {
90+
console.log("foreighfetch", event.request.url)
91+
})

0 commit comments

Comments
 (0)