<!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>[201423] trunk</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/201423">201423</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2016-05-26 11:19:30 -0700 (Thu, 26 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Sites served over insecure connections should not be allowed to use geolocation.
https://bugs.webkit.org/show_bug.cgi?id=157423
&lt;rdar://problem/23751632&gt;

Patch by Pranjal Jumde &lt;pjumde@apple.com&gt; on 2016-05-26
Reviewed by Brent Fulgham.

Source/WebCore:

Tests: http/tests/security/insecure-geolocation.html
       http/tests/security/mixedcontent-geolocation-block-insecure-content.html
       http/tests/security/mixedcontent-geolocation.html

* Modules/geolocation/Geolocation.cpp:
(WebCore::logError):
Logs an error to the console if geolocation is blocked.
(WebCore::Geolocation::startRequest):
Access to Geolocation will be blocked if site is not secure. An error will be logged when access to Geolocation is blocked.
(WebCore::Geolocation::shouldBlockGeolocationRequests)
Returns true if the access to geolocation should be blocked.
* Modules/geolocation/Geolocation.h:
* dom/SecurityContext.h:
(WebCore::SecurityContext::foundMixedContent):
Returns true if insecure content was accessed over secure connection.
(WebCore::SecurityContext::setFoundMixedContent):
Sets m_foundMixedContent to true if insecure content is accessed over secure connection.
(WebCore::SecurityContext::geolocationAccessed):
Returns true if geolocation was accessed
(WebCore::SecurityContext::setGeolocationAccessed):
Sets m_geolocationAccessed to true if geolocation was accessed.
* loader/MixedContentChecker.cpp:
(WebCore::MixedContentChecker::canDisplayInsecureContent):
Insecure content will be blocked if geolocation was accessed by the page. Updates document to keep track of mixed content.
(WebCore::MixedContentChecker::canRunInsecureContent):
Insecure content will be blocked if geolocation was accessed by the page. Updates document to keep track of mixed content.

LayoutTests:

* http/tests/security/geolocation-over-insecure-content.html: Added.
* http/tests/security/geolocation-over-mixed-content-block.html: Added.
* http/tests/security/geolocation-over-mixed-content.html: Added.
* http/tests/security/insecure-geolocation-expected.txt: Added.
* http/tests/security/insecure-geolocation.html: Added.
* http/tests/security/mixedcontent-geolocation-block-insecure-content-expected.txt: Added.
* http/tests/security/mixedcontent-geolocation-block-insecure-content.html: Added.
* http/tests/security/mixedcontent-geolocation-expected.txt: Added.
* http/tests/security/mixedcontent-geolocation.html: Added.
* http/tests/security/sandboxed-iframe-geolocation-watchPosition.html:
  iframe is loaded over secure connection to avoid geolocation failures
* http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition.html: 
  iframe is loaded over secure connection to avoid geolocation failures</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritysandboxediframegeolocationgetCurrentPositionhtml">trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritysandboxediframegeolocationwatchPositionhtml">trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesgeolocationGeolocationcpp">trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesgeolocationGeolocationh">trunk/Source/WebCore/Modules/geolocation/Geolocation.h</a></li>
<li><a href="#trunkSourceWebCoredomSecurityContexth">trunk/Source/WebCore/dom/SecurityContext.h</a></li>
<li><a href="#trunkSourceWebCoreloaderMixedContentCheckercpp">trunk/Source/WebCore/loader/MixedContentChecker.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestssecurityinsecuregeolocationexpectedtxt">trunk/LayoutTests/http/tests/security/insecure-geolocation-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecurityinsecuregeolocationhtml">trunk/LayoutTests/http/tests/security/insecure-geolocation.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymixedcontentgeolocationblockinsecurecontentexpectedtxt">trunk/LayoutTests/http/tests/security/mixedcontent-geolocation-block-insecure-content-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymixedcontentgeolocationblockinsecurecontenthtml">trunk/LayoutTests/http/tests/security/mixedcontent-geolocation-block-insecure-content.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymixedcontentgeolocationexpectedtxt">trunk/LayoutTests/http/tests/security/mixedcontent-geolocation-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymixedcontentgeolocationhtml">trunk/LayoutTests/http/tests/security/mixedcontent-geolocation.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (201422 => 201423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-05-26 17:23:02 UTC (rev 201422)
+++ trunk/LayoutTests/ChangeLog        2016-05-26 18:19:30 UTC (rev 201423)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2016-05-26  Pranjal Jumde  &lt;pjumde@apple.com&gt;
+
+        Sites served over insecure connections should not be allowed to use geolocation.
+        https://bugs.webkit.org/show_bug.cgi?id=157423
+        &lt;rdar://problem/23751632&gt;
+
+        Reviewed by Brent Fulgham.
+
+        * http/tests/security/geolocation-over-insecure-content.html: Added.
+        * http/tests/security/geolocation-over-mixed-content-block.html: Added.
+        * http/tests/security/geolocation-over-mixed-content.html: Added.
+        * http/tests/security/insecure-geolocation-expected.txt: Added.
+        * http/tests/security/insecure-geolocation.html: Added.
+        * http/tests/security/mixedcontent-geolocation-block-insecure-content-expected.txt: Added.
+        * http/tests/security/mixedcontent-geolocation-block-insecure-content.html: Added.
+        * http/tests/security/mixedcontent-geolocation-expected.txt: Added.
+        * http/tests/security/mixedcontent-geolocation.html: Added.
+        * http/tests/security/sandboxed-iframe-geolocation-watchPosition.html:
+          iframe is loaded over secure connection to avoid geolocation failures
+        * http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition.html: 
+          iframe is loaded over secure connection to avoid geolocation failures
+
</ins><span class="cx"> 2016-05-26  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Implement internals.observeGC to get called back when a Javascript object is GC'ed.
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecurityinsecuregeolocationexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/insecure-geolocation-expected.txt (0 => 201423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/insecure-geolocation-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/insecure-geolocation-expected.txt        2016-05-26 18:19:30 UTC (rev 201423)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+CONSOLE MESSAGE: line 4: [blocked] Access to geolocation was blocked over insecure connection to http://127.0.0.1:8080.
+
+This test loads an insecure frame that tries to access geolocation. Access to geolocation is blocked over insecure connections.
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecurityinsecuregeolocationhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/insecure-geolocation.html (0 => 201423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/insecure-geolocation.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/insecure-geolocation.html        2016-05-26 18:19:30 UTC (rev 201423)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;html&gt;
+&lt;body&gt;
+&lt;script&gt;
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+    testRunner.setCanOpenWindows();
+    testRunner.setCloseRemainingWindowsWhenComplete(true);
+}
+window.addEventListener(&quot;message&quot;, function (e) {
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, false);
+&lt;/script&gt;
+&lt;p&gt;This test loads an insecure frame that tries to access geolocation.  Access to geolocation is blocked over insecure connections.&lt;/p&gt;
+&lt;script&gt;
+onload = function() {
+    window.open(&quot;http://127.0.0.1:8080/security/resources/geolocation-over-insecure-content.html&quot;);
+}
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymixedcontentgeolocationblockinsecurecontentexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/mixedcontent-geolocation-block-insecure-content-expected.txt (0 => 201423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/mixedcontent-geolocation-block-insecure-content-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/mixedcontent-geolocation-block-insecure-content-expected.txt        2016-05-26 18:19:30 UTC (rev 201423)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+CONSOLE MESSAGE: line 14: [blocked] The page at https://127.0.0.1:8443/security/resources/geolocation-over-mixed-content-block.html was not allowed to display insecure content from http://127.0.0.1:8080/security/resources/compass.jpg.
+
+This test loads a secure frame with insecure content that tries to access geolocation before loading insecure content. Access to insecure content is blocked over secure connections when geolocation is accessed.
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymixedcontentgeolocationblockinsecurecontenthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/mixedcontent-geolocation-block-insecure-content.html (0 => 201423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/mixedcontent-geolocation-block-insecure-content.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/mixedcontent-geolocation-block-insecure-content.html        2016-05-26 18:19:30 UTC (rev 201423)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;html&gt;
+&lt;body&gt;
+&lt;script&gt;
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+    testRunner.setCanOpenWindows();
+    testRunner.setCloseRemainingWindowsWhenComplete(true);
+}
+window.addEventListener(&quot;message&quot;, function (e) {
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, false);
+&lt;/script&gt;
+&lt;p&gt;This test loads a secure frame with insecure content that tries to access geolocation before loading insecure content.  Access to insecure content is blocked over secure connections when geolocation is accessed.&lt;/p&gt;
+&lt;script&gt;
+onload = function() {
+    window.open(&quot;https://127.0.0.1:8443/security/resources/geolocation-over-mixed-content-block.html&quot;);
+}
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymixedcontentgeolocationexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/mixedcontent-geolocation-expected.txt (0 => 201423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/mixedcontent-geolocation-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/mixedcontent-geolocation-expected.txt        2016-05-26 18:19:30 UTC (rev 201423)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+CONSOLE MESSAGE: line 2: The page at https://127.0.0.1:8443/security/resources/geolocation-over-mixed-content.html was allowed to display insecure content from http://127.0.0.1:8080/security/resources/compass.jpg.
+
+CONSOLE MESSAGE: line 5: [blocked] Access to geolocation was blocked over secure connection with mixed content to https://127.0.0.1:8443.
+
+This test loads a secure frame with mixed content that tries to access geolocation. Access to geolocation is blocked over secure connections with mixed content.
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymixedcontentgeolocationhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/mixedcontent-geolocation.html (0 => 201423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/mixedcontent-geolocation.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/mixedcontent-geolocation.html        2016-05-26 18:19:30 UTC (rev 201423)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;html&gt;
+&lt;body&gt;
+&lt;script&gt;
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+    testRunner.setCanOpenWindows();
+    testRunner.setCloseRemainingWindowsWhenComplete(true);
+}
+window.addEventListener(&quot;message&quot;, function (e) {
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, false);
+&lt;/script&gt;
+&lt;p&gt;This test loads a secure frame with mixed content that tries to access geolocation.  Access to geolocation is blocked over secure connections with mixed content.&lt;/p&gt;
+&lt;script&gt;
+onload = function() {
+    window.open(&quot;https://127.0.0.1:8443/security/resources/geolocation-over-mixed-content.html&quot;);
+}
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritysandboxediframegeolocationgetCurrentPositionhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition.html (201422 => 201423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition.html        2016-05-26 17:23:02 UTC (rev 201422)
+++ trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition.html        2016-05-26 18:19:30 UTC (rev 201423)
</span><span class="lines">@@ -11,6 +11,6 @@
</span><span class="cx"> &lt;/head&gt;
</span><span class="cx"> &lt;body&gt;
</span><span class="cx"> &lt;p&gt;Tests that navigator.geolocation.getCurrentPosition() returns error POSITION_UNAVAILABLE when called from a document in a sandboxed iframe.&lt;/p&gt;
</span><del>-&lt;iframe src=&quot;resources/sandboxed-iframe-geolocation-getCurrentPosition.html&quot; sandbox=&quot;allow-scripts&quot; width=&quot;100%&quot; height=&quot;300&quot;&gt;&lt;/iframe&gt;
</del><ins>+&lt;iframe src=&quot;https://127.0.0.1:8443/security/resources/sandboxed-iframe-geolocation-getCurrentPosition.html&quot; sandbox=&quot;allow-scripts&quot; width=&quot;100%&quot; height=&quot;300&quot;&gt;&lt;/iframe&gt;
</ins><span class="cx"> &lt;/body&gt;
</span><span class="cx"> &lt;/html&gt;
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritysandboxediframegeolocationwatchPositionhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition.html (201422 => 201423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition.html        2016-05-26 17:23:02 UTC (rev 201422)
+++ trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition.html        2016-05-26 18:19:30 UTC (rev 201423)
</span><span class="lines">@@ -11,6 +11,6 @@
</span><span class="cx"> &lt;/head&gt;
</span><span class="cx"> &lt;body&gt;
</span><span class="cx"> &lt;p&gt;Tests that navigator.geolocation.watchPosition() returns error POSITION_UNAVAILABLE when called from a document in a sandboxed iframe.&lt;/p&gt;
</span><del>-&lt;iframe src=&quot;resources/sandboxed-iframe-geolocation-watchPosition.html&quot; sandbox=&quot;allow-scripts&quot; width=&quot;100%&quot; height=&quot;300&quot;&gt;&lt;/iframe&gt;
</del><ins>+&lt;iframe src=&quot;https://127.0.0.1:8443/security/resources/sandboxed-iframe-geolocation-watchPosition.html&quot; sandbox=&quot;allow-scripts&quot; width=&quot;100%&quot; height=&quot;300&quot;&gt;&lt;/iframe&gt;
</ins><span class="cx"> &lt;/body&gt;
</span><span class="cx"> &lt;/html&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (201422 => 201423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-26 17:23:02 UTC (rev 201422)
+++ trunk/Source/WebCore/ChangeLog        2016-05-26 18:19:30 UTC (rev 201423)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2016-05-26  Pranjal Jumde  &lt;pjumde@apple.com&gt;
+
+        Sites served over insecure connections should not be allowed to use geolocation.
+        https://bugs.webkit.org/show_bug.cgi?id=157423
+        &lt;rdar://problem/23751632&gt;
+
+        Reviewed by Brent Fulgham.
+
+        Tests: http/tests/security/insecure-geolocation.html
+               http/tests/security/mixedcontent-geolocation-block-insecure-content.html
+               http/tests/security/mixedcontent-geolocation.html
+
+        * Modules/geolocation/Geolocation.cpp:
+        (WebCore::logError):
+        Logs an error to the console if geolocation is blocked.
+        (WebCore::Geolocation::startRequest):
+        Access to Geolocation will be blocked if site is not secure. An error will be logged when access to Geolocation is blocked.
+        (WebCore::Geolocation::shouldBlockGeolocationRequests)
+        Returns true if the access to geolocation should be blocked.
+        * Modules/geolocation/Geolocation.h:
+        * dom/SecurityContext.h:
+        (WebCore::SecurityContext::foundMixedContent):
+        Returns true if insecure content was accessed over secure connection.
+        (WebCore::SecurityContext::setFoundMixedContent):
+        Sets m_foundMixedContent to true if insecure content is accessed over secure connection.
+        (WebCore::SecurityContext::geolocationAccessed):
+        Returns true if geolocation was accessed
+        (WebCore::SecurityContext::setGeolocationAccessed):
+        Sets m_geolocationAccessed to true if geolocation was accessed.
+        * loader/MixedContentChecker.cpp:
+        (WebCore::MixedContentChecker::canDisplayInsecureContent):
+        Insecure content will be blocked if geolocation was accessed by the page. Updates document to keep track of mixed content.
+        (WebCore::MixedContentChecker::canRunInsecureContent):
+        Insecure content will be blocked if geolocation was accessed by the page. Updates document to keep track of mixed content.
+
</ins><span class="cx"> 2016-05-26  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Implement internals.observeGC to get called back when a Javascript object is GC'ed.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesgeolocationGeolocationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp (201422 => 201423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp        2016-05-26 17:23:02 UTC (rev 201422)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp        2016-05-26 18:19:30 UTC (rev 201423)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> #include &quot;SecurityOrigin.h&quot;
</span><span class="cx"> #include &lt;wtf/CurrentTime.h&gt;
</span><span class="cx"> #include &lt;wtf/Ref.h&gt;
</span><ins>+#include &lt;wtf/text/StringBuilder.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -172,7 +173,7 @@
</span><span class="cx"> {
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><del>-
</del><ins>+    
</ins><span class="cx"> void Geolocation::suspend(ReasonForSuspension reason)
</span><span class="cx"> {
</span><span class="cx">     if (reason == ActiveDOMObject::PageCache) {
</span><span class="lines">@@ -337,12 +338,44 @@
</span><span class="cx">     return watchID;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void logError(const String&amp; target, const bool isSecure, const bool isMixedContent, Document* document)
+{
+    StringBuilder message;
+    message.append(&quot;[blocked] Access to geolocation was blocked over&quot;);
+    
+    if (!isSecure)
+        message.append(&quot; insecure connection to &quot;);
+    else if (isMixedContent)
+        message.append(&quot; secure connection with mixed content to &quot;);
+    else
+        return;
+    
+    message.append(target);
+    message.append(&quot;.\n&quot;);
+    document-&gt;addConsoleMessage(MessageSource::Security, MessageLevel::Error, message.toString());
+}
+
+bool Geolocation::shouldBlockGeolocationRequests()
+{
+    bool isSecure = SecurityOrigin::isSecure(document()-&gt;url());
+    bool hasMixedContent = document()-&gt;foundMixedContent();
+    bool isLocalFile = document()-&gt;url().isLocalFile();
+    if (securityOrigin()-&gt;canRequestGeolocation()) {
+        if (isLocalFile || (isSecure &amp;&amp; !hasMixedContent))
+            return false;
+    }
+    
+    logError(securityOrigin()-&gt;toString(), isSecure, hasMixedContent, document());
+    return true;
+}
+
</ins><span class="cx"> void Geolocation::startRequest(GeoNotifier* notifier)
</span><span class="cx"> {
</span><del>-    if (!securityOrigin()-&gt;canRequestGeolocation()) {
</del><ins>+    if (shouldBlockGeolocationRequests()) {
</ins><span class="cx">         notifier-&gt;setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, ASCIILiteral(originCannotRequestGeolocationErrorMessage)));
</span><span class="cx">         return;
</span><span class="cx">     }
</span><ins>+    document()-&gt;setGeolocationAccessed();
</ins><span class="cx"> 
</span><span class="cx">     // Check whether permissions have already been denied. Note that if this is the case,
</span><span class="cx">     // the permission state can not change again in the lifetime of this page.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesgeolocationGeolocationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.h (201422 => 201423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/geolocation/Geolocation.h        2016-05-26 17:23:02 UTC (rev 201422)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.h        2016-05-26 18:19:30 UTC (rev 201423)
</span><span class="lines">@@ -72,6 +72,7 @@
</span><span class="cx"> 
</span><span class="cx">     void positionChanged();
</span><span class="cx">     void setError(GeolocationError*);
</span><ins>+    bool shouldBlockGeolocationRequests();
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     explicit Geolocation(ScriptExecutionContext*);
</span></span></pre></div>
<a id="trunkSourceWebCoredomSecurityContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/SecurityContext.h (201422 => 201423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/SecurityContext.h        2016-05-26 17:23:02 UTC (rev 201422)
+++ trunk/Source/WebCore/dom/SecurityContext.h        2016-05-26 18:19:30 UTC (rev 201423)
</span><span class="lines">@@ -75,6 +75,10 @@
</span><span class="cx">     WEBCORE_EXPORT SecurityOrigin* securityOrigin() const;
</span><span class="cx"> 
</span><span class="cx">     static SandboxFlags parseSandboxPolicy(const String&amp; policy, String&amp; invalidTokensErrorMessage);
</span><ins>+    bool foundMixedContent() const { return m_foundMixedContent; }
+    void setFoundMixedContent() { m_foundMixedContent = true; }
+    bool geolocationAccessed() const { return m_geolocationAccessed; }
+    void setGeolocationAccessed() { m_geolocationAccessed = true; }
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     SecurityContext();
</span><span class="lines">@@ -90,6 +94,8 @@
</span><span class="cx">     SandboxFlags m_sandboxFlags;
</span><span class="cx">     RefPtr&lt;SecurityOriginPolicy&gt; m_securityOriginPolicy;
</span><span class="cx">     std::unique_ptr&lt;ContentSecurityPolicy&gt; m_contentSecurityPolicy;
</span><ins>+    bool m_foundMixedContent { false };
+    bool m_geolocationAccessed { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderMixedContentCheckercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/MixedContentChecker.cpp (201422 => 201423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/MixedContentChecker.cpp        2016-05-26 17:23:02 UTC (rev 201422)
+++ trunk/Source/WebCore/loader/MixedContentChecker.cpp        2016-05-26 18:19:30 UTC (rev 201423)
</span><span class="lines">@@ -65,11 +65,13 @@
</span><span class="cx">     if (!isMixedContent(securityOrigin, url))
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    bool allowed = m_frame.settings().allowDisplayOfInsecureContent() || type == ContentType::ActiveCanWarn;
</del><ins>+    bool allowed = (m_frame.settings().allowDisplayOfInsecureContent() || type == ContentType::ActiveCanWarn) &amp;&amp; !m_frame.document()-&gt;geolocationAccessed();
</ins><span class="cx">     logWarning(allowed, &quot;display&quot;, url);
</span><span class="cx"> 
</span><del>-    if (allowed)
</del><ins>+    if (allowed) {
+        m_frame.document()-&gt;setFoundMixedContent();
</ins><span class="cx">         client().didDisplayInsecureContent();
</span><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     return allowed;
</span><span class="cx"> }
</span><span class="lines">@@ -79,11 +81,13 @@
</span><span class="cx">     if (!isMixedContent(securityOrigin, url))
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    bool allowed = m_frame.settings().allowRunningOfInsecureContent();
</del><ins>+    bool allowed = m_frame.settings().allowRunningOfInsecureContent() &amp;&amp; !m_frame.document()-&gt;geolocationAccessed();
</ins><span class="cx">     logWarning(allowed, &quot;run&quot;, url);
</span><span class="cx"> 
</span><del>-    if (allowed)
</del><ins>+    if (allowed) {
+        m_frame.document()-&gt;setFoundMixedContent();
</ins><span class="cx">         client().didRunInsecureContent(securityOrigin, url);
</span><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     return allowed;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>