<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[187737] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/187737">187737</a></dd>
<dt>Author</dt> <dd>youenn.fablet@crf.canon.fr</dd>
<dt>Date</dt> <dd>2015-08-03 08:38:32 -0700 (Mon, 03 Aug 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[EFL] http/tests/media/media-stream/disconnected-frame-already.html is crashing after <a href="http://trac.webkit.org/projects/webkit/changeset/185903">r185903</a>
https://bugs.webkit.org/show_bug.cgi?id=146834

Reviewed by Eric Carlson.

<a href="http://trac.webkit.org/projects/webkit/changeset/185903">r185903</a> went to far in removing some tests, in particular whether the current process is related to a frame.
Readded that check.
Refactored the code to remove the need for NavigatorUserMedia class.

Covered by existing tests.

* CMakeLists.txt: Removed NavigatorUserMedia.cpp.
* Modules/mediastream/NavigatorUserMedia.cpp: Removed.
* Modules/mediastream/NavigatorUserMedia.h: Removed.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* bindings/js/JSNavigatorCustom.cpp:
(WebCore::JSNavigator::webkitGetUserMedia): Inlined NavigatorUserMeia::webkitGetUserMedia.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSNavigatorCustomcpp">trunk/Source/WebCore/bindings/js/JSNavigatorCustom.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreModulesmediastreamNavigatorUserMediacpp">trunk/Source/WebCore/Modules/mediastream/NavigatorUserMedia.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamNavigatorUserMediah">trunk/Source/WebCore/Modules/mediastream/NavigatorUserMedia.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (187736 => 187737)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2015-08-03 12:48:52 UTC (rev 187736)
+++ trunk/Source/WebCore/CMakeLists.txt        2015-08-03 15:38:32 UTC (rev 187737)
</span><span class="lines">@@ -912,7 +912,6 @@
</span><span class="cx">     Modules/mediastream/MediaTrackConstraintSet.cpp
</span><span class="cx">     Modules/mediastream/MediaTrackConstraints.cpp
</span><span class="cx">     Modules/mediastream/NavigatorMediaDevices.cpp
</span><del>-    Modules/mediastream/NavigatorUserMedia.cpp
</del><span class="cx">     Modules/mediastream/NavigatorUserMediaError.cpp
</span><span class="cx">     Modules/mediastream/RTCDTMFSender.cpp
</span><span class="cx">     Modules/mediastream/RTCDTMFToneChangeEvent.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (187736 => 187737)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-08-03 12:48:52 UTC (rev 187736)
+++ trunk/Source/WebCore/ChangeLog        2015-08-03 15:38:32 UTC (rev 187737)
</span><span class="lines">@@ -1,5 +1,25 @@
</span><span class="cx"> 2015-08-03  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
</span><span class="cx"> 
</span><ins>+        [EFL] http/tests/media/media-stream/disconnected-frame-already.html is crashing after r185903
+        https://bugs.webkit.org/show_bug.cgi?id=146834
+
+        Reviewed by Eric Carlson.
+
+        r185903 went to far in removing some tests, in particular whether the current process is related to a frame.
+        Readded that check.
+        Refactored the code to remove the need for NavigatorUserMedia class.
+
+        Covered by existing tests.
+
+        * CMakeLists.txt: Removed NavigatorUserMedia.cpp.
+        * Modules/mediastream/NavigatorUserMedia.cpp: Removed.
+        * Modules/mediastream/NavigatorUserMedia.h: Removed.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * bindings/js/JSNavigatorCustom.cpp:
+        (WebCore::JSNavigator::webkitGetUserMedia): Inlined NavigatorUserMeia::webkitGetUserMedia.
+
+2015-08-03  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
+
</ins><span class="cx">         JSXMLHttpRequest::visitAdditionalChildren does not need to explicitly mark m_response
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=147488
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamNavigatorUserMediacpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/mediastream/NavigatorUserMedia.cpp (187736 => 187737)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/NavigatorUserMedia.cpp        2015-08-03 12:48:52 UTC (rev 187736)
+++ trunk/Source/WebCore/Modules/mediastream/NavigatorUserMedia.cpp        2015-08-03 15:38:32 UTC (rev 187737)
</span><span class="lines">@@ -1,82 +0,0 @@
</span><del>-/*
- *  Copyright (C) 2000 Harri Porten (porten@kde.org)
- *  Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org)
- *  Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org)
- *  Copyright (C) 2003, 2004, 2005, 2006 Apple Inc.
- *  Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include &quot;config.h&quot;
-#include &quot;NavigatorUserMedia.h&quot;
-
-#if ENABLE(MEDIA_STREAM)
-
-#include &quot;Dictionary.h&quot;
-#include &quot;Document.h&quot;
-#include &quot;ExceptionCode.h&quot;
-#include &quot;Frame.h&quot;
-#include &quot;MediaStream.h&quot;
-#include &quot;Navigator.h&quot;
-#include &quot;NavigatorUserMediaError.h&quot;
-#include &quot;NavigatorUserMediaErrorCallback.h&quot;
-#include &quot;NavigatorUserMediaSuccessCallback.h&quot;
-#include &quot;Page.h&quot;
-#include &quot;UserMediaController.h&quot;
-#include &quot;UserMediaRequest.h&quot;
-
-namespace WebCore {
-
-NavigatorUserMedia::NavigatorUserMedia()
-{
-}
-
-NavigatorUserMedia::~NavigatorUserMedia()
-{
-}
-
-void NavigatorUserMedia::webkitGetUserMedia(Navigator* navigator, const Dictionary&amp; options, PassRefPtr&lt;NavigatorUserMediaSuccessCallback&gt; successCallback, PassRefPtr&lt;NavigatorUserMediaErrorCallback&gt; errorCallback, ExceptionCode&amp; ec)
-{
-    // FIXME: Remove this test once IDL is updated to make errroCallback parameter mandatory.
-    if (!successCallback || !errorCallback) {
-        ec = TYPE_MISMATCH_ERR;
-        return;
-    }
-
-    // We do not need to protect the context (i.e. document) here as UserMediaRequest is observing context destruction and will check validity before resolving/rejecting promise.
-    Document* document = navigator-&gt;frame()-&gt;document();
-
-    ASSERT(errorCallback);
-    ASSERT(successCallback);
-    auto resolveCallback = [successCallback, document](const RefPtr&lt;MediaStream&gt;&amp; stream) mutable {
-        RefPtr&lt;MediaStream&gt; protectedStream = stream;
-        document-&gt;postTask([successCallback, protectedStream](ScriptExecutionContext&amp;) {
-            successCallback-&gt;handleEvent(protectedStream.get());
-        });
-    };
-    auto rejectCallback = [errorCallback, document](const RefPtr&lt;NavigatorUserMediaError&gt;&amp; error) mutable {
-        RefPtr&lt;NavigatorUserMediaError&gt; protectedError = error;
-        document-&gt;postTask([errorCallback, protectedError](ScriptExecutionContext&amp;) {
-            errorCallback-&gt;handleEvent(protectedError.get());
-        });
-    };
-
-    UserMediaRequest::start(navigator-&gt;frame()-&gt;document(), options, MediaDevices::Promise(WTF::move(resolveCallback), WTF::move(rejectCallback)), ec);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(MEDIA_STREAM)
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamNavigatorUserMediah"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/mediastream/NavigatorUserMedia.h (187736 => 187737)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/NavigatorUserMedia.h        2015-08-03 12:48:52 UTC (rev 187736)
+++ trunk/Source/WebCore/Modules/mediastream/NavigatorUserMedia.h        2015-08-03 15:38:32 UTC (rev 187737)
</span><span class="lines">@@ -1,50 +0,0 @@
</span><del>-/*
-    Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#ifndef NavigatorUserMedia_h
-#define NavigatorUserMedia_h
-
-#if ENABLE(MEDIA_STREAM)
-
-#include &lt;wtf/PassRefPtr.h&gt;
-#include &lt;wtf/text/WTFString.h&gt;
-
-namespace WebCore {
-
-class Dictionary;
-class Navigator;
-class NavigatorUserMediaErrorCallback;
-class NavigatorUserMediaSuccessCallback;
-
-typedef int ExceptionCode;
-
-class NavigatorUserMedia {
-public:
-    static void webkitGetUserMedia(Navigator*, const Dictionary&amp;, PassRefPtr&lt;NavigatorUserMediaSuccessCallback&gt;, PassRefPtr&lt;NavigatorUserMediaErrorCallback&gt;, ExceptionCode&amp;);
-
-private:
-    NavigatorUserMedia();
-    ~NavigatorUserMedia();
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(MEDIA_STREAM)
-
-#endif // NavigatorUserMedia_h
</del></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (187736 => 187737)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-08-03 12:48:52 UTC (rev 187736)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-08-03 15:38:32 UTC (rev 187737)
</span><span class="lines">@@ -215,7 +215,6 @@
</span><span class="cx">                 078E090117D14CEE00420AA1 /* MediaStreamRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07221B5217CEC32700848E51 /* MediaStreamRegistry.cpp */; };
</span><span class="cx">                 078E090217D14CEE00420AA1 /* MediaStreamTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07221B5417CEC32700848E51 /* MediaStreamTrack.cpp */; };
</span><span class="cx">                 078E090317D14CEE00420AA1 /* MediaStreamTrackEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07221B5717CEC32700848E51 /* MediaStreamTrackEvent.cpp */; };
</span><del>-                078E090417D14CEE00420AA1 /* NavigatorUserMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07221B5A17CEC32700848E51 /* NavigatorUserMedia.cpp */; };
</del><span class="cx">                 078E090517D14CEE00420AA1 /* RTCDataChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07221B6317CEC32700848E51 /* RTCDataChannel.cpp */; };
</span><span class="cx">                 078E090617D14CEE00420AA1 /* RTCDataChannelEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07221B6617CEC32700848E51 /* RTCDataChannelEvent.cpp */; };
</span><span class="cx">                 078E090717D14CEE00420AA1 /* RTCDTMFSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07221B6917CEC32700848E51 /* RTCDTMFSender.cpp */; };
</span><span class="lines">@@ -237,7 +236,6 @@
</span><span class="cx">                 078E091717D14D1C00420AA1 /* MediaStreamRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 07221B5317CEC32700848E51 /* MediaStreamRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 078E091817D14D1C00420AA1 /* MediaStreamTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 07221B5517CEC32700848E51 /* MediaStreamTrack.h */; };
</span><span class="cx">                 078E091917D14D1C00420AA1 /* MediaStreamTrackEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 07221B5817CEC32700848E51 /* MediaStreamTrackEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                078E091A17D14D1C00420AA1 /* NavigatorUserMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 07221B5B17CEC32700848E51 /* NavigatorUserMedia.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">                 078E091B17D14D1C00420AA1 /* NavigatorUserMediaError.h in Headers */ = {isa = PBXBuildFile; fileRef = 07221B5D17CEC32700848E51 /* NavigatorUserMediaError.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 078E091C17D14D1C00420AA1 /* NavigatorUserMediaErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 07221B5F17CEC32700848E51 /* NavigatorUserMediaErrorCallback.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 078E091D17D14D1C00420AA1 /* NavigatorUserMediaSuccessCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 07221B6117CEC32700848E51 /* NavigatorUserMediaSuccessCallback.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -7219,8 +7217,6 @@
</span><span class="cx">                 07221B5717CEC32700848E51 /* MediaStreamTrackEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaStreamTrackEvent.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 07221B5817CEC32700848E51 /* MediaStreamTrackEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaStreamTrackEvent.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 07221B5917CEC32700848E51 /* MediaStreamTrackEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaStreamTrackEvent.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                07221B5A17CEC32700848E51 /* NavigatorUserMedia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NavigatorUserMedia.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                07221B5B17CEC32700848E51 /* NavigatorUserMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigatorUserMedia.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 07221B5C17CEC32700848E51 /* NavigatorUserMedia.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NavigatorUserMedia.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 07221B5D17CEC32700848E51 /* NavigatorUserMediaError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigatorUserMediaError.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 07221B5E17CEC32700848E51 /* NavigatorUserMediaError.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NavigatorUserMediaError.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -14782,8 +14778,6 @@
</span><span class="cx">                                 5EA725CA1ACABCB500EAD17B /* NavigatorMediaDevices.cpp */,
</span><span class="cx">                                 5EA725CB1ACABCB500EAD17B /* NavigatorMediaDevices.h */,
</span><span class="cx">                                 5EA725CC1ACABCB500EAD17B /* NavigatorMediaDevices.idl */,
</span><del>-                                07221B5A17CEC32700848E51 /* NavigatorUserMedia.cpp */,
-                                07221B5B17CEC32700848E51 /* NavigatorUserMedia.h */,
</del><span class="cx">                                 07221B5C17CEC32700848E51 /* NavigatorUserMedia.idl */,
</span><span class="cx">                                 070327F717EA4AAF00CE1318 /* NavigatorUserMediaError.cpp */,
</span><span class="cx">                                 07221B5D17CEC32700848E51 /* NavigatorUserMediaError.h */,
</span><span class="lines">@@ -26100,7 +26094,6 @@
</span><span class="cx">                                 E12719C70EEEC16800F61213 /* NavigatorBase.h in Headers */,
</span><span class="cx">                                 9711460414EF009A00674FD9 /* NavigatorGeolocation.h in Headers */,
</span><span class="cx">                                 5EA725D61ACABD5700EAD17B /* NavigatorMediaDevices.h in Headers */,
</span><del>-                                078E091A17D14D1C00420AA1 /* NavigatorUserMedia.h in Headers */,
</del><span class="cx">                                 078E091B17D14D1C00420AA1 /* NavigatorUserMediaError.h in Headers */,
</span><span class="cx">                                 078E091C17D14D1C00420AA1 /* NavigatorUserMediaErrorCallback.h in Headers */,
</span><span class="cx">                                 078E091D17D14D1C00420AA1 /* NavigatorUserMediaSuccessCallback.h in Headers */,
</span><span class="lines">@@ -29700,7 +29693,6 @@
</span><span class="cx">                                 51A4BB101954D62700FA5C2E /* NavigatorGamepad.cpp in Sources */,
</span><span class="cx">                                 9711460314EF009A00674FD9 /* NavigatorGeolocation.cpp in Sources */,
</span><span class="cx">                                 5EA725D51ACABD5700EAD17B /* NavigatorMediaDevices.cpp in Sources */,
</span><del>-                                078E090417D14CEE00420AA1 /* NavigatorUserMedia.cpp in Sources */,
</del><span class="cx">                                 070327F817EA4AAF00CE1318 /* NavigatorUserMediaError.cpp in Sources */,
</span><span class="cx">                                 5D874F130D161D3200796C3B /* NetscapePlugInStreamLoader.cpp in Sources */,
</span><span class="cx">                                 A19D934A1AA11B1E00B46C24 /* NetworkExtensionContentFilter.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSNavigatorCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSNavigatorCustom.cpp (187736 => 187737)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSNavigatorCustom.cpp        2015-08-03 12:48:52 UTC (rev 187736)
+++ trunk/Source/WebCore/bindings/js/JSNavigatorCustom.cpp        2015-08-03 15:38:32 UTC (rev 187737)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
</span><ins>+ * Copyright (C) 2015 Canon INC.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -29,10 +30,13 @@
</span><span class="cx"> #include &quot;JSNavigator.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Dictionary.h&quot;
</span><ins>+#include &quot;Document.h&quot;
</ins><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><ins>+#include &quot;Frame.h&quot;
</ins><span class="cx"> #include &quot;JSNavigatorUserMediaErrorCallback.h&quot;
</span><span class="cx"> #include &quot;JSNavigatorUserMediaSuccessCallback.h&quot;
</span><del>-#include &quot;NavigatorUserMedia.h&quot;
</del><ins>+#include &quot;MediaStream.h&quot;
+#include &quot;UserMediaRequest.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> using namespace JSC;
</span><span class="cx"> 
</span><span class="lines">@@ -64,11 +68,32 @@
</span><span class="cx">         return jsUndefined();
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (!impl().frame()) {
+        setDOMException(exec, NOT_SUPPORTED_ERR);
+        return jsUndefined();
+    }
+
+    // We do not need to protect the context (i.e. document) here as UserMediaRequest is observing context destruction and will check validity before resolving/rejecting promise.
+    Document* document = impl().frame()-&gt;document();
+
</ins><span class="cx">     RefPtr&lt;NavigatorUserMediaSuccessCallback&gt; successCallback = JSNavigatorUserMediaSuccessCallback::create(asObject(exec-&gt;uncheckedArgument(1)), globalObject());
</span><ins>+    auto resolveCallback = [successCallback, document](const RefPtr&lt;MediaStream&gt;&amp; stream) mutable {
+        RefPtr&lt;MediaStream&gt; protectedStream = stream;
+        document-&gt;postTask([successCallback, protectedStream](ScriptExecutionContext&amp;) {
+            successCallback-&gt;handleEvent(protectedStream.get());
+        });
+    };
+
</ins><span class="cx">     RefPtr&lt;NavigatorUserMediaErrorCallback&gt; errorCallback = JSNavigatorUserMediaErrorCallback::create(asObject(exec-&gt;uncheckedArgument(2)), globalObject());
</span><ins>+    auto rejectCallback = [errorCallback, document](const RefPtr&lt;NavigatorUserMediaError&gt;&amp; error) mutable {
+        RefPtr&lt;NavigatorUserMediaError&gt; protectedError = error;
+        document-&gt;postTask([errorCallback, protectedError](ScriptExecutionContext&amp;) {
+            errorCallback-&gt;handleEvent(protectedError.get());
+        });
+    };
</ins><span class="cx"> 
</span><span class="cx">     ExceptionCode ec = 0;
</span><del>-    NavigatorUserMedia::webkitGetUserMedia(&amp;impl(), options, successCallback, errorCallback, ec);
</del><ins>+    UserMediaRequest::start(document, options, MediaDevices::Promise(WTF::move(resolveCallback), WTF::move(rejectCallback)), ec);
</ins><span class="cx">     setDOMException(exec, ec);
</span><span class="cx">     return jsUndefined();
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>