commit 76065bbb6c97a3fc5a3ede758e429e74540514ca
parent b135da1f086ed830a58c792e7fda21b0681fc2f7
Author: Serban Stanca <sstanca@mozilla.com>
Date: Fri, 31 Oct 2025 02:13:06 +0200
Revert "Bug 1997216 - Fix Exception::ColumnNumber to return actual column number. r=arai,emilio" for causing mochitests-plain failures in test_exception_line_column.html.
This reverts commit 2b92c4f86d82faa200e4e6f7e7f04f08302b7f67.
Diffstat:
7 files changed, 6 insertions(+), 66 deletions(-)
diff --git a/dom/base/DOMException.cpp b/dom/base/DOMException.cpp
@@ -289,13 +289,7 @@ uint32_t Exception::LineNumber(JSContext* aCx) const {
return 0;
}
-uint32_t Exception::ColumnNumber(JSContext* aCx) const {
- if (mLocation) {
- return mLocation->GetColumnNumber(aCx);
- }
-
- return 0;
-}
+uint32_t Exception::ColumnNumber() const { return 0; }
already_AddRefed<nsIStackFrame> Exception::GetLocation() const {
nsCOMPtr<nsIStackFrame> location = mLocation;
diff --git a/dom/base/DOMException.h b/dom/base/DOMException.h
@@ -89,7 +89,7 @@ class Exception : public nsIException, public nsWrapperCache {
uint32_t LineNumber(JSContext* aCx) const;
- uint32_t ColumnNumber(JSContext* aCx) const;
+ uint32_t ColumnNumber() const;
already_AddRefed<nsIStackFrame> GetLocation() const;
diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf
@@ -219,7 +219,7 @@ DOMInterfaces = {
},
'DOMException': {
- 'implicitJSContext': [ 'filename', 'lineNumber', 'columnNumber', 'stack' ],
+ 'implicitJSContext': [ 'filename', 'lineNumber', 'stack' ],
},
'DOMMatrixReadOnly': {
@@ -260,7 +260,7 @@ DOMInterfaces = {
'Exception': {
'headerFile': 'mozilla/dom/DOMException.h',
- 'implicitJSContext': [ '__stringifier', 'filename', 'lineNumber', 'columnNumber', 'stack' ],
+ 'implicitJSContext': [ '__stringifier', 'filename', 'lineNumber', 'stack' ],
},
'ExtendableEvent': {
diff --git a/dom/bindings/test/mochitest.toml b/dom/bindings/test/mochitest.toml
@@ -96,8 +96,6 @@ skip-if = ["!debug"]
["test_exceptionThrowing.html"]
-["test_exception_line_column.html"]
-
["test_exception_messages.html"]
["test_exception_options_from_jsimplemented.html"]
diff --git a/dom/bindings/test/test_exception_line_column.html b/dom/bindings/test/test_exception_line_column.html
@@ -1,52 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1997216
--->
-<head>
- <meta charset="utf-8">
- <title>Test for Bug 1997216</title>
- <script src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
- <script type="application/javascript">
-
- /** Test for Bug 1997216 */
-
- // Test 1: DOMException from querySelector
- try {
- document.querySelector('###INVALID_SELECTOR###');
- ok(false, "Should have thrown");
- } catch (e) {
- is(e.lineNumber, 17, "querySelector exception should be on line 17");
- is(e.columnNumber, 14, "querySelector exception should be on column 14");
- }
-
- // Test 2: Manually created DOMException
- try {
- throw new DOMException('Test exception', 'NotFoundError');
- } catch (e) {
- is(e.lineNumber, 26, "Manual DOMException should be on line 26");
- is(e.columnNumber, 11, "Manual DOMException should be on column 11");
- }
-
- // Test 3: DOMException from invalid appendChild
- try {
- document.documentElement.appendChild(null);
- ok(false, "Should have thrown");
- } catch (e) {
- is(e.lineNumber, 35, "appendChild exception should be on line 35");
- is(e.columnNumber, 30, "appendChild exception should be on column 30");
- }
-
- </script>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1997216">Mozilla Bug 1997216</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-</pre>
-</body>
-</html>
diff --git a/js/xpconnect/src/ExecutionTracerIntegration.cpp b/js/xpconnect/src/ExecutionTracerIntegration.cpp
@@ -168,7 +168,7 @@ bool ExecutionTracerIntegration::WriteExceptionSummary(
uint32_t line = exception->LineNumber(aCx);
aWriter->writeUint32(line);
- uint32_t column = exception->ColumnNumber(aCx);
+ uint32_t column = exception->ColumnNumber();
aWriter->writeUint32(column);
nsCOMPtr<nsIStackFrame> stack = exception->GetLocation();
diff --git a/js/xpconnect/src/nsXPConnect.cpp b/js/xpconnect/src/nsXPConnect.cpp
@@ -253,7 +253,7 @@ void xpc::ErrorReport::Init(JSContext* aCx, mozilla::dom::Exception* aException,
}
mSourceId = aException->SourceId(aCx);
mLineNumber = aException->LineNumber(aCx);
- mColumn = aException->ColumnNumber(aCx);
+ mColumn = aException->ColumnNumber();
}
static LazyLogModule gJSDiagnostics("JSDiagnostics");