forked from mirrors/gecko-dev
Because of #2122 I cannot write test for this right now because it will be failing randomly due to that iframe issue. However, if it doesn't fail due to that issue a test like this:
```html
<html>
<head>
<meta charset="utf8" />
<script src="harness.js"></script>
<title>Iframe contentDocument test.</title>
</head>
<body>
<iframe src="test_iframe_contentDocument_inner.html" id="iframe"></iframe>
<script>
waitForExplicitFinish();
var timeout = 100;
var iframe = document.getElementById('iframe');
function test_contentWindow() {
if (!iframe.contentWindow) {
// Iframe not loaded yet, try again.
// No load event for iframe, insert bug number here.
setTimeout(test_contentWindow, timeout);
return;
}
is(iframe.contentDocument.getElementById('test').textContent, 'value');
finish();
}
test_contentWindow();
</script>
</body>
</html>
```
where inner is simply:
```html
<html><body><div id="test">value</div></body></html>
```
passes.
I have added `SameOrigin` method to the `UrlHelper`. I wanted to reuse it in [`constellation.rs` same_script check](f0184a2d01/components/compositing/constellation.rs (L625)) but I it didn't want to compile saying
```
error: unresolved import `dom::urlhelper::UrlHelper`. Maybe a missing `extern crate dom`?
```
So I didn't include it in this PR for now.
There is more discussion about the cross origin iframes in [another issue](https://github.com/servo/servo/issues/3939). In this PR I just added same origin check.
Source-Repo: https://github.com/servo/servo
Source-Revision: 85a2f0b66a32cfd6022b3e6cec6ec06f3b59baf1
33 lines
1.3 KiB
Text
33 lines
1.3 KiB
Text
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
// http://www.whatwg.org/html/#htmliframeelement
|
|
interface HTMLIFrameElement : HTMLElement {
|
|
attribute DOMString src;
|
|
// attribute DOMString srcdoc;
|
|
// attribute DOMString name;
|
|
//[PutForwards=value] readonly attribute DOMSettableTokenList sandbox;
|
|
attribute DOMString sandbox;
|
|
// attribute boolean seamless;
|
|
// attribute boolean allowFullscreen;
|
|
// attribute DOMString width;
|
|
// attribute DOMString height;
|
|
readonly attribute Document? contentDocument;
|
|
//readonly attribute WindowProxy? contentWindow;
|
|
readonly attribute Window? contentWindow;
|
|
|
|
// also has obsolete members
|
|
};
|
|
|
|
// http://www.whatwg.org/html/#HTMLIFrameElement-partial
|
|
partial interface HTMLIFrameElement {
|
|
// attribute DOMString align;
|
|
// attribute DOMString scrolling;
|
|
// attribute DOMString frameBorder;
|
|
// attribute DOMString longDesc;
|
|
|
|
//[TreatNullAs=EmptyString] attribute DOMString marginHeight;
|
|
//[TreatNullAs=EmptyString] attribute DOMString marginWidth;
|
|
};
|