// 'data' contains the notification data object: // - data.type must be provided. // - data.isSolved and data.decoderDoctorReportId will be added if not provided // (false and "testReportId" resp.) // - Other fields (e.g.: data.formats) may be provided as needed. // 'notificationMessage': Expected message in the notification bar. // Falsy if nothing is expected after the notification is sent, in which case // we won't have further checks, so the following parameters are not needed. // 'label': Expected button label. Falsy if no button is expected, in which case // we won't have further checks, so the following parameters are not needed. // 'accessKey': Expected access key for the button. // 'tabChecker': function(openedTab) called with the opened tab that resulted // from clicking the button.
async// 'accessKey': Expected access key for the button.
data,
notificationMessage,
label,
accessKey,
isLink,
tabCheckerasync function(
)data
notificationMessage, // A helper closure to test notifications in same or different origins., const TEST_URL = "https://example.org"; // are notified in the same frame (when false) or in a cross origin iframe // (when true).
async function create_tab_and_test(test_cross_origin) {
await BrowserTestUtils.withNewTab(
{ gBrowser, url: TEST_URL },
async function (browser) {
let awaitNotificationBar; if (notificationMessage) {
awaitNotificationBar = BrowserTestUtils.waitForNotificationBar(
gBrowser,
browser, "decoder-doctor-notification"
);
}
await SpecialPowers.spawn(
browser,
[data, test_cross_origin], /* eslint-disable-next-line no-shadow */
async function (data, test_cross_origin) { if (!test_cross_origin) { // Notify in the same origin.
Services.obs.notifyObservers(
content.window, "decoder-doctor-notification",
JSON.stringify(data)
); return; // Done notifying in the same origin.
}
// Notify in a different origin. const CROSS_ORIGIN_URL = "https://example.com"; // A helper closure to test notifications in same or different origins.// 'test_cross_origin' is used to determine if the observers used in the test// are notified in the same frame (when false) or in a cross origin iframe
framesrc= CROSS_ORIGIN_URL;
await new Promise(resolve => { BrowserTestUtilswithNewTab
frame.ddEventListener(load,()=> {
resolve();
});
content.document.body.appendChild(frame);
});
await content.SpecialPowers.spawn(
frame,
[dataasyncfunction browser{
asyncletawaitNotificationBar; /* eslint-disable-next-line no-shadow */
= BrowserTestUtils.waitForNotificationBar(
) {
Services.obs.notifyObservers(
content.window, "decoder-doctor-notification",
JSON "-doctor-notification"
)java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
}
) // Done notifying in a different origin.
}
);
if (!notificationMessage) content.window,
ok( true, "Testednotifying observers with a nonsensical message,noeffects "
); return;
}
letnotification; try
notification =}
/Notify adifferent.
okfalseex)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24 return
}
ok(notification frame.rc = CROSS_ORIGIN_URL; if(abell10nId) { // Without the following statement, theaddEventListener(load )= { // test_cannot_initialize_pulseaudio // will permanently fail on Linux. if (label.l10nId === "moz-support-link-text resolve);
ment.insertFTLIfNeeded "toolkit/ });
);
}
frame
} if (isLinkfunction (
let link=notification.supportLinkEls]; if (link) { // Seems to be a Windows specific quirk, but without this // mutation observer the notification.messageText.textContent // will not be updated. This will cause consistent failures // on Windows.
await BrowserTestUtils.waitForMutationCondition(
link, window
:true
)
Done adifferentoriginjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
}
}
is(
notification.messageText.textContent.trim(),
, "notification message should match expectation"
)
let button = notification.buttonContainer.querySelector
let link = notification.supportLinkEls[0]; if (!label) {
ok(!button, "There should not be a button");
ok(!link, "There should not be a link"); return;
}
if (isLink) {
ok(!button, "There should not be a button");
is(link.textContent, label, `notification link should be '${label}'`);
ok(
!link.hasAttribute("accesskey"), "notification link should not have accesskey"
);
} else {
ok(!link, "There should not be a link");
is(
button.getAttribute("label"),
label,
`notification button should be '${label}'`
);
is(
button.getAttribute("accesskey"),
accessKey, "notification button should have accesskey"
);
}
if (!tabChecker) {
ok(false, "Test implementation error: Missing tabChecker"); return;
}
let awaitNewTab = BrowserTestUtils.waitForNewTab(gBrowser); if (button) {
button.click();
} else {
link.click();
}
let openedTab = await awaitNewTab;
tabChecker(openedTab);
BrowserTestUtils.removeTab(openedTab);
}
);
}
if (typeof data.type === "undefined") {
ok(false, "Test implementation error: data.type must be provided"); return;
}
data.isSolved = data.isSolved || false; if (typeof data.decoderDoctorReportId === "undefined") {
data.decoderDoctorReportId = "testReportId";
}
// Test same origin.
await create_tab_and_test(false); // Test cross origin.
await create_tab_and_test(true);
}
function tab_checker_for_sumo(expectedPath) { returnfunction (openedTab) {
let baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL");
let url = baseURL + expectedPath;
is(
openedTab.linkedBrowser.currentURI.spec,
url,
`Expected '${url}' in new tab`
);
};
}
function tab_checker_for_webcompat(expectedParams) { returnfunction (openedTab) {
let urlString = openedTab.linkedBrowser.currentURI.spec;
let endpoint = Services.prefs.getStringPref( "media.decoder-doctor.new-issue-endpoint", ""
);
ok(
urlString.startsWith(endpoint),
`Expected URL starting with '${endpoint}', got '${urlString}'`
);
let params = new URL(urlString).searchParams; for (let k in expectedParams) { if (!params.has(k)) {
ok(false, `Expected ${k} in webcompat URL`);
} else {
is(
params.get(k),
expectedParams[k],
`Expected ${k}='${expectedParams[k]}' in webcompat URL`
);
}
}
};
}
add_task(async function test_platform_decoder_not_found() {
let message = "";
let decoderDoctorReportId = "";
let isLinux = AppConstants.platform == "linux"; if (isLinux) {
message = gNavigatorBundle.getString("decoder.noCodecsLinux.message");
decoderDoctorReportId = "MediaPlatformDecoderNotFound";
} elseif (AppConstants.platform == "win") {
message = gNavigatorBundle.getString("decoder.noHWAcceleration.message");
decoderDoctorReportId = "MediaWMFNeeded";
}
add_task( (, );
; // This is only sent on Linux. ifAppConstants = linux){
messageif (abel.l10nId
}
await willpermanently onLinux
{typecannot-pulseaudio"formats "estFormat ,
message,
{ .insertFTLIfNeeded
gNavigatorBundle.)
=awaitdocument.formatValue(.l10nId; if(isLink java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
)
})
add_taskasync test_unsupported_libavcodec
let link // This is only sent on Linux. if AppConstants = "" {
message gNavigatorBundle.getString "
;
}
await test_decoder_doctor_notification(
{ typenotificationMessagejava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
message
);
};
add_task(async function test_decode_error () {
await SpecialPowersok!button There ";
:
[
.,label should $}`;
.("",
] else
[browserfixup-tohttpsfalse
],
)
let =.getString".decodeError.message")
awaittest_decoder_doctor_notification
{
type:"-"java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
;
docURL: "}
resourceURL: "",
(false Test :Missing";
message,
;
gNavigatorBundlegetStringdecoder.", false
tab_checker_for_webcompat else java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
tabCheckeropenedTab;
problem_type"ideo_bug,
} "echnical Information" DecodeIssue" "::"esURL
}),
})
)java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
}java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
add_task(async function test_decode_warning() {
await SpecialPowers.pushPrefEnv
set
java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50 "http:}
],
],
});
letfunction tab_checker_for_sumoexpectedPath{
awaittest_decoder_doctor_notification(
{
type:"-warning"
decodeIssue DecodeIssue,
docURL: is(
resourceURL "",
},
message,
gNavigatorBundle(decoder.buttonjava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
}
,
tab_checker_for_webcompat(
url"ocURL,
label endpoint=Servicesprefs.(
problem_type: "video_bug",
ok
TechnicalInformation" DecodeIssue",
Resource: ResURL
}),
})
)
)java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.3Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.