mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1912074 - Add more validity checks r=nalexander,nrishel,win-reviewers,gstoll
Differential Revision: https://phabricator.services.mozilla.com/D218776
This commit is contained in:
parent
4f279e4694
commit
369450f48c
@ -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_MANIFESTS += ["test/mochitest.toml"]
|
||||
MOCHITEST_CHROME_MANIFESTS += ["test/chrome/chrome.toml"]
|
||||
|
||||
BROWSER_CHROME_MANIFESTS += ["test/browser.toml"]
|
||||
BROWSER_CHROME_MANIFESTS += ["test/browser/browser.toml"]
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
"nsIAlertsService.idl",
|
||||
|
@ -1,6 +1,7 @@
|
||||
[DEFAULT]
|
||||
skip-if = ["os == 'android'"] # We don't use XUL alerts on Android
|
||||
support-files = [
|
||||
"empty.html",
|
||||
"image.gif",
|
||||
"image.png",
|
||||
"image_server.sjs",
|
0
toolkit/components/alerts/test/chrome/empty.html
Normal file
0
toolkit/components/alerts/test/chrome/empty.html
Normal file
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
@ -4,8 +4,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Alerts Service</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -73,7 +73,6 @@ 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();
|
@ -4,8 +4,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Alerts Service</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -74,6 +74,7 @@ async function runTest() {
|
||||
try {
|
||||
notifier.showAlertNotification(null, "Notification test",
|
||||
"This notification has no observer");
|
||||
notifier.closeAlert();
|
||||
ok(true, "showAlertNotification() succeeded");
|
||||
} catch (ex) {
|
||||
todo(false, "showAlertNotification() failed.", ex);
|
@ -2,8 +2,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for alerts with requireInteraction</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
@ -2,8 +2,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 1233086</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -16,7 +16,7 @@ const Cc = SpecialPowers.Cc;
|
||||
const Ci = SpecialPowers.Ci;
|
||||
const Services = SpecialPowers.Services;
|
||||
|
||||
const imageServerURL = "http://mochi.test:8888/tests/toolkit/components/alerts/test/image_server.sjs";
|
||||
const imageServerURL = "http://mochi.test:8888/chrome/toolkit/components/alerts/test/chrome/image_server.sjs";
|
||||
|
||||
function makeAlert(...params) {
|
||||
var alert = Cc["@mozilla.org/alert-notification;1"]
|
@ -4,8 +4,8 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for stability when providing invalid UTF-16 strings</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
<script>
|
||||
const Cc = SpecialPowers.Cc;
|
||||
const Ci = SpecialPowers.Ci;
|
@ -2,8 +2,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for multiple alerts</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
@ -85,12 +85,15 @@ add_task(async function test_multiple_alerts() {
|
||||
var firstAlertPosition = await promiseAlertPosition(alertService);
|
||||
if (!firstAlertPosition) {
|
||||
ok(true, "Platform does not use XUL alerts.");
|
||||
alertService.closeAlert();
|
||||
return;
|
||||
}
|
||||
|
||||
var secondAlertPosition = await promiseAlertPosition(alertService);
|
||||
is(secondAlertPosition.x, firstAlertPosition.x, "Second alert should be opened in the same position.");
|
||||
is(secondAlertPosition.y, firstAlertPosition.y, "Second alert should be opened in the same position.");
|
||||
|
||||
alertService.closeAlert();
|
||||
});
|
||||
|
||||
</script>
|
@ -2,11 +2,12 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 1202933</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<iframe id="iframe" src="http://mochi.test:8888/chrome/toolkit/components/alerts/test/chrome/empty.html"></iframe>
|
||||
<p id="display"></p>
|
||||
|
||||
<pre id="test">
|
||||
@ -77,7 +78,12 @@ async function testNullPrincipal() {
|
||||
}
|
||||
|
||||
async function testNodePrincipal() {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
const { iframe } = document.all;
|
||||
if (iframe.contentDocument.readyState !== "complete") {
|
||||
await new Promise(r => iframe.onload = r);
|
||||
}
|
||||
|
||||
var principal = iframe.contentDocument.nodePrincipal;
|
||||
var source = await notify("nodePrincipal", principal);
|
||||
|
||||
var stringBundle = Services.strings.createBundle(
|
@ -625,10 +625,20 @@ ComPtr<IXmlDocument> 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);
|
||||
|
Loading…
Reference in New Issue
Block a user