- From: Anthony Hughes <web-platform-tests-notifications@w3.org>
- Date: Wed, 18 Mar 2015 22:48:50 GMT
- To: public-web-platform-tests-notifications@w3.org
I'm still trying to get my feet wet but I think I have done what's needed to fulfill the example provided above. However I'm not sure if I've put it in the right place and I need help researching if this is the extent of what's needed. Perhaps if you could help give me a push in the right direction here I can try to figure it out.
As an aside, I noticed that I'm getting a failure in /dom/nodes/DOMImplementation-createHTMLDocument.html without any changes. I'm not sure if this needs to get fixed separately:
```
createHTMLDocument(): metadata assert_equals: expected (string) "UTF-8" but got (object) null
@http://web-platform.test:8000/dom/nodes/DOMImplementation-createHTMLDocument.html:72:3
Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1227:20
test@http://web-platform.test:8000/resources/testharness.js:428:9
@http://web-platform.test:8000/dom/nodes/DOMImplementation-createHTMLDocument.html:66:1
```
At any rate, here is what I've come up with so far for my tests:
```
diff --git a/dom/nodes/DOMImplementation-createHTMLDocument.html b/dom/nodes/DOMImplementation-createHTMLDocument.html
index 89dc383..e4afbc6 100644
--- a/dom/nodes/DOMImplementation-createHTMLDocument.html
+++ b/dom/nodes/DOMImplementation-createHTMLDocument.html
@@ -81,4 +81,22 @@ test(function() {
a.href = "http://example.org/?\u00E4";
assert_equals(a.href, "http://example.org/?%C3%A4");
}, "createHTMLDocument(): URL parsing")
+
+// Test that document.location getter is null outside browser context
+test(function() {
+ var doc = document.implementation.createHTMLDocument();
+ assert_equals(doc.location, null);
+}, "createHTMLDocument(): doc.location getter")
+
+// Test that window.location getter is null outside browser context
+test(function() {
+ var iframe = document.createElement("iframe");
+ document.body.appendChild(iframe);
+ var win = iframe.contentWindow;
+ assert_not_equals(win.location, null);
+ assert_equals(win.location, win.document.location);
+ document.body.removeChild(iframe);
+ assert_equals(win.location, null);
+ assert_equals(win.document.location, null);
+}, "createHTMLDocument(): win.location getter")
</script>
```
I ran this locally and the tests seem to pass, aside from the previous failure mentioned above.
View on GitHub: https://github.com/w3c/web-platform-tests/issues/1506#issuecomment-83216504
Received on Wednesday, 18 March 2015 22:49:37 UTC