blob: 6bea1f4b8dcd5770c5d5972de82276be88bb1258 [file] [log] [blame]
<p>This test checks cross-frame access security of window attribute setters (rdar://problem/5326791).</p>
<iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-put-test.html" style=""></iframe>
<pre id="console"></pre>
<script>
function log(s)
{
document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
}
window.targetWindow = window.frames[0];
window.onload = function()
{
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
// Constructors
targetWindow.Attr = "FAIL!! CUSTOM Attr";
targetWindow.CDATASection = "FAIL!! CUSTOM CDATASection";
targetWindow.CharacterData = "FAIL!! CUSTOM CharacterData";
targetWindow.Comment = "FAIL!! CUSTOM Comment";
targetWindow.CSSPrimitiveValue = "FAIL!! CUSTOM CSSPrimitiveValue";
targetWindow.CSSRule = "FAIL!! CUSTOM CSSRule";
targetWindow.CSSStyleDeclaration = "FAIL!! CUSTOM CSSStyleDeclaration";
targetWindow.CSSValue = "FAIL!! CUSTOM CSSValue";
targetWindow.Document = "FAIL!! CUSTOM Document";
targetWindow.DocumentFragment = "FAIL!! CUSTOM DocumentFragment";
targetWindow.DocumentType = "FAIL!! CUSTOM DocumentType";
targetWindow.DOMException = "FAIL!! CUSTOM DOMException";
targetWindow.DOMImplementation = "FAIL!! CUSTOM DOMImplementation";
targetWindow.DOMParser = "FAIL!! CUSTOM DOMParser";
targetWindow.Element = "FAIL!! CUSTOM Element";
targetWindow.Entity = "FAIL!! CUSTOM Entity";
targetWindow.EntityReference = "FAIL!! CUSTOM EntityReference";
targetWindow.EvalError = "FAIL!! CUSTOM EvalError";
targetWindow.Event = "FAIL!! CUSTOM Event";
targetWindow.HTMLAnchorElement = "FAIL!! CUSTOM HTMLAnchorElement";
targetWindow.HTMLAppletElement = "FAIL!! CUSTOM HTMLAppletElement";
targetWindow.HTMLAreaElement = "FAIL!! CUSTOM HTMLAreaElement";
targetWindow.HTMLBaseElement = "FAIL!! CUSTOM HTMLBaseElement";
targetWindow.HTMLBaseFontElement = "FAIL!! CUSTOM HTMLBaseFontElement";
targetWindow.HTMLBodyElement = "FAIL!! CUSTOM HTMLBodyElement";
targetWindow.HTMLBRElement = "FAIL!! CUSTOM HTMLBRElement";
targetWindow.HTMLButtonElement = "FAIL!! CUSTOM HTMLButtonElement";
targetWindow.HTMLCanvasElement = "FAIL!! CUSTOM HTMLCanvasElement";
targetWindow.HTMLDirectoryElement = "FAIL!! CUSTOM HTMLDirectoryElement";
targetWindow.HTMLDivElement = "FAIL!! CUSTOM HTMLDivElement";
targetWindow.HTMLDListElement = "FAIL!! CUSTOM HTMLDListElement";
targetWindow.HTMLDocument = "FAIL!! CUSTOM HTMLDocument";
targetWindow.HTMLElement = "FAIL!! CUSTOM HTMLElement";
targetWindow.HTMLFieldSetElement = "FAIL!! CUSTOM HTMLFieldSetElement";
targetWindow.HTMLFontElement = "FAIL!! CUSTOM HTMLFontElement";
targetWindow.HTMLFormElement = "FAIL!! CUSTOM HTMLFormElement";
targetWindow.HTMLFrameElement = "FAIL!! CUSTOM HTMLFrameElement";
targetWindow.HTMLFrameSetElement = "FAIL!! CUSTOM HTMLFrameSetElement";
targetWindow.HTMLHeadElement = "FAIL!! CUSTOM HTMLHeadElement";
targetWindow.HTMLHeadingElement = "FAIL!! CUSTOM HTMLHeadingElement";
targetWindow.HTMLHRElement = "FAIL!! CUSTOM HTMLHRElement";
targetWindow.HTMLHtmlElement = "FAIL!! CUSTOM HTMLHtmlElement";
targetWindow.HTMLIFrameElement = "FAIL!! CUSTOM HTMLIFrameElement";
targetWindow.HTMLImageElement = "FAIL!! CUSTOM HTMLImageElement";
targetWindow.HTMLInputElement = "FAIL!! CUSTOM HTMLInputElement";
targetWindow.HTMLIsIndexElement = "FAIL!! CUSTOM HTMLIsIndexElement";
targetWindow.HTMLLabelElement = "FAIL!! CUSTOM HTMLLabelElement";
targetWindow.HTMLLegendElement = "FAIL!! CUSTOM HTMLLegendElement";
targetWindow.HTMLLIElement = "FAIL!! CUSTOM HTMLLIElement";
targetWindow.HTMLLinkElement = "FAIL!! CUSTOM HTMLLinkElement";
targetWindow.HTMLMapElement = "FAIL!! CUSTOM HTMLMapElement";
targetWindow.HTMLMarqueeElement = "FAIL!! CUSTOM HTMLMarqueeElement";
targetWindow.HTMLMenuElement = "FAIL!! CUSTOM HTMLMenuElement";
targetWindow.HTMLMetaElement = "FAIL!! CUSTOM HTMLMetaElement";
targetWindow.HTMLModElement = "FAIL!! CUSTOM HTMLModElement";
targetWindow.HTMLOListElement = "FAIL!! CUSTOM HTMLOListElement";
targetWindow.HTMLOptGroupElement = "FAIL!! CUSTOM HTMLOptGroupElement";
targetWindow.HTMLOptionElement = "FAIL!! CUSTOM HTMLOptionElement";
targetWindow.HTMLParagraphElement = "FAIL!! CUSTOM HTMLParagraphElement";
targetWindow.HTMLParamElement = "FAIL!! CUSTOM HTMLParamElement";
targetWindow.HTMLPreElement = "FAIL!! CUSTOM HTMLPreElement";
targetWindow.HTMLQuoteElement = "FAIL!! CUSTOM HTMLQuoteElement";
targetWindow.HTMLScriptElement = "FAIL!! CUSTOM HTMLScriptElement";
targetWindow.HTMLSelectElement = "FAIL!! CUSTOM HTMLSelectElement";
targetWindow.HTMLStyleElement = "FAIL!! CUSTOM HTMLStyleElement";
targetWindow.HTMLTableCaptionElement = "FAIL!! CUSTOM HTMLTableCaptionElement";
targetWindow.HTMLTableCellElement = "FAIL!! CUSTOM HTMLTableCellElement";
targetWindow.HTMLTableColElement = "FAIL!! CUSTOM HTMLTableColElement";
targetWindow.HTMLTableElement = "FAIL!! CUSTOM HTMLTableElement";
targetWindow.HTMLTableRowElement = "FAIL!! CUSTOM HTMLTableRowElement";
targetWindow.HTMLTableSectionElement = "FAIL!! CUSTOM HTMLTableSectionElement";
targetWindow.HTMLTextAreaElement = "FAIL!! CUSTOM HTMLTextAreaElement";
targetWindow.HTMLTitleElement = "FAIL!! CUSTOM HTMLTitleElement";
targetWindow.HTMLUListElement = "FAIL!! CUSTOM HTMLUListElement";
targetWindow.MutationEvent = "FAIL!! CUSTOM MutationEvent";
targetWindow.Node = "FAIL!! CUSTOM Node";
targetWindow.NodeFilter = "FAIL!! CUSTOM NodeFilter";
targetWindow.Notation = "FAIL!! CUSTOM Notation";
targetWindow.ProcessingInstruction = "FAIL!! CUSTOM ProcessingInstruction";
targetWindow.Range = "FAIL!! CUSTOM Range";
targetWindow.RangeError = "FAIL!! CUSTOM RangeError";
targetWindow.RangeException = "FAIL!! CUSTOM RangeException";
targetWindow.ReferenceError = "FAIL!! CUSTOM ReferenceError";
targetWindow.SyntaxError = "FAIL!! CUSTOM SyntaxError";
targetWindow.Text = "FAIL!! CUSTOM Text";
targetWindow.TypeError = "FAIL!! CUSTOM TypeError";
targetWindow.URIError = "FAIL!! CUSTOM URIError";
targetWindow.XMLDocument = "FAIL!! CUSTOM XMLDocument";
targetWindow.XMLSerializer = "FAIL!! CUSTOM XMLSerializer";
targetWindow.XPathEvaluator = "FAIL!! CUSTOM XPathEvaluator";
targetWindow.XPathResult = "FAIL!! CUSTOM XPathResult";
// FIXME: find a way to test these Constructors
// targetWindow.Image = "FAIL!! CUSTOM Image";
// targetWindow.Option = "FAIL!! CUSTOM Option";
// targetWindow.XMLHttpRequest = "FAIL!! CUSTOM XMLHttpRequest";
// targetWindow.XSLTProcessor = "FAIL!! CUSTOM XSLTProcessor";
// Attributes
targetWindow.clientInformation = "FAIL!! CUSTOM clientInformation";
targetWindow.closed = "FAIL!! CUSTOM closed";
targetWindow.console = "FAIL!! CUSTOM console";
targetWindow.crypto = "FAIL!! CUSTOM crypto";
targetWindow.defaultStatus = "FAIL!! CUSTOM defaultStatus";
targetWindow.defaultstatus = "FAIL!! CUSTOM defaultstatus";
targetWindow.devicePixelRatio = "FAIL!! CUSTOM devicePixelRatio";
targetWindow.document = "FAIL!! CUSTOM document";
targetWindow.embeds = "FAIL!! CUSTOM embeds";
targetWindow.event = "FAIL!! CUSTOM event";
targetWindow.frameElement = "FAIL!! CUSTOM frameElement";
targetWindow.frames = "FAIL!! CUSTOM frames";
targetWindow.history = "FAIL!! CUSTOM history";
targetWindow.images = "FAIL!! CUSTOM images";
targetWindow.innerHeight = "FAIL!! CUSTOM innerHeight";
targetWindow.innerWidth = "FAIL!! CUSTOM innerWidth";
targetWindow.length = "FAIL!! CUSTOM length";
targetWindow.locationbar = "FAIL!! CUSTOM locationbar";
targetWindow.menubar = "FAIL!! CUSTOM menubar";
targetWindow.name = "FAIL!! CUSTOM name";
targetWindow.navigator = "FAIL!! CUSTOM navigator";
targetWindow.offscreenBuffering = "FAIL!! CUSTOM offscreenBuffering";
targetWindow.onabort = "FAIL!! CUSTOM onabort";
targetWindow.onbeforeunload = "FAIL!! CUSTOM onbeforeunload";
targetWindow.onblur = "FAIL!! CUSTOM onblur";
targetWindow.onchange = "FAIL!! CUSTOM onchange";
targetWindow.onclick = "FAIL!! CUSTOM onclick";
targetWindow.ondblclick = "FAIL!! CUSTOM ondblclick";
targetWindow.onerror = "FAIL!! CUSTOM onerror";
targetWindow.onfocus = "FAIL!! CUSTOM onfocus";
targetWindow.onkeydown = "FAIL!! CUSTOM onkeydown";
targetWindow.onkeypress = "FAIL!! CUSTOM onkeypress";
targetWindow.onkeyup = "FAIL!! CUSTOM onkeyup";
targetWindow.onload = "FAIL!! CUSTOM onload";
targetWindow.onmousedown = "FAIL!! CUSTOM onmousedown";
targetWindow.onmousemove = "FAIL!! CUSTOM onmousemove";
targetWindow.onmouseout = "FAIL!! CUSTOM onmouseout";
targetWindow.onmouseover = "FAIL!! CUSTOM onmouseover";
targetWindow.onmouseup = "FAIL!! CUSTOM onmouseup";
targetWindow.onmousewheel = "FAIL!! CUSTOM onmousewheel";
targetWindow.onreset = "FAIL!! CUSTOM onreset";
targetWindow.onresize = "FAIL!! CUSTOM onresize";
targetWindow.onscroll = "FAIL!! CUSTOM onscroll";
targetWindow.onsearch = "FAIL!! CUSTOM onsearch";
targetWindow.onselect = "FAIL!! CUSTOM onselect";
targetWindow.onsubmit = "FAIL!! CUSTOM onsubmit";
targetWindow.onunload = "FAIL!! CUSTOM onunload";
targetWindow.opener = "FAIL!! CUSTOM opener";
targetWindow.outerHeight = "FAIL!! CUSTOM outerHeight";
targetWindow.outerWidth = "FAIL!! CUSTOM outerWidth";
targetWindow.pageXOffset = "FAIL!! CUSTOM pageXOffset";
targetWindow.pageYOffset = "FAIL!! CUSTOM pageYOffset";
targetWindow.personalbar = "FAIL!! CUSTOM personalbar";
targetWindow.plugins = "FAIL!! CUSTOM plugins";
targetWindow.screen = "FAIL!! CUSTOM screen";
targetWindow.screenLeft = "FAIL!! CUSTOM screenLeft";
targetWindow.screenTop = "FAIL!! CUSTOM screenTop";
targetWindow.screenX = "FAIL!! CUSTOM screenX";
targetWindow.screenY = "FAIL!! CUSTOM screenY";
targetWindow.scrollbars = "FAIL!! CUSTOM scrollbars";
targetWindow.scrollX = "FAIL!! CUSTOM scrollX";
targetWindow.scrollY = "FAIL!! CUSTOM scrollY";
targetWindow.self = "FAIL!! CUSTOM self";
targetWindow.status = "FAIL!! CUSTOM status";
targetWindow.statusbar = "FAIL!! CUSTOM statusbar";
targetWindow.toolbar = "FAIL!! CUSTOM toolbar";
targetWindow.window = "FAIL!! CUSTOM window";
// FIXME: find a way to test these attributes
// targetWindow.parent = "FAIL!! CUSTOM parent";
// targetWindow.top = "FAIL!! CUSTOM top";
// Functions
targetWindow.addEventListener = "FAIL!! CUSTOM addEventListener";
targetWindow.alert = "FAIL!! CUSTOM alert";
targetWindow.atob = "FAIL!! CUSTOM atob";
targetWindow.blur = "FAIL!! CUSTOM blur";
targetWindow.btoa = "FAIL!! CUSTOM btoa";
targetWindow.captureEvents = "FAIL!! CUSTOM captureEvents";
targetWindow.clearInterval = "FAIL!! CUSTOM clearInterval";
targetWindow.clearTimeout = "FAIL!! CUSTOM clearTimeout";
targetWindow.close = "FAIL!! CUSTOM close";
targetWindow.confirm = "FAIL!! CUSTOM confirm";
targetWindow.eval = "FAIL!! CUSTOM eval";
targetWindow.find = "FAIL!! CUSTOM find";
targetWindow.focus = "FAIL!! CUSTOM focus";
targetWindow.getComputedStyle = "FAIL!! CUSTOM getComputedStyle";
targetWindow.getMatchedCSSRules = "FAIL!! CUSTOM getMatchedCSSRules";
targetWindow.getSelection = "FAIL!! CUSTOM getSelection";
targetWindow.moveBy = "FAIL!! CUSTOM moveBy";
targetWindow.moveTo = "FAIL!! CUSTOM moveTo";
targetWindow.open = "FAIL!! CUSTOM open";
targetWindow.print = "FAIL!! CUSTOM print";
targetWindow.prompt = "FAIL!! CUSTOM prompt";
targetWindow.releaseEvents = "FAIL!! CUSTOM releaseEvents";
targetWindow.removeEventListener = "FAIL!! CUSTOM removeEventListener";
targetWindow.resizeBy = "FAIL!! CUSTOM resizeBy";
targetWindow.resizeTo = "FAIL!! CUSTOM resizeTo";
targetWindow.scroll = "FAIL!! CUSTOM scroll";
targetWindow.scrollBy = "FAIL!! CUSTOM scrollBy";
targetWindow.scrollTo = "FAIL!! CUSTOM scrollTo";
targetWindow.setInterval = "FAIL!! CUSTOM setInterval";
targetWindow.setTimeout = "FAIL!! CUSTOM setTimeout";
targetWindow.showModalDialog = "FAIL!! CUSTOM showModalDialog";
targetWindow.stop = "FAIL!! CUSTOM stop";
setTimeout(function() {
// log(targetWindow.focus.__proto__);
log("MAIN WINDOW: !!-- Test ended--!!");
window.stop();
if (window.layoutTestController)
layoutTestController.notifyDone();
}, 1);
}
</script>