Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/Modulator.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/Modulator.cpp b/third_party/WebKit/Source/core/dom/Modulator.cpp |
| index c523d831ef8089beadc06462ad4b2496857a543a..d2682836a076dabe1a4e3063b0121acbd2ecfe18 100644 |
| --- a/third_party/WebKit/Source/core/dom/Modulator.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Modulator.cpp |
| @@ -16,4 +16,30 @@ Modulator* Modulator::from(LocalFrame* frame) { |
| return scriptState->perContextData()->modulator(); |
| } |
| +KURL Modulator::resolveModuleSpecifier(const String& moduleRequest, |
| + const KURL& baseURL) { |
| + // Step 1. Apply the URL parser to specifier. If the result is not failure, |
| + // return the result. |
| + KURL url(KURL(), moduleRequest); |
| + if (url.isValid()) |
| + return url; |
| + |
| + // Step 2. If specifier does not start with the character U+002F SOLIDUS (/), |
| + // the two-character sequence U+002E FULL STOP, U+002F SOLIDUS (./), or the |
| + // three-character sequence U+002E FULL STOP, U+002E FULL STOP, U+002F SOLIDUS |
| + // (../), return failure and abort these steps. |
| + if (!moduleRequest.startsWith("/") && !moduleRequest.startsWith("./") && |
| + !moduleRequest.startsWith("../")) |
| + return KURL(); |
| + |
| + // Step 3. Return the result of applying the URL parser to specifier with |
| + // script's base URL as the base URL. |
| + DCHECK(baseURL.isValid()); |
| + KURL relativeURL(baseURL, moduleRequest); |
|
yhirano
2017/01/19 02:05:44
Should this be named as |absoluteURL|? According t
kouhei (in TOK)
2017/01/19 02:20:43
Done.
|
| + if (relativeURL.isValid()) |
| + return relativeURL; |
| + |
| + return KURL(); |
| +} |
| + |
| } // namespace blink |