Skip to content

Commit 0f039f7

Browse files
2011-04-15 Vsevolod Vlasov <vsevik@chromium.org>
Reviewed by Pavel Feldman. Web Inspector: No console message and headers in inspector when X-Frame-Options header blocks a load https://bugs.webkit.org/show_bug.cgi?id=58136 Passed response info to inspector when X-Frame-Options header blocks resource loading. * http/tests/inspector/network/resources/x-frame-options-deny.cgi: Added. * http/tests/inspector/network/x-frame-options-deny-expected.txt: Added. * http/tests/inspector/network/x-frame-options-deny.html: Added. 2011-04-15 Vsevolod Vlasov <vsevik@chromium.org> Reviewed by Pavel Feldman. Web Inspector: No console message and headers in inspector when X-Frame-Options header blocks a load https://bugs.webkit.org/show_bug.cgi?id=58136 Passed response info to inspector when X-Frame-Options header blocks resource loading. Test: http/tests/inspector/network/x-frame-options-deny.html * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::continueAfterXFrameOptionsDenied): * loader/MainResourceLoader.cpp: (WebCore::MainResourceLoader::didReceiveResponse): Canonical link: https://commits.webkit.org/73738@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83984 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent dd085d5 commit 0f039f7

8 files changed

Lines changed: 110 additions & 0 deletions

File tree

LayoutTests/ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2011-04-15 Vsevolod Vlasov <vsevik@chromium.org>
2+
3+
Reviewed by Pavel Feldman.
4+
5+
Web Inspector: No console message and headers in inspector when X-Frame-Options header blocks a load
6+
https://bugs.webkit.org/show_bug.cgi?id=58136
7+
8+
Passed response info to inspector when X-Frame-Options header blocks resource loading.
9+
10+
* http/tests/inspector/network/resources/x-frame-options-deny.cgi: Added.
11+
* http/tests/inspector/network/x-frame-options-deny-expected.txt: Added.
12+
* http/tests/inspector/network/x-frame-options-deny.html: Added.
13+
114
2011-04-15 Andrey Adaikin <aandrey@google.com>
215

316
Reviewed by Pavel Feldman.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/perl -wT
2+
use strict;
3+
4+
print "Content-Type: text/html\n";
5+
print "Cache-Control: no-cache, no-store\n";
6+
print "X-FRAME-OPTIONS: deny\n\n";
7+
8+
print "<p>FAIL: This should not show up.</p>\n";
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Tests that responseReceived is called on NetworkDispatcher for resource requests denied due to X-Frame-Options header.
2+
3+
4+
Received response for x-frame-options-deny.cgi
5+
SUCCESS
6+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<html>
2+
<head>
3+
<script src="../inspector-test.js"></script>
4+
<script>
5+
function loadIFrameWithDownload()
6+
{
7+
var iframe = document.createElement("iframe");
8+
iframe.setAttribute("src", "http://127.0.0.1:8000/security/XFrameOptions/resources/x-frame-options-deny.cgi");
9+
document.body.appendChild(iframe);
10+
}
11+
12+
function test()
13+
{
14+
InspectorTest.addSniffer(WebInspector.NetworkDispatcher.prototype, "responseReceived", responseReceived);
15+
InspectorTest.addSniffer(WebInspector.NetworkDispatcher.prototype, "loadingFailed", loadingFailed);
16+
InspectorTest.addSniffer(WebInspector.NetworkDispatcher.prototype, "loadingFinished", loadingFinished);
17+
InspectorTest.evaluateInPage("loadIFrameWithDownload()");
18+
19+
function responseReceived(identifier, time, resourceType, response)
20+
{
21+
var resource = WebInspector.networkResourceById(identifier);
22+
if (/x-frame-options-deny\.cgi/.exec(resource.url)) {
23+
InspectorTest.addResult("Received response for x-frame-options-deny.cgi");
24+
InspectorTest.addResult("SUCCESS");
25+
InspectorTest.completeTest();
26+
}
27+
}
28+
29+
function loadingFinished(identifier, finishTime)
30+
{
31+
var resource = WebInspector.networkResourceById(identifier);
32+
if (/x-frame-options-deny\.cgi/.exec(resource.url))
33+
InspectorTest.completeTest();
34+
}
35+
36+
function loadingFailed(identifier, time, localizedDescription, canceled)
37+
{
38+
var resource = WebInspector.networkResourceById(identifier);
39+
if (/x-frame-options-deny\.cgi/.exec(resource.url))
40+
InspectorTest.completeTest();
41+
}
42+
}
43+
</script>
44+
</head>
45+
<body onload="runTest()">
46+
<p>Tests that responseReceived is called on NetworkDispatcher for resource requests denied due to X-Frame-Options header.</p>
47+
</body>
48+
</html>

