+2007-12-13 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Alice and Sam.
+
+ - <rdar://5621435> Need a way to specify local resources (being loaded
+ from HTTP tests) on Windows.
+ - Updated the following tests to use the new layoutTestController
+ function, pathToLocalResource to get a Windows viable path (when on
+ Windows) to the local resources they are attempting to access.
+ - Also clarified and updated some results.
+
+ * fast/dom/frame-loading-via-document-write.html:
+ * fast/loader/local-CSS-from-local-expected.txt:
+ * fast/loader/local-CSS-from-local.html:
+ * fast/loader/local-JavaScript-from-local-expected.txt:
+ * fast/loader/local-JavaScript-from-local.html:
+ * fast/loader/local-iFrame-source-from-local-expected.txt:
+ * fast/loader/local-iFrame-source-from-local.html:
+ * fast/loader/local-image-from-local-expected.txt:
+ * fast/loader/local-image-from-local.html:
+ * http/tests/security/frame-loading-via-document-write.html:
+ * http/tests/security/local-CSS-from-remote-expected.txt:
+ * http/tests/security/local-CSS-from-remote.html:
+ * http/tests/security/local-JavaScript-from-remote-expected.txt:
+ * http/tests/security/local-JavaScript-from-remote.html:
+ * http/tests/security/local-iFrame-from-remote-expected.txt:
+ * http/tests/security/local-iFrame-from-remote.html:
+ * http/tests/security/local-image-from-remote-expected.txt:
+ * http/tests/security/local-image-from-remote.html:
+ * http/tests/security/local-user-CSS-from-remote.html:
+ * platform/mac/fast/dom/frame-loading-via-document-write-expected.txt:
+ * platform/win/Skipped:
+ * platform/win/http: Added.
+ * platform/win/http/tests: Added.
+ * platform/win/http/tests/security: Added.
+ * platform/win/http/tests/security/frame-loading-via-document-write-expected.txt: Added.
+
2007-12-13 Dan Bernstein <mitz@apple.com>
Reviewed by Adam Roben.
function buildFrameset()
{
- if (window.layoutTestController)
+ if (window.layoutTestController) {
layoutTestController.waitUntilDone();
+ layoutTestController.dumpAsText();
+ layoutTestController.dumpChildFramesAsText();
+ }
var outHTML="<frameset rows=\"33%, 33%, 33%\">"+
"<frame src=\"\" name=\"topRow\">"+
frames['topRow'].document. write(outHTML);
frames['topRow'].document.close();
+ var localImageLocation = "file:////tmp/LayoutTests/fast/dom/resources/abe.png";
+ if (window.layoutTestController)
+ localImageLocation = layoutTestController.pathToLocalResource(localImageLocation);
+
outHTML = "<html><head><scr" + "ipt language=\"JavaScript\" src=\"resources/frame-loading-via-document-write.js\">"+
"</scr" + "ipt></head><body onLoad=\"didImageLoad()\"><table><tr><td>"+
"<div id=\"result\"></div>"+
- "<img src=\"file:////tmp/LayoutTests/fast/dom/resources/abe.png\" id=\"myImg\">"+
+ "<img src=\"" + localImageLocation + "\" id=\"myImg\">"+
"</td></tr></table></body></html>";
frames['middleRow'].document.open("text/html","replace");
This test is to see if a local file can include a local CSS style.
+Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
+
If the background is yellow then the CSS was loaded.
-Test Passed.
+Test Passed. Local CSS remotely loaded
<html>
<head>
- <link rel="stylesheet" type="text/css" href="file:///tmp/LayoutTests/http/tests/security/resources/cssStyle.css" />
<script>
- if (window.layoutTestController) {
- layoutTestController.dumpAsText();
+ function test() {
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ var localStyleSheetLocation = "file:///tmp/LayoutTests/http/tests/security/resources/cssStyle.css";
+ if (window.layoutTestController)
+ localStyleSheetLocation = layoutTestController.pathToLocalResource(localStyleSheetLocation);
+
+ var localLinkElement = document.createElement("link");
+ localLinkElement.setAttribute("type", "text/css");
+ localLinkElement.setAttribute("rel", "stylesheet");
+ localLinkElement.setAttribute("href", localStyleSheetLocation);
+
+ document.documentElement.firstChild.appendChild(localLinkElement);
+
+ // Unfortunately link tags do not have load events, so we cannot simply make a load handler.
+ window.setTimeout(backgroundCheck, 1);
+ window.setTimeout(function() {
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }, 5000);
}
-
+
function backgroundCheck() {
var result = document.getElementById("result");
var myBody = document.getElementById("myBody");
var style = document.defaultView.getComputedStyle(myBody, null);
var bgColor = style.getPropertyValue("background-color");
if (bgColor[4] == 2) {
- result.innerHTML = "Test Passed.";
+ result.innerHTML = "Test Passed. Local CSS remotely loaded";
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
} else {
result.innerHTML = "Test Failed: Local CSS not remotely loaded.";
+ window.setTimeout(backgroundCheck, 1);
}
}
+
</script>
</head>
-<body id="myBody" onload="backgroundCheck()">
+<body id="myBody" onload="test()">
<div id="div0">
This test is to see if a local file can include a local CSS style.
<br/>
+ Currently this test cannot be run manually on Windows because we do not have
+ a function like pathToLocalResource() outside of DRT.
+ <br/>
+ <br/>
If the background is yellow then the CSS was loaded.
</div>
- </br>
+ <br/>
<div id="result">
Test not run correctly.
</div>
-This test is to see if a local file can run a local script.
+This test is to see if a local file can run a local script.
+Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
-Test Passed.
+Test Passed. Local script loaded and run.
<html>
<head>
- <script>
- var secretness = 0;
- </script>
- <script src="file:///tmp/LayoutTests/http/tests/security/resources/localScript.js"></script>
- <script>
- function test() {
- if (window.layoutTestController)
- layoutTestController.dumpAsText();
+<script>
+ var secretness = 0;
- var tag = document.getElementById("result");
- if (secretness == 13)
- tag.innerHTML = "Test Passed.";
- else
- tag.innerHTML = "Test Failed: Local script not run by local file.";
- }
- </script>
+ function test() {
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ var localScriptLocation = "file:///tmp/LayoutTests/http/tests/security/resources/localScript.js";
+ if (window.layoutTestController)
+ localScriptLocation = layoutTestController.pathToLocalResource(localScriptLocation);
+
+ var localScriptElement = document.createElement("script");
+ localScriptElement.setAttribute("src", localScriptLocation);
+ localScriptElement.addEventListener("load", function() {
+ var tag = document.getElementById("result");
+ if (secretness == 13)
+ tag.innerHTML = "Test Passed. Local script loaded and run.";
+ else
+ tag.innerHTML = "Test Failed. Local script loaded, but not successfully run.";
+ });
+ localScriptElement.addEventListener("error", function() {
+ var tag = document.getElementById("result");
+ tag.innerHTML = "Test Failed: Local script not loaded.";
+ });
+
+ document.body.appendChild(localScriptElement)
+ }
+</script>
</head>
<body onload="test()">
<div id="div0">
This test is to see if a local file can run a local script.
+ <br/>
+ Currently this test cannot be run manually on Windows because we do not have
+ a function like pathToLocalResource() outside of DRT.
+ <br/>
</div>
</br>
<div id="result">
-This test is to see if a local file can include a local page in an iFrame.
+This test is to see if a local file can include a local page in an iFrame.
+Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
-Test Passed.
+Test Passed. Local page loaded locally into iFrame.
<html>
<head>
<script>
- if (window.layoutTestController) {
- layoutTestController.dumpAsText();
- }
-
function iFrameTest() {
if (window.layoutTestController)
layoutTestController.dumpAsText();
+ var localPageLocation = "file:///tmp/LayoutTests/http/tests/security/resources/localPage.html";
+ if (window.layoutTestController)
+ localPageLocation = layoutTestController.pathToLocalResource(localPageLocation);
+
+ var localIframeElement = document.createElement("iFrame");
+ localIframeElement.setAttribute("id", "myFrame");
+ localIframeElement.setAttribute("src", localPageLocation);
+
+ document.body.appendChild(localIframeElement);
+
var result = document.getElementById("result");
var myFrameDocument = document.getElementById("myFrame").contentDocument;
- if (myFrameDocument) {
- result.innerHTML = "Test Passed.";
- } else {
+ if (myFrameDocument)
+ result.innerHTML = "Test Passed. Local page loaded locally into iFrame.";
+ else
result.innerHTML = "Test Failed: Local page not locally loaded into iFrame.";
- }
}
</script>
</head>
-<body>
+<body onload="iFrameTest()">
<div id="div0">
This test is to see if a local file can include a local page in an iFrame.
+ <br/>
+ Currently this test cannot be run manually on Windows because we do not have
+ a function like pathToLocalResource() outside of DRT.
+ <br/>
</div>
</br>
<div id="result">
Test not run correctly.
</div>
- <iFrame id="myFrame" onload="iFrameTest()" src="file:///tmp/LayoutTests/http/tests/security/resources/localPage.html" />
</body>
</html>
-This test is to see if a remote file can include a local image.
+This test is to see if a remote file can include a local image.
+Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
-Test Passed.
+Test Passed. Local image loaded.
if (window.layoutTestController)
layoutTestController.dumpAsText();
+ var localImageLocation = "file:///tmp/LayoutTests/http/tests/security/resources/compass.jpg";
+ if (window.layoutTestController)
+ localImageLocation = layoutTestController.pathToLocalResource(localImageLocation);
+
+ var localImageElement = document.createElement("img");
+ localImageElement.setAttribute("id", "myImg");
+ localImageElement.setAttribute("src", localImageLocation);
+ localImageElement.setAttribute("onError", "imgError()");
+ localImageElement.setAttribute("onLoad", "imgLoad()");
+
function imgError() {
var result = document.getElementById("result");
result.innerHTML = "Test Failed: Image Load Error.";
function imgLoad() {
var result = document.getElementById("result");
- result.innerHTML = "Test Passed.";
+ result.innerHTML = "Test Passed. Local image loaded.";
}
</script>
</head>
-<body>
+<body onload="document.body.appendChild(localImageElement)">
<div id="div0">
This test is to see if a remote file can include a local image.
+ <br/>
+ Currently this test cannot be run manually on Windows because we do not have
+ a function like pathToLocalResource() outside of DRT.
+ <br/>
</div>
</br>
<div id="result">
Test has not run.
</div>
</br>
- <img id="myImg" src="file:///tmp/LayoutTests/http/tests/security/resources/compass.jpg" onError="imgError()" onLoad="imgLoad()"/>
</body>
</html>
<html>
<head>
+<title/>
<script language="JavaScript">
function buildFrameset()
{
- if (window.layoutTestController)
+ if (window.layoutTestController) {
layoutTestController.waitUntilDone();
+ layoutTestController.dumpAsText();
+ layoutTestController.dumpChildFramesAsText();
+ }
var outHTML="<frameset rows=\"33%, 33%, 33%\">"+
"<frame src=\"\" name=\"topRow\">"+
frames['topRow'].document.open("text/html","replace");
frames['topRow'].document.charset=document.charset;
- frames['topRow'].document. write(outHTML);
+ frames['topRow'].document.write(outHTML);
frames['topRow'].document.close();
+ var localImageLocation = "file:////tmp/LayoutTests/fast/dom/resources/abe.png";
+ if (window.layoutTestController)
+ localImageLocation = layoutTestController.pathToLocalResource(localImageLocation);
+
outHTML = "<html><head><scr" + "ipt language=\"JavaScript\" src=\"resources/frame-loading-via-document-write.js\">"+
"</scr" + "ipt></head><body onLoad=\"didImageLoad()\"><table><tr><td>"+
"<div id=\"result\"></div>"+
- "<img src=\"file:////tmp/LayoutTests/fast/dom/resources/abe.png\" id=\"myImg\">"+
+ "<img src=\"" + localImageLocation + "\" id=\"myImg\">"+
"</td></tr></table></body></html>";
frames['middleRow'].document.open("text/html","replace");
frames['middleRow'].document.charset=document.charset;
- frames['middleRow'].document. write(outHTML);
+ frames['middleRow'].document.write(outHTML);
frames['middleRow'].document.close();
outHTML = "<html><head><scr" + "ipt language=\"JavaScript\" src=\"resources/frame-loading-via-document-write.js\">"+
frames['bottomRow'].document.open("text/html","replace");
frames['bottomRow'].document.charset=document.charset;
- frames['bottomRow'].document. write(outHTML);
+ frames['bottomRow'].document.write(outHTML);
frames['bottomRow'].document.close();
}
-CONSOLE MESSAGE: line 0: Not allowed to load local resource: file:///tmp/LayoutTests/http/tests/security/resources/cssStyle.css
+CONSOLE MESSAGE: line 0: Not allowed to load local resource: file://C:/cygwin/home/PyongHopscotch/WebKit/OpenSource/LayoutTests/http/tests/security/resources/cssStyle.css
This test is to see if a remote file can include a local CSS style.
+Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
+
If the background is yellow then the CSS was loaded.
-Test Passed.
+Test Passed: Local CSS not remotely loaded.
<html>
<head>
- <link rel="stylesheet" type="text/css" href="file:///tmp/LayoutTests/http/tests/security/resources/cssStyle.css" />
- <script>
+<script>
+ function test() {
if (window.layoutTestController) {
layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
}
- function backgroundCheck() {
- var result = document.getElementById("result");
- var myBody = document.getElementById("myBody");
- var style = document.defaultView.getComputedStyle(myBody, null);
- var bgColor = style.getPropertyValue("background-color");
- if (bgColor[4] == 2) {
- result.innerHTML = "Test Failed: Local CSS remotely loaded.";
- } else {
- result.innerHTML = "Test Passed.";
- }
+ var localStyleSheetLocation = "file:///tmp/LayoutTests/http/tests/security/resources/cssStyle.css";
+ if (window.layoutTestController)
+ localStyleSheetLocation = layoutTestController.pathToLocalResource(localStyleSheetLocation);
+
+ var localLinkElement = document.createElement("link");
+ localLinkElement.setAttribute("type", "text/css");
+ localLinkElement.setAttribute("rel", "stylesheet");
+ localLinkElement.setAttribute("href", localStyleSheetLocation);
+
+ document.documentElement.firstChild.appendChild(localLinkElement);
+
+ // Unfortunately link tags do not have load events, so we cannot simply make a load handler.
+ window.setTimeout(backgroundCheck, 1);
+ window.setTimeout(function() {
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }, 5000);
+ }
+
+ function backgroundCheck() {
+ var result = document.getElementById("result");
+ var myBody = document.getElementById("myBody");
+ var style = document.defaultView.getComputedStyle(myBody, null);
+ var bgColor = style.getPropertyValue("background-color");
+ if (bgColor[4] == 2) {
+ result.innerHTML = "Test Failed: Local CSS remotely loaded.";
+ window.setTimeout(backgroundCheck, 1);
+ } else {
+ result.innerHTML = "Test Passed: Local CSS not remotely loaded.";
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
}
- </script>
+ }
+</script>
</head>
-<body id="myBody" onload="backgroundCheck()">
+<body id="myBody" onload="test()">
<div id="other">
This test is to see if a remote file can include a local CSS style.
<br/>
+ Currently this test cannot be run manually on Windows because we do not have
+ a function like pathToLocalResource() outside of DRT.
+ <br/>
+ <br/>
If the background is yellow then the CSS was loaded.
</div>
</br>
-CONSOLE MESSAGE: line 0: Not allowed to load local resource: file:///tmp/LayoutTests/http/tests/security/resources/localScript.js
-This test is to see if a remote file can run a local script.
+CONSOLE MESSAGE: line 0: Not allowed to load local resource: file://C:/cygwin/home/PyongHopscotch/WebKit/OpenSource/LayoutTests/http/tests/security/resources/localScript.js
+This test is to see if a remote file can run a local script.
+Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
-Test Passed.
+Test Passed: Local script not loaded.
<html>
<head>
- <script>
- var secretness = 0;
- </script>
- <script src="file:///tmp/LayoutTests/http/tests/security/resources/localScript.js"></script>
- <script>
- function test() {
- if (window.layoutTestController)
- layoutTestController.dumpAsText();
+ <script>
+ var secretness = 0;
+ function test() {
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ var localScriptLocation = "file:///tmp/LayoutTests/http/tests/security/resources/localScript.js";
+ if (window.layoutTestController)
+ localScriptLocation = layoutTestController.pathToLocalResource(localScriptLocation);
+
+ var localScriptElement = document.createElement("script");
+ localScriptElement.setAttribute("src", localScriptLocation);
+ localScriptElement.addEventListener("load", function() {
var tag = document.getElementById("result");
if (secretness == 13)
- tag.innerHTML = "Test Failed: Local script run remotely.";
+ tag.innerHTML = "Test Failed. Local script loaded and run.";
else
- tag.innerHTML = "Test Passed.";
- }
- </script>
+ tag.innerHTML = "Test Failed. Local script loaded, but not successfully run.";
+ });
+
+ localScriptElement.addEventListener("error", function() {
+ var tag = document.getElementById("result");
+ tag.innerHTML = "Test Passed: Local script not loaded.";
+ });
+
+ document.body.appendChild(localScriptElement)
+ }
+ </script>
</head>
<body onload="test()">
<div id="div0">
This test is to see if a remote file can run a local script.
+ <br/>
+ Currently this test cannot be run manually on Windows because we do not have
+ a function like pathToLocalResource() outside of DRT.
+ <br/>
</div>
- </br>
+ <br>
<div id="result">
Test not run correctly.
</div>
-CONSOLE MESSAGE: line 0: Not allowed to load local resource: file:///tmp/LayoutTests/http/tests/security/resources/localPage.html
-This test is to see if a remote file can include a local page in an iFrame.
+CONSOLE MESSAGE: line 0: Not allowed to load local resource: file://C:/cygwin/home/PyongHopscotch/WebKit/OpenSource/LayoutTests/http/tests/security/resources/localPage.html
+This test is to see if a remote file can include a local page in an iFrame.
+Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
-Test Passed.
+Test Passed. Local page not remotely loaded into iFrame.
<html>
<head>
<script>
- if (window.layoutTestController) {
+ if (window.layoutTestController)
layoutTestController.dumpAsText();
- }
-
+
+ var localPageLocation = "file:///tmp/LayoutTests/http/tests/security/resources/localPage.html";
+ if (window.layoutTestController)
+ localPageLocation = layoutTestController.pathToLocalResource(localPageLocation);
+
+ var localIframeElement = document.createElement("iFrame");
+ localIframeElement.setAttribute("id", "myFrame");
+ localIframeElement.setAttribute("src", localPageLocation);
+
function iFrameTest() {
- var result = document.getElementById("result");
+ document.body.appendChild(localIframeElement);
+ var result = document.getElementById("result");
var myFrameDocument = document.getElementById("myFrame").contentDocument;
- if (myFrameDocument) {
+ if (myFrameDocument)
result.innerHTML = "Test Failed: Local page remotely loaded into iFrame.";
- } else {
- result.innerHTML = "Test Passed.";
- }
-
+ else
+ result.innerHTML = "Test Passed. Local page not remotely loaded into iFrame.";
}
</script>
</head>
<body onload="iFrameTest()">
<div id="div0">
This test is to see if a remote file can include a local page in an iFrame.
+ <br/>
+ Currently this test cannot be run manually on Windows because we do not have
+ a function like pathToLocalResource() outside of DRT.
+ <br/>
</div>
</br>
<div id="result">
Test not run correctly.
</div>
- <iFrame id="myFrame" src="file:///tmp/LayoutTests/http/tests/security/resources/localPage.html" />
</body>
</html>
-CONSOLE MESSAGE: line 0: Not allowed to load local resource: file:///tmp/LayoutTests/http/tests/security/resources/compass.jpg
-This test is to see if a remote file can include a local image.
+CONSOLE MESSAGE: line 0: Not allowed to load local resource: file://C:/cygwin/home/PyongHopscotch/WebKit/OpenSource/LayoutTests/http/tests/security/resources/compass.jpg
+This test is to see if a remote file can include a local image.
+Currently this test cannot be run manually on Windows because we do not have a function like pathToLocalResource() outside of DRT.
-Test Passed.
+Test Passed. Local image not loaded remotely.
<html>
<head>
- <script>
- if (window.layoutTestController)
- layoutTestController.dumpAsText();
-
- function imageTest() {
- var result = document.getElementById("result");
- var myImg = document.getElementById("myImg");
- if (myImg.height == 0 && myImg.width == 0) {
- result.innerHTML = "Test Passed.";
- } else {
- result.innerHTML = "Test Failed: Local image loaded remotely.";
- }
-
- }
- </script>
+<script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ var localImageLocation = "file:///tmp/LayoutTests/http/tests/security/resources/compass.jpg";
+ if (window.layoutTestController)
+ localImageLocation = layoutTestController.pathToLocalResource(localImageLocation);
+
+ var localImageElement = document.createElement("img");
+ localImageElement.setAttribute("id", "myImg");
+ localImageElement.setAttribute("src", localImageLocation);
+
+ function imageTest() {
+ document.body.appendChild(localImageElement);
+
+ var result = document.getElementById("result");
+ var myImg = document.getElementById("myImg");
+
+ if (myImg.height == 0 && myImg.width == 0)
+ result.innerHTML = "Test Passed. Local image not loaded remotely.";
+ else
+ result.innerHTML = "Test Failed: Local image loaded remotely.";
+ }
+</script>
+
</head>
<body onLoad="imageTest()">
<div id="div0">
This test is to see if a remote file can include a local image.
+ <br/>
+ Currently this test cannot be run manually on Windows because we do not have
+ a function like pathToLocalResource() outside of DRT.
+ <br/>
</div>
</br>
<div id="result">
Test has not run.
</div>
</br>
- <img id="myImg" src="file:///tmp/LayoutTests/http/tests/security/resources/compass.jpg" />
</body>
</html>
<html>
- <head>
- <title>User Stylesheet Test</title>
- <script type="text/javascript">
- if (window.layoutTestController) {
- layoutTestController.dumpAsText();
+<head>
+<title>User Stylesheet Test</title>
+<script type="text/javascript">
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
- // This won't work outside of DRT!
- if (window.location.hash == '') {
- layoutTestController.waitUntilDone();
- layoutTestController.setUserStyleSheetLocation("file:///tmp/LayoutTests/http/tests/security/resources/cssStyle.css");
- layoutTestController.setUserStyleSheetEnabled(true);
- location += '?#done';
- }
- }
+ // This won't work outside of DRT!
+ if (window.location.hash == '') {
+ layoutTestController.waitUntilDone();
+ layoutTestController.setUserStyleSheetLocation("file:///tmp/LayoutTests/http/tests/security/resources/cssStyle.css");
+ layoutTestController.setUserStyleSheetEnabled(true);
+ location += '?#done';
+ }
+ }
- function backgroundCheck() {
- var result = document.getElementById("result");
- var myBody = document.getElementById("myBody");
-
- var style = document.defaultView.getComputedStyle(myBody, null);
- var bgColor = style.getPropertyValue("background-color");
- if (bgColor[4] == 2) {
- result.innerHTML = "Test Passed: Local user stylesheet loaded.";
- } else {
- result.innerHTML = "Test Failed: Local user stylesheet not loaded into remote document.";
- }
+ function backgroundCheck() {
+ var result = document.getElementById("result");
+ var myBody = document.getElementById("myBody");
+
+ var style = document.defaultView.getComputedStyle(myBody, null);
+ var bgColor = style.getPropertyValue("background-color");
+ if (bgColor[4] == 2) {
+ result.innerHTML = "Test Passed: Local user stylesheet loaded.";
+ } else {
+ result.innerHTML = "Test Failed: Local user stylesheet not loaded into remote document.";
+ }
- if (window.layoutTestController) {
- layoutTestController.setUserStyleSheetEnabled(false);
- layoutTestController.notifyDone();
- }
-
- }
- </script>
- </head>
- <body id="myBody" onload="backgroundCheck()">
- <div id="other">
- This test is to see if a remote file can include a local user stylesheet.
- <br />
- To run this test manually you must set your user style sheet in your Safari preferences
- to LayoutTests/http/tests/security/resources/cssStyle.css
- <br/>
- If the background is yellow then the user stylesheet was loaded.
- </div>
- </br>
- <div id="result">
- Test not run correctly.
- </div>
- </body>
+ if (window.layoutTestController) {
+ layoutTestController.setUserStyleSheetEnabled(false);
+ layoutTestController.notifyDone();
+ }
+ }
+</script>
+</head>
+<body id="myBody" onload="backgroundCheck()">
+ <div id="other">
+ This test is to see if a remote file can include a local user stylesheet.
+ <br />
+ To run this test manually you must set your user style sheet in your Safari preferences
+ to LayoutTests/http/tests/security/resources/cssStyle.css
+ <br/>
+ If the background is yellow then the user stylesheet was loaded.
+ </div>
+ </br>
+ <div id="result">
+ Test not run correctly.
+ </div>
+</body>
</html>
-layer at (0,0) size 800x600
- RenderView at (0,0) size 800x600
-layer at (0,0) size 800x600
- RenderBlock {HTML} at (0,0) size 800x600
- RenderFrameSet {FRAMESET} at (0,0) size 800x600
- RenderFrame {FRAME} at (0,0) size 800x196
- layer at (0,0) size 800x196
- RenderView at (0,0) size 800x196
- layer at (0,0) size 800x196
- RenderBlock {HTML} at (0,0) size 800x196
- RenderBody {BODY} at (8,8) size 784x180
- RenderBlock {DIV} at (0,0) size 784x54
- RenderInline {SPAN} at (0,0) size 221x18
- RenderText {#text} at (0,0) size 221x18
- text run at (0,0) width 221: "This page was successfully loaded."
- RenderBR {BR} at (221,14) size 0x0
- RenderInline {SPAN} at (0,0) size 120x18
- RenderText {#text} at (0,18) size 120x18
- text run at (0,18) width 120: "My protocol is file:"
- RenderBR {BR} at (120,32) size 0x0
- RenderInline {SPAN} at (0,0) size 125x18
- RenderText {#text} at (0,36) size 125x18
- text run at (0,36) width 125: "My referrer is blank"
- RenderBR {BR} at (125,50) size 0x0
- RenderFrame {FRAME} at (0,202) size 800x196
- layer at (0,0) size 800x196
- RenderView at (0,0) size 800x196
- layer at (0,0) size 800x147
- RenderBlock {HTML} at (0,0) size 800x147
- RenderBody {BODY} at (8,8) size 784x131
- RenderTable {TABLE} at (0,0) size 95x131
- RenderTableSection {TBODY} at (0,0) size 95x131
- RenderTableRow {TR} at (0,2) size 95x127
- RenderTableCell {TD} at (2,2) size 91x127 [r=0 c=0 rs=1 cs=1]
- RenderBlock {DIV} at (1,1) size 89x18
- RenderText {#text} at (0,0) size 89x18
- text run at (0,0) width 89: "Image loaded."
- RenderBlock (anonymous) at (1,19) size 89x107
- RenderImage {IMG} at (0,0) size 76x103
- RenderFrame {FRAME} at (0,404) size 800x196
- layer at (0,0) size 800x196
- RenderView at (0,0) size 800x196
- layer at (0,0) size 800x147
- RenderBlock {HTML} at (0,0) size 800x147
- RenderBody {BODY} at (8,8) size 784x131
- RenderTable {TABLE} at (0,0) size 95x131
- RenderTableSection {TBODY} at (0,0) size 95x131
- RenderTableRow {TR} at (0,2) size 95x127
- RenderTableCell {TD} at (2,2) size 91x127 [r=0 c=0 rs=1 cs=1]
- RenderBlock {DIV} at (1,1) size 89x18
- RenderText {#text} at (0,0) size 89x18
- text run at (0,0) width 89: "Image loaded."
- RenderBlock (anonymous) at (1,19) size 89x107
- RenderImage {IMG} at (0,0) size 76x103
+
+
+--------
+Frame: 'topRow'
+--------
+This page was successfully loaded.
+My protocol is file:
+My referrer is blank
+
+
+--------
+Frame: 'middleRow'
+--------
+Image loaded.
+
+
+--------
+Frame: 'bottomRow'
+--------
+Image loaded.
+
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+# Access violation when trying to run local script. <rdar://5631705>
+fast/dom/frame-loading-via-document-write.html
+fast/loader/local-iFrame-source-from-local.html
+fast/loader/local-image-from-local.html
+fast/loader/local-CSS-from-local.html
+fast/loader/local-JavaScript-from-local.html
+http/tests/security/local-JavaScript-from-remote.html
+http/tests/security/local-iFrame-from-remote.html
+http/tests/security/local-CSS-from-remote.html
+http/tests/security/local-user-CSS-from-remote.html
+http/tests/security/frame-loading-via-document-write.html
+http/tests/security/local-image-from-remote.html
+
# Should be moved to platform/mac <rdar://5621425>
http/tests/misc/willCacheResponse-delegate-callback.html
#<rdar://problem/5224271> Some LayoutTests fail when not run by themselves.
http/tests/navigation/anchor-frames.html
-# Symlinks arn't working correctly. <rdar://problem/5128536>
-fast/dom/frame-loading-via-document-write.html
-fast/loader/local-CSS-from-local.html
-fast/loader/local-JavaScript-from-local.html
-fast/loader/local-iFrame-source-from-local.html
-fast/loader/local-image-from-local.html
-
-# Need a way to specify local resources from http tests that works on Windows <rdar://5621435>
-http/tests/security/frame-loading-via-document-write.html
-http/tests/security/local-CSS-from-remote.html
-http/tests/security/local-JavaScript-from-remote.html
-http/tests/security/local-image-from-remote.html
-
# No built-in plugin in DRT <rdar://problem/5074411>
plugins/call-as-function-test.html
plugins/get-url-that-the-resource-load-delegate-will-disallow.html
--- /dev/null
+CONSOLE MESSAGE: line 0: Not allowed to load local resource: file://C:/cygwin/home/PyongHopscotch/WebKit/OpenSource/LayoutTests/fast/dom/resources/abe.png
+
+
+--------
+Frame: 'topRow'
+--------
+This page was successfully loaded.
+My protocol is http:
+My referrer is blank
+
+
+--------
+Frame: 'middleRow'
+--------
+Image NOT loaded.
+
+
+--------
+Frame: 'bottomRow'
+--------
+Image loaded.
+
+2007-12-12 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Alice and Sam.
+
+ - <rdar://5621435> Need a way to specify local resources (being loaded
+ from HTTP tests) on Windows.
+ - Implemented pathToLocalResource which exposes the functionality of
+ converting a given unix path to the correct location on Windows.
+
+ * DumpRenderTree/LayoutTestController.cpp:
+ (pathToLocalResourceCallback):
+ (LayoutTestController::staticFunctions):
+ * DumpRenderTree/LayoutTestController.h:
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+ (LayoutTestController::pathToLocalResource):
+ * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+ (LayoutTestController::pathToLocalResource):
+
2007-12-11 Anders Carlsson <andersca@apple.com>
Reviewed by Sam.
return JSValueMakeUndefined(context);
}
+static JSValueRef pathToLocalResourceCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+
+ LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ JSRetainPtr<JSStringRef> localPath = JSValueToStringCopy(context, arguments[0], exception);
+ ASSERT(!*exception);
+
+ return JSValueMakeString(context, controller->pathToLocalResource(context, localPath.get()));
+}
+
static JSValueRef repaintSweepHorizontallyCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
{ "encodeHostName", encodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "pathToLocalResource", pathToLocalResourceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "queueBackNavigation", queueBackNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "queueForwardNavigation", queueForwardNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "queueLoad", queueLoadCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
void display();
void keepWebHistory();
void notifyDone();
+ JSStringRef pathToLocalResource(JSContextRef, JSStringRef url);
void queueBackNavigation(int howFarBackward);
void queueForwardNavigation(int howFarForward);
void queueLoad(JSStringRef url, JSStringRef target);
m_waitToDump = false;
}
+JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url)
+{
+ return url; // Do nothing on mac.
+}
+
void LayoutTestController::queueBackNavigation(int howFarBack)
{
WorkQueue::shared()->queue(new BackItem(howFarBack));
using std::string;
using std::wstring;
+static bool resolveCygwinPath(const wstring& cygwinPath, wstring& windowsPath);
+
LayoutTestController::~LayoutTestController()
{
COMPtr<IWebView> webView;
m_waitToDump = false;
}
+JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url)
+{
+ wstring localPath;
+ if (!resolveCygwinPath(wstring(JSStringGetCharactersPtr(url), JSStringGetLength(url)), localPath))
+ return 0;
+
+ return JSStringCreateWithCharacters(localPath.c_str(), localPath.length());
+}
+
void LayoutTestController::queueBackNavigation(int howFarBack)
{
// Same as on mac. This can be shared.
static bool resolveCygwinPath(const wstring& cygwinPath, wstring& windowsPath)
{
- if (cygwinPath[0] != '/')
+ wstring fileProtocol = L"file://";
+ bool isFileProtocol = cygwinPath.find(fileProtocol) != string::npos;
+ if (cygwinPath[isFileProtocol ? 7 : 0] != '/') // ensure path is absolute
return false;
// Get the Root path.
windowsPath = wstring(rootPath, rootPathSize);
- int oldPos = 1;
+ int oldPos = isFileProtocol ? 8 : 1;
while (1) {
int newPos = cygwinPath.find('/', oldPos);
oldPos = newPos + 1;
}
+
+ if (isFileProtocol)
+ windowsPath = fileProtocol + windowsPath;
+
return true;
}