Skip to content

Commit

Permalink
Merge m-c to inbound, a=merge
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 42kYU6Mip4
  • Loading branch information
KWierso committed Feb 9, 2017
2 parents e52a6ab + afcf40f commit 3363667
Show file tree
Hide file tree
Showing 323 changed files with 22,489 additions and 19,520 deletions.
3 changes: 3 additions & 0 deletions .hgignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,6 @@ GPATH

# tup database
^\.tup

subinclude:servo/.hgignore

7 changes: 1 addition & 6 deletions accessible/ipc/DocAccessibleParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,8 @@ DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
// We do not use GetAccessible here because we want to be sure to not get the
// document it self.
ProxyEntry* e = mAccessibles.GetEntry(aParentID);
if (!e) {
#ifdef DEBUG
if (!e)
return IPC_FAIL(this, "binding to nonexistant proxy!");
#else
return IPC_OK();
#endif
}

ProxyAccessible* outerDoc = e->mProxy;
MOZ_ASSERT(outerDoc);
Expand Down
5 changes: 5 additions & 0 deletions browser/base/content/test/general/browser_bookmark_popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ function* test_bookmarks_popup({isNewBookmark, popupShowFn, popupEditFn,
});
}

info(`BookmarkingUI.status is ${BookmarkingUI.status}`);
yield BrowserTestUtils.waitForCondition(
() => BookmarkingUI.status != BookmarkingUI.STATUS_UPDATING,
"BookmarkingUI should not be updating");

is(bookmarkStar.hasAttribute("starred"), !isNewBookmark,
"Page should only be starred prior to popupshown if editing bookmark");
is(bookmarkPanel.state, "closed", "Panel should be 'closed' to start test");
Expand Down
109 changes: 82 additions & 27 deletions browser/base/content/test/general/browser_selectpopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ const PAGECONTENT_COLORS =
' <option value="Four" class="defaultColor defaultBackground">{"color": "-moz-ComboboxText", "backgroundColor": "transparent", "unstyled": "true"}</option>' +
' <option value="Five" class="defaultColor">{"color": "-moz-ComboboxText", "backgroundColor": "transparent", "unstyled": "true"}</option>' +
' <option value="Six" class="defaultBackground">{"color": "-moz-ComboboxText", "backgroundColor": "transparent", "unstyled": "true"}</option>' +
' <option value="Seven" selected="true">{"unstyled": "true"}</option>' +
"</select></body></html>";

const PAGECONTENT_COLORS_ON_SELECT =
"<html><head><style>" +
" #one { background-color: #7E3A3A; color: #fff }" +
"</style>" +
"<body><select id='one'>" +
' <option value="One">{"color": "rgb(255, 255, 255)", "backgroundColor": "transparent"}</option>' +
' <option value="Two">{"color": "rgb(255, 255, 255)", "backgroundColor": "transparent"}</option>' +
' <option value="Three">{"color": "rgb(255, 255, 255)", "backgroundColor": "transparent"}</option>' +
' <option value="Four" selected="true">{"end": "true"}</option>' +
"</select></body></html>";

function openSelectPopup(selectPopup, mode = "key", selector = "select", win = window) {
Expand Down Expand Up @@ -150,6 +162,38 @@ function getClickEvents() {
});
}

function testOptionColors(index, item, menulist) {
let expected = JSON.parse(item.label);

for (let color of Object.keys(expected)) {
if (color.toLowerCase().includes("color") &&
!expected[color].startsWith("rgb")) {
// Need to convert system color to RGB color.
let textarea = document.createElementNS("http://www.w3.org/1999/xhtml", "textarea");
textarea.style.color = expected[color];
expected[color] = getComputedStyle(textarea).color;
}
}

// Press Down to move the selected item to the next item in the
// list and check the colors of this item when it's not selected.
EventUtils.synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });

if (expected.end) {
return;
}

if (expected.unstyled) {
ok(!item.hasAttribute("customoptionstyling"),
`Item ${index} should not have any custom option styling`);
} else {
is(getComputedStyle(item).color, expected.color,
"Item " + (index) + " has correct foreground color");
is(getComputedStyle(item).backgroundColor, expected.backgroundColor,
"Item " + (index) + " has correct background color");
}
}

function* doSelectTests(contentType, dtd) {
const pageUrl = "data:" + contentType + "," + escape(dtd + "\n" + PAGECONTENT);
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
Expand Down Expand Up @@ -745,50 +789,61 @@ add_task(function* test_somehidden() {
yield BrowserTestUtils.removeTab(tab);
});

add_task(function* test_colors_applied_to_popup() {
// This test checks when a <select> element has styles applied to <option>s within it.
add_task(function* test_colors_applied_to_popup_items() {
const pageUrl = "data:text/html," + escape(PAGECONTENT_COLORS);
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);

let selectPopup = document.getElementById("ContentSelectDropdown").menupopup;
let menulist = document.getElementById("ContentSelectDropdown");
let selectPopup = menulist.menupopup;

let popupShownPromise = BrowserTestUtils.waitForEvent(selectPopup, "popupshown");
yield BrowserTestUtils.synthesizeMouseAtCenter("#one", { type: "mousedown" }, gBrowser.selectedBrowser);
yield popupShownPromise;

// The label contains a JSON string of the expected colors for
// `color` and `background-color`.
is(selectPopup.parentNode.itemCount, 6, "Correct number of items");
is(selectPopup.parentNode.itemCount, 7, "Correct number of items");
let child = selectPopup.firstChild;
let idx = 1;

ok(child.selected, "The first child should be selected");
ok(!child.selected, "The first child should not be selected");
while (child) {
let expected = JSON.parse(child.label);

for (let color of Object.keys(expected)) {
if (color.toLowerCase().includes("color") &&
!expected[color].startsWith("rgb")) {
// Need to convert system color to RGB color.
let textarea = document.createElementNS("http://www.w3.org/1999/xhtml", "textarea");
textarea.style.color = expected[color];
expected[color] = getComputedStyle(textarea).color;
}
}
testOptionColors(idx, child, menulist);
idx++;
child = child.nextSibling;
}

// Press Down to move the selected item to the next item in the
// list and check the colors of this item when it's not selected.
EventUtils.synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
yield hideSelectPopup(selectPopup, "escape");
yield BrowserTestUtils.removeTab(tab);
});

if (expected.unstyled) {
ok(!child.hasAttribute("customoptionstyling"),
`Item ${idx} should not have any custom option styling`);
} else {
is(getComputedStyle(child).color, expected.color,
"Item " + (idx) + " has correct foreground color");
is(getComputedStyle(child).backgroundColor, expected.backgroundColor,
"Item " + (idx) + " has correct background color");
}
// This test checks when a <select> element has styles applied to itself.
add_task(function* test_colors_applied_to_popup() {
const pageUrl = "data:text/html," + escape(PAGECONTENT_COLORS_ON_SELECT);
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);

let menulist = document.getElementById("ContentSelectDropdown");
let selectPopup = menulist.menupopup;

let popupShownPromise = BrowserTestUtils.waitForEvent(selectPopup, "popupshown");
yield BrowserTestUtils.synthesizeMouseAtCenter("#one", { type: "mousedown" }, gBrowser.selectedBrowser);
yield popupShownPromise;

// The label contains a JSON string of the expected colors for
// `color` and `background-color`.
is(selectPopup.parentNode.itemCount, 4, "Correct number of items");
let child = selectPopup.firstChild;
let idx = 1;

is(getComputedStyle(selectPopup).color, "rgb(255, 255, 255)",
"popup has expected foreground color");
is(getComputedStyle(selectPopup).backgroundColor, "rgb(126, 58, 58)",
"popup has expected background color");

ok(!child.selected, "The first child should not be selected");
while (child) {
testOptionColors(idx, child, menulist);
idx++;
child = child.nextSibling;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ var tests = [
EventUtils.synthesizeMouseAtCenter(checkbox, {});
dismissNotification(popup);
},
onHidden(popup) {
*onHidden(popup) {
let icon = document.getElementById("default-notification-icon");
let shown = waitForNotificationPanel();
EventUtils.synthesizeMouseAtCenter(icon, {});
yield shown;
let notification = popup.childNodes[0];
let checkbox = notification.checkbox;
checkCheckbox(checkbox, "This is a checkbox", true);
Expand Down
4 changes: 2 additions & 2 deletions browser/base/content/test/popupNotifications/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ function* runNextTest() {
});
onPopupEvent("popuphidden", function() {
info("[" + nextTest.id + "] popup hidden");
nextTest.onHidden(this);
goNext();
Task.spawn(() => nextTest.onHidden(this))
.then(() => goNext(), ex => Assert.ok(false, "onHidden failed: " + ex));
}, () => shownState);
info("[" + nextTest.id + "] added listeners; panel is open: " + PopupNotifications.isPanelOpen);
}
Expand Down
Loading

0 comments on commit 3363667

Please sign in to comment.