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

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

Issue 2796653003: Move ScriptState::forWorld/ScriptState::forMainWorld (Part 2) (Closed)
Patch Set: Rebase Created 3 years, 8 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
11 * License as published by the Free Software Foundation; either 11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version. 12 * version 2 of the License, or (at your option) any later version.
13 * 13 *
14 * This library is distributed in the hope that it will be useful, 14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details. 17 * Library General Public License for more details.
18 * 18 *
19 * You should have received a copy of the GNU Library General Public License 19 * You should have received a copy of the GNU Library General Public License
20 * along with this library; see the file COPYING.LIB. If not, write to 20 * along with this library; see the file COPYING.LIB. If not, write to
21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA. 22 * Boston, MA 02110-1301, USA.
23 */ 23 */
24 24
25 #include "core/dom/ScriptLoader.h" 25 #include "core/dom/ScriptLoader.h"
26 26
27 #include "bindings/core/v8/ScriptController.h" 27 #include "bindings/core/v8/ScriptController.h"
28 #include "bindings/core/v8/ScriptSourceCode.h" 28 #include "bindings/core/v8/ScriptSourceCode.h"
29 #include "bindings/core/v8/V8Binding.h"
29 #include "core/HTMLNames.h" 30 #include "core/HTMLNames.h"
30 #include "core/SVGNames.h" 31 #include "core/SVGNames.h"
31 #include "core/dom/Document.h" 32 #include "core/dom/Document.h"
32 #include "core/dom/DocumentParserTiming.h" 33 #include "core/dom/DocumentParserTiming.h"
33 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" 34 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h"
34 #include "core/dom/ScriptElementBase.h" 35 #include "core/dom/ScriptElementBase.h"
35 #include "core/dom/ScriptRunner.h" 36 #include "core/dom/ScriptRunner.h"
36 #include "core/dom/ScriptableDocumentParser.h" 37 #include "core/dom/ScriptableDocumentParser.h"
37 #include "core/dom/Text.h" 38 #include "core/dom/Text.h"
38 #include "core/events/Event.h" 39 #include "core/events/Event.h"
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 // - "If the script's type is "classic", and the element has a src attribute" 453 // - "If the script's type is "classic", and the element has a src attribute"
453 // TODO(hiroshige): Check the script's type and implement "module" case. 454 // TODO(hiroshige): Check the script's type and implement "module" case.
454 if (m_element->hasSourceAttribute()) { 455 if (m_element->hasSourceAttribute()) {
455 // "The element must be added to the set of scripts that will execute 456 // "The element must be added to the set of scripts that will execute
456 // as soon as possible of the node document of the script element at the 457 // as soon as possible of the node document of the script element at the
457 // time the prepare a script algorithm started." 458 // time the prepare a script algorithm started."
458 m_pendingScript = PendingScript::create(m_element.get(), m_resource.get()); 459 m_pendingScript = PendingScript::create(m_element.get(), m_resource.get());
459 m_asyncExecType = ScriptRunner::Async; 460 m_asyncExecType = ScriptRunner::Async;
460 LocalFrame* frame = m_element->document().frame(); 461 LocalFrame* frame = m_element->document().frame();
461 if (frame) { 462 if (frame) {
462 ScriptState* scriptState = ScriptState::forMainWorld(frame); 463 ScriptState* scriptState = toScriptStateForMainWorld(frame);
463 if (scriptState) 464 if (scriptState)
464 ScriptStreamer::startStreaming( 465 ScriptStreamer::startStreaming(
465 m_pendingScript.get(), ScriptStreamer::Async, frame->settings(), 466 m_pendingScript.get(), ScriptStreamer::Async, frame->settings(),
466 scriptState, frame->frameScheduler()->loadingTaskRunner()); 467 scriptState, frame->frameScheduler()->loadingTaskRunner());
467 } 468 }
468 // TODO(hiroshige): Here |contextDocument| is used as "node document" 469 // TODO(hiroshige): Here |contextDocument| is used as "node document"
469 // while Step 14 uses |elementDocument| as "node document". Fix this. 470 // while Step 14 uses |elementDocument| as "node document". Fix this.
470 contextDocument->scriptRunner()->queueScriptForExecution(this, 471 contextDocument->scriptRunner()->queueScriptForExecution(this,
471 m_asyncExecType); 472 m_asyncExecType);
472 // Note that watchForLoad can immediately call pendingScriptFinished. 473 // Note that watchForLoad can immediately call pendingScriptFinished.
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 // then abort these steps at this point. The script is not executed. 871 // then abort these steps at this point. The script is not executed.
871 return equalIgnoringCase(eventAttribute, "onload") || 872 return equalIgnoringCase(eventAttribute, "onload") ||
872 equalIgnoringCase(eventAttribute, "onload()"); 873 equalIgnoringCase(eventAttribute, "onload()");
873 } 874 }
874 875
875 String ScriptLoader::scriptContent() const { 876 String ScriptLoader::scriptContent() const {
876 return m_element->textFromChildren(); 877 return m_element->textFromChildren();
877 } 878 }
878 879
879 } // namespace blink 880 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Modulator.cpp ('k') | third_party/WebKit/Source/core/dom/StyleEngineTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698