| Index: security/cross-frame-access.html
|
| ===================================================================
|
| --- security/cross-frame-access.html (revision 1080)
|
| +++ security/cross-frame-access.html (working copy)
|
| @@ -15,8 +15,8 @@
|
| final crossOriginIFrame = new Element.tag('iframe');
|
| crossOriginIFrame.src = 'data:text/html, <p>test iframe</p>';
|
|
|
| - asyncTest('WaitForFramesLoad', 2, () {
|
| - frameLoaded(Event e) { callbackDone(); }
|
| + test('WaitForFramesLoad', () {
|
| + var frameLoaded = expectAsync1((Event e) { }, count:2);
|
| sameOriginIFrame.onLoad.listen(frameLoaded);
|
| document.body.nodes.add(sameOriginIFrame);
|
| crossOriginIFrame.onLoad.listen(frameLoaded);
|
| @@ -33,7 +33,7 @@
|
| testHistory(crossOriginIFrame.contentWindow.history);
|
| });
|
|
|
| - asyncTest('Location', 2, () {
|
| + test('Location', () {
|
| testLocation(sameOriginIFrame.contentWindow.location);
|
| testLocation(crossOriginIFrame.contentWindow.location);
|
| });
|
| @@ -46,15 +46,16 @@
|
|
|
| testWindow(WindowBase targetWindow) {
|
| // Not allowed methods.
|
| - expectThrow(() => targetWindow.alert('test'));
|
| - expectThrow(() => targetWindow.onLoad.listen((Event e) {}));
|
| - expectThrow(() => targetWindow.find('test', true, true, true, true, true, true));
|
| + expect(() => targetWindow.alert('test'), throws);
|
| + expect(() => targetWindow.onLoad.listen((Event e) {}), throws);
|
| + expect(() =>
|
| + targetWindow.find('test', true, true, true, true, true, true), throws);
|
|
|
| // Not allowed properties.
|
| - expectThrow(() => targetWindow.contentDocument);
|
| - expectThrow(() => targetWindow.frameElement);
|
| - expectThrow(() => targetWindow.localStorage);
|
| - expectThrow(() => targetWindow.console);
|
| + expect(() => targetWindow.contentDocument, throws);
|
| + expect(() => targetWindow.frameElement, throws);
|
| + expect(() => targetWindow.localStorage, throws);
|
| + expect(() => targetWindow.console, throws);
|
|
|
| // Allowed methods.
|
| targetWindow.close();
|
| @@ -67,13 +68,13 @@
|
|
|
| testHistory(HistoryBase history) {
|
| // Not allowed properties.
|
| - expectThrow(() => history.length);
|
| + expect(() => history.length, throws);
|
|
|
| // Not allowed methods.
|
| window.history.pushState('test', 'test', 'test');
|
| - expectThrow(() => history.pushState('test', 'test', 'test'));
|
| + expect(() => history.pushState('test', 'test', 'test'), throws);
|
| window.history.replaceState('test', 'test', 'test');
|
| - expectThrow(() => history.replaceState('test', 'test', 'test'));
|
| + expect(() => history.replaceState('test', 'test', 'test'), throws);
|
|
|
| // Allowed method.
|
| history.back();
|
| @@ -83,27 +84,27 @@
|
|
|
| testLocation(LocationBase location) {
|
| // Not allowed properties.
|
| - expectThrow(() => location.href);
|
| - expectThrow(() => location.protocol);
|
| - expectThrow(() => location.host = 'test');
|
| - expectThrow(() => location.origin);
|
| + expect(() => location.href, throws);
|
| + expect(() => location.protocol, throws);
|
| + expect(() => location.host = 'test', throws);
|
| + expect(() => location.origin, throws);
|
|
|
| // Not allowed methods.
|
| - expectThrow(() => location.assign('http://www.webkit.org'));
|
| - expectThrow(() => location.reload());
|
| - expectThrow(() => location.getParameter('test'));
|
| + expect(() => location.assign('http://www.webkit.org'), throws);
|
| + expect(() => location.reload(), throws);
|
| + expect(() => location.getParameter('test'), throws);
|
|
|
| // Allowed properties.
|
| - window.onMessage.listen((Event e) {
|
| + window.onMessage.listen(expectAsync1((Event e) {
|
| expect(e.data, equals('navigated'));
|
| - window.setTimeout(callbackDone, 0);
|
| - });
|
| + window.setTimeout(expectAsync0((){}), 0);
|
| + }));
|
| location.href = 'data:text/html, <script>parent.postMessage("navigated", "*")<${"/script>"}';
|
| }
|
|
|
| testIFrameElement(IFrameElement iframe) {
|
| - expectThrow(() => iframe.contentDocument);
|
| - expectThrow(() => iframe.getSVGDocument());
|
| + expect(() => iframe.contentDocument, throws);
|
| + expect(() => iframe.getSVGDocument(), throws);
|
| }
|
| </script>
|
|
|
|
|