[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
caseq at chromium.org
caseq at chromium.org
Mon Feb 21 00:37:51 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit c49856187ecd6df51be077f45c082322ee31883d
Author: caseq at chromium.org <caseq at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Feb 2 18:05:28 2011 +0000
2011-02-01 Andrey Kosyakov <caseq at chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: add test for OPTIONS requests caused by CORS preflight checking to appear in Network panel
https://bugs.webkit.org/show_bug.cgi?id=53501
* http/tests/inspector/network-preflight-options-expected.txt: Added.
* http/tests/inspector/network-preflight-options.html: Added.
* http/tests/inspector/resources/cors-target.php: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77379 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 57ec753..2981caf 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2011-02-01 Andrey Kosyakov <caseq at chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: add test for OPTIONS requests caused by CORS preflight checking to appear in Network panel
+ https://bugs.webkit.org/show_bug.cgi?id=53501
+
+ * http/tests/inspector/network-preflight-options-expected.txt: Added.
+ * http/tests/inspector/network-preflight-options.html: Added.
+ * http/tests/inspector/resources/cors-target.php: Added.
+
2011-02-02 Martin Robinson <mrobinson at igalia.com>
Skip another test that uses modal dialogs.
diff --git a/LayoutTests/http/tests/inspector/network-preflight-options-expected.txt b/LayoutTests/http/tests/inspector/network-preflight-options-expected.txt
new file mode 100644
index 0000000..21940b5
--- /dev/null
+++ b/LayoutTests/http/tests/inspector/network-preflight-options-expected.txt
@@ -0,0 +1,9 @@
+CONSOLE MESSAGE: line 1: XMLHttpRequest cannot load http://localhost:8000/inspector/resources/cors-target.php?deny=yes. Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin.
+CONSOLE MESSAGE: line 1: XMLHttpRequest cannot load http://localhost:8000/inspector/resources/cors-target.php?deny=yes. Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin.
+Tests that preflight OPTIONS requests appear in Network resources
+
+POST http://localhost:8000/inspector/resources/cors-target.php?deny=yes
+OPTIONS http://localhost:8000/inspector/resources/cors-target.php?deny=yes
+OPTIONS http://localhost:8000/inspector/resources/cors-target.php
+POST http://localhost:8000/inspector/resources/cors-target.php
+
diff --git a/LayoutTests/http/tests/inspector/network-preflight-options.html b/LayoutTests/http/tests/inspector/network-preflight-options.html
new file mode 100755
index 0000000..1bcabe5
--- /dev/null
+++ b/LayoutTests/http/tests/inspector/network-preflight-options.html
@@ -0,0 +1,47 @@
+<html>
+<head>
+<script src="inspector-test2.js"></script>
+<script type="text/javascript">
+
+function sendXHR(url, forcePreflight)
+{
+ var xhr = new XMLHttpRequest();
+ xhr.open("POST", url, false);
+ xhr.setRequestHeader("Content-Type", forcePreflight ? "application/xml" : "text/plain");
+ try {
+ xhr.send("<xml></xml>"); // Denied requests will cause exceptions.
+ } catch (e) {
+ }
+}
+
+function doCrossOriginXHR()
+{
+ var targetURL = "http://localhost:8000/inspector/resources/cors-target.php";
+ // Failed POSTs with no preflight check should result in a POST request being logged
+ sendXHR(targetURL + "?deny=yes", false);
+ // Failed POSTs with preflight check should result in an OPTIONS request being logged
+ sendXHR(targetURL + "?deny=yes", true);
+ // Successful POSTs with preflight check should result in an OPTIONS request followed by POST request being logged
+ // Generate request name based on timestamp to defeat caching (this is only relevant for repeated invocations of the test in signle instance of DRT)
+ sendXHR(targetURL + "?date=" + Date.now(), true);
+}
+
+var test = function()
+{
+ function onResource(event)
+ {
+ var resource = event.data;
+ InspectorTest.addResult(resource.requestMethod + " " + resource.url.replace(/[&?]date=\d+/, ""));
+ if (resource.requestMethod === "POST" && !/\?deny=yes/.test(resource.url))
+ InspectorTest.completeTest();
+ }
+ WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceFinished, onResource);
+ InspectorTest.evaluateInPage("doCrossOriginXHR();");
+}
+
+</script>
+</head>
+<body onload="runTest()">
+<p>Tests that preflight OPTIONS requests appear in Network resources</p>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/inspector/resources/cors-target.php b/LayoutTests/http/tests/inspector/resources/cors-target.php
new file mode 100755
index 0000000..d784baf
--- /dev/null
+++ b/LayoutTests/http/tests/inspector/resources/cors-target.php
@@ -0,0 +1,10 @@
+<?php
+ parse_str($_SERVER['QUERY_STRING'], $queryParams);
+ if ($queryParams["deny"] != "yes") {
+ header("Access-control-allow-origin: http://127.0.0.1:8000");
+ header("Access-control-allow-headers: Content-Type");
+ }
+ header("Content-Type: text/plain");
+
+ print "body"
+?>
diff --git a/Source/WebCore/inspector/front-end/Resource.js b/Source/WebCore/inspector/front-end/Resource.js
index 3790fdd..9108d2d 100644
--- a/Source/WebCore/inspector/front-end/Resource.js
+++ b/Source/WebCore/inspector/front-end/Resource.js
@@ -31,7 +31,6 @@ WebInspector.Resource = function(identifier, url)
this.url = url;
this._startTime = -1;
this._endTime = -1;
- this._requestMethod = "";
this._category = WebInspector.resourceCategories.other;
this._pendingContentCallbacks = [];
this._responseHeadersSize = 0;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list