commit edfc3ac2b555b6c9f82e445ec428d33ecacd1dcc
parent e1d22ea27f3632f31e15b603fa1b6a3029d30221
Author: Vincent Hilla <vhilla@mozilla.com>
Date: Wed, 3 Dec 2025 19:06:48 +0000
Bug 2003693 - Extend CKEditor fix to JEDITOR. r=hsivonen,emilio
Differential Revision: https://phabricator.services.mozilla.com/D274941
Diffstat:
4 files changed, 72 insertions(+), 2 deletions(-)
diff --git a/dom/base/nsGlobalWindowInner.cpp b/dom/base/nsGlobalWindowInner.cpp
@@ -2189,7 +2189,16 @@ MOZ_CAN_RUN_SCRIPT static bool IsCkEditor4EmptyFrame(Element& aEmbedder) {
JS_ClearPendingException(jsapi.cx());
return false;
}
- if (!StringBeginsWith(property.mCKEDITOR.mVersion, u"4."_ns)) {
+ const auto* version = [&]() -> const CkEditorVersion* {
+ if (property.mCKEDITOR.WasPassed()) {
+ return &property.mCKEDITOR.Value();
+ }
+ if (property.mJEDITOR.WasPassed()) {
+ return &property.mJEDITOR.Value();
+ }
+ return nullptr;
+ }();
+ if (!version || !StringBeginsWith(version->mVersion, u"4."_ns)) {
return false;
}
aEmbedder.OwnerDoc()->WarnOnceAbout(
diff --git a/dom/base/test/mochitest.toml b/dom/base/test/mochitest.toml
@@ -1091,6 +1091,8 @@ skip-if = [
"http3",
]
+["test_ckeditor4_compat_hack.html"]
+
["test_clearTimeoutIntervalNoArg.html"]
["test_clipboard_nbsp.html"]
diff --git a/dom/base/test/test_ckeditor4_compat_hack.html b/dom/base/test/test_ckeditor4_compat_hack.html
@@ -0,0 +1,58 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test that for the specific CKEditor 4 iframe, we get an async initial about:blank load</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
+ <script>
+
+async function base_test(options = {}) {
+ const {
+ cls = "cke_wysiwyg_frame",
+ src = "",
+ name = "CKEDITOR",
+ version = "4.15.0",
+ asyncLoad = true
+ } = options;
+
+ window[name] = { version };
+
+ const iframe = document.createElement("iframe");
+ iframe.src = src;
+ iframe.classList.add(cls);
+ let loadCnt = 0;
+ iframe.addEventListener("load", () => ++loadCnt );
+ document.body.append(iframe);
+
+ is(loadCnt, asyncLoad ? 0 : 1, "CKEditor frame got expected amount of sync loads")
+
+ if (loadCnt == 0 && asyncLoad) {
+ await new Promise(resolve => iframe.addEventListener("load", resolve, { once: true }));
+ ok(true, "CKEditor received an async load");
+ }
+
+ iframe.remove();
+ window[name] = undefined;
+}
+
+add_task(async function test_sanity_sync_load() {
+ await base_test({ name: "NOT_CKEDITOR", asyncLoad: false });
+});
+
+add_task(async function test_ckeditor() {
+ await base_test();
+});
+
+add_task(async function test_jeditor() {
+ await base_test({ name: "JEDITOR" });
+});
+
+ </script>
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+</body>
+</html>
diff --git a/dom/chrome-webidl/WebCompat.webidl b/dom/chrome-webidl/WebCompat.webidl
@@ -13,5 +13,6 @@ dictionary CkEditorVersion {
[GenerateInit]
dictionary CkEditorProperty {
- required CkEditorVersion CKEDITOR;
+ CkEditorVersion CKEDITOR;
+ CkEditorVersion JEDITOR;
};