Source/WebCore/ChangeLog

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
2011-04-15 Vsevolod Vlasov <vsevik@chromium.org>
2+
3+
Reviewed by Pavel Feldman.
4+
5+
Web Inspector: No console message and headers in inspector when X-Frame-Options header blocks a load
6+
https://bugs.webkit.org/show_bug.cgi?id=58136
7+
8+
Passed response info to inspector when X-Frame-Options header blocks resource loading.
9+
10+
Test: http/tests/inspector/network/x-frame-options-deny.html
11+
12+
* inspector/InspectorInstrumentation.cpp:
13+
(WebCore::InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl):
14+
* inspector/InspectorInstrumentation.h:
15+
(WebCore::InspectorInstrumentation::continueAfterXFrameOptionsDenied):
16+
* loader/MainResourceLoader.cpp:
17+
(WebCore::MainResourceLoader::didReceiveResponse):
18+
119
2011-04-15 Andrey Adaikin <aandrey@google.com>
220

321
Reviewed by Pavel Feldman.

Source/WebCore/inspector/InspectorInstrumentation.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,11 @@ void InspectorInstrumentation::didReceiveResourceResponseButCanceledImpl(Frame*
463463
InspectorInstrumentation::didReceiveResourceResponse(cookie, identifier, loader, r);
464464
}
465465

466+
void InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
467+
{
468+
didReceiveResourceResponseButCanceledImpl(frame, loader, identifier, r);
469+
}
470+
466471
void InspectorInstrumentation::continueWithPolicyDownloadImpl(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
467472
{
468473
didReceiveResourceResponseButCanceledImpl(frame, loader, identifier, r);

Source/WebCore/inspector/InspectorInstrumentation.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ class InspectorInstrumentation {
118118
static void didReceiveResourceData(const InspectorInstrumentationCookie&);
119119
static InspectorInstrumentationCookie willReceiveResourceResponse(Frame*, unsigned long identifier, const ResourceResponse&);
120120
static void didReceiveResourceResponse(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&);
121+
static void continueAfterXFrameOptionsDenied(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
121122
static void continueWithPolicyDownload(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
122123
static void continueWithPolicyIgnore(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
123124
static void didReceiveContentLength(Frame*, unsigned long identifier, int dataLength, int lengthReceived);
@@ -237,6 +238,7 @@ class InspectorInstrumentation {
237238
static InspectorInstrumentationCookie willReceiveResourceResponseImpl(InspectorAgent*, unsigned long identifier, const ResourceResponse&);
238239
static void didReceiveResourceResponseImpl(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&);
239240
static void didReceiveResourceResponseButCanceledImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
241+
static void continueAfterXFrameOptionsDeniedImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
240242
static void continueWithPolicyDownloadImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
241243
static void continueWithPolicyIgnoreImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
242244
static void didReceiveContentLengthImpl(InspectorAgent*, unsigned long identifier, int dataLength, int lengthReceived);
@@ -670,6 +672,14 @@ inline void InspectorInstrumentation::didReceiveResourceResponse(const Inspector
670672
#endif
671673
}
672674

675+
inline void InspectorInstrumentation::continueAfterXFrameOptionsDenied(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
676+
{
677+
#if ENABLE(INSPECTOR)
678+
if (inspectorAgentWithFrontendForFrame(frame))
679+
InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl(frame, loader, identifier, r);
680+
#endif
681+
}
682+
673683
inline void InspectorInstrumentation::continueWithPolicyDownload(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
674684
{
675685
#if ENABLE(INSPECTOR)

Source/WebCore/loader/MainResourceLoader.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ void MainResourceLoader::didReceiveResponse(const ResourceResponse& r)
358358
if (it != r.httpHeaderFields().end()) {
359359
String content = it->second;
360360
if (m_frame->loader()->shouldInterruptLoadForXFrameOptions(content, r.url())) {
361+
InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_frame.get(), documentLoader(), identifier(), r);
362+
361363
cancel();
362364
return;
363365
}

0 commit comments

Comments
 (0)