Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Unified Diff: LayoutTests/fast/dom/cross-frame-accessor-throw.html

Issue 68563003: Create DOM exceptions in the correct context. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased onto df9a982fbe97 Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/cross-frame-accessor-throw-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/cross-frame-accessor-throw.html
diff --git a/LayoutTests/fast/dom/cross-frame-accessor-throw.html b/LayoutTests/fast/dom/cross-frame-accessor-throw.html
new file mode 100644
index 0000000000000000000000000000000000000000..7245ca571af3a5e0a0405885e2d0532393b4c23f
--- /dev/null
+++ b/LayoutTests/fast/dom/cross-frame-accessor-throw.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Throwing in the context of an accessor setter (235223)</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+</head>
+<body>
+<script type="text/javascript">
+var frame = document.createElement('iframe');
+document.body.appendChild(frame);
+var frameWindow = frame.contentWindow;
+
+function assert_dom_exception_in_frame(exception) {
+ assert_equals(frameWindow.DOMException.prototype, Object.getPrototypeOf(exception));
+ assert_not_equals(DOMException.prototype, Object.getPrototypeOf(exception));
+}
+
+test(function () {
+ // Sanity check over functions.
+ try {
+ var element = frameWindow.document.createElement('textarea');
+ element.appendChild(element);
+ assert_unreached("Cyclic appendChild() should throw HierarchyRequestError.");
+ } catch (e) {
+ assert_true(e.name == "HierarchyRequestError");
+ assert_dom_exception_in_frame(e);
+ }
+}, "Check that exception is created in called function's context.");
+
+test(function () {
+ try {
+ var i = frameWindow.document.createElement('input');
+ i.size = 0;
+ assert_unreached("Setting input.size to zero should throw IndexSizeError.");
+ } catch (e) {
+ assert_true(e.name == "IndexSizeError");
+ assert_dom_exception_in_frame(e);
+ }
+ try {
+ var xhr = new frameWindow.XMLHttpRequest();
+ xhr.open('GET', 'nonExistent.html', false);
+ xhr.timeout = 10;
+ assert_unreached("Setting xhr.timeout on sync XHR object should throw InvalidAccessError.");
+ } catch (e) {
+ assert_true(e.name == "InvalidAccessError");
+ assert_dom_exception_in_frame(e);
+ }
+}, "Check that DOM exception is created in setter's context.");
+
+test(function () {
+ try {
+ var serializer = new frameWindow.XMLSerializer();
+ serializer.serializeToString(null);
+ assert_unreached("serializing null should throw a TypeError");
+ } catch (e) {
+ assert_true(e.name == "TypeError");
+ assert_equals(frameWindow.TypeError.prototype, Object.getPrototypeOf(e));
+ assert_not_equals(TypeError.prototype, Object.getPrototypeOf(e));
+ }
+}, "Check that native exception is created in setter's context.");
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/cross-frame-accessor-throw-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698