зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1066450 - Fix regression of web audio tools not reinitializing after navigation. r=vp
This commit is contained in:
Родитель
24f7a396e3
Коммит
2ff4c3a1bc
|
@ -31,6 +31,7 @@ support-files =
|
|||
[browser_wa_reset-02.js]
|
||||
[browser_wa_reset-03.js]
|
||||
[browser_wa_reset-04.js]
|
||||
[browser_wa_navigate.js]
|
||||
|
||||
[browser_wa_graph-click.js]
|
||||
[browser_wa_graph-markers.js]
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Tests naviating from a page to another will repopulate
|
||||
* the audio graph if both pages have an AudioContext.
|
||||
*/
|
||||
|
||||
function spawnTest() {
|
||||
let [target, debuggee, panel] = yield initWebAudioEditor(SIMPLE_CONTEXT_URL);
|
||||
let { panelWin } = panel;
|
||||
let { gFront, $ } = panelWin;
|
||||
|
||||
reload(target);
|
||||
|
||||
var [actors] = yield Promise.all([
|
||||
get3(gFront, "create-node"),
|
||||
waitForGraphRendered(panelWin, 3, 2)
|
||||
]);
|
||||
|
||||
var { nodes, edges } = countGraphObjects(panelWin);
|
||||
ise(nodes, 3, "should only be 3 nodes.");
|
||||
ise(edges, 2, "should only be 2 edges.");
|
||||
|
||||
navigate(target, SIMPLE_NODES_URL);
|
||||
|
||||
var [actors] = yield Promise.all([
|
||||
getN(gFront, "create-node", 14),
|
||||
waitForGraphRendered(panelWin, 14, 0)
|
||||
]);
|
||||
|
||||
is($("#reload-notice").hidden, true,
|
||||
"The 'reload this page' notice should be hidden after context found after navigation.");
|
||||
is($("#waiting-notice").hidden, true,
|
||||
"The 'waiting for an audio context' notice should be hidden after context found after navigation.");
|
||||
is($("#content").hidden, false,
|
||||
"The tool's content should reappear without closing and reopening the toolbox.");
|
||||
|
||||
var { nodes, edges } = countGraphObjects(panelWin);
|
||||
ise(nodes, 14, "after navigation, should have 14 nodes");
|
||||
ise(edges, 0, "after navigation, should have 0 edges.");
|
||||
|
||||
yield teardown(panel);
|
||||
finish();
|
||||
}
|
|
@ -114,6 +114,11 @@ function reload(aTarget, aWaitForTargetEvent = "navigate") {
|
|||
return once(aTarget, aWaitForTargetEvent);
|
||||
}
|
||||
|
||||
function navigate(aTarget, aUrl, aWaitForTargetEvent = "navigate") {
|
||||
executeSoon(() => aTarget.activeTab.navigateTo(aUrl));
|
||||
return once(aTarget, aWaitForTargetEvent);
|
||||
}
|
||||
|
||||
function test () {
|
||||
Task.spawn(spawnTest).then(finish, handleError);
|
||||
}
|
||||
|
|
|
@ -284,6 +284,7 @@ let WebAudioActor = exports.WebAudioActor = protocol.ActorClass({
|
|||
|
||||
this._onDestroyNode = this._onDestroyNode.bind(this);
|
||||
this._onGlobalDestroyed = this._onGlobalDestroyed.bind(this);
|
||||
this._onGlobalCreated = this._onGlobalCreated.bind(this);
|
||||
},
|
||||
|
||||
destroy: function(conn) {
|
||||
|
@ -322,6 +323,9 @@ let WebAudioActor = exports.WebAudioActor = protocol.ActorClass({
|
|||
holdWeak: true,
|
||||
storeCalls: false
|
||||
});
|
||||
// Bind to `window-ready` so we can reenable recording on the
|
||||
// call watcher
|
||||
on(this.tabActor, "window-ready", this._onGlobalCreated);
|
||||
// Bind to the `window-destroyed` event so we can unbind events between
|
||||
// the global destruction and the `finalize` cleanup method on the actor.
|
||||
on(this.tabActor, "window-destroyed", this._onGlobalDestroyed);
|
||||
|
@ -395,6 +399,7 @@ let WebAudioActor = exports.WebAudioActor = protocol.ActorClass({
|
|||
this.tabActor = null;
|
||||
this._initialized = false;
|
||||
off(this.tabActor, "window-destroyed", this._onGlobalDestroyed);
|
||||
off(this.tabActor, "window-ready", this._onGlobalCreated);
|
||||
this._nativeToActorID = null;
|
||||
this._callWatcher.eraseRecording();
|
||||
this._callWatcher.finalize();
|
||||
|
@ -569,6 +574,14 @@ let WebAudioActor = exports.WebAudioActor = protocol.ActorClass({
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Ensures that the new global has recording on
|
||||
* so we can proxy the function calls.
|
||||
*/
|
||||
_onGlobalCreated: function () {
|
||||
this._callWatcher.resumeRecording();
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when the underlying ContentObserver fires `global-destroyed`
|
||||
* so we can cleanup some things between the global being destroyed and
|
||||
|
|
Загрузка…
Ссылка в новой задаче