mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 05:39:41 +02:00
These tests were using chrome mochitest which forces the test page to be running in chrome and in parent process. This doesn't reflect typical setup where the page runs unprivileged in content process. Also, with the current bug, the pages running in system principal will be debugged with a special setup. Actors will be run with modules loaded in a distinct loader in order to be executed in a distinct compartment, distinct from the shared system principal compartment. That a prerequisite for the Debugger API. It has to run in a distinct compartment than its debuggee. Depends on D16825 Differential Revision: https://phabricator.services.mozilla.com/D16826 --HG-- rename : devtools/server/tests/mochitest/animation-data.html => devtools/server/tests/browser/animation-data.html rename : devtools/server/tests/mochitest/test_inspector-mutations-childlist.html => devtools/server/tests/browser/browser_inspector-mutations-childlist.js rename : devtools/server/tests/mochitest/inspector-helpers.js => devtools/server/tests/browser/inspector-helpers.js extra : moz-landing-system : lando
65 lines
2.5 KiB
JavaScript
65 lines
2.5 KiB
JavaScript
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
"use strict";
|
|
|
|
// Test for Bug 1247243
|
|
|
|
add_task(async function setup() {
|
|
info("Setting up inspector and animation actors.");
|
|
const { animations, walker } =
|
|
await initAnimationsFrontForUrl(MAIN_DOMAIN + "animation-data.html");
|
|
|
|
info("Testing animated node actor");
|
|
const animatedNodeActor = await walker.querySelector(walker.rootNode,
|
|
".animated");
|
|
await animations.getAnimationPlayersForNode(animatedNodeActor);
|
|
|
|
await assertNumberOfAnimationActors(1, "AnimationActor have 1 AnimationPlayerActors");
|
|
|
|
info("Testing AnimationPlayerActors release");
|
|
const stillNodeActor = await walker.querySelector(walker.rootNode,
|
|
".still");
|
|
await animations.getAnimationPlayersForNode(stillNodeActor);
|
|
await assertNumberOfAnimationActors(0,
|
|
"AnimationActor does not have any AnimationPlayerActors anymore");
|
|
|
|
info("Testing multi animated node actor");
|
|
const multiNodeActor = await walker.querySelector(walker.rootNode,
|
|
".multi");
|
|
await animations.getAnimationPlayersForNode(multiNodeActor);
|
|
await assertNumberOfAnimationActors(2,
|
|
"AnimationActor has now 2 AnimationPlayerActors");
|
|
|
|
info("Testing single animated node actor");
|
|
await animations.getAnimationPlayersForNode(animatedNodeActor);
|
|
await assertNumberOfAnimationActors(1,
|
|
"AnimationActor has only one AnimationPlayerActors");
|
|
|
|
info("Testing AnimationPlayerActors release again");
|
|
await animations.getAnimationPlayersForNode(stillNodeActor);
|
|
await assertNumberOfAnimationActors(0,
|
|
"AnimationActor does not have any AnimationPlayerActors anymore");
|
|
|
|
async function assertNumberOfAnimationActors(expected, message) {
|
|
const actors = await ContentTask.spawn(
|
|
gBrowser.selectedBrowser,
|
|
[animations.actorID],
|
|
function(actorID) {
|
|
const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm");
|
|
const { DebuggerServer } = require("devtools/server/main");
|
|
// Convert actorID to current compartment string otherwise
|
|
// searchAllConnectionsForActor is confused and won't find the actor.
|
|
actorID = String(actorID);
|
|
const animationActors = DebuggerServer
|
|
.searchAllConnectionsForActor(actorID);
|
|
if (!animationActors) {
|
|
return 0;
|
|
}
|
|
return animationActors.actors.length;
|
|
}
|
|
);
|
|
is(actors, expected, message);
|
|
}
|
|
});
|