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

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: Improve comment 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 startPlayerLoad();
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::startPlayerLoad()
890 {
891 // Filter out user:pass as those two URL components aren't
892 // considered for media resource fetches (including for the CORS
893 // use-credentials mode.) That behavior aligns with Gecko, with IE
894 // being more restrictive and not allowing fetches to such URLs.
895 //
896 // Spec reference: http://whatwg.org/c/#concept-media-load-resource
897 //
898 // FIXME: when the HTML spec switches to specifying resource
899 // fetches in terms of Fetch (http://fetch.spec.whatwg.org), and
900 // along with that potentially also specifying a setting for its
901 // 'authentication flag' to control how user:pass embedded in a
902 // media resource URL should be treated, then update the handling
903 // here to match.
904 KURL requestURL = m_currentSrc;
905 if (!requestURL.user().isEmpty())
906 requestURL.setUser(String());
907 if (!requestURL.pass().isEmpty())
908 requestURL.setPass(String());
909
910 m_player->load(loadType(), requestURL, corsMode());
911 }
912
890 void HTMLMediaElement::setPlayerPreload() 913 void HTMLMediaElement::setPlayerPreload()
891 { 914 {
892 m_player->setPreload(m_preload); 915 m_player->setPreload(m_preload);
893 916
894 if (m_delayingLoadForPreloadNone && m_preload != MediaPlayer::None) 917 if (m_delayingLoadForPreloadNone && m_preload != MediaPlayer::None)
895 startDelayedLoad(); 918 startDelayedLoad();
896 } 919 }
897 920
898 void HTMLMediaElement::startDelayedLoad() 921 void HTMLMediaElement::startDelayedLoad()
899 { 922 {
900 ASSERT(m_delayingLoadForPreloadNone); 923 ASSERT(m_delayingLoadForPreloadNone);
901 924
902 m_delayingLoadForPreloadNone = false; 925 m_delayingLoadForPreloadNone = false;
903 926
904 m_player->load(loadType(), m_currentSrc, corsMode()); 927 startPlayerLoad();
905 } 928 }
906 929
907 WebMediaPlayer::LoadType HTMLMediaElement::loadType() const 930 WebMediaPlayer::LoadType HTMLMediaElement::loadType() const
908 { 931 {
909 if (m_mediaSource) 932 if (m_mediaSource)
910 return WebMediaPlayer::LoadTypeMediaSource; 933 return WebMediaPlayer::LoadTypeMediaSource;
911 934
912 if (isMediaStreamURL(m_currentSrc.string())) 935 if (isMediaStreamURL(m_currentSrc.string()))
913 return WebMediaPlayer::LoadTypeMediaStream; 936 return WebMediaPlayer::LoadTypeMediaStream;
914 937
(...skipping 2696 matching lines...) Expand 10 before | Expand all | Expand 10 after
3611 { 3634 {
3612 visitor->trace(m_currentSourceNode); 3635 visitor->trace(m_currentSourceNode);
3613 visitor->trace(m_nextChildNodeToConsider); 3636 visitor->trace(m_nextChildNodeToConsider);
3614 visitor->trace(m_textTracks); 3637 visitor->trace(m_textTracks);
3615 visitor->trace(m_textTracksWhenResourceSelectionBegan); 3638 visitor->trace(m_textTracksWhenResourceSelectionBegan);
3616 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); 3639 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor);
3617 HTMLElement::trace(visitor); 3640 HTMLElement::trace(visitor);
3618 } 3641 }
3619 3642
3620 } 3643 }
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