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

Unified Diff: Source/bindings/dart/DartApplicationLoader.cpp

Issue 49603003: Check for import from previous script. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Hoist partially redundant check Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/dart/DartApplicationLoader.cpp
diff --git a/Source/bindings/dart/DartApplicationLoader.cpp b/Source/bindings/dart/DartApplicationLoader.cpp
index 7f8ef4ccba352ad945b132cc9479bb035eb2cc31..14e34df87ae6fa29a56e588f05b1ce927630f36d 100644
--- a/Source/bindings/dart/DartApplicationLoader.cpp
+++ b/Source/bindings/dart/DartApplicationLoader.cpp
@@ -180,10 +180,15 @@ void DartApplicationLoader::loadMainScript(const String& url, const String& sour
}
ASSERT(!Dart_IsNull(script));
- // FIXME(dartbug.com/13460): We need to record the lineOffset and columnOffset.
- Dart_Handle library = Dart_LoadLibrary(DartUtilities::stringToDartString(url), dartSource);
- if (Dart_IsError(library))
- DartUtilities::reportProblem(m_originDocument, library, m_libraryUrl);
+ Dart_Handle libraryUrlHandle = DartUtilities::stringToDartString(url);
+ // Test if a previous script already loaded this library.
+ Dart_Handle library = Dart_LookupLibrary(libraryUrlHandle);
+ if (Dart_IsError(library)) {
+ // FIXME(dartbug.com/13460): We need to record the lineOffset and columnOffset.
+ library = Dart_LoadLibrary(libraryUrlHandle, dartSource);
+ if (Dart_IsError(library))
+ DartUtilities::reportProblem(m_originDocument, library, m_libraryUrl);
+ }
Dart_Handle result = Dart_LibraryImportLibrary(script, library, Dart_Null());
if (Dart_IsError(result))
« 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