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

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

Issue 2845313002: Abort and reschedule if script is not ready during execution time (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 883
884 // 7. "Decrement the ignore-destructive-writes counter of neutralized doc, 884 // 7. "Decrement the ignore-destructive-writes counter of neutralized doc,
885 // if it was incremented in the earlier step." 885 // if it was incremented in the earlier step."
886 // Implemented as the scope out of IgnoreDestructiveWriteCountIncrementer. 886 // Implemented as the scope out of IgnoreDestructiveWriteCountIncrementer.
887 } 887 }
888 888
889 void ScriptLoader::Execute() { 889 void ScriptLoader::Execute() {
890 DCHECK(!will_be_parser_executed_); 890 DCHECK(!will_be_parser_executed_);
891 DCHECK(async_exec_type_ != ScriptRunner::kNone); 891 DCHECK(async_exec_type_ != ScriptRunner::kNone);
892 DCHECK(pending_script_->IsExternal()); 892 DCHECK(pending_script_->IsExternal());
893
894 // If revalidation occurs after the script is scheduled for execution,
895 // the script may not be ready at this point.
896 // Abort execution and reschedule when the script is ready again.
897 if (!pending_script_->IsReady()) {
898 pending_script_->WatchForLoad(this);
899 return;
900 }
901
893 bool error_occurred = false; 902 bool error_occurred = false;
894 Script* script = pending_script_->GetSource(KURL(), error_occurred); 903 Script* script = pending_script_->GetSource(KURL(), error_occurred);
895 const bool wasCanceled = pending_script_->WasCanceled(); 904 const bool wasCanceled = pending_script_->WasCanceled();
896 DetachPendingScript(); 905 DetachPendingScript();
897 if (error_occurred) { 906 if (error_occurred) {
898 DispatchErrorEvent(); 907 DispatchErrorEvent();
899 } else if (!wasCanceled) { 908 } else if (!wasCanceled) {
900 if (ExecuteScript(script)) 909 if (ExecuteScript(script))
901 DispatchLoadEvent(); 910 DispatchLoadEvent();
902 else 911 else
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 // then abort these steps at this point. The script is not executed. 983 // then abort these steps at this point. The script is not executed.
975 return DeprecatedEqualIgnoringCase(event_attribute, "onload") || 984 return DeprecatedEqualIgnoringCase(event_attribute, "onload") ||
976 DeprecatedEqualIgnoringCase(event_attribute, "onload()"); 985 DeprecatedEqualIgnoringCase(event_attribute, "onload()");
977 } 986 }
978 987
979 String ScriptLoader::ScriptContent() const { 988 String ScriptLoader::ScriptContent() const {
980 return element_->TextFromChildren(); 989 return element_->TextFromChildren();
981 } 990 }
982 991
983 } // namespace blink 992 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698