Issue #2653 - Part 2: Update tests

This commit is contained in:
Moonchild 2024-11-17 21:37:56 +01:00 committed by roytam1
commit 0e6fa95840
13 changed files with 2 additions and 531 deletions

View file

@ -8,27 +8,6 @@
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
// We'll need to get the appId from the current document,
// it's either SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID when
// we are not running inside an app (e.g. Firefox Desktop),
// or the appId of Mochitest app when we are running inside that app
// (e.g. Emulator).
var currentAppId = SpecialPowers.wrap(document).nodePrincipal.appId;
var inApp =
currentAppId !== SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID;
// We will also need the manifest URL and set it on iframes.
var currentAppManifestURL;
if (inApp) {
let appsService = SpecialPowers.Cc["@mozilla.org/AppsService;1"]
.getService(SpecialPowers.Ci.nsIAppsService);
currentAppManifestURL = appsService.getManifestURLByLocalId(currentAppId);
};
info('appId=' + currentAppId);
info('manifestURL=' + currentAppManifestURL);
function setup() {
let appInfo = SpecialPowers.Cc['@mozilla.org/xre/app-info;1']
.getService(SpecialPowers.Ci.nsIXULAppInfo);
@ -73,9 +52,6 @@ function createFrames() {
for (let i = 0; i < 2; i++) {
let frame = gInputMethodFrames[i] = document.createElement('iframe');
frame.setAttribute('mozbrowser', 'true');
if (currentAppManifestURL) {
frame.setAttribute('mozapp', currentAppManifestURL);
}
frame.addEventListener('mozbrowserloadend', countLoadend);
frame.src = 'file_empty.html#' + i;
document.body.appendChild(frame);
@ -88,20 +64,10 @@ function setPermissions() {
allow: true,
context: {
url: SimpleTest.getTestFileURL('/file_empty.html'),
originAttributes: {
appId: currentAppId,
inIsolatedMozBrowser: true
}
originAttributes: {}
}
}];
if (inApp) {
// The current document would also need to be given access for IPC to
// recognize our permission (why)?
permissions.push({
type: 'input', allow: true, context: document });
}
SpecialPowers.pushPermissions(permissions,
SimpleTest.waitForFocus.bind(SimpleTest, startTest));
}