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

Side by Side 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: Created 7 years, 1 month 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 | Annotate | Revision Log
« 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 // Copyright (c) 2009, Google Inc. 1 // Copyright (c) 2009, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // Create a page-level library if necessary. 173 // Create a page-level library if necessary.
174 Dart_Handle script = Dart_RootLibrary(); 174 Dart_Handle script = Dart_RootLibrary();
175 if (Dart_IsNull(script)) { 175 if (Dart_IsNull(script)) {
176 String scriptUrl = m_originDocument->url().string() + "$script"; 176 String scriptUrl = m_originDocument->url().string() + "$script";
177 script = Dart_LoadScript(DartUtilities::stringToDartString(scriptUrl ), Dart_NewStringFromCString(""), 0, 0); 177 script = Dart_LoadScript(DartUtilities::stringToDartString(scriptUrl ), Dart_NewStringFromCString(""), 0, 0);
178 if (Dart_IsError(script)) 178 if (Dart_IsError(script))
179 DartUtilities::reportProblem(m_originDocument, script, scriptUrl ); 179 DartUtilities::reportProblem(m_originDocument, script, scriptUrl );
180 } 180 }
181 ASSERT(!Dart_IsNull(script)); 181 ASSERT(!Dart_IsNull(script));
182 182
183 // FIXME(dartbug.com/13460): We need to record the lineOffset and column Offset. 183 Dart_Handle libraryUrlHandle = DartUtilities::stringToDartString(url);
184 Dart_Handle library = Dart_LoadLibrary(DartUtilities::stringToDartString (url), dartSource); 184 // Test if a previous script already loaded this library.
185 Dart_Handle library = Dart_LookupLibrary(libraryUrlHandle);
186 if (Dart_IsError(library)) {
187 // FIXME(dartbug.com/13460): We need to record the lineOffset and co lumnOffset.
188 library = Dart_LoadLibrary(libraryUrlHandle, dartSource);
189 }
185 if (Dart_IsError(library)) 190 if (Dart_IsError(library))
186 DartUtilities::reportProblem(m_originDocument, library, m_libraryUrl ); 191 DartUtilities::reportProblem(m_originDocument, library, m_libraryUrl );
siva 2013/10/28 19:52:42 This Dart_IsError(library) error check should also
vsm 2013/10/28 19:58:41 Done.
187 192
188 Dart_Handle result = Dart_LibraryImportLibrary(script, library, Dart_Nul l()); 193 Dart_Handle result = Dart_LibraryImportLibrary(script, library, Dart_Nul l());
189 if (Dart_IsError(result)) 194 if (Dart_IsError(result))
190 DartUtilities::reportProblem(m_originDocument, result, m_libraryUrl) ; 195 DartUtilities::reportProblem(m_originDocument, result, m_libraryUrl) ;
191 } else { 196 } else {
192 // This is a background isolate. Load as a top-level script. 197 // This is a background isolate. Load as a top-level script.
193 Dart_Handle script = Dart_LoadScript(DartUtilities::stringToDartString(u rl), dartSource, lineOffset, 0); 198 Dart_Handle script = Dart_LoadScript(DartUtilities::stringToDartString(u rl), dartSource, lineOffset, 0);
194 if (Dart_IsError(script)) 199 if (Dart_IsError(script))
195 DartUtilities::reportProblem(m_originDocument, script, m_libraryUrl) ; 200 DartUtilities::reportProblem(m_originDocument, script, m_libraryUrl) ;
196 } 201 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // FIXME: try to dig out line number, -1 for now. 287 // FIXME: try to dig out line number, -1 for now.
283 if (failedUrl.startsWith(String("dart:"))) { 288 if (failedUrl.startsWith(String("dart:"))) {
284 m_originDocument->logExceptionToConsole(String("The built-in library '") + failedUrl + String("' is not available on Dartium."), m_libraryUrl, -1, 0, 0) ; 289 m_originDocument->logExceptionToConsole(String("The built-in library '") + failedUrl + String("' is not available on Dartium."), m_libraryUrl, -1, 0, 0) ;
285 } else { 290 } else {
286 m_originDocument->logExceptionToConsole(String("Failed to load a file ") + failedUrl, m_libraryUrl, -1, 0, 0); 291 m_originDocument->logExceptionToConsole(String("Failed to load a file ") + failedUrl, m_libraryUrl, -1, 0, 0);
287 } 292 }
288 m_errorEventDispatcher->dispatchErrorEvent(); 293 m_errorEventDispatcher->dispatchErrorEvent();
289 } 294 }
290 295
291 } 296 }
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