OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 211 |
212 // 6. Set the text track readiness state to loading. | 212 // 6. Set the text track readiness state to loading. |
213 setReadyState(HTMLTrackElement::LOADING); | 213 setReadyState(HTMLTrackElement::LOADING); |
214 | 214 |
215 // 7. Let URL be the track URL of the track element. | 215 // 7. Let URL be the track URL of the track element. |
216 KURL url = getNonEmptyURLAttribute(srcAttr); | 216 KURL url = getNonEmptyURLAttribute(srcAttr); |
217 | 217 |
218 // 8. If the track element's parent is a media element then let CORS mode be
the state of the parent media | 218 // 8. If the track element's parent is a media element then let CORS mode be
the state of the parent media |
219 // element's crossorigin content attribute. Otherwise, let CORS mode be No C
ORS. | 219 // element's crossorigin content attribute. Otherwise, let CORS mode be No C
ORS. |
220 if (!canLoadUrl(url)) { | 220 if (!canLoadUrl(url)) { |
221 didCompleteLoad(ensureTrack(), HTMLTrackElement::Failure); | 221 didCompleteLoad(HTMLTrackElement::Failure); |
222 return; | 222 return; |
223 } | 223 } |
224 | 224 |
225 ensureTrack()->scheduleLoad(url); | 225 ensureTrack()->scheduleLoad(url); |
226 } | 226 } |
227 | 227 |
228 bool HTMLTrackElement::canLoadUrl(const KURL& url) | 228 bool HTMLTrackElement::canLoadUrl(const KURL& url) |
229 { | 229 { |
230 if (!RuntimeEnabledFeatures::videoTrackEnabled()) | 230 if (!RuntimeEnabledFeatures::videoTrackEnabled()) |
231 return false; | 231 return false; |
(...skipping 11 matching lines...) Expand all Loading... |
243 return false; | 243 return false; |
244 | 244 |
245 if (!document().contentSecurityPolicy()->allowMediaFromSource(url)) { | 245 if (!document().contentSecurityPolicy()->allowMediaFromSource(url)) { |
246 LOG(Media, "HTMLTrackElement::canLoadUrl(%s) -> rejected by Content Secu
rity Policy", urlForLoggingTrack(url).utf8().data()); | 246 LOG(Media, "HTMLTrackElement::canLoadUrl(%s) -> rejected by Content Secu
rity Policy", urlForLoggingTrack(url).utf8().data()); |
247 return false; | 247 return false; |
248 } | 248 } |
249 | 249 |
250 return dispatchBeforeLoadEvent(url.string()); | 250 return dispatchBeforeLoadEvent(url.string()); |
251 } | 251 } |
252 | 252 |
253 void HTMLTrackElement::didCompleteLoad(LoadableTextTrack*, LoadStatus status) | 253 void HTMLTrackElement::didCompleteLoad(LoadStatus status) |
254 { | 254 { |
255 // 4.8.10.12.3 Sourcing out-of-band text tracks (continued) | 255 // 4.8.10.12.3 Sourcing out-of-band text tracks (continued) |
256 | 256 |
257 // 4. Download: ... | 257 // 4. Download: ... |
258 // If the fetching algorithm fails for any reason (network error, the server
returns an error | 258 // If the fetching algorithm fails for any reason (network error, the server
returns an error |
259 // code, a cross-origin check fails, etc), or if URL is the empty string or
has the wrong origin | 259 // code, a cross-origin check fails, etc), or if URL is the empty string or
has the wrong origin |
260 // as determined by the condition at the start of this step, or if the fetch
ed resource is not in | 260 // as determined by the condition at the start of this step, or if the fetch
ed resource is not in |
261 // a supported format, then queue a task to first change the text track read
iness state to failed | 261 // a supported format, then queue a task to first change the text track read
iness state to failed |
262 // to load and then fire a simple event named error at the track element; an
d then, once that task | 262 // to load and then fire a simple event named error at the track element; an
d then, once that task |
263 // is queued, move on to the step below labeled monitoring. | 263 // is queued, move on to the step below labeled monitoring. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 HTMLMediaElement* HTMLTrackElement::mediaElement() const | 347 HTMLMediaElement* HTMLTrackElement::mediaElement() const |
348 { | 348 { |
349 Element* parent = parentElement(); | 349 Element* parent = parentElement(); |
350 if (parent && parent->isMediaElement()) | 350 if (parent && parent->isMediaElement()) |
351 return toHTMLMediaElement(parentNode()); | 351 return toHTMLMediaElement(parentNode()); |
352 return 0; | 352 return 0; |
353 } | 353 } |
354 | 354 |
355 } | 355 } |
356 | 356 |
OLD | NEW |