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

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

Issue 2885203006: [DevTools] inline modules should have correct text offset (Closed)
Patch Set: a Created 3 years, 7 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
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 7 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 case ScriptType::kClassic: 472 case ScriptType::kClassic:
473 // TODO(hiroshige): Clarify how Step 22.2 is implemented for "classic". 473 // TODO(hiroshige): Clarify how Step 22.2 is implemented for "classic".
474 break; 474 break;
475 475
476 // - "module": 476 // - "module":
477 case ScriptType::kModule: { 477 case ScriptType::kModule: {
478 // 1. "Let base URL be the script element's node document's document 478 // 1. "Let base URL be the script element's node document's document
479 // base URL." 479 // base URL."
480 KURL base_url = element_document.BaseURL(); 480 KURL base_url = element_document.BaseURL();
481 481
482 TextPosition position = element_document.IsInDocumentWrite()
483 ? TextPosition()
484 : script_start_position;
482 // 2. "Let script be the result of creating a module script using 485 // 2. "Let script be the result of creating a module script using
483 // source text, settings, base URL, cryptographic nonce, 486 // source text, settings, base URL, cryptographic nonce,
484 // parser state, and module script credentials mode." 487 // parser state, and module script credentials mode."
485 Modulator* modulator = Modulator::From( 488 Modulator* modulator = Modulator::From(
486 ToScriptStateForMainWorld(element_document.GetFrame())); 489 ToScriptStateForMainWorld(element_document.GetFrame()));
487 ModuleScript* module_script = ModuleScript::Create( 490 ModuleScript* module_script = ModuleScript::Create(
488 ScriptContent(), modulator, base_url, nonce, parser_state, 491 ScriptContent(), modulator, base_url, nonce, parser_state,
489 credentials_mode, kSharableCrossOrigin); 492 credentials_mode, kSharableCrossOrigin, position);
490 493
491 // 3. "If this returns null, set the script's script to null and abort 494 // 3. "If this returns null, set the script's script to null and abort
492 // these substeps; the script is ready." 495 // these substeps; the script is ready."
493 if (!module_script) 496 if (!module_script)
494 return false; 497 return false;
495 498
496 // 4. "Fetch the descendants of script (using an empty ancestor list). 499 // 4. "Fetch the descendants of script (using an empty ancestor list).
497 // When this asynchronously completes, set the script's script to 500 // When this asynchronously completes, set the script's script to
498 // the result. At that time, the script is ready." 501 // the result. At that time, the script is ready."
499 DCHECK(!module_tree_client_); 502 DCHECK(!module_tree_client_);
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 // then abort these steps at this point. The script is not executed. 980 // then abort these steps at this point. The script is not executed.
978 return DeprecatedEqualIgnoringCase(event_attribute, "onload") || 981 return DeprecatedEqualIgnoringCase(event_attribute, "onload") ||
979 DeprecatedEqualIgnoringCase(event_attribute, "onload()"); 982 DeprecatedEqualIgnoringCase(event_attribute, "onload()");
980 } 983 }
981 984
982 String ScriptLoader::ScriptContent() const { 985 String ScriptLoader::ScriptContent() const {
983 return element_->TextFromChildren(); 986 return element_->TextFromChildren();
984 } 987 }
985 988
986 } // namespace blink 989 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698