OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Google, Inc. 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 visitor->trace(m_streamer); | 218 visitor->trace(m_streamer); |
219 visitor->trace(m_client); | 219 visitor->trace(m_client); |
220 ResourceOwner<ScriptResource>::trace(visitor); | 220 ResourceOwner<ScriptResource>::trace(visitor); |
221 MemoryCoordinatorClient::trace(visitor); | 221 MemoryCoordinatorClient::trace(visitor); |
222 } | 222 } |
223 | 223 |
224 ScriptSourceCode PendingScript::getSource(const KURL& documentURL, | 224 ScriptSourceCode PendingScript::getSource(const KURL& documentURL, |
225 bool& errorOccurred) const { | 225 bool& errorOccurred) const { |
226 checkState(); | 226 checkState(); |
227 | 227 |
228 errorOccurred = this->errorOccurred(); | |
228 if (resource()) { | 229 if (resource()) { |
229 errorOccurred = resource()->errorOccurred() || m_integrityFailure; | |
230 DCHECK(resource()->isLoaded()); | 230 DCHECK(resource()->isLoaded()); |
231 if (m_streamer && !m_streamer->streamingSuppressed()) | 231 if (m_streamer && !m_streamer->streamingSuppressed()) |
232 return ScriptSourceCode(m_streamer, resource()); | 232 return ScriptSourceCode(m_streamer, resource()); |
233 return ScriptSourceCode(resource()); | 233 return ScriptSourceCode(resource()); |
234 } | 234 } |
235 | 235 |
236 errorOccurred = false; | |
237 return ScriptSourceCode(m_element->textContent(), documentURL, | 236 return ScriptSourceCode(m_element->textContent(), documentURL, |
238 startingPosition()); | 237 startingPosition()); |
239 } | 238 } |
240 | 239 |
241 void PendingScript::setStreamer(ScriptStreamer* streamer) { | 240 void PendingScript::setStreamer(ScriptStreamer* streamer) { |
242 DCHECK(!m_streamer); | 241 DCHECK(!m_streamer); |
243 DCHECK(!m_watchingForLoad); | 242 DCHECK(!m_watchingForLoad); |
244 m_streamer = streamer; | 243 m_streamer = streamer; |
245 checkState(); | 244 checkState(); |
246 } | 245 } |
247 | 246 |
248 bool PendingScript::isReady() const { | 247 bool PendingScript::isReady() const { |
249 checkState(); | 248 checkState(); |
250 if (resource()) { | 249 if (resource()) { |
251 return resource()->isLoaded() && (!m_streamer || m_streamer->isFinished()); | 250 return resource()->isLoaded() && (!m_streamer || m_streamer->isFinished()); |
252 } | 251 } |
253 | 252 |
254 return true; | 253 return true; |
255 } | 254 } |
256 | 255 |
257 bool PendingScript::errorOccurred() const { | 256 bool PendingScript::errorOccurred() const { |
258 checkState(); | 257 checkState(); |
259 if (resource()) | 258 if (resource()) |
260 return resource()->errorOccurred(); | 259 return resource()->errorOccurred() || m_integrityFailure; |
sof
2017/02/23 08:10:48
The ScriptLoader will consult the resource to deci
hiroshige
2017/02/23 16:41:25
Oh, this line? I'll update it soon.
https://codese
| |
261 | 260 |
262 return false; | 261 return false; |
263 } | 262 } |
264 | 263 |
265 void PendingScript::onPurgeMemory() { | 264 void PendingScript::onPurgeMemory() { |
266 checkState(); | 265 checkState(); |
267 if (!m_streamer) | 266 if (!m_streamer) |
268 return; | 267 return; |
269 m_streamer->cancel(); | 268 m_streamer->cancel(); |
270 m_streamer = nullptr; | 269 m_streamer = nullptr; |
271 } | 270 } |
272 | 271 |
273 } // namespace blink | 272 } // namespace blink |
OLD | NEW |