Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: third_party/WebKit/Source/core/dom/Modulator.cpp

Issue 2555653002: [WIP Prototype] ES6 https://html.spec.whatwg.org/#fetch-a-single-module-script implementation (Closed)
Patch Set: ModuleScriptLoaderTest Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/dom/Modulator.h"
6
7 namespace blink {
8
9 KURL Modulator::resolveModuleSpecifier(const String& moduleRequest,
10 const KURL& baseURL) {
11 // Step 1. Apply the URL parser to specifier. If the result is not failure,
12 // return the result.
13 KURL url(KURL(), moduleRequest);
14 if (url.isValid())
15 return url;
16
17 // Step 2. If specifier does not start with the character U+002F SOLIDUS (/),
18 // the two-character sequence U+002E FULL STOP, U+002F SOLIDUS (./), or the
19 // three-character sequence U+002E FULL STOP, U+002E FULL STOP, U+002F SOLIDUS
20 // (../), return failure and abort these steps.
21 if (!moduleRequest.startsWith("/") && !moduleRequest.startsWith("./") &&
22 !moduleRequest.startsWith("../"))
23 return KURL();
24
25 // Step 3. Return the result of applying the URL parser to specifier with
26 // script's base URL as the base URL.
27 DCHECK(baseURL.isValid());
28 KURL relativeURL(baseURL, moduleRequest);
29 if (relativeURL.isValid())
30 return relativeURL;
31
32 return KURL();
33 }
34
35 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698