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

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

Issue 2225023002: binding: Updates a layout test for exception's creation context. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months 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 | third_party/WebKit/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: third_party/WebKit/LayoutTests/fast/dom/cross-frame-accessor-throw.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/cross-frame-accessor-throw.html b/third_party/WebKit/LayoutTests/fast/dom/cross-frame-accessor-throw.html
index 7245ca571af3a5e0a0405885e2d0532393b4c23f..a762690e66f72b618350df38dec2965fdfee3f7c 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/cross-frame-accessor-throw.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/cross-frame-accessor-throw.html
@@ -16,6 +16,11 @@ function assert_dom_exception_in_frame(exception) {
assert_not_equals(DOMException.prototype, Object.getPrototypeOf(exception));
}
+function assert_dom_exception_in_incumbent(exception) {
+ assert_not_equals(frameWindow.DOMException.prototype, Object.getPrototypeOf(exception));
+ assert_equals(DOMException.prototype, Object.getPrototypeOf(exception));
+}
+
test(function () {
// Sanity check over functions.
try {
@@ -26,18 +31,36 @@ test(function () {
assert_true(e.name == "HierarchyRequestError");
assert_dom_exception_in_frame(e);
}
-}, "Check that exception is created in called function's context.");
+ try {
+ var element = frameWindow.document.createElement('textarea');
+ Node.prototype.appendChild.call(element, element);
+ assert_unreached("Cyclic appendChild() should throw HierarchyRequestError.");
+ } catch (e) {
+ assert_true(e.name == "HierarchyRequestError");
+ assert_dom_exception_in_incumbent(e);
+ }
+}, "Check that DOM exception is created in called function's context.");
test(function () {
try {
- var i = frameWindow.document.createElement('input');
- i.size = 0;
+ var input = frameWindow.document.createElement('input');
+ input.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 input = frameWindow.document.createElement('input');
+ var pd = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'size');
+ pd.set.call(input, 0);
+ assert_unreached("Setting input.size to zero should throw IndexSizeError.");
+ } catch (e) {
+ assert_true(e.name == "IndexSizeError");
+ assert_dom_exception_in_incumbent(e);
+ }
+
+ try {
var xhr = new frameWindow.XMLHttpRequest();
xhr.open('GET', 'nonExistent.html', false);
xhr.timeout = 10;
@@ -46,18 +69,37 @@ test(function () {
assert_true(e.name == "InvalidAccessError");
assert_dom_exception_in_frame(e);
}
+ try {
+ var xhr = new frameWindow.XMLHttpRequest();
+ xhr.open('GET', 'nonExistent.html', false);
+ var pd = Object.getOwnPropertyDescriptor(XMLHttpRequest.prototype, 'timeout');
+ pd.set.call(xhr, 10);
+ assert_unreached("Setting xhr.timeout on sync XHR object should throw InvalidAccessError.");
+ } catch (e) {
+ assert_true(e.name == "InvalidAccessError");
+ assert_dom_exception_in_incumbent(e);
+ }
}, "Check that DOM exception is created in setter's context.");
test(function () {
try {
var serializer = new frameWindow.XMLSerializer();
- serializer.serializeToString(null);
+ 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));
}
+ try {
+ var serializer = new frameWindow.XMLSerializer();
+ XMLSerializer.prototype.serializeToString.call(serializer, null);
+ assert_unreached("serializing null should throw a TypeError");
+ } catch (e) {
+ assert_true(e.name == "TypeError");
+ assert_not_equals(frameWindow.TypeError.prototype, Object.getPrototypeOf(e));
+ assert_equals(TypeError.prototype, Object.getPrototypeOf(e));
+ }
}, "Check that native exception is created in setter's context.");
</script>
</body>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/cross-frame-accessor-throw-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698