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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2942833004: Add article link to play promises rejection error message (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/media/video-play-pause-events-expected.txt ('k') | 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 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 886
887 DCHECK(!paused_ || play_promise_resolvers_.IsEmpty()); 887 DCHECK(!paused_ || play_promise_resolvers_.IsEmpty());
888 888
889 // 4.6 - If the paused attribute is false, then run these substeps 889 // 4.6 - If the paused attribute is false, then run these substeps
890 if (!paused_) { 890 if (!paused_) {
891 // 4.6.1 - Set the paused attribute to true. 891 // 4.6.1 - Set the paused attribute to true.
892 paused_ = true; 892 paused_ = true;
893 893
894 // 4.6.2 - Take pending play promises and reject pending play promises 894 // 4.6.2 - Take pending play promises and reject pending play promises
895 // with the result and an "AbortError" DOMException. 895 // with the result and an "AbortError" DOMException.
896 RejectPlayPromises( 896 RejectPlayPromises(kAbortError,
897 kAbortError, 897 "The play() request was interrupted by a new load "
898 "The play() request was interrupted by a new load request."); 898 "request. https://goo.gl/LdLk22");
899 } 899 }
900 900
901 // 4.7 - If seeking is true, set it to false. 901 // 4.7 - If seeking is true, set it to false.
902 seeking_ = false; 902 seeking_ = false;
903 903
904 // 4.8 - Set the current playback position to 0. 904 // 4.8 - Set the current playback position to 0.
905 // Set the official playback position to 0. 905 // Set the official playback position to 0.
906 // If this changed the official playback position, then queue a task 906 // If this changed the official playback position, then queue a task
907 // to fire a simple event named timeupdate at the media element. 907 // to fire a simple event named timeupdate at the media element.
908 // 4.9 - Set the initial playback position to 0. 908 // 4.9 - Set the initial playback position to 0.
(...skipping 3027 matching lines...) Expand 10 before | Expand all | Expand 10 after
3936 3936
3937 play_promise_resolve_list_.clear(); 3937 play_promise_resolve_list_.clear();
3938 } 3938 }
3939 3939
3940 void HTMLMediaElement::RejectScheduledPlayPromises() { 3940 void HTMLMediaElement::RejectScheduledPlayPromises() {
3941 // TODO(mlamouri): the message is generated based on the code because 3941 // TODO(mlamouri): the message is generated based on the code because
3942 // arguments can't be passed to a cancellable task. In order to save space 3942 // arguments can't be passed to a cancellable task. In order to save space
3943 // used by the object, the string isn't saved. 3943 // used by the object, the string isn't saved.
3944 DCHECK(play_promise_error_code_ == kAbortError || 3944 DCHECK(play_promise_error_code_ == kAbortError ||
3945 play_promise_error_code_ == kNotSupportedError); 3945 play_promise_error_code_ == kNotSupportedError);
3946 if (play_promise_error_code_ == kAbortError) 3946 if (play_promise_error_code_ == kAbortError) {
3947 RejectPlayPromisesInternal( 3947 RejectPlayPromisesInternal(kAbortError,
3948 kAbortError, 3948 "The play() request was interrupted by a call "
3949 "The play() request was interrupted by a call to pause()."); 3949 "to pause(). https://goo.gl/LdLk22");
3950 else 3950 } else {
3951 RejectPlayPromisesInternal( 3951 RejectPlayPromisesInternal(
3952 kNotSupportedError, 3952 kNotSupportedError,
3953 "Failed to load because no supported source was found."); 3953 "Failed to load because no supported source was found.");
3954 }
3954 } 3955 }
3955 3956
3956 void HTMLMediaElement::RejectPlayPromises(ExceptionCode code, 3957 void HTMLMediaElement::RejectPlayPromises(ExceptionCode code,
3957 const String& message) { 3958 const String& message) {
3958 play_promise_reject_list_.AppendVector(play_promise_resolvers_); 3959 play_promise_reject_list_.AppendVector(play_promise_resolvers_);
3959 play_promise_resolvers_.clear(); 3960 play_promise_resolvers_.clear();
3960 RejectPlayPromisesInternal(code, message); 3961 RejectPlayPromisesInternal(code, message);
3961 } 3962 }
3962 3963
3963 void HTMLMediaElement::RejectPlayPromisesInternal(ExceptionCode code, 3964 void HTMLMediaElement::RejectPlayPromisesInternal(ExceptionCode code,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
4091 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); 4092 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE);
4092 } 4093 }
4093 4094
4094 void HTMLMediaElement::ViewportFillDebouncerTimerFired(TimerBase*) { 4095 void HTMLMediaElement::ViewportFillDebouncerTimerFired(TimerBase*) {
4095 mostly_filling_viewport_ = true; 4096 mostly_filling_viewport_ = true;
4096 if (web_media_player_) 4097 if (web_media_player_)
4097 web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_); 4098 web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_);
4098 } 4099 }
4099 4100
4100 } // namespace blink 4101 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/media/video-play-pause-events-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698