-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Service Worker] Support redirects to relative URLs in Safari (#1978)
- Loading branch information
Showing
5 changed files
with
51 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
import './lib/blob'; | ||
import './lib/custom-event'; | ||
import './lib/url'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { currentJsRuntime } from './current-js-runtime'; | ||
|
||
if (currentJsRuntime === 'NODE') { | ||
/** | ||
* Polyfill for URL.canParse if it's missing. | ||
* | ||
* URL.canParse is available since Node 19.9.0, | ||
* but Playground currently uses Node 18.18.0. | ||
* | ||
* This implementation is based on the one from `core-js` | ||
* by Denis Pushkarev, https://github.com/zloirock | ||
* https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url.can-parse.js | ||
*/ | ||
if (typeof URL.canParse !== 'function') { | ||
globalThis.URL.canParse = function (url: string) { | ||
try { | ||
return !!new URL(url); | ||
} catch (e) { | ||
return false; | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters