Skip to content
This repository has been archived by the owner on Feb 13, 2021. It is now read-only.

Commit

Permalink
Merge autoland to mozilla-central. a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihai Alexandru Michis committed Sep 10, 2019
2 parents 0f89254 + 081827e commit 0ef6713
Show file tree
Hide file tree
Showing 30 changed files with 626 additions and 569 deletions.
1 change: 1 addition & 0 deletions browser/components/aboutlogins/content/aboutLogins.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ <h2 class="title">
<div class="reveal-password-wrapper">
<input type="password"
name="password"
autocomplete="off"
dir="ltr"
required
readonly/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
}

.fxaccount-email {
font-weight: 600;
font-size: .9em;
vertical-align: middle;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ input[type="url"][readOnly]:hover:active {
display: block;
font-size: smaller;
color: var(--in-content-deemphasized-text);
margin-bottom: 5px;
margin-bottom: 8px;
}

:host([data-editing]) .detail-cell input:not([readOnly]):not([type="checkbox"]) {
Expand Down
23 changes: 20 additions & 3 deletions browser/components/aboutlogins/content/components/login-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ export default class LoginItem extends HTMLElement {
this._title.textContent = this._login.title;
this._originInput.defaultValue = this._login.origin || "";
this._usernameInput.defaultValue = this._login.username || "";
this._passwordInput.defaultValue = this._login.password || "";
// The password gets filled in _updatePasswordRevealState

if (this.dataset.editing) {
this._usernameInput.removeAttribute("data-l10n-id");
this._usernameInput.placeholder = "";
Expand Down Expand Up @@ -246,7 +247,8 @@ export default class LoginItem extends HTMLElement {
case "click": {
let classList = event.currentTarget.classList;
if (classList.contains("reveal-password-checkbox")) {
if (this._revealCheckbox.checked) {
// We prompt for the master password when entering edit mode already.
if (this._revealCheckbox.checked && !this.dataset.editing) {
let masterPasswordAuth = await new Promise(resolve => {
window.AboutLoginsUtils.promptForMasterPassword(resolve);
});
Expand Down Expand Up @@ -344,6 +346,13 @@ export default class LoginItem extends HTMLElement {
return;
}
if (classList.contains("edit-button")) {
let masterPasswordAuth = await new Promise(resolve => {
window.AboutLoginsUtils.promptForMasterPassword(resolve);
});
if (!masterPasswordAuth) {
return;
}

this._toggleEditing();
this.render();

Expand Down Expand Up @@ -680,7 +689,15 @@ export default class LoginItem extends HTMLElement {

let { checked } = this._revealCheckbox;
let inputType = checked ? "text" : "password";
this._passwordInput.setAttribute("type", inputType);
this._passwordInput.type = inputType;
// Don't include the password value in the attribute when it's supposed to be
// masked so that it's not trivial to bypass the Master Password prompt with
// the inspector in devtools.
let password = this._login.password || "";
// We prompt for the master password before entering edit mode so we can use
// the password in the markup then.
this._passwordInput.defaultValue =
checked || this.dataset.editing ? password : " ".repeat(password.length);
}
}
customElements.define("login-item", LoginItem);
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ add_task(async function test_telemetry_events() {

let promiseNewTab = BrowserTestUtils.waitForNewTab(
gBrowser,
TEST_LOGIN2.origin
TEST_LOGIN2.origin + "/"
);
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
let loginItem = content.document.querySelector("login-item");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ add_task(async function setup() {
add_task(async function test_launch_login_item() {
let promiseNewTab = BrowserTestUtils.waitForNewTab(
gBrowser,
TEST_LOGIN1.origin
TEST_LOGIN1.origin + "/"
);

let browser = gBrowser.selectedBrowser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ add_task(async function test_login_item() {

async function test_discard_dialog(exitPoint) {
editButton.click();
await ContentTaskUtils.waitForCondition(
() => loginItem.dataset.editing,
"Entering edit mode"
);
await Promise.resolve();

usernameInput.value += "-undome";
Expand Down Expand Up @@ -102,7 +106,7 @@ add_task(async function test_login_item() {
);
is(
passwordInput.value,
login.password,
" ".repeat(login.password.length),
"Password change should be reverted"
);
is(
Expand All @@ -118,6 +122,10 @@ add_task(async function test_login_item() {
await test_discard_dialog(cancelButton);

editButton.click();
await ContentTaskUtils.waitForCondition(
() => loginItem.dataset.editing,
"Entering edit mode"
);
await Promise.resolve();

let revealCheckbox = loginItem.shadowRoot.querySelector(
Expand All @@ -132,6 +140,8 @@ add_task(async function test_login_item() {
usernameInput.value += "-saveme";
passwordInput.value += "-saveme";

// Cache the value since it will change upon leaving edit mode.
let passwordInputValue = passwordInput.value;
ok(loginItem.dataset.editing, "LoginItem should be in 'edit' mode");

let saveChangesButton = loginItem.shadowRoot.querySelector(
Expand All @@ -145,7 +155,7 @@ add_task(async function test_login_item() {
return (
updatedLogin &&
updatedLogin.username == usernameInput.value &&
updatedLogin.password == passwordInput.value
updatedLogin.password == passwordInputValue
);
}, "Waiting for corresponding login in login list to update");

Expand All @@ -164,6 +174,10 @@ add_task(async function test_login_item() {
);

editButton.click();
await ContentTaskUtils.waitForCondition(
() => loginItem.dataset.editing,
"Entering edit mode"
);
await Promise.resolve();

ok(loginItem.dataset.editing, "LoginItem should be in 'edit' mode");
Expand Down
12 changes: 6 additions & 6 deletions browser/components/aboutlogins/tests/browser/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ let nsLoginInfo = new Components.Constructor(
);

let TEST_LOGIN1 = new nsLoginInfo(
"https://example.com/",
"https://example.com/",
"https://example.com",
"https://example.com",
null,
"user1",
"pass1",
"username",
"password"
);
let TEST_LOGIN2 = new nsLoginInfo(
"https://2.example.com/",
"https://2.example.com/",
"https://2.example.com",
"https://2.example.com",
null,
"user2",
"pass2",
Expand All @@ -27,8 +27,8 @@ let TEST_LOGIN2 = new nsLoginInfo(
);

let TEST_LOGIN3 = new nsLoginInfo(
"https://breached.com/",
"https://breached.com/",
"https://breached.com",
"https://breached.com",
null,
"breachedLogin1",
"pass3",
Expand Down
13 changes: 9 additions & 4 deletions browser/components/aboutlogins/tests/chrome/test_login_item.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
let usernameInput = gLoginItem.shadowRoot.querySelector("input[name='username']");
is(usernameInput.value, TEST_LOGIN_1.username, "username should be populated");
is(document.l10n.getAttributes(usernameInput).id, "about-logins-login-item-username", "username field should have default placeholder when not editing");
is(gLoginItem.shadowRoot.querySelector("input[name='password']").value, TEST_LOGIN_1.password, "password should be populated");
is(gLoginItem.shadowRoot.querySelector("input[name='password']").value.length, TEST_LOGIN_1.password.length, "password mask text should be populated");
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-created")).args.timeCreated, TEST_LOGIN_1.timeCreated, "time-created should be populated");
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-changed")).args.timeChanged, TEST_LOGIN_1.timePasswordChanged, "time-changed should be populated");
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-used")).args.timeUsed, TEST_LOGIN_1.timeLastUsed, "time-used should be populated");
Expand Down Expand Up @@ -126,6 +126,7 @@

usernameInput.placeholder = "dummy placeholder";
gLoginItem.shadowRoot.querySelector(".edit-button").click();
await asyncElementRendered();
is(
document.l10n.getAttributes(usernameInput).id,
null,
Expand Down Expand Up @@ -160,6 +161,7 @@
usernameInput.placeholder = "dummy placeholder";
gLoginItem.shadowRoot.querySelector(".edit-button").click();
await asyncElementRendered();
await asyncElementRendered();

ok(gLoginItem.dataset.editing, "loginItem should be in 'edit' mode");
ok(isHidden(gLoginItem.shadowRoot.querySelector(".edit-button")), "edit button should be hidden in 'edit' mode");
Expand Down Expand Up @@ -199,6 +201,7 @@
add_task(async function test_edit_login_cancel() {
gLoginItem.setLogin(TEST_LOGIN_1);
gLoginItem.shadowRoot.querySelector(".edit-button").click();
await asyncElementRendered();

ok(gLoginItem.dataset.editing, "loginItem should be in 'edit' mode");
is(!!gLoginItem.dataset.isNewLogin, false,
Expand Down Expand Up @@ -231,6 +234,8 @@

let editButton = gLoginItem.shadowRoot.querySelector(".edit-button");
editButton.click();
await asyncElementRendered();

ok(revealCheckbox.checked, "reveal-checkbox should remain checked when entering 'edit' mode");
gLoginItem.shadowRoot.querySelector(".cancel-button").click();
ok(!revealCheckbox.checked, "reveal-checkbox should be unchecked after canceling 'edit' mode");
Expand Down Expand Up @@ -307,7 +312,7 @@

is(gLoginItem.shadowRoot.querySelector("input[name='origin']").value, TEST_LOGIN_1.origin, "origin should be unchanged");
is(gLoginItem.shadowRoot.querySelector("input[name='username']").value, TEST_LOGIN_1.username, "username should be unchanged");
is(gLoginItem.shadowRoot.querySelector("input[name='password']").value, TEST_LOGIN_1.password, "password should be unchanged");
is(gLoginItem.shadowRoot.querySelector("input[name='password']").value, " ".repeat(TEST_LOGIN_1.password.length), "password length should be unchanged");
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-created")).args.timeCreated, TEST_LOGIN_1.timeCreated, "time-created should be unchanged");
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-changed")).args.timeChanged, TEST_LOGIN_1.timePasswordChanged, "time-changed should be unchanged");
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-used")).args.timeUsed, TEST_LOGIN_1.timeLastUsed, "time-used should be unchanged");
Expand All @@ -321,7 +326,7 @@

is(gLoginItem.shadowRoot.querySelector("input[name='origin']").value, TEST_LOGIN_1.origin, "origin should be unchanged");
is(gLoginItem.shadowRoot.querySelector("input[name='username']").value, TEST_LOGIN_1.username, "username should be unchanged");
is(gLoginItem.shadowRoot.querySelector("input[name='password']").value, TEST_LOGIN_1.password, "password should be unchanged");
is(gLoginItem.shadowRoot.querySelector("input[name='password']").value, " ".repeat(TEST_LOGIN_1.password.length), "password length should be unchanged");
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-created")).args.timeCreated, TEST_LOGIN_1.timeCreated, "time-created should be unchanged");
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-changed")).args.timeChanged, TEST_LOGIN_1.timePasswordChanged, "time-changed should be unchanged");
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-used")).args.timeUsed, TEST_LOGIN_1.timeLastUsed, "time-used should be unchanged");
Expand All @@ -335,7 +340,7 @@

is(gLoginItem.shadowRoot.querySelector("input[name='origin']").value, modifiedLogin.origin, "origin should be updated");
is(gLoginItem.shadowRoot.querySelector("input[name='username']").value, modifiedLogin.username, "username should be updated");
is(gLoginItem.shadowRoot.querySelector("input[name='password']").value, modifiedLogin.password, "password should be updated");
is(gLoginItem.shadowRoot.querySelector("input[name='password']").value, " ".repeat(modifiedLogin.password.length), "password length should be updated");
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-created")).args.timeCreated, modifiedLogin.timeCreated, "time-created should be updated");
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-changed")).args.timeChanged, modifiedLogin.timePasswordChanged, "time-changed should be updated");
is(document.l10n.getAttributes(gLoginItem.shadowRoot.querySelector(".time-used")).args.timeUsed, modifiedLogin.timeLastUsed, "time-used should be updated");
Expand Down
4 changes: 2 additions & 2 deletions build/unix/elfhack/elfhack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class ElfRelHackCode_Section : public ElfSection {

~ElfRelHackCode_Section() { delete elf; }

void serialize(std::ofstream& file, char ei_class, char ei_data) {
void serialize(std::ofstream& file, char ei_class, char ei_data) override {
// Readjust code offsets
for (std::vector<ElfSection*>::iterator c = code.begin(); c != code.end();
++c)
Expand All @@ -217,7 +217,7 @@ class ElfRelHackCode_Section : public ElfSection {
ElfSection::serialize(file, ei_class, ei_data);
}

bool isRelocatable() { return false; }
bool isRelocatable() override { return false; }

unsigned int getEntryPoint() { return entry_point; }

Expand Down
2 changes: 2 additions & 0 deletions config/recurse.mk
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ $(addprefix build/unix/stdc++compat/,target host) build/clang-plugin/host: confi
# export, which ensures it exists before recursing the rust targets, tricking
# Make into keeping them early.
$(rust_targets): $(DEPTH)/.cargo/config
ifndef TEST_MOZBUILD
export:: $(DEPTH)/.cargo/config
endif

# When building gtest as part of the build (LINK_GTEST_DURING_COMPILE),
# force the build system to get to it first, so that it can be linked
Expand Down
4 changes: 2 additions & 2 deletions devtools/client/debugger/src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// @flow

import type { SourceContent } from "../types";
import { saveAs } from "devtools-modules";
import { DevToolsUtils } from "devtools-modules";

/**
* Utils for utils, by utils
Expand Down Expand Up @@ -62,5 +62,5 @@ export function downloadFile(content: SourceContent, fileName: string) {
}

const data = new TextEncoder().encode(content.value);
saveAs(window, data, fileName);
DevToolsUtils.saveAs(window, data, fileName);
}
1 change: 1 addition & 0 deletions devtools/client/shared/build/build-debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const moduleMapping = {
asyncStoreHelper: "devtools/client/shared/async-store-helper",
asyncStorage: "devtools/shared/async-storage",
PluralForm: "devtools/shared/plural-form",
DevToolsUtils: "devtools/shared/DevToolsUtils",
};

/*
Expand Down
Loading

0 comments on commit 0ef6713

Please sign in to comment.