From 81e55ad78bdec8eb1feb97d6242e33742267c7ab Mon Sep 17 00:00:00 2001 From: Iulian Moraru Date: Fri, 23 Aug 2024 04:41:22 +0300 Subject: [PATCH] Backed out changeset 056846758066 (bug 1912074) for causing mochitest-chrome failures on test_principal.html. CLOSED TREE --- toolkit/components/alerts/moz.build | 4 ++-- .../alerts/test/{browser => }/browser.toml | 0 .../alerts/test/{browser => }/browser_bug1682866.js | 0 toolkit/components/alerts/test/chrome/empty.html | 0 .../alerts/test/{browser => }/file_bug1682866.html | 0 .../components/alerts/test/{chrome => }/image.gif | Bin .../components/alerts/test/{chrome => }/image.png | Bin .../alerts/test/{chrome => }/image_server.sjs | 0 .../test/{chrome/chrome.toml => mochitest.toml} | 1 - .../alerts/test/{chrome => }/test_alerts.html | 5 +++-- .../test/{chrome => }/test_alerts_noobserve.html | 4 ++-- .../test_alerts_requireinteraction.html | 4 ++-- .../alerts/test/{chrome => }/test_image.html | 6 +++--- .../test/{chrome => }/test_invalid_utf16.html | 4 ++-- .../test/{chrome => }/test_multiple_alerts.html | 4 ++-- .../alerts/test/{chrome => }/test_principal.html | 12 +++--------- widget/windows/ToastNotificationHandler.cpp | 10 ---------- 17 files changed, 19 insertions(+), 35 deletions(-) rename toolkit/components/alerts/test/{browser => }/browser.toml (100%) rename toolkit/components/alerts/test/{browser => }/browser_bug1682866.js (100%) delete mode 100644 toolkit/components/alerts/test/chrome/empty.html rename toolkit/components/alerts/test/{browser => }/file_bug1682866.html (100%) rename toolkit/components/alerts/test/{chrome => }/image.gif (100%) rename toolkit/components/alerts/test/{chrome => }/image.png (100%) rename toolkit/components/alerts/test/{chrome => }/image_server.sjs (100%) rename toolkit/components/alerts/test/{chrome/chrome.toml => mochitest.toml} (97%) rename toolkit/components/alerts/test/{chrome => }/test_alerts.html (92%) rename toolkit/components/alerts/test/{chrome => }/test_alerts_noobserve.html (93%) rename toolkit/components/alerts/test/{chrome => }/test_alerts_requireinteraction.html (96%) rename toolkit/components/alerts/test/{chrome => }/test_image.html (92%) rename toolkit/components/alerts/test/{chrome => }/test_invalid_utf16.html (96%) rename toolkit/components/alerts/test/{chrome => }/test_multiple_alerts.html (93%) rename toolkit/components/alerts/test/{chrome => }/test_principal.html (88%) diff --git a/toolkit/components/alerts/moz.build b/toolkit/components/alerts/moz.build index 88666682fd6c..b07ce72f0d52 100644 --- a/toolkit/components/alerts/moz.build +++ b/toolkit/components/alerts/moz.build @@ -4,9 +4,9 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -MOCHITEST_CHROME_MANIFESTS += ["test/chrome/chrome.toml"] +MOCHITEST_MANIFESTS += ["test/mochitest.toml"] -BROWSER_CHROME_MANIFESTS += ["test/browser/browser.toml"] +BROWSER_CHROME_MANIFESTS += ["test/browser.toml"] XPIDL_SOURCES += [ "nsIAlertsService.idl", diff --git a/toolkit/components/alerts/test/browser/browser.toml b/toolkit/components/alerts/test/browser.toml similarity index 100% rename from toolkit/components/alerts/test/browser/browser.toml rename to toolkit/components/alerts/test/browser.toml diff --git a/toolkit/components/alerts/test/browser/browser_bug1682866.js b/toolkit/components/alerts/test/browser_bug1682866.js similarity index 100% rename from toolkit/components/alerts/test/browser/browser_bug1682866.js rename to toolkit/components/alerts/test/browser_bug1682866.js diff --git a/toolkit/components/alerts/test/chrome/empty.html b/toolkit/components/alerts/test/chrome/empty.html deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/toolkit/components/alerts/test/browser/file_bug1682866.html b/toolkit/components/alerts/test/file_bug1682866.html similarity index 100% rename from toolkit/components/alerts/test/browser/file_bug1682866.html rename to toolkit/components/alerts/test/file_bug1682866.html diff --git a/toolkit/components/alerts/test/chrome/image.gif b/toolkit/components/alerts/test/image.gif similarity index 100% rename from toolkit/components/alerts/test/chrome/image.gif rename to toolkit/components/alerts/test/image.gif diff --git a/toolkit/components/alerts/test/chrome/image.png b/toolkit/components/alerts/test/image.png similarity index 100% rename from toolkit/components/alerts/test/chrome/image.png rename to toolkit/components/alerts/test/image.png diff --git a/toolkit/components/alerts/test/chrome/image_server.sjs b/toolkit/components/alerts/test/image_server.sjs similarity index 100% rename from toolkit/components/alerts/test/chrome/image_server.sjs rename to toolkit/components/alerts/test/image_server.sjs diff --git a/toolkit/components/alerts/test/chrome/chrome.toml b/toolkit/components/alerts/test/mochitest.toml similarity index 97% rename from toolkit/components/alerts/test/chrome/chrome.toml rename to toolkit/components/alerts/test/mochitest.toml index 995c45787bb1..99cbd1385d0e 100644 --- a/toolkit/components/alerts/test/chrome/chrome.toml +++ b/toolkit/components/alerts/test/mochitest.toml @@ -1,7 +1,6 @@ [DEFAULT] skip-if = ["os == 'android'"] # We don't use XUL alerts on Android support-files = [ - "empty.html", "image.gif", "image.png", "image_server.sjs", diff --git a/toolkit/components/alerts/test/chrome/test_alerts.html b/toolkit/components/alerts/test/test_alerts.html similarity index 92% rename from toolkit/components/alerts/test/chrome/test_alerts.html rename to toolkit/components/alerts/test/test_alerts.html index c3c185330084..9c9371fc7081 100644 --- a/toolkit/components/alerts/test/chrome/test_alerts.html +++ b/toolkit/components/alerts/test/test_alerts.html @@ -4,8 +4,8 @@ Test for Alerts Service - - + + @@ -73,6 +73,7 @@ function runTest() { notifier.showAlertNotification(null, "Notification test", "Surprise! I'm here to test notifications!", false, "foobarcookie", observer, alertName); + ok(true, "showAlertNotification() succeeded. Waiting for notification..."); } catch (ex) { todo(false, "showAlertNotification() failed.", ex); SimpleTest.finish(); diff --git a/toolkit/components/alerts/test/chrome/test_alerts_noobserve.html b/toolkit/components/alerts/test/test_alerts_noobserve.html similarity index 93% rename from toolkit/components/alerts/test/chrome/test_alerts_noobserve.html rename to toolkit/components/alerts/test/test_alerts_noobserve.html index 8be3fb7b0f6d..b6a7658e17a4 100644 --- a/toolkit/components/alerts/test/chrome/test_alerts_noobserve.html +++ b/toolkit/components/alerts/test/test_alerts_noobserve.html @@ -4,8 +4,8 @@ Test for Alerts Service - - + + diff --git a/toolkit/components/alerts/test/chrome/test_alerts_requireinteraction.html b/toolkit/components/alerts/test/test_alerts_requireinteraction.html similarity index 96% rename from toolkit/components/alerts/test/chrome/test_alerts_requireinteraction.html rename to toolkit/components/alerts/test/test_alerts_requireinteraction.html index 172e5f27dc65..dc189920ad5e 100644 --- a/toolkit/components/alerts/test/chrome/test_alerts_requireinteraction.html +++ b/toolkit/components/alerts/test/test_alerts_requireinteraction.html @@ -2,8 +2,8 @@ Test for alerts with requireInteraction - - + +
diff --git a/toolkit/components/alerts/test/chrome/test_image.html b/toolkit/components/alerts/test/test_image.html
similarity index 92%
rename from toolkit/components/alerts/test/chrome/test_image.html
rename to toolkit/components/alerts/test/test_image.html
index b03c48588381..3928529c13d9 100644
--- a/toolkit/components/alerts/test/chrome/test_image.html
+++ b/toolkit/components/alerts/test/test_image.html
@@ -2,8 +2,8 @@
 
 
   Test for Bug 1233086
-  
-  
+  
+  
 
 
 
@@ -16,7 +16,7 @@ const Cc = SpecialPowers.Cc;
 const Ci = SpecialPowers.Ci;
 const Services = SpecialPowers.Services;
 
-const imageServerURL = "http://mochi.test:8888/chrome/toolkit/components/alerts/test/chrome/image_server.sjs";
+const imageServerURL = "http://mochi.test:8888/tests/toolkit/components/alerts/test/image_server.sjs";
 
 function makeAlert(...params) {
   var alert = Cc["@mozilla.org/alert-notification;1"]
diff --git a/toolkit/components/alerts/test/chrome/test_invalid_utf16.html b/toolkit/components/alerts/test/test_invalid_utf16.html
similarity index 96%
rename from toolkit/components/alerts/test/chrome/test_invalid_utf16.html
rename to toolkit/components/alerts/test/test_invalid_utf16.html
index 5fdb9f857379..5d7fa9c0792d 100644
--- a/toolkit/components/alerts/test/chrome/test_invalid_utf16.html
+++ b/toolkit/components/alerts/test/test_invalid_utf16.html
@@ -4,8 +4,8 @@
 
   
   Test for stability when providing invalid UTF-16 strings
-  
-  
+  
+  
   
-  
+  
+  
 
 
 
diff --git a/toolkit/components/alerts/test/chrome/test_principal.html b/toolkit/components/alerts/test/test_principal.html
similarity index 88%
rename from toolkit/components/alerts/test/chrome/test_principal.html
rename to toolkit/components/alerts/test/test_principal.html
index 29c6a6c2dc37..7b0795d3f8ea 100644
--- a/toolkit/components/alerts/test/chrome/test_principal.html
+++ b/toolkit/components/alerts/test/test_principal.html
@@ -2,12 +2,11 @@
 
 
   Test for Bug 1202933
-  
-  
+  
+  
 
 
 
-
 

@@ -78,12 +77,7 @@ async function testNullPrincipal() {
 }
 
 async function testNodePrincipal() {
-  const { iframe } = document.all;
-  if (iframe.contentDocument.readyState !== "complete") {
-    await new Promise(r => iframe.onload = r);
-  }
-
-  var principal = iframe.contentDocument.nodePrincipal;
+  var principal = SpecialPowers.wrap(document).nodePrincipal;
   var source = await notify("nodePrincipal", principal);
 
   var stringBundle = Services.strings.createBundle(
diff --git a/widget/windows/ToastNotificationHandler.cpp b/widget/windows/ToastNotificationHandler.cpp
index 5181a7c500f4..6569c901ecfb 100644
--- a/widget/windows/ToastNotificationHandler.cpp
+++ b/widget/windows/ToastNotificationHandler.cpp
@@ -625,20 +625,10 @@ ComPtr ToastNotificationHandler::CreateToastXmlDocument() {
     nsString title;
     ns = action->GetTitle(title);
     NS_ENSURE_SUCCESS(ns, nullptr);
-    if (!EnsureUTF16Validity(title)) {
-      MOZ_LOG(sWASLog, LogLevel::Warning,
-              ("Notification text was invalid UTF16, unpaired surrogates have "
-               "been replaced."));
-    }
 
     nsString actionString;
     ns = action->GetAction(actionString);
     NS_ENSURE_SUCCESS(ns, nullptr);
-    if (!EnsureUTF16Validity(actionString)) {
-      MOZ_LOG(sWASLog, LogLevel::Warning,
-              ("Notification text was invalid UTF16, unpaired surrogates have "
-               "been replaced."));
-    }
 
     nsString opaqueRelaunchData;
     ns = action->GetOpaqueRelaunchData(opaqueRelaunchData);