diff --git a/src/browser/tests/document/query_selector.html b/src/browser/tests/document/query_selector.html index b333069e..0837999e 100644 --- a/src/browser/tests/document/query_selector.html +++ b/src/browser/tests/document/query_selector.html @@ -24,11 +24,10 @@ diff --git a/src/browser/tests/domexception.html b/src/browser/tests/domexception.html index 1ed43e8d..05bdc837 100644 --- a/src/browser/tests/domexception.html +++ b/src/browser/tests/domexception.html @@ -127,7 +127,7 @@ testing.withError((err) => { testing.expectEqual(3, err.code); - testing.expectEqual('Hierarchy Error', err.message); + testing.expectEqual('HierarchyRequestError', err.name); testing.expectEqual(true, err instanceof DOMException); testing.expectEqual(true, err instanceof Error); }, () => link.appendChild(content)); diff --git a/src/browser/tests/element/attributes.html b/src/browser/tests/element/attributes.html index 9b8c29d3..0929a3d9 100644 --- a/src/browser/tests/element/attributes.html +++ b/src/browser/tests/element/attributes.html @@ -36,7 +36,6 @@ testing.withError((err) => { testing.expectEqual(8, err.code); testing.expectEqual("NotFoundError", err.name); - testing.expectEqual("Not Found", err.message); }, () => el1.removeAttributeNode(script_id_node)); testing.expectEqual(an1, el1.removeAttributeNode(an1)); diff --git a/src/browser/tests/element/matches.html b/src/browser/tests/element/matches.html index 5e1721b5..f28d7a71 100644 --- a/src/browser/tests/element/matches.html +++ b/src/browser/tests/element/matches.html @@ -66,11 +66,10 @@ { const container = $('#test-container'); - testing.expectError("SyntaxError: Syntax Error", () => container.matches('')); + testing.expectError("SyntaxError", () => container.matches('')); testing.withError((err) => { testing.expectEqual(12, err.code); testing.expectEqual("SyntaxError", err.name); - testing.expectEqual("Syntax Error", err.message); }, () => container.matches('')); } diff --git a/src/browser/tests/element/query_selector.html b/src/browser/tests/element/query_selector.html index 9564ca6d..203524b6 100644 --- a/src/browser/tests/element/query_selector.html +++ b/src/browser/tests/element/query_selector.html @@ -12,11 +12,10 @@ const p1 = $('#p1'); testing.expectEqual(null, p1.querySelector('#p1')); - testing.expectError("SyntaxError: Syntax Error", () => p1.querySelector('')); + testing.expectError("SyntaxError", () => p1.querySelector('')); testing.withError((err) => { testing.expectEqual(12, err.code); testing.expectEqual("SyntaxError", err.name); - testing.expectEqual("Syntax Error", err.message); }, () => p1.querySelector('')); testing.expectEqual($('#c2'), p1.querySelector('#c2')); diff --git a/src/browser/tests/element/query_selector_all.html b/src/browser/tests/element/query_selector_all.html index eeedc876..3b4013c2 100644 --- a/src/browser/tests/element/query_selector_all.html +++ b/src/browser/tests/element/query_selector_all.html @@ -24,11 +24,10 @@ diff --git a/src/browser/tests/element/selector_invalid.html b/src/browser/tests/element/selector_invalid.html index 35409c19..c0d16d59 100644 --- a/src/browser/tests/element/selector_invalid.html +++ b/src/browser/tests/element/selector_invalid.html @@ -43,8 +43,8 @@ const container = $('#container'); // Empty selectors - testing.expectError("SyntaxError: Syntax Error", () => container.querySelector('')); - testing.expectError("SyntaxError: Syntax Error", () => document.querySelectorAll('')); + testing.expectError("SyntaxError", () => container.querySelector('')); + testing.expectError("SyntaxError", () => document.querySelectorAll('')); } diff --git a/src/browser/tests/node/insert_before.html b/src/browser/tests/node/insert_before.html index 8be48e56..50dff07c 100644 --- a/src/browser/tests/node/insert_before.html +++ b/src/browser/tests/node/insert_before.html @@ -19,7 +19,6 @@ testing.withError((err) => { testing.expectEqual(8, err.code); testing.expectEqual("NotFoundError", err.name); - testing.expectEqual("Not Found", err.message); }, () => d1.insertBefore(document.createElement('div'), d2)); let c1 = document.createElement('div'); diff --git a/src/browser/tests/node/remove_child.html b/src/browser/tests/node/remove_child.html index fdf0b813..1118e4cf 100644 --- a/src/browser/tests/node/remove_child.html +++ b/src/browser/tests/node/remove_child.html @@ -7,7 +7,6 @@ testing.withError((err) => { testing.expectEqual(8, err.code); testing.expectEqual("NotFoundError", err.name); - testing.expectEqual("Not Found", err.message); }, () => $('#d1').removeChild($('#p1'))); const p1 = $('#p1'); diff --git a/src/browser/tests/node/replace_child.html b/src/browser/tests/node/replace_child.html index 45ed1bc5..51b0a173 100644 --- a/src/browser/tests/node/replace_child.html +++ b/src/browser/tests/node/replace_child.html @@ -25,7 +25,6 @@ testing.withError((err) => { testing.expectEqual(3, err.code); testing.expectEqual("HierarchyRequestError", err.name); - testing.expectEqual("Hierarchy Error", err.message); }, () => d1.replaceChild(c4, c3)); testing.expectEqual(c2, d1.replaceChild(c4, c2)); diff --git a/src/browser/tests/range.html b/src/browser/tests/range.html index d9a8637b..8440c187 100644 --- a/src/browser/tests/range.html +++ b/src/browser/tests/range.html @@ -451,12 +451,12 @@ const p1 = $('#p1'); // Test setStart with offset beyond node length - testing.expectError('IndexSizeError: Index or size is negative or greater than the allowed amount', () => { + testing.expectError('IndexSizeError:', () => { range.setStart(p1, 999); }); // Test with negative offset (wraps to large u32) - testing.expectError('IndexSizeError: Index or size is negative or greater than the allowed amount', () => { + testing.expectError('IndexSizeError:', () => { range.setStart(p1.firstChild, -1); }); } @@ -468,12 +468,12 @@ const p1 = $('#p1'); // Test setEnd with offset beyond node length - testing.expectError('IndexSizeError: Index or size is negative or greater than the allowed amount', () => { + testing.expectError('IndexSizeError:', () => { range.setEnd(p1, 999); }); // Test with text node - testing.expectError('IndexSizeError: Index or size is negative or greater than the allowed amount', () => { + testing.expectError('IndexSizeError:', () => { range.setEnd(p1.firstChild, 9999); }); } @@ -525,11 +525,11 @@ range.setEnd(p1, 1); // Test comparePoint with invalid offset - testing.expectError('IndexSizeError: Index or size is negative or greater than the allowed amount', () => { + testing.expectError('IndexSizeError:', () => { range.comparePoint(p1, 20); }); - testing.expectError('IndexSizeError: Index or size is negative or greater than the allowed amount', () => { + testing.expectError('IndexSizeError:', () => { range.comparePoint(p1.firstChild, -1); }); } @@ -650,11 +650,11 @@ range.setEnd(p1, 1); // Invalid offset should throw IndexSizeError - testing.expectError('IndexSizeError: Index or size is negative or greater than the allowed amount', () => { + testing.expectError('IndexSizeError:', () => { range.isPointInRange(p1, 999); }); - testing.expectError('IndexSizeError: Index or size is negative or greater than the allowed amount', () => { + testing.expectError('IndexSizeError:', () => { range.isPointInRange(p1.firstChild, 9999); }); } @@ -854,11 +854,11 @@ range2.setStart(p, 0); // Invalid how parameter should throw NotSupportedError - testing.expectError('NotSupportedError: Not Supported', () => { + testing.expectError('NotSupportedError:', () => { range1.compareBoundaryPoints(4, range2); }); - testing.expectError('NotSupportedError: Not Supported', () => { + testing.expectError('NotSupportedError:', () => { range1.compareBoundaryPoints(99, range2); }); } @@ -883,7 +883,7 @@ range2.setEnd(foreignP, 1); // Comparing ranges in different documents should throw WrongDocumentError - testing.expectError('WrongDocumentError: wrong_document_error', () => { + testing.expectError('WrongDocumentError:', () => { range1.compareBoundaryPoints(Range.START_TO_START, range2); }); } diff --git a/src/browser/tests/window/window.html b/src/browser/tests/window/window.html index 01025b86..e4094f9b 100644 --- a/src/browser/tests/window/window.html +++ b/src/browser/tests/window/window.html @@ -82,7 +82,7 @@ testing.expectEqual('ceil', atob('Y2VpbA')); // 6 chars, len%4==2, needs '==' // length % 4 == 1 must still throw - testing.expectError('InvalidCharacterError: Invalid Character', () => { + testing.expectError('InvalidCharacterError', () => { atob('Y'); }); diff --git a/src/browser/webapi/DOMException.zig b/src/browser/webapi/DOMException.zig index 3e0da288..46294b8d 100644 --- a/src/browser/webapi/DOMException.zig +++ b/src/browser/webapi/DOMException.zig @@ -104,13 +104,27 @@ pub fn getMessage(self: *const DOMException) []const u8 { } return switch (self._code) { .none => "", - .invalid_character_error => "Invalid Character", .index_size_error => "Index or size is negative or greater than the allowed amount", - .syntax_error => "Syntax Error", - .not_supported => "Not Supported", - .not_found => "Not Found", - .hierarchy_error => "Hierarchy Error", - else => @tagName(self._code), + .hierarchy_error => "The operation would yield an incorrect node tree", + .wrong_document_error => "The object is in the wrong document", + .invalid_character_error => "The string contains invalid characters", + .no_modification_allowed_error => "The object can not be modified", + .not_found => "The object can not be found here", + .not_supported => "The operation is not supported", + .inuse_attribute_error => "The attribute already in use", + .invalid_state_error => "The object is in an invalid state", + .syntax_error => "The string did not match the expected pattern", + .invalid_modification_error => "The object can not be modified in this way", + .namespace_error => "The operation is not allowed by Namespaces in XML", + .invalid_access_error => "The object does not support the operation or argument", + .security_error => "The operation is insecure", + .network_error => "A network error occurred", + .abort_error => "The operation was aborted", + .url_mismatch_error => "The given URL does not match another URL", + .quota_exceeded_error => "The quota has been exceeded", + .timeout_error => "The operation timed out", + .invalid_node_type_error => "The supplied node is incorrect or has an incorrect ancestor for this operation", + .data_clone_error => "The object can not be cloned", }; }