| OLD | NEW |
| 1 // Copyright (c) 2013, Google Inc. | 1 // Copyright (c) 2013, 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 196 } |
| 197 | 197 |
| 198 for (ScriptList::iterator i = m_scriptsToLoad.begin(); i != m_scriptsToLoad.
end(); ++i) { | 198 for (ScriptList::iterator i = m_scriptsToLoad.begin(); i != m_scriptsToLoad.
end(); ++i) { |
| 199 RefPtr<DartScriptInfo> script = *i; | 199 RefPtr<DartScriptInfo> script = *i; |
| 200 const String& src = script->sourceAttributeValue(); | 200 const String& src = script->sourceAttributeValue(); |
| 201 const String& url = script->url(); | 201 const String& url = script->url(); |
| 202 if (src.isEmpty()) { | 202 if (src.isEmpty()) { |
| 203 // Inline script. | 203 // Inline script. |
| 204 ASSERT(!m_pendingLibraries.contains(url)); | 204 ASSERT(!m_pendingLibraries.contains(url)); |
| 205 m_pendingLibraries.add(url); | 205 m_pendingLibraries.add(url); |
| 206 process(script->url(), script->scriptContent(), script->startLineNum
ber().zeroBasedInt()); | 206 intptr_t lineOffset = script->startLineNumber().zeroBasedInt(); |
| 207 // Blink gives generated script tags an invalid start line. |
| 208 if (lineOffset < 0) |
| 209 lineOffset = 0; |
| 210 process(script->url(), script->scriptContent(), lineOffset); |
| 207 } else { | 211 } else { |
| 208 // Canonicalize the src attribute url. | 212 // Canonicalize the src attribute url. |
| 209 String canonical = KURL(script->ownerDocument()->url(), src).string(
); | 213 String canonical = KURL(script->ownerDocument()->url(), src).string(
); |
| 210 // Request if we don't have the script or haven't already requested
it. | 214 // Request if we don't have the script or haven't already requested
it. |
| 211 if (!m_pendingLibraries.contains(canonical)) { | 215 if (!m_pendingLibraries.contains(canonical)) { |
| 212 m_pendingLibraries.add(canonical); | 216 m_pendingLibraries.add(canonical); |
| 213 fetchScriptResource(canonical); | 217 fetchScriptResource(canonical); |
| 214 } | 218 } |
| 215 } | 219 } |
| 216 } | 220 } |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 ResourcePtr<ScriptResource> scriptResource = m_loadCallback->requestScript(r
equest); | 429 ResourcePtr<ScriptResource> scriptResource = m_loadCallback->requestScript(r
equest); |
| 426 if (scriptResource) { | 430 if (scriptResource) { |
| 427 scriptResource->addClient(new ScriptLoadedCallback(m_loadCallback->compl
eteURL(url), this, scriptResource)); | 431 scriptResource->addClient(new ScriptLoadedCallback(m_loadCallback->compl
eteURL(url), this, scriptResource)); |
| 428 } else { | 432 } else { |
| 429 m_error = true; | 433 m_error = true; |
| 430 m_loadCallback->reportError(String("File request error"), url); | 434 m_loadCallback->reportError(String("File request error"), url); |
| 431 } | 435 } |
| 432 } | 436 } |
| 433 | 437 |
| 434 } | 438 } |
| OLD | NEW |