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

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

Issue 286993008: For media element fetches, remove user:pass components always. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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 | « Source/core/html/HTMLMediaElement.h ('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 reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple 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 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 m_mediaSource = nullptr; 863 m_mediaSource = nullptr;
864 attemptLoad = false; 864 attemptLoad = false;
865 } 865 }
866 } 866 }
867 } 867 }
868 } 868 }
869 869
870 if (attemptLoad && canLoadURL(url, contentType, keySystem)) { 870 if (attemptLoad && canLoadURL(url, contentType, keySystem)) {
871 ASSERT(!webMediaPlayer()); 871 ASSERT(!webMediaPlayer());
872 872
873 if (m_preload == MediaPlayer::None) { 873 if (m_preload == MediaPlayer::None)
874 m_delayingLoadForPreloadNone = true; 874 m_delayingLoadForPreloadNone = true;
875 } else { 875 else
876 m_player->load(loadType(), m_currentSrc, corsMode()); 876 startLoad();
acolwell GONE FROM CHROMIUM 2014/05/16 17:32:19 nit: s/startLoad/startPlayerLoad/ just to make it
sof 2014/05/16 19:51:31 That's a clearer name, thanks.
877 }
878 } else { 877 } else {
879 mediaLoadingFailed(MediaPlayer::FormatError); 878 mediaLoadingFailed(MediaPlayer::FormatError);
880 } 879 }
881 880
882 // If there is no poster to display, allow the media engine to render video frames as soon as 881 // If there is no poster to display, allow the media engine to render video frames as soon as
883 // they are available. 882 // they are available.
884 updateDisplayState(); 883 updateDisplayState();
885 884
886 if (renderer()) 885 if (renderer())
887 renderer()->updateFromElement(); 886 renderer()->updateFromElement();
888 } 887 }
889 888
889 void HTMLMediaElement::startLoad()
890 {
891 // Filter out user:pass as the information isn't supplied for
892 // media resource fetches (including CORS use-credentials).
893 // Compatible behavior, and what the embedder currently does
Nate Chapin 2014/05/16 16:55:36 Grammar Nit: I'm not 100% sure I've read this corr
sof 2014/05/16 19:51:31 I tried to make the comment minimal, but compresse
894 // regardless.
acolwell GONE FROM CHROMIUM 2014/05/16 17:32:19 Please put relevant spec references for this behav
sof 2014/05/16 19:51:31 Done, but the treatment of these URL forms isn't (
895 //
896 // FIXME: when the spec switches to being Fetch-based, and
897 // explicitly sets the authentication flag, adjust handling.
898 KURL requestURL = m_currentSrc;
899 if (!requestURL.user().isEmpty())
900 requestURL.setUser(String());
901 if (!requestURL.pass().isEmpty())
902 requestURL.setPass(String());
903
904 m_player->load(loadType(), requestURL, corsMode());
905 }
906
890 void HTMLMediaElement::setPlayerPreload() 907 void HTMLMediaElement::setPlayerPreload()
891 { 908 {
892 m_player->setPreload(m_preload); 909 m_player->setPreload(m_preload);
893 910
894 if (m_delayingLoadForPreloadNone && m_preload != MediaPlayer::None) 911 if (m_delayingLoadForPreloadNone && m_preload != MediaPlayer::None)
895 startDelayedLoad(); 912 startDelayedLoad();
896 } 913 }
897 914
898 void HTMLMediaElement::startDelayedLoad() 915 void HTMLMediaElement::startDelayedLoad()
899 { 916 {
900 ASSERT(m_delayingLoadForPreloadNone); 917 ASSERT(m_delayingLoadForPreloadNone);
901 918
902 m_delayingLoadForPreloadNone = false; 919 m_delayingLoadForPreloadNone = false;
903 920
904 m_player->load(loadType(), m_currentSrc, corsMode()); 921 startLoad();
905 } 922 }
906 923
907 WebMediaPlayer::LoadType HTMLMediaElement::loadType() const 924 WebMediaPlayer::LoadType HTMLMediaElement::loadType() const
908 { 925 {
909 if (m_mediaSource) 926 if (m_mediaSource)
910 return WebMediaPlayer::LoadTypeMediaSource; 927 return WebMediaPlayer::LoadTypeMediaSource;
911 928
912 if (isMediaStreamURL(m_currentSrc.string())) 929 if (isMediaStreamURL(m_currentSrc.string()))
913 return WebMediaPlayer::LoadTypeMediaStream; 930 return WebMediaPlayer::LoadTypeMediaStream;
914 931
(...skipping 2696 matching lines...) Expand 10 before | Expand all | Expand 10 after
3611 { 3628 {
3612 visitor->trace(m_currentSourceNode); 3629 visitor->trace(m_currentSourceNode);
3613 visitor->trace(m_nextChildNodeToConsider); 3630 visitor->trace(m_nextChildNodeToConsider);
3614 visitor->trace(m_textTracks); 3631 visitor->trace(m_textTracks);
3615 visitor->trace(m_textTracksWhenResourceSelectionBegan); 3632 visitor->trace(m_textTracksWhenResourceSelectionBegan);
3616 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); 3633 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor);
3617 HTMLElement::trace(visitor); 3634 HTMLElement::trace(visitor);
3618 } 3635 }
3619 3636
3620 } 3637 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698