Skip to content

Commit

Permalink
merge autoland to mozilla-central. r=merge a=merge
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 2Uy29fNzn62
  • Loading branch information
Archaeopteryx committed Sep 10, 2017
2 parents 00fa5da + 0714f62 commit dcf34ac
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions browser/modules/PageActions.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ this.PageActions = {
this._persistedActions.idsInUrlbar.includes(action.id);
} else {
// The action is new. Store it in the persisted actions.
this._persistedActions.ids.push(action.id);
this._updateIDsInUrlbarForAction(action);
}
},
Expand Down
29 changes: 29 additions & 0 deletions browser/modules/test/browser/browser_PageActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ add_task(async function simple() {
Assert.deepEqual(PageActions.actionForID(action.id), action,
"actionForID should be action");

Assert.ok(PageActions._persistedActions.ids.includes(action.id),
"PageActions should record action in its list of seen actions");

// The action's panel button should have been created.
let panelButtonNode = document.getElementById(panelButtonID);
Assert.notEqual(panelButtonNode, null, "panelButtonNode");
Expand Down Expand Up @@ -179,6 +182,29 @@ add_task(async function simple() {
Assert.equal(action.title, newTitle, "New title");
Assert.equal(panelButtonNode.getAttribute("label"), action.title, "New label");

// Now that shownInUrlbar has been toggled, make sure that it sticks across
// app restarts. Simulate that by "unregistering" the action (not by removing
// it, which is more permanent) and then registering it again.

// unregister
PageActions._actionsByID.delete(action.id);
let index = PageActions._nonBuiltInActions.findIndex(a => a.id == action.id);
Assert.ok(index >= 0, "Action should be in _nonBuiltInActions to begin with");
PageActions._nonBuiltInActions.splice(index, 1);

// register again
PageActions._registerAction(action);

// check relevant properties
Assert.ok(PageActions._persistedActions.ids.includes(action.id),
"PageActions should have 'seen' the action");
Assert.ok(PageActions._persistedActions.idsInUrlbar.includes(action.id),
"idsInUrlbar should still include the action");
Assert.ok(action.shownInUrlbar,
"shownInUrlbar should still be true");
Assert.ok(action._shownInUrlbar,
"_shownInUrlbar should still be true, for good measure");

// Remove the action.
action.remove();
panelButtonNode = document.getElementById(panelButtonID);
Expand All @@ -191,6 +217,9 @@ add_task(async function simple() {
Assert.equal(PageActions.actionForID(action.id), null,
"actionForID should be null");

Assert.ok(!PageActions._persistedActions.ids.includes(action.id),
"PageActions should remove action from its list of seen actions");

// The separator between the built-in actions and non-built-in actions should
// be gone now, too.
let separatorNode = document.getElementById(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ public class testSessionOOMSave extends SessionTest {
protected void setUp() throws Exception {
super.setUp();

// Having the Activity Stream home panel active during this test seems to cause relatively
// frequent intermittent crashes, so for now, we avoid loading it by setting a different
// default panel for this test (bug 1396324).
// TODO: Remove the workaround once crashes have been fixed (bug 1398532).
final HomeConfig homeConfig = HomeConfig.getDefault(getInstrumentation().getTargetContext());
final HomeConfig.State state = homeConfig.load();
mEditor = state.edit();
Expand Down

0 comments on commit dcf34ac

Please sign in to comment.