Index: third_party/WebKit/LayoutTests/http/tests/inspector/extensions-headers.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-headers.html b/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-headers.html |
index fd2f123e376bb888eb363946f3db7790ca7086cd..bb4e730b81f2f55dee16f61de533648b3eb2fa7f 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-headers.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-headers.html |
@@ -23,12 +23,37 @@ function extension_testAddHeaders(nextTest) |
function doXHR() |
{ |
var xhr = new XMLHttpRequest(); |
- xhr.open("GET", "resources/echo-headers.php", false); |
+ xhr.open("GET", "/resources/echo-headers.php", false); |
xhr.send(null); |
// Can't use output() here due to output order instability: this is invoked by inspectedWindow.eval(), |
// which is not serialized against output from extension, as the latter is posted asynchronously via |
// postMessage to front-end window. |
- document.getElementById("headers").textContent += xhr.responseText; |
+ let xWebInspectorExtensionHeaderValue; |
+ let httpUserAgentHeaderValue; |
+ const lines = xhr.responseText.split('\n'); |
+ for (let line of lines) { |
+ const parts = line.split(': ', 2); |
+ if (parts.length < 2) { |
+ continue; |
+ } |
+ const name = parts[0]; |
+ const value = parts[1]; |
+ if (name == "HTTP_X_WEBINSPECTOR_EXTENSION") { |
+ xWebInspectorExtensionHeaderValue = value; |
+ } |
+ if (name == "HTTP_USER_AGENT") { |
+ httpUserAgentHeaderValue = value; |
+ } |
+ } |
+ |
+ let result = ''; |
+ if (xWebInspectorExtensionHeaderValue !== undefined) { |
+ result += xWebInspectorExtensionHeaderValue + '\n'; |
+ } |
+ if (httpUserAgentHeaderValue !== undefined) { |
+ result += httpUserAgentHeaderValue + '\n'; |
+ } |
+ document.getElementById("headers").textContent += result; |
} |
</script> |