Merge m-c to autoland, a=merge

MozReview-Commit-ID: 3pEpsd3DljH
This commit is contained in:
Wes Kocher 2017-01-19 16:47:25 -08:00
Родитель f3c46ccf42 32faf4c617
Коммит 336f27142f
4680 изменённых файлов: 322383 добавлений и 58750 удалений

Просмотреть файл

@ -68,7 +68,7 @@ browser/components/sessionstore/**
browser/components/tabview/**
# generated files in cld2
browser/components/translation/cld2/cld-worker.js
browser/extensions/pdfjs/**
browser/extensions/pdfjs/content/**
# generated or library files in pocket
browser/extensions/pocket/content/panels/js/tmpl.js
browser/extensions/pocket/content/panels/js/vendor/**

Просмотреть файл

@ -16,12 +16,12 @@
</stringbundleset>
<commandset id="mainCommandSet">
<command id="cmd_newNavigator" oncommand="OpenBrowserWindow()" reserved="true"/>
<command id="cmd_newNavigator" oncommand="OpenBrowserWindow()"/>
<command id="cmd_handleBackspace" oncommand="BrowserHandleBackspace();" />
<command id="cmd_handleShiftBackspace" oncommand="BrowserHandleShiftBackspace();" />
<command id="cmd_newNavigatorTab" oncommand="BrowserOpenTab(event);" reserved="true"/>
<command id="cmd_newNavigatorTabNoEvent" oncommand="BrowserOpenTab();" reserved="true"/>
<command id="cmd_newNavigatorTab" oncommand="BrowserOpenTab(event);"/>
<command id="cmd_newNavigatorTabNoEvent" oncommand="BrowserOpenTab();"/>
<command id="Browser:OpenFile" oncommand="BrowserOpenFileWindow();"/>
<command id="Browser:SavePage" oncommand="saveBrowser(gBrowser.selectedBrowser);"/>
@ -31,11 +31,11 @@
<command id="cmd_pageSetup" oncommand="PrintUtils.showPageSetup();"/>
<command id="cmd_print" oncommand="PrintUtils.printWindow(window.gBrowser.selectedBrowser.outerWindowID, window.gBrowser.selectedBrowser);"/>
<command id="cmd_printPreview" oncommand="PrintUtils.printPreview(PrintPreviewListener);"/>
<command id="cmd_close" oncommand="BrowserCloseTabOrWindow()" reserved="true"/>
<command id="cmd_closeWindow" oncommand="BrowserTryToCloseWindow()" reserved="true"/>
<command id="cmd_close" oncommand="BrowserCloseTabOrWindow()"/>
<command id="cmd_closeWindow" oncommand="BrowserTryToCloseWindow()"/>
<command id="cmd_toggleMute" oncommand="gBrowser.selectedTab.toggleMuteAudio()"/>
<command id="cmd_CustomizeToolbars" oncommand="BrowserCustomizeToolbar()"/>
<command id="cmd_quitApplication" oncommand="goQuitApplication()" reserved="true"/>
<command id="cmd_quitApplication" oncommand="goQuitApplication()"/>
<commandset id="editMenuCommands"/>
@ -80,8 +80,8 @@
<command id="Browser:ReloadSkipCache" oncommand="BrowserReloadSkipCache()" disabled="true">
<observes element="Browser:Reload" attribute="disabled"/>
</command>
<command id="Browser:NextTab" oncommand="gBrowser.tabContainer.advanceSelectedTab(1, true);" reserved="true"/>
<command id="Browser:PrevTab" oncommand="gBrowser.tabContainer.advanceSelectedTab(-1, true);" reserved="true"/>
<command id="Browser:NextTab" oncommand="gBrowser.tabContainer.advanceSelectedTab(1, true);"/>
<command id="Browser:PrevTab" oncommand="gBrowser.tabContainer.advanceSelectedTab(-1, true);"/>
<command id="Browser:ShowAllTabs" oncommand="allTabs.open();"/>
<command id="cmd_fullZoomReduce" oncommand="FullZoom.reduce()"/>
<command id="cmd_fullZoomEnlarge" oncommand="FullZoom.enlarge()"/>
@ -92,7 +92,7 @@
<command id="cmd_gestureRotateEnd" oncommand="gGestureSupport.rotateEnd()"/>
<command id="Browser:OpenLocation" oncommand="openLocation();"/>
<command id="Browser:RestoreLastSession" oncommand="restoreLastSession();" disabled="true"/>
<command id="Browser:NewUserContextTab" oncommand="openNewUserContextTab(event.sourceEvent);" reserved="true"/>
<command id="Browser:NewUserContextTab" oncommand="openNewUserContextTab(event.sourceEvent);"/>
<command id="Browser:OpenAboutContainers" oncommand="openPreferences('paneContainers');"/>
<command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/>
@ -101,7 +101,7 @@
<command id="Tools:Sanitize"
oncommand="Cc['@mozilla.org/browser/browserglue;1'].getService(Ci.nsIBrowserGlue).sanitize(window);"/>
<command id="Tools:PrivateBrowsing"
oncommand="OpenBrowserWindow({private: true});" reserved="true"/>
oncommand="OpenBrowserWindow({private: true});"/>
#ifdef E10S_TESTING_ONLY
<command id="Tools:NonRemoteWindow"
oncommand="OpenBrowserWindow({remote: false});"/>
@ -193,8 +193,9 @@
<key id="key_newNavigator"
key="&newNavigatorCmd.key;"
command="cmd_newNavigator"
modifiers="accel"/>
<key id="key_newNavigatorTab" key="&tabCmd.commandkey;" modifiers="accel" command="cmd_newNavigatorTabNoEvent"/>
modifiers="accel" reserved="true"/>
<key id="key_newNavigatorTab" key="&tabCmd.commandkey;" modifiers="accel"
command="cmd_newNavigatorTabNoEvent" reserved="true"/>
<key id="focusURLBar" key="&openCmd.commandkey;" command="Browser:OpenLocation"
modifiers="accel"/>
#ifndef XP_MACOSX
@ -236,8 +237,8 @@
<key id="openFileKb" key="&openFileCmd.commandkey;" command="Browser:OpenFile" modifiers="accel"/>
<key id="key_savePage" key="&savePageCmd.commandkey;" command="Browser:SavePage" modifiers="accel"/>
<key id="printKb" key="&printCmd.commandkey;" command="cmd_print" modifiers="accel"/>
<key id="key_close" key="&closeCmd.key;" command="cmd_close" modifiers="accel"/>
<key id="key_closeWindow" key="&closeCmd.key;" command="cmd_closeWindow" modifiers="accel,shift"/>
<key id="key_close" key="&closeCmd.key;" command="cmd_close" modifiers="accel" reserved="true"/>
<key id="key_closeWindow" key="&closeCmd.key;" command="cmd_closeWindow" modifiers="accel,shift" reserved="true"/>
<key id="key_toggleMute" key="&toggleMuteCmd.key;" command="cmd_toggleMute" modifiers="control"/>
<key id="key_undo"
key="&undoCmd.key;"
@ -341,13 +342,14 @@
<key id="key_switchTextDirection" key="&bidiSwitchTextDirectionItem.commandkey;" command="cmd_switchTextDirection" modifiers="accel,shift" />
<key id="key_privatebrowsing" command="Tools:PrivateBrowsing" key="&privateBrowsingCmd.commandkey;" modifiers="accel,shift"/>
<key id="key_privatebrowsing" command="Tools:PrivateBrowsing" key="&privateBrowsingCmd.commandkey;"
modifiers="accel,shift" reserved="true"/>
<key id="key_sanitize" command="Tools:Sanitize" keycode="VK_DELETE" modifiers="accel,shift"/>
#ifdef XP_MACOSX
<key id="key_sanitize_mac" command="Tools:Sanitize" keycode="VK_BACK" modifiers="accel,shift"/>
<key id="key_quitApplication" key="&quitApplicationCmdUnix.key;" modifiers="accel" reserved="true"/>
#elifdef XP_UNIX
<key id="key_quitApplication" key="&quitApplicationCmdUnix.key;" command="cmd_quitApplication" modifiers="accel"/>
<key id="key_quitApplication" key="&quitApplicationCmdUnix.key;" command="cmd_quitApplication" modifiers="accel" reserved="true"/>
#endif
#ifdef FULL_BROWSER_WINDOW

Просмотреть файл

@ -11,7 +11,8 @@ const XHTML_DTD = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www
const PAGECONTENT =
"<html xmlns='http://www.w3.org/1999/xhtml'>" +
"<body onload='gChangeEvents = 0;gInputEvents = 0; document.body.firstChild.focus()'><select oninput='gInputEvents++' onchange='gChangeEvents++'>" +
"<body onload='gChangeEvents = 0;gInputEvents = 0; gClickEvents = 0; document.body.firstChild.focus()'>" +
"<select oninput='gInputEvents++' onchange='gChangeEvents++' onclick='if (event.target == this) gClickEvents++'>" +
" <optgroup label='First Group'>" +
" <option value='One'>One</option>" +
" <option value='Two'>Two</option>" +
@ -79,12 +80,18 @@ const PAGECONTENT_TRANSLATED =
"</iframe>" +
"</div></body></html>";
function openSelectPopup(selectPopup, withMouse, selector = "select", win = window) {
function openSelectPopup(selectPopup, mode = "key", selector = "select", win = window) {
let popupShownPromise = BrowserTestUtils.waitForEvent(selectPopup, "popupshown");
if (withMouse) {
return Promise.all([popupShownPromise,
BrowserTestUtils.synthesizeMouseAtCenter(selector, { }, win.gBrowser.selectedBrowser)]);
if (mode == "click" || mode == "mousedown") {
let mousePromise;
if (mode == "click") {
mousePromise = BrowserTestUtils.synthesizeMouseAtCenter(selector, { }, win.gBrowser.selectedBrowser);
} else {
mousePromise = BrowserTestUtils.synthesizeMouse(selector, 5, 5, { type: "mousedown" }, win.gBrowser.selectedBrowser);
}
return Promise.all([popupShownPromise, mousePromise]);
}
EventUtils.synthesizeKey("KEY_ArrowDown", { altKey: true, code: "ArrowDown" }, win);
@ -121,6 +128,12 @@ function getChangeEvents() {
});
}
function getClickEvents() {
return ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
return content.wrappedJSObject.gClickEvents;
});
}
function* doSelectTests(contentType, dtd) {
const pageUrl = "data:" + contentType + "," + escape(dtd + "\n" + PAGECONTENT);
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
@ -163,6 +176,7 @@ function* doSelectTests(contentType, dtd) {
is((yield getInputEvents()), 0, "Before closed - number of input events");
is((yield getChangeEvents()), 0, "Before closed - number of change events");
is((yield getClickEvents()), 0, "Before closed - number of click events");
EventUtils.synthesizeKey("a", { accelKey: true });
yield ContentTask.spawn(gBrowser.selectedBrowser, { isWindows }, function(args) {
@ -183,26 +197,31 @@ function* doSelectTests(contentType, dtd) {
is(menulist.selectedIndex, 3, "Item 3 still selected");
is((yield getInputEvents()), 1, "After closed - number of input events");
is((yield getChangeEvents()), 1, "After closed - number of change events");
is((yield getClickEvents()), 0, "After closed - number of click events");
// Opening and closing the popup without changing the value should not fire a change event.
yield openSelectPopup(selectPopup, true);
yield openSelectPopup(selectPopup, "click");
yield hideSelectPopup(selectPopup, "escape");
is((yield getInputEvents()), 1, "Open and close with no change - number of input events");
is((yield getChangeEvents()), 1, "Open and close with no change - number of change events");
is((yield getClickEvents()), 1, "Open and close with no change - number of click events");
EventUtils.synthesizeKey("VK_TAB", { });
EventUtils.synthesizeKey("VK_TAB", { shiftKey: true });
is((yield getInputEvents()), 1, "Tab away from select with no change - number of input events");
is((yield getChangeEvents()), 1, "Tab away from select with no change - number of change events");
is((yield getClickEvents()), 1, "Tab away from select with no change - number of click events");
yield openSelectPopup(selectPopup, true);
yield openSelectPopup(selectPopup, "click");
EventUtils.synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
yield hideSelectPopup(selectPopup, "escape");
is((yield getInputEvents()), isWindows ? 2 : 1, "Open and close with change - number of input events");
is((yield getChangeEvents()), isWindows ? 2 : 1, "Open and close with change - number of change events");
is((yield getClickEvents()), 2, "Open and close with change - number of click events");
EventUtils.synthesizeKey("VK_TAB", { });
EventUtils.synthesizeKey("VK_TAB", { shiftKey: true });
is((yield getInputEvents()), isWindows ? 2 : 1, "Tab away from select with change - number of input events");
is((yield getChangeEvents()), isWindows ? 2 : 1, "Tab away from select with change - number of change events");
is((yield getClickEvents()), 2, "Tab away from select with change - number of click events");
is(selectPopup.lastChild.previousSibling.label, "Seven", "Spaces collapsed");
is(selectPopup.lastChild.label, "\xA0\xA0Eight\xA0\xA0", "Non-breaking spaces not collapsed");
@ -236,7 +255,7 @@ add_task(function*() {
let selectPopup = menulist.menupopup;
// First, try it when a different <select> element than the one that is open is removed
yield openSelectPopup(selectPopup, true, "#one");
yield openSelectPopup(selectPopup, "click", "#one");
yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
content.document.body.removeChild(content.document.getElementById("two"));
@ -250,7 +269,7 @@ add_task(function*() {
yield hideSelectPopup(selectPopup);
// Next, try it when the same <select> element than the one that is open is removed
yield openSelectPopup(selectPopup, true, "#three");
yield openSelectPopup(selectPopup, "click", "#three");
let popupHiddenPromise = BrowserTestUtils.waitForEvent(selectPopup, "popuphidden");
yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
@ -261,7 +280,7 @@ add_task(function*() {
ok(true, "Popup hidden when select is removed");
// Finally, try it when the tab is closed while the select popup is open.
yield openSelectPopup(selectPopup, true, "#one");
yield openSelectPopup(selectPopup, "click", "#one");
popupHiddenPromise = BrowserTestUtils.waitForEvent(selectPopup, "popuphidden");
yield BrowserTestUtils.removeTab(tab);
@ -279,7 +298,7 @@ add_task(function*() {
let selectPopup = menulist.menupopup;
// First, get the position of the select popup when no translations have been applied.
yield openSelectPopup(selectPopup, false);
yield openSelectPopup(selectPopup);
let rect = selectPopup.getBoundingClientRect();
let expectedX = rect.left;
@ -320,7 +339,7 @@ add_task(function*() {
});
});
yield openSelectPopup(selectPopup, false);
yield openSelectPopup(selectPopup);
expectedX += step[2];
expectedY += step[3];
@ -391,7 +410,7 @@ add_task(function* test_event_order() {
for (let mode of ["enter", "click"]) {
let expected = mode == "enter" ? expectedEnter : expectedClick;
yield openSelectPopup(selectPopup, true, mode == "enter" ? "#one" : "#two");
yield openSelectPopup(selectPopup, "click", mode == "enter" ? "#one" : "#two");
let eventsPromise = ContentTask.spawn(browser, [mode, expected], function*([contentMode, contentExpected]) {
return new Promise((resolve) => {
@ -443,6 +462,58 @@ function* performLargePopupTests(win) {
let selectPopup = win.document.getElementById("ContentSelectDropdown").menupopup;
let browserRect = browser.getBoundingClientRect();
// Check if a drag-select works and scrolls the list.
yield openSelectPopup(selectPopup, "mousedown", "select", win);
let scrollPos = selectPopup.scrollBox.scrollTop;
let popupRect = selectPopup.getBoundingClientRect();
// First, check that scrolling does not occur when the mouse is moved over the
// anchor button but not the popup yet.
EventUtils.synthesizeMouseAtPoint(popupRect.left + 5, popupRect.top - 10, { type: "mousemove" }, win);
is(selectPopup.scrollBox.scrollTop, scrollPos, "scroll position after mousemove over button should not change");
EventUtils.synthesizeMouseAtPoint(popupRect.left + 20, popupRect.top + 10, { type: "mousemove" }, win);
// Dragging above the popup scrolls it up.
EventUtils.synthesizeMouseAtPoint(popupRect.left + 20, popupRect.top - 20, { type: "mousemove" }, win);
ok(selectPopup.scrollBox.scrollTop < scrollPos - 5, "scroll position at drag up");
// Dragging below the popup scrolls it down.
scrollPos = selectPopup.scrollBox.scrollTop;
EventUtils.synthesizeMouseAtPoint(popupRect.left + 20, popupRect.bottom + 20, { type: "mousemove" }, win);
ok(selectPopup.scrollBox.scrollTop > scrollPos + 5, "scroll position at drag down");
// Releasing the mouse button and moving the mouse does not change the scroll position.
scrollPos = selectPopup.scrollBox.scrollTop;
EventUtils.synthesizeMouseAtPoint(popupRect.left + 20, popupRect.bottom + 25, { type: "mouseup" }, win);
is(selectPopup.scrollBox.scrollTop, scrollPos, "scroll position at mouseup should not change");
EventUtils.synthesizeMouseAtPoint(popupRect.left + 20, popupRect.bottom + 20, { type: "mousemove" }, win);
is(selectPopup.scrollBox.scrollTop, scrollPos, "scroll position at mousemove after mouseup should not change");
// Now check dragging with a mousedown on an item
let menuRect = selectPopup.childNodes[51].getBoundingClientRect();
EventUtils.synthesizeMouseAtPoint(menuRect.left + 5, menuRect.top + 5, { type: "mousedown" }, win);
// Dragging below the popup scrolls it down.
EventUtils.synthesizeMouseAtPoint(popupRect.left + 20, popupRect.bottom + 20, { type: "mousemove" }, win);
ok(selectPopup.scrollBox.scrollTop > scrollPos + 5, "scroll position at drag down from option");
// Dragging above the popup scrolls it up.
EventUtils.synthesizeMouseAtPoint(popupRect.left + 20, popupRect.top - 20, { type: "mousemove" }, win);
ok(selectPopup.scrollBox.scrollTop, scrollPos, "scroll position at drag up from option");
scrollPos = selectPopup.scrollBox.scrollTop;
EventUtils.synthesizeMouseAtPoint(popupRect.left + 20, popupRect.bottom + 25, { type: "mouseup" }, win);
is(selectPopup.scrollBox.scrollTop, scrollPos, "scroll position at mouseup from option should not change");
EventUtils.synthesizeMouseAtPoint(popupRect.left + 20, popupRect.bottom + 20, { type: "mousemove" }, win);
is(selectPopup.scrollBox.scrollTop, scrollPos, "scroll position at mousemove after mouseup should not change");
yield hideSelectPopup(selectPopup, "escape", win);
let positions = [
"margin-top: 300px;",
"position: fixed; bottom: 100px;",
@ -450,8 +521,8 @@ function* performLargePopupTests(win) {
];
let position;
while (true) {
yield openSelectPopup(selectPopup, false, "select", win);
while (positions.length) {
yield openSelectPopup(selectPopup, "key", "select", win);
let rect = selectPopup.getBoundingClientRect();
ok(rect.top >= browserRect.top, "Popup top position in within browser area");
@ -481,14 +552,11 @@ function* performLargePopupTests(win) {
yield hideSelectPopup(selectPopup, "enter", win);
position = positions.shift();
if (!position) {
break;
}
let contentPainted = BrowserTestUtils.contentPainted(browser);
yield ContentTask.spawn(browser, position, function*(contentPosition) {
let select = content.document.getElementById("one");
select.setAttribute("style", contentPosition);
select.setAttribute("style", contentPosition || "");
select.getBoundingClientRect();
});
yield contentPainted;
@ -622,7 +690,7 @@ add_task(function* test_mousemove_correcttarget() {
// The popup should be closed when fullscreen mode is entered or exited.
for (let steps = 0; steps < 2; steps++) {
yield openSelectPopup(selectPopup, true);
yield openSelectPopup(selectPopup, "click");
let popupHiddenPromise = BrowserTestUtils.waitForEvent(selectPopup, "popuphidden");
let sizeModeChanged = BrowserTestUtils.waitForEvent(window, "sizemodechange");
BrowserFullScreen();

Просмотреть файл

@ -11,6 +11,7 @@ var gSubDialog = {
_frame: null,
_overlay: null,
_box: null,
_openedURL: null,
_injectedStyleSheets: [
"chrome://browser/skin/preferences/preferences.css",
"chrome://global/skin/in-content/common.css",

Просмотреть файл

@ -5,57 +5,43 @@ const RELATIVE_DIR = "browser/extensions/pdfjs/test/";
const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
add_task(function* test() {
let handlerService = Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService);
let mimeService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
let handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
let handlerInfo = mimeService.getFromTypeAndExtension("application/pdf", "pdf");
// Make sure pdf.js is the default handler.
is(handlerInfo.alwaysAskBeforeHandling, false, 'pdf handler defaults to always-ask is false');
is(handlerInfo.preferredAction, Ci.nsIHandlerInfo.handleInternally, 'pdf handler defaults to internal');
is(handlerInfo.alwaysAskBeforeHandling, false, "pdf handler defaults to always-ask is false");
is(handlerInfo.preferredAction, Ci.nsIHandlerInfo.handleInternally, "pdf handler defaults to internal");
info('Pref action: ' + handlerInfo.preferredAction);
info("Pref action: " + handlerInfo.preferredAction);
yield BrowserTestUtils.withNewTab({ gBrowser: gBrowser, url: "about:blank" },
yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" },
function* (newTabBrowser) {
yield waitForPdfJS(newTabBrowser, TESTROOT + "file_pdfjs_test.pdf");
ok(gBrowser.isFindBarInitialized(), "Browser FindBar initialized!");
yield ContentTask.spawn(newTabBrowser, null, function* () {
//
// Overall sanity tests
//
Assert.ok(content.document.querySelector('div#viewer'), "document content has viewer UI");
Assert.ok('PDFJS' in content.wrappedJSObject, "window content has PDFJS object");
Assert.ok(content.document.querySelector("div#viewer"), "document content has viewer UI");
Assert.ok("PDFJS" in content.wrappedJSObject, "window content has PDFJS object");
//
// Sidebar: open
//
var sidebar = content.document.querySelector('button#sidebarToggle'),
outerContainer = content.document.querySelector('div#outerContainer');
var sidebar = content.document.querySelector("button#sidebarToggle"),
outerContainer = content.document.querySelector("div#outerContainer");
sidebar.click();
Assert.ok(outerContainer.classList.contains('sidebarOpen'), "sidebar opens on click");
Assert.ok(outerContainer.classList.contains("sidebarOpen"), "sidebar opens on click");
//
// Sidebar: close
//
sidebar.click();
Assert.ok(!outerContainer.classList.contains('sidebarOpen'), "sidebar closes on click");
Assert.ok(!outerContainer.classList.contains("sidebarOpen"), "sidebar closes on click");
//
// Page change from prev/next buttons
//
var prevPage = content.document.querySelector('button#previous'),
nextPage = content.document.querySelector('button#next');
var pgNumber = content.document.querySelector('input#pageNumber').value;
// Verify that initial page is 1
var pgNumber = content.document.querySelector("input#pageNumber").value;
Assert.equal(parseInt(pgNumber, 10), 1, "initial page is 1");
//
// Bookmark button
//
var viewBookmark = content.document.querySelector('a#viewBookmark');
var viewBookmark = content.document.querySelector("a#viewBookmark");
viewBookmark.click();
Assert.ok(viewBookmark.href.length > 0, "viewBookmark button has href");

Просмотреть файл

@ -143,13 +143,13 @@ const TESTS = [
add_task(function* test() {
let mimeService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
let handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
let handlerInfo = mimeService.getFromTypeAndExtension("application/pdf", "pdf");
// Make sure pdf.js is the default handler.
is(handlerInfo.alwaysAskBeforeHandling, false, 'pdf handler defaults to always-ask is false');
is(handlerInfo.preferredAction, Ci.nsIHandlerInfo.handleInternally, 'pdf handler defaults to internal');
is(handlerInfo.alwaysAskBeforeHandling, false, "pdf handler defaults to always-ask is false");
is(handlerInfo.preferredAction, Ci.nsIHandlerInfo.handleInternally, "pdf handler defaults to internal");
info('Pref action: ' + handlerInfo.preferredAction);
info("Pref action: " + handlerInfo.preferredAction);
yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" },
function* (newTabBrowser) {
@ -166,7 +166,7 @@ add_task(function* test() {
yield Task.spawn(runTests(newTabBrowser));
yield ContentTask.spawn(newTabBrowser, null, function*() {
let pageNumber = content.document.querySelector('input#pageNumber');
let pageNumber = content.document.querySelector("input#pageNumber");
Assert.equal(pageNumber.value, pageNumber.max, "Document is left on the last page");
});
});
@ -230,24 +230,24 @@ function* contentSetUp() {
* @param callback
*/
function* runTests(browser) {
yield ContentTask.spawn(browser, TESTS, function* (TESTS) {
yield ContentTask.spawn(browser, TESTS, function* (contentTESTS) {
let window = content;
let document = window.document;
for (let test of TESTS) {
for (let test of contentTESTS) {
let deferred = {};
deferred.promise = new Promise((resolve, reject) => {
deferred.resolve = resolve;
deferred.reject = reject;
});
let pageNumber = document.querySelector('input#pageNumber');
let pageNumber = document.querySelector("input#pageNumber");
// Add an event-listener to wait for page to change, afterwards resolve the promise
let timeout = window.setTimeout(() => deferred.reject(), 5000);
window.addEventListener('pagechange', function pageChange() {
window.addEventListener("pagechange", function pageChange() {
if (pageNumber.value == test.expectedPage) {
window.removeEventListener('pagechange', pageChange);
window.removeEventListener("pagechange", pageChange);
window.clearTimeout(timeout);
deferred.resolve(+pageNumber.value);
}
@ -262,14 +262,14 @@ function* runTests(browser) {
el.value = test.action.value;
// Dispatch the event for changing the page
var ev;
if (test.action.event == "keydown") {
var ev = document.createEvent("KeyboardEvent");
ev.initKeyEvent("keydown", true, true, null, false, false, false, false,
test.action.keyCode, 0);
ev = document.createEvent("KeyboardEvent");
ev.initKeyEvent("keydown", true, true, null, false, false, false, false,
test.action.keyCode, 0);
el.dispatchEvent(ev);
}
else {
var ev = new Event(test.action.event);
} else {
ev = new Event(test.action.event);
}
el.dispatchEvent(ev);

Просмотреть файл

@ -7,11 +7,9 @@ const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
function test() {
var oldAction = changeMimeHandler(Ci.nsIHandlerInfo.useSystemDefault, true);
var tab = gBrowser.addTab(TESTROOT + "file_pdfjs_test.pdf");
//
// Test: "Open with" dialog comes up when pdf.js is not selected as the default
// handler.
//
addWindowListener('chrome://mozapps/content/downloads/unknownContentType.xul', finish);
addWindowListener("chrome://mozapps/content/downloads/unknownContentType.xul", finish);
waitForExplicitFinish();
registerCleanupFunction(function() {
@ -23,7 +21,7 @@ function test() {
function changeMimeHandler(preferredAction, alwaysAskBeforeHandling) {
let handlerService = Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService);
let mimeService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
let handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
let handlerInfo = mimeService.getFromTypeAndExtension("application/pdf", "pdf");
var oldAction = [handlerInfo.preferredAction, handlerInfo.alwaysAskBeforeHandling];
// Change and save mime handler settings
@ -31,23 +29,21 @@ function changeMimeHandler(preferredAction, alwaysAskBeforeHandling) {
handlerInfo.preferredAction = preferredAction;
handlerService.store(handlerInfo);
Services.obs.notifyObservers(null, 'pdfjs:handlerChanged', null);
Services.obs.notifyObservers(null, "pdfjs:handlerChanged", null);
// Refresh data
handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
handlerInfo = mimeService.getFromTypeAndExtension("application/pdf", "pdf");
//
// Test: Mime handler was updated
//
is(handlerInfo.alwaysAskBeforeHandling, alwaysAskBeforeHandling, 'always-ask prompt change successful');
is(handlerInfo.preferredAction, preferredAction, 'mime handler change successful');
is(handlerInfo.alwaysAskBeforeHandling, alwaysAskBeforeHandling, "always-ask prompt change successful");
is(handlerInfo.preferredAction, preferredAction, "mime handler change successful");
return oldAction;
}
function addWindowListener(aURL, aCallback) {
Services.wm.addListener({
onOpenWindow: function(aXULWindow) {
onOpenWindow(aXULWindow) {
info("window opened, waiting for focus");
Services.wm.removeListener(this);
@ -59,7 +55,7 @@ function addWindowListener(aURL, aCallback) {
aCallback();
}, domwindow);
},
onCloseWindow: function(aXULWindow) { },
onWindowTitleChange: function(aXULWindow, aNewTitle) { }
onCloseWindow(aXULWindow) { },
onWindowTitleChange(aXULWindow, aNewTitle) { }
});
}

Просмотреть файл

@ -5,15 +5,14 @@ const RELATIVE_DIR = "browser/extensions/pdfjs/test/";
const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
add_task(function* test() {
let handlerService = Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService);
let mimeService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
let handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
let handlerInfo = mimeService.getFromTypeAndExtension("application/pdf", "pdf");
// Make sure pdf.js is the default handler.
is(handlerInfo.alwaysAskBeforeHandling, false, 'pdf handler defaults to always-ask is false');
is(handlerInfo.preferredAction, Ci.nsIHandlerInfo.handleInternally, 'pdf handler defaults to internal');
is(handlerInfo.alwaysAskBeforeHandling, false, "pdf handler defaults to always-ask is false");
is(handlerInfo.preferredAction, Ci.nsIHandlerInfo.handleInternally, "pdf handler defaults to internal");
info('Pref action: ' + handlerInfo.preferredAction);
info("Pref action: " + handlerInfo.preferredAction);
yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" },
function* (browser) {
@ -24,24 +23,24 @@ add_task(function* test() {
Assert.ok(content.document.querySelector("div#viewer"), "document content has viewer UI");
Assert.ok("PDFJS" in content.wrappedJSObject, "window content has PDFJS object");
//open sidebar
var sidebar = content.document.querySelector('button#sidebarToggle');
var outerContainer = content.document.querySelector('div#outerContainer');
// open sidebar
var sidebar = content.document.querySelector("button#sidebarToggle");
var outerContainer = content.document.querySelector("div#outerContainer");
sidebar.click();
Assert.ok(outerContainer.classList.contains("sidebarOpen"), "sidebar opens on click");
// check that thumbnail view is open
var thumbnailView = content.document.querySelector('div#thumbnailView');
var outlineView = content.document.querySelector('div#outlineView');
var thumbnailView = content.document.querySelector("div#thumbnailView");
var outlineView = content.document.querySelector("div#outlineView");
Assert.equal(thumbnailView.getAttribute("class"), null,
"Initial view is thumbnail view");
Assert.equal(outlineView.getAttribute("class"), "hidden",
"Outline view is hidden initially");
//switch to outline view
var viewOutlineButton = content.document.querySelector('button#viewOutline');
// switch to outline view
var viewOutlineButton = content.document.querySelector("button#viewOutline");
viewOutlineButton.click();
Assert.equal(thumbnailView.getAttribute("class"), "hidden",
@ -49,8 +48,8 @@ add_task(function* test() {
Assert.equal(outlineView.getAttribute("class"), "",
"Outline view is visible when selected");
//switch back to thumbnail view
var viewThumbnailButton = content.document.querySelector('button#viewThumbnail');
// switch back to thumbnail view
var viewThumbnailButton = content.document.querySelector("button#viewThumbnail");
viewThumbnailButton.click();
Assert.equal(thumbnailView.getAttribute("class"), "",

Просмотреть файл

@ -59,30 +59,28 @@ const TESTS = [
];
add_task(function* test() {
let handlerService = Cc["@mozilla.org/uriloader/handler-service;1"]
.getService(Ci.nsIHandlerService);
let mimeService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
let handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
let handlerInfo = mimeService.getFromTypeAndExtension("application/pdf", "pdf");
// Make sure pdf.js is the default handler.
is(handlerInfo.alwaysAskBeforeHandling, false,
'pdf handler defaults to always-ask is false');
"pdf handler defaults to always-ask is false");
is(handlerInfo.preferredAction, Ci.nsIHandlerInfo.handleInternally,
'pdf handler defaults to internal');
"pdf handler defaults to internal");
info('Pref action: ' + handlerInfo.preferredAction);
info("Pref action: " + handlerInfo.preferredAction);
yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" },
function* (newTabBrowser) {
yield waitForPdfJS(newTabBrowser, TESTROOT + "file_pdfjs_test.pdf" + "#zoom=100");
yield ContentTask.spawn(newTabBrowser, TESTS, function* (TESTS) {
yield ContentTask.spawn(newTabBrowser, TESTS, function* (contentTESTS) {
let document = content.document;
function waitForRender() {
return new Promise((resolve) => {
document.addEventListener("pagerendered", function onPageRendered(e) {
if(e.detail.pageNumber !== 1) {
if (e.detail.pageNumber !== 1) {
return;
}
@ -98,29 +96,28 @@ add_task(function* test() {
let initialWidth, previousWidth;
initialWidth = previousWidth =
parseInt(content.document.querySelector('div.page[data-page-number="1"]').style.width);
parseInt(content.document.querySelector("div.page[data-page-number='1']").style.width);
for (let test of TESTS) {
for (let subTest of contentTESTS) {
// We zoom using an UI element
var ev;
if (test.action.selector) {
if (subTest.action.selector) {
// Get the element and trigger the action for changing the zoom
var el = document.querySelector(test.action.selector);
Assert.ok(el, "Element '" + test.action.selector + "' has been found");
var el = document.querySelector(subTest.action.selector);
Assert.ok(el, "Element '" + subTest.action.selector + "' has been found");
if (test.action.index){
el.selectedIndex = test.action.index;
if (subTest.action.index) {
el.selectedIndex = subTest.action.index;
}
// Dispatch the event for changing the zoom
ev = new Event(test.action.event);
}
// We zoom using keyboard
else {
ev = new Event(subTest.action.event);
} else {
// We zoom using keyboard
// Simulate key press
ev = new content.KeyboardEvent("keydown",
{ key: test.action.event,
keyCode: test.action.keyCode,
{ key: subTest.action.event,
keyCode: subTest.action.keyCode,
ctrlKey: true });
el = content;
}
@ -128,21 +125,21 @@ add_task(function* test() {
el.dispatchEvent(ev);
yield waitForRender();
var pageZoomScale = content.document.querySelector('select#scaleSelect');
var pageZoomScale = content.document.querySelector("select#scaleSelect");
// The zoom value displayed in the zoom select
var zoomValue = pageZoomScale.options[pageZoomScale.selectedIndex].innerHTML;
let pageContainer = content.document.querySelector('div.page[data-page-number="1"]');
let pageContainer = content.document.querySelector("div.page[data-page-number='1']");
let actualWidth = parseInt(pageContainer.style.width);
// the actual zoom of the PDF document
let computedZoomValue = parseInt(((actualWidth/initialWidth).toFixed(2))*100) + "%";
let computedZoomValue = parseInt(((actualWidth / initialWidth).toFixed(2)) * 100) + "%";
Assert.equal(computedZoomValue, zoomValue, "Content has correct zoom");
// Check that document zooms in the expected way (in/out)
let zoom = (actualWidth - previousWidth) * test.expectedZoom;
Assert.ok(zoom > 0, test.message);
let zoom = (actualWidth - previousWidth) * subTest.expectedZoom;
Assert.ok(zoom > 0, subTest.message);
previousWidth = actualWidth;
}

Просмотреть файл

@ -1,6 +1,6 @@
function waitForPdfJS(browser, url) {
// Runs tests after all 'load' event handlers have fired off
return ContentTask.spawn(browser, url, function* (url) {
// Runs tests after all "load" event handlers have fired off
return ContentTask.spawn(browser, url, function* (contentUrl) {
yield new Promise((resolve) => {
// NB: Add the listener to the global object so that we receive the
// event fired from the new window.
@ -9,7 +9,7 @@ function waitForPdfJS(browser, url) {
resolve();
}, false, true);
content.location = url;
content.location = contentUrl;
});
});
}

Просмотреть файл

@ -988,7 +988,14 @@ Toolbox.prototype = {
* @param {KeyboardEvent} event
*/
_onToolbarArrowKeypress: function (event) {
let { key, target } = event;
let { key, target, ctrlKey, shiftKey, altKey, metaKey } = event;
// If any of the modifier keys are pressed do not attempt navigation as it
// might conflict with global shortcuts (Bug 1327972).
if (ctrlKey || shiftKey || altKey || metaKey) {
return;
}
let buttons = [...this._componentMount.querySelectorAll("button")];
let curIndex = buttons.indexOf(target);

Просмотреть файл

@ -118,6 +118,7 @@ devtools.jar:
content/shared/widgets/cubic-bezier.css (shared/widgets/cubic-bezier.css)
content/shared/widgets/mdn-docs.css (shared/widgets/mdn-docs.css)
content/shared/widgets/filter-widget.css (shared/widgets/filter-widget.css)
content/shared/widgets/color-widget.css (shared/widgets/color-widget.css)
content/shared/widgets/spectrum.css (shared/widgets/spectrum.css)
content/aboutdebugging/aboutdebugging.xhtml (aboutdebugging/aboutdebugging.xhtml)
content/aboutdebugging/aboutdebugging.css (aboutdebugging/aboutdebugging.css)

Просмотреть файл

@ -64,6 +64,8 @@ pref("devtools.inspector.showUserAgentStyles", false);
pref("devtools.inspector.showAllAnonymousContent", false);
// Enable the MDN docs tooltip
pref("devtools.inspector.mdnDocsTooltip.enabled", true);
// Enable the new color widget
pref("devtools.inspector.colorWidget.enabled", false);
// Enable the Font Inspector
pref("devtools.fontinspector.enabled", true);

Просмотреть файл

@ -0,0 +1,341 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* This file is a new working copy of Spectrum.js for the purposes of refreshing the color
* widget. It is hidden behind a pref("devtools.inspector.colorWidget.enabled").
*/
"use strict";
const EventEmitter = require("devtools/shared/event-emitter");
const XHTML_NS = "http://www.w3.org/1999/xhtml";
/**
* ColorWidget creates a color picker widget in any container you give it.
*
* Simple usage example:
*
* const {ColorWidget} = require("devtools/client/shared/widgets/ColorWidget");
* let s = new ColorWidget(containerElement, [255, 126, 255, 1]);
* s.on("changed", (event, rgba, color) => {
* console.log("rgba(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2] + ", " +
* rgba[3] + ")");
* });
* s.show();
* s.destroy();
*
* Note that the color picker is hidden by default and you need to call show to
* make it appear. This 2 stages initialization helps in cases you are creating
* the color picker in a parent element that hasn't been appended anywhere yet
* or that is hidden. Calling show() when the parent element is appended and
* visible will allow the color widget to correctly initialize its various parts.
*
* Fires the following events:
* - changed : When the user changes the current color
*/
function ColorWidget(parentEl, rgb) {
EventEmitter.decorate(this);
this.element = parentEl.ownerDocument.createElementNS(XHTML_NS, "div");
this.parentEl = parentEl;
this.element.className = "colorwidget-container";
this.element.innerHTML = `
<div class="colorwidget-top">
<div class="colorwidget-fill"></div>
<div class="colorwidget-top-inner">
<div class="colorwidget-color colorwidget-box">
<div class="colorwidget-sat">
<div class="colorwidget-val">
<div class="colorwidget-dragger"></div>
</div>
</div>
</div>
<div class="colorwidget-hue colorwidget-box">
<div class="colorwidget-slider colorwidget-slider-control"></div>
</div>
</div>
</div>
<div class="colorwidget-alpha colorwidget-checker colorwidget-box">
<div class="colorwidget-alpha-inner">
<div class="colorwidget-alpha-handle colorwidget-slider-control"></div>
</div>
</div>
`;
this.onElementClick = this.onElementClick.bind(this);
this.element.addEventListener("click", this.onElementClick);
this.parentEl.appendChild(this.element);
this.slider = this.element.querySelector(".colorwidget-hue");
this.slideHelper = this.element.querySelector(".colorwidget-slider");
ColorWidget.draggable(this.slider, this.onSliderMove.bind(this));
this.dragger = this.element.querySelector(".colorwidget-color");
this.dragHelper = this.element.querySelector(".colorwidget-dragger");
ColorWidget.draggable(this.dragger, this.onDraggerMove.bind(this));
this.alphaSlider = this.element.querySelector(".colorwidget-alpha");
this.alphaSliderInner = this.element.querySelector(".colorwidget-alpha-inner");
this.alphaSliderHelper = this.element.querySelector(".colorwidget-alpha-handle");
ColorWidget.draggable(this.alphaSliderInner, this.onAlphaSliderMove.bind(this));
if (rgb) {
this.rgb = rgb;
this.updateUI();
}
}
module.exports.ColorWidget = ColorWidget;
ColorWidget.hsvToRgb = function (h, s, v, a) {
let r, g, b;
let i = Math.floor(h * 6);
let f = h * 6 - i;
let p = v * (1 - s);
let q = v * (1 - f * s);
let t = v * (1 - (1 - f) * s);
switch (i % 6) {
case 0: r = v; g = t; b = p; break;
case 1: r = q; g = v; b = p; break;
case 2: r = p; g = v; b = t; break;
case 3: r = p; g = q; b = v; break;
case 4: r = t; g = p; b = v; break;
case 5: r = v; g = p; b = q; break;
}
return [r * 255, g * 255, b * 255, a];
};
ColorWidget.rgbToHsv = function (r, g, b, a) {
r = r / 255;
g = g / 255;
b = b / 255;
let max = Math.max(r, g, b), min = Math.min(r, g, b);
let h, s, v = max;
let d = max - min;
s = max == 0 ? 0 : d / max;
if (max == min) {
// achromatic
h = 0;
} else {
switch (max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
return [h, s, v, a];
};
ColorWidget.draggable = function (element, onmove, onstart, onstop) {
onmove = onmove || function () {};
onstart = onstart || function () {};
onstop = onstop || function () {};
let doc = element.ownerDocument;
let dragging = false;
let offset = {};
let maxHeight = 0;
let maxWidth = 0;
function prevent(e) {
e.stopPropagation();
e.preventDefault();
}
function move(e) {
if (dragging) {
if (e.buttons === 0) {
// The button is no longer pressed but we did not get a mouseup event.
stop();
return;
}
let pageX = e.pageX;
let pageY = e.pageY;
let dragX = Math.max(0, Math.min(pageX - offset.left, maxWidth));
let dragY = Math.max(0, Math.min(pageY - offset.top, maxHeight));
onmove.apply(element, [dragX, dragY]);
}
}
function start(e) {
let rightclick = e.which === 3;
if (!rightclick && !dragging) {
if (onstart.apply(element, arguments) !== false) {
dragging = true;
maxHeight = element.offsetHeight;
maxWidth = element.offsetWidth;
offset = element.getBoundingClientRect();
move(e);
doc.addEventListener("selectstart", prevent);
doc.addEventListener("dragstart", prevent);
doc.addEventListener("mousemove", move);
doc.addEventListener("mouseup", stop);
prevent(e);
}
}
}
function stop() {
if (dragging) {
doc.removeEventListener("selectstart", prevent);
doc.removeEventListener("dragstart", prevent);
doc.removeEventListener("mousemove", move);
doc.removeEventListener("mouseup", stop);
onstop.apply(element, arguments);
}
dragging = false;
}
element.addEventListener("mousedown", start);
};
ColorWidget.prototype = {
set rgb(color) {
this.hsv = ColorWidget.rgbToHsv(color[0], color[1], color[2], color[3]);
},
get rgb() {
let rgb = ColorWidget.hsvToRgb(this.hsv[0], this.hsv[1], this.hsv[2],
this.hsv[3]);
return [Math.round(rgb[0]), Math.round(rgb[1]), Math.round(rgb[2]),
Math.round(rgb[3] * 100) / 100];
},
get rgbNoSatVal() {
let rgb = ColorWidget.hsvToRgb(this.hsv[0], 1, 1);
return [Math.round(rgb[0]), Math.round(rgb[1]), Math.round(rgb[2]), rgb[3]];
},
get rgbCssString() {
let rgb = this.rgb;
return "rgba(" + rgb[0] + ", " + rgb[1] + ", " + rgb[2] + ", " +
rgb[3] + ")";
},
show: function () {
this.element.classList.add("colorwidget-show");
this.slideHeight = this.slider.offsetHeight;
this.dragWidth = this.dragger.offsetWidth;
this.dragHeight = this.dragger.offsetHeight;
this.dragHelperHeight = this.dragHelper.offsetHeight;
this.slideHelperHeight = this.slideHelper.offsetHeight;
this.alphaSliderWidth = this.alphaSliderInner.offsetWidth;
this.alphaSliderHelperWidth = this.alphaSliderHelper.offsetWidth;
this.updateUI();
},
onElementClick: function (e) {
e.stopPropagation();
},
onSliderMove: function (dragX, dragY) {
this.hsv[0] = (dragY / this.slideHeight);
this.updateUI();
this.onChange();
},
onDraggerMove: function (dragX, dragY) {
this.hsv[1] = dragX / this.dragWidth;
this.hsv[2] = (this.dragHeight - dragY) / this.dragHeight;
this.updateUI();
this.onChange();
},
onAlphaSliderMove: function (dragX, dragY) {
this.hsv[3] = dragX / this.alphaSliderWidth;
this.updateUI();
this.onChange();
},
onChange: function () {
this.emit("changed", this.rgb, this.rgbCssString);
},
updateHelperLocations: function () {
// If the UI hasn't been shown yet then none of the dimensions will be
// correct
if (!this.element.classList.contains("colorwidget-show")) {
return;
}
let h = this.hsv[0];
let s = this.hsv[1];
let v = this.hsv[2];
// Placing the color dragger
let dragX = s * this.dragWidth;
let dragY = this.dragHeight - (v * this.dragHeight);
let helperDim = this.dragHelperHeight / 2;
dragX = Math.max(
-helperDim,
Math.min(this.dragWidth - helperDim, dragX - helperDim)
);
dragY = Math.max(
-helperDim,
Math.min(this.dragHeight - helperDim, dragY - helperDim)
);
this.dragHelper.style.top = dragY + "px";
this.dragHelper.style.left = dragX + "px";
// Placing the hue slider
let slideY = (h * this.slideHeight) - this.slideHelperHeight / 2;
this.slideHelper.style.top = slideY + "px";
// Placing the alpha slider
let alphaSliderX = (this.hsv[3] * this.alphaSliderWidth) -
(this.alphaSliderHelperWidth / 2);
this.alphaSliderHelper.style.left = alphaSliderX + "px";
},
updateUI: function () {
this.updateHelperLocations();
let rgb = this.rgb;
let rgbNoSatVal = this.rgbNoSatVal;
let flatColor = "rgb(" + rgbNoSatVal[0] + ", " + rgbNoSatVal[1] + ", " +
rgbNoSatVal[2] + ")";
this.dragger.style.backgroundColor = flatColor;
let rgbNoAlpha = "rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + ")";
let rgbAlpha0 = "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + ", 0)";
let alphaGradient = "linear-gradient(to right, " + rgbAlpha0 + ", " +
rgbNoAlpha + ")";
this.alphaSliderInner.style.background = alphaGradient;
},
destroy: function () {
this.element.removeEventListener("click", this.onElementClick);
this.parentEl.removeChild(this.element);
this.slider = null;
this.dragger = null;
this.alphaSlider = this.alphaSliderInner = this.alphaSliderHelper = null;
this.parentEl = null;
this.element = null;
}
};

Просмотреть файл

@ -0,0 +1,155 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#eyedropper-button {
margin-inline-start: 5px;
display: block;
}
#eyedropper-button::before {
background-image: url(chrome://devtools/skin/images/command-eyedropper.svg);
}
/* Mix-in classes */
.colorwidget-checker {
background-color: #eee;
background-image: linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc),
linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc);
background-size: 12px 12px;
background-position: 0 0, 6px 6px;
}
.colorwidget-slider-control {
cursor: pointer;
box-shadow: 0 0 2px rgba(0,0,0,.6);
background: #fff;
border-radius: 10px;
opacity: .8;
}
.colorwidget-box {
border: 1px solid rgba(0,0,0,0.2);
border-radius: 2px;
background-clip: content-box;
}
/* Elements */
#colorwidget-tooltip {
padding: 4px;
}
.colorwidget-container {
position: relative;
display: none;
top: 0;
left: 0;
border-radius: 0;
width: 200px;
padding: 5px;
}
.colorwidget-show {
display: inline-block;
}
/* Keep aspect ratio:
http://www.briangrinstead.com/blog/keep-aspect-ratio-with-html-and-css */
.colorwidget-top {
position: relative;
width: 100%;
display: inline-block;
}
.colorwidget-top-inner {
position: absolute;
top:0;
left:0;
bottom:0;
right:0;
}
.colorwidget-color {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 20%;
}
.colorwidget-hue {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 83%;
}
.colorwidget-fill {
/* Same as colorwidget-color width */
margin-top: 85%;
}
.colorwidget-sat, .colorwidget-val {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.colorwidget-dragger, .colorwidget-slider {
-moz-user-select: none;
}
.colorwidget-alpha {
position: relative;
height: 8px;
margin-top: 3px;
}
.colorwidget-alpha-inner {
height: 100%;
}
.colorwidget-alpha-handle {
position: absolute;
top: -3px;
bottom: -3px;
width: 5px;
left: 50%;
}
.colorwidget-sat {
background-image: linear-gradient(to right, #FFF, rgba(204, 154, 129, 0));
}
.colorwidget-val {
background-image: linear-gradient(to top, #000000, rgba(204, 154, 129, 0));
}
.colorwidget-hue {
background: linear-gradient(to bottom, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
}
.colorwidget-dragger {
position: absolute;
top: 0px;
left: 0px;
cursor: pointer;
border-radius: 50%;
height: 8px;
width: 8px;
border: 1px solid white;
box-shadow: 0 0 2px rgba(0,0,0,.6);
}
.colorwidget-slider {
position: absolute;
top: 0;
height: 5px;
left: -3px;
right: -3px;
}

Просмотреть файл

@ -13,6 +13,7 @@ DevToolsModules(
'BarGraphWidget.js',
'BreadcrumbsWidget.jsm',
'Chart.js',
'ColorWidget.js',
'CubicBezierPresets.js',
'CubicBezierWidget.js',
'FastListWidget.js',

Просмотреть файл

@ -4,6 +4,7 @@
"use strict";
const Services = require("Services");
const {Task} = require("devtools/shared/task");
const {colorUtils} = require("devtools/shared/css/color");
const {Spectrum} = require("devtools/client/shared/widgets/Spectrum");
@ -13,6 +14,8 @@ const L10N = new LocalizationHelper("devtools/client/locales/inspector.propertie
const Heritage = require("sdk/core/heritage");
const colorWidgetPref = "devtools.inspector.colorWidget.enabled";
const NEW_COLOR_WIDGET = Services.prefs.getBoolPref(colorWidgetPref);
const XHTML_NS = "http://www.w3.org/1999/xhtml";
/**
@ -34,7 +37,9 @@ const XHTML_NS = "http://www.w3.org/1999/xhtml";
function SwatchColorPickerTooltip(document,
inspector,
{supportsCssColor4ColorFunction}) {
let stylesheet = "chrome://devtools/content/shared/widgets/spectrum.css";
let stylesheet = NEW_COLOR_WIDGET ?
"chrome://devtools/content/shared/widgets/color-widget.css" :
"chrome://devtools/content/shared/widgets/spectrum.css";
SwatchBasedEditorTooltip.call(this, document, stylesheet);
this.inspector = inspector;
@ -71,7 +76,13 @@ SwatchColorPickerTooltip.prototype = Heritage.extend(SwatchBasedEditorTooltip.pr
this.tooltip.setContent(container, { width: 218, height: 224 });
let spectrum = new Spectrum(spectrumNode, color);
let spectrum;
if (NEW_COLOR_WIDGET) {
const {ColorWidget} = require("devtools/client/shared/widgets/ColorWidget");
spectrum = new ColorWidget(spectrumNode, color);
} else {
spectrum = new Spectrum(spectrumNode, color);
}
// Wait for the tooltip to be shown before calling spectrum.show
// as it expect to be visible in order to compute DOM element sizes.

Просмотреть файл

@ -73,6 +73,7 @@
#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
#include "mozilla/dom/File.h" // for input type=file
#include "mozilla/dom/FileList.h" // for input type=file
#include "mozilla/TextEvents.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -1115,9 +1116,11 @@ ChromeTooltipListener::AddTooltipListener()
{
if (mEventTarget) {
nsresult rv = NS_OK;
#ifndef XP_WIN
rv = mEventTarget->AddSystemEventListener(NS_LITERAL_STRING("keydown"),
this, false, false);
NS_ENSURE_SUCCESS(rv, rv);
#endif
rv = mEventTarget->AddSystemEventListener(NS_LITERAL_STRING("mousedown"),
this, false, false);
NS_ENSURE_SUCCESS(rv, rv);
@ -1156,9 +1159,11 @@ ChromeTooltipListener::RemoveTooltipListener()
{
if (mEventTarget) {
nsresult rv = NS_OK;
#ifndef XP_WIN
rv = mEventTarget->RemoveSystemEventListener(NS_LITERAL_STRING("keydown"),
this, false);
NS_ENSURE_SUCCESS(rv, rv);
#endif
rv = mEventTarget->RemoveSystemEventListener(NS_LITERAL_STRING("mousedown"),
this, false);
NS_ENSURE_SUCCESS(rv, rv);
@ -1181,9 +1186,15 @@ ChromeTooltipListener::HandleEvent(nsIDOMEvent* aEvent)
nsAutoString eventType;
aEvent->GetType(eventType);
if (eventType.EqualsLiteral("keydown") ||
eventType.EqualsLiteral("mousedown")) {
if (eventType.EqualsLiteral("mousedown")) {
return HideTooltip();
} else if (eventType.EqualsLiteral("keydown")) {
WidgetKeyboardEvent* keyEvent = aEvent->WidgetEventPtr()->AsKeyboardEvent();
if (!keyEvent->IsModifierKeyEvent()) {
return HideTooltip();
}
return NS_OK;
} else if (eventType.EqualsLiteral("mouseout")) {
// Reset flag so that tooltip will display on the next MouseMove
mTooltipShownOnce = false;

2
dom/cache/DBSchema.cpp поставляемый
Просмотреть файл

@ -2553,7 +2553,7 @@ Migrate(mozIStorageConnection* aConn)
}
}
#if !defined(RELEASE_OR_BETA)
#if defined(DEBUG) || !defined(RELEASE_OR_BETA)
int32_t lastVersion = currentVersion;
#endif
rv = aConn->GetSchemaVersion(&currentVersion);

4
dom/cache/Manager.cpp поставляемый
Просмотреть файл

@ -1526,7 +1526,7 @@ Manager::ReleaseCacheId(CacheId aCacheId)
NS_ASSERT_OWNINGTHREAD(Manager);
for (uint32_t i = 0; i < mCacheIdRefs.Length(); ++i) {
if (mCacheIdRefs[i].mCacheId == aCacheId) {
#if !defined(RELEASE_OR_BETA)
#if defined(DEBUG) || !defined(RELEASE_OR_BETA)
uint32_t oldRef = mCacheIdRefs[i].mCount;
#endif
mCacheIdRefs[i].mCount -= 1;
@ -1577,7 +1577,7 @@ Manager::ReleaseBodyId(const nsID& aBodyId)
NS_ASSERT_OWNINGTHREAD(Manager);
for (uint32_t i = 0; i < mBodyIdRefs.Length(); ++i) {
if (mBodyIdRefs[i].mBodyId == aBodyId) {
#if !defined(RELEASE_OR_BETA)
#if defined(DEBUG) || !defined(RELEASE_OR_BETA)
uint32_t oldRef = mBodyIdRefs[i].mCount;
#endif
mBodyIdRefs[i].mCount -= 1;

4
dom/cache/StreamControl.cpp поставляемый
Просмотреть файл

@ -45,7 +45,7 @@ void
StreamControl::CloseReadStreams(const nsID& aId)
{
AssertOwningThread();
#if !defined(RELEASE_OR_BETA)
#if defined(DEBUG) || !defined(RELEASE_OR_BETA)
uint32_t closedCount = 0;
#endif
@ -54,7 +54,9 @@ StreamControl::CloseReadStreams(const nsID& aId)
RefPtr<ReadStream::Controllable> stream = iter.GetNext();
if (stream->MatchId(aId)) {
stream->CloseStream();
#if defined(DEBUG) || !defined(RELEASE_OR_BETA)
closedCount += 1;
#endif
}
}

Просмотреть файл

@ -0,0 +1,13 @@
<svg height='600'
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<filter id='f1'>
<feSpecularLighting kernelUnitLength='-82'>
<feSpotLight/>
</feSpecularLighting>
</filter>
<filter id='f2' xlink:href='#f1'></filter>
<polyline filter='url(#f2)' points='10,59 293,88 18,289'/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 325 B

Просмотреть файл

@ -0,0 +1,13 @@
<svg height='600'
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<filter id='f1'>
<feSpecularLighting kernelUnitLength='-80 10'>
<feSpotLight/>
</feSpecularLighting>
</filter>
<filter id='f2' xlink:href='#f1'></filter>
<polyline filter='url(#f2)' points='10,59 293,88 18,289'/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 328 B

Просмотреть файл

@ -0,0 +1,13 @@
<svg height='600'
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<filter id='f1'>
<feSpecularLighting kernelUnitLength='80 -10'>
<feSpotLight/>
</feSpecularLighting>
</filter>
<filter id='f2' xlink:href='#f1'></filter>
<polyline filter='url(#f2)' points='10,59 293,88 18,289'/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 328 B

Просмотреть файл

@ -0,0 +1,13 @@
<svg height='600'
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<filter id='f1'>
<feDiffuseLighting kernelUnitLength='-80'>
<feSpotLight/>
</feDiffuseLighting>
</filter>
<filter id='f2' xlink:href='#f1'></filter>
<polyline filter='url(#f2)' points='10,59 293,88 18,289'/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 323 B

Просмотреть файл

@ -0,0 +1,13 @@
<svg height='600'
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<filter id='f1'>
<feDiffuseLighting kernelUnitLength='-80 10'>
<feSpotLight/>
</feDiffuseLighting>
</filter>
<filter id='f2' xlink:href='#f1'></filter>
<polyline filter='url(#f2)' points='10,59 293,88 18,289'/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 326 B

Просмотреть файл

@ -0,0 +1,13 @@
<svg height='600'
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<filter id='f1'>
<feDiffuseLighting kernelUnitLength='80 -10'>
<feSpotLight/>
</feDiffuseLighting>
</filter>
<filter id='f2' xlink:href='#f1'></filter>
<polyline filter='url(#f2)' points='10,59 293,88 18,289'/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 326 B

Просмотреть файл

@ -82,3 +82,9 @@ load 1282985-1.svg
#load long-clipPath-reference-chain.svg
load zero-size-image.svg
asserts-if(stylo,2) load 1322286.html # bug 1324669
load 1329849-1.svg
load 1329849-2.svg
load 1329849-3.svg
load 1329849-4.svg
load 1329849-5.svg
load 1329849-6.svg

Просмотреть файл

@ -517,6 +517,12 @@ nsSVGFELightingElement::AddLightingAttributes(FilterPrimitiveDescription aDescri
Size kernelUnitLength =
GetKernelUnitLength(aInstance, &mNumberPairAttributes[KERNEL_UNIT_LENGTH]);
if (kernelUnitLength.width <= 0 || kernelUnitLength.height <= 0) {
// According to spec, A negative or zero value is an error. See link below for details.
// https://www.w3.org/TR/SVG/filters.html#feSpecularLightingKernelUnitLengthAttribute
return FilterPrimitiveDescription(PrimitiveType::Empty);
}
FilterPrimitiveDescription& descr = aDescription;
descr.Attributes().Set(eLightingLight, ComputeLightAttributes(aInstance));
descr.Attributes().Set(eLightingSurfaceScale, surfaceScale);

Просмотреть файл

@ -24,9 +24,14 @@ class ServiceWorkerRegistrarTest : public ServiceWorkerRegistrar
public:
ServiceWorkerRegistrarTest()
{
#if defined(DEBUG) || !defined(RELEASE_OR_BETA)
nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
getter_AddRefs(mProfileDir));
MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv));
#else
NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
getter_AddRefs(mProfileDir));
#endif
MOZ_DIAGNOSTIC_ASSERT(mProfileDir);
}

Просмотреть файл

@ -89,6 +89,7 @@ nsXBLPrototypeHandler::nsXBLPrototypeHandler(const char16_t* aEvent,
uint32_t aLineNumber)
: mHandlerText(nullptr),
mLineNumber(aLineNumber),
mReserved(false),
mNextHandler(nullptr),
mPrototypeBinding(aBinding)
{
@ -99,9 +100,10 @@ nsXBLPrototypeHandler::nsXBLPrototypeHandler(const char16_t* aEvent,
aGroup, aPreventDefault, aAllowUntrusted);
}
nsXBLPrototypeHandler::nsXBLPrototypeHandler(nsIContent* aHandlerElement)
nsXBLPrototypeHandler::nsXBLPrototypeHandler(nsIContent* aHandlerElement, bool aReserved)
: mHandlerElement(nullptr),
mLineNumber(0),
mReserved(aReserved),
mNextHandler(nullptr),
mPrototypeBinding(nullptr)
{
@ -114,6 +116,7 @@ nsXBLPrototypeHandler::nsXBLPrototypeHandler(nsIContent* aHandlerElement)
nsXBLPrototypeHandler::nsXBLPrototypeHandler(nsXBLPrototypeBinding* aBinding)
: mHandlerText(nullptr),
mLineNumber(0),
mReserved(false),
mNextHandler(nullptr),
mPrototypeBinding(aBinding)
{

Просмотреть файл

@ -83,7 +83,7 @@ public:
uint32_t aLineNumber);
// This constructor is used only by XUL key handlers (e.g., <key>)
explicit nsXBLPrototypeHandler(nsIContent* aKeyElement);
explicit nsXBLPrototypeHandler(nsIContent* aKeyElement, bool aReserved);
// This constructor is used for handlers loaded from the cache
explicit nsXBLPrototypeHandler(nsXBLPrototypeBinding* aBinding);
@ -116,6 +116,7 @@ public:
uint8_t GetPhase() { return mPhase; }
uint8_t GetType() { return mType; }
bool GetIsReserved() { return mReserved; }
nsXBLPrototypeHandler* GetNextHandler() { return mNextHandler; }
void SetNextHandler(nsXBLPrototypeHandler* aHandler) { mNextHandler = aHandler; }
@ -226,6 +227,8 @@ protected:
// stores whether or not we're a key code or char code.
// For mouse events, stores the clickCount.
bool mReserved; // <key> is reserved for chrome. Not used by handlers.
int32_t mKeyMask; // Which modifier keys this event handler expects to have down
// in order to be matched.

Просмотреть файл

@ -214,7 +214,9 @@ BuildHandlerChain(nsIContent* aContent, nsXBLPrototypeHandler** aResult)
valKey.IsEmpty() && valCharCode.IsEmpty() && valKeyCode.IsEmpty())
continue;
nsXBLPrototypeHandler* handler = new nsXBLPrototypeHandler(key);
bool reserved = key->AttrValueIs(kNameSpaceID_None, nsGkAtoms::reserved,
nsGkAtoms::_true, eCaseMatters);
nsXBLPrototypeHandler* handler = new nsXBLPrototypeHandler(key, reserved);
handler->SetNextHandler(*aResult);
*aResult = handler;
@ -706,18 +708,15 @@ nsXBLWindowKeyHandler::WalkHandlersAndExecute(
continue;
}
bool isReserved = false;
bool isReserved = handler->GetIsReserved();
if (aOutReservedForChrome) {
*aOutReservedForChrome = isReserved;
}
if (commandElement) {
if (aExecute && !IsExecutableElement(commandElement)) {
continue;
}
isReserved =
commandElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::reserved,
nsGkAtoms::_true, eCaseMatters);
if (aOutReservedForChrome) {
*aOutReservedForChrome = isReserved;
}
}
if (!aExecute) {

Просмотреть файл

@ -3482,6 +3482,9 @@ FilterNodeLightingSoftware<LightType, LightingType>::DoRender(const IntRect& aRe
CoordType aKernelUnitLengthX,
CoordType aKernelUnitLengthY)
{
MOZ_ASSERT(aKernelUnitLengthX > 0, "aKernelUnitLengthX can be a negative or zero value");
MOZ_ASSERT(aKernelUnitLengthY > 0, "aKernelUnitLengthY can be a negative or zero value");
IntRect srcRect = aRect;
IntSize size = aRect.Size();
srcRect.Inflate(ceil(float(aKernelUnitLengthX)),

Просмотреть файл

@ -765,6 +765,45 @@ BaselineCacheIRCompiler::emitStoreDynamicSlot()
return emitStoreSlotShared(false);
}
bool
BaselineCacheIRCompiler::emitStoreUnboxedProperty()
{
ObjOperandId objId = reader.objOperandId();
JSValueType fieldType = reader.valueType();
Address offsetAddr = stubAddress(reader.stubOffset());
// Allocate the fixed registers first. These need to be fixed for
// callTypeUpdateIC.
AutoStubFrame stubFrame(*this);
AutoScratchRegister scratch(allocator, masm, R1.scratchReg());
ValueOperand val = allocator.useFixedValueRegister(masm, reader.valOperandId(), R0);
Register obj = allocator.useRegister(masm, objId);
// We only need the type update IC if we are storing an object.
if (fieldType == JSVAL_TYPE_OBJECT) {
LiveGeneralRegisterSet saveRegs;
saveRegs.add(obj);
saveRegs.add(val);
if (!callTypeUpdateIC(stubFrame, obj, val, scratch, saveRegs))
return false;
}
masm.load32(offsetAddr, scratch);
BaseIndex fieldAddr(obj, scratch, TimesOne);
// Note that the storeUnboxedProperty call here is infallible, as the
// IR emitter is responsible for guarding on |val|'s type.
EmitUnboxedPreBarrierForBaseline(masm, fieldAddr, fieldType);
masm.storeUnboxedProperty(fieldAddr, fieldType,
ConstantOrRegister(TypedOrValueRegister(val)),
/* failure = */ nullptr);
if (UnboxedTypeNeedsPostBarrier(fieldType))
BaselineEmitPostWriteBarrierSlot(masm, obj, val, scratch, LiveGeneralRegisterSet(), cx_);
return true;
}
bool
BaselineCacheIRCompiler::emitTypeMonitorResult()
{
@ -965,7 +1004,7 @@ jit::AttachBaselineCacheIRStub(JSContext* cx, const CacheIRWriter& writer,
auto otherStub = iter->toCacheIR_Monitored();
if (otherStub->stubInfo() != stubInfo)
continue;
if (!writer.stubDataEquals(otherStub->stubDataStart()))
if (!writer.stubDataEqualsMaybeUpdate(otherStub->stubDataStart()))
continue;
break;
}
@ -975,7 +1014,7 @@ jit::AttachBaselineCacheIRStub(JSContext* cx, const CacheIRWriter& writer,
auto otherStub = iter->toCacheIR_Updated();
if (otherStub->stubInfo() != stubInfo)
continue;
if (!writer.stubDataEquals(otherStub->stubDataStart()))
if (!writer.stubDataEqualsMaybeUpdate(otherStub->stubDataStart()))
continue;
break;
}

Просмотреть файл

@ -292,8 +292,7 @@ DoTypeUpdateFallback(JSContext* cx, BaselineFrame* frame, ICUpdatedStub* stub, H
AddTypePropertyId(cx, obj, id, value);
break;
}
case ICStub::SetProp_NativeAdd:
case ICStub::SetProp_Unboxed: {
case ICStub::SetProp_NativeAdd: {
MOZ_ASSERT(obj->isNative() || obj->is<UnboxedPlainObject>());
jsbytecode* pc = stub->getChainFallback()->icEntry()->pc(script);
if (*pc == JSOP_SETALIASEDVAR || *pc == JSOP_INITALIASEDLEXICAL)
@ -1452,9 +1451,8 @@ BaselineScript::noteArrayWriteHole(uint32_t pcOffset)
// SetElem_DenseOrUnboxedArray
//
template <typename T>
void
EmitUnboxedPreBarrierForBaseline(MacroAssembler &masm, T address, JSValueType type)
EmitUnboxedPreBarrierForBaseline(MacroAssembler &masm, const BaseIndex& address, JSValueType type)
{
if (type == JSVAL_TYPE_OBJECT)
EmitPreBarrier(masm, address, MIRType::Object);
@ -2750,40 +2748,6 @@ TryAttachSetAccessorPropStub(JSContext* cx, HandleScript script, jsbytecode* pc,
return true;
}
static bool
TryAttachUnboxedSetPropStub(JSContext* cx, HandleScript script,
ICSetProp_Fallback* stub, HandleId id,
HandleObject obj, HandleValue rhs, bool* attached)
{
MOZ_ASSERT(!*attached);
if (!cx->runtime()->jitSupportsFloatingPoint)
return true;
if (!obj->is<UnboxedPlainObject>())
return true;
const UnboxedLayout::Property* property = obj->as<UnboxedPlainObject>().layout().lookup(id);
if (!property)
return true;
ICSetProp_Unboxed::Compiler compiler(cx, obj->group(),
property->offset + UnboxedPlainObject::offsetOfData(),
property->type);
ICUpdatedStub* newStub = compiler.getStub(compiler.getStubSpace(script));
if (!newStub)
return false;
if (compiler.needsUpdateStubs() && !newStub->addUpdateStubForValue(cx, script, obj, id, rhs))
return false;
stub->addNewStub(newStub);
StripPreliminaryObjectStubs(cx, stub);
*attached = true;
return true;
}
static bool
TryAttachTypedObjectSetPropStub(JSContext* cx, HandleScript script,
ICSetProp_Fallback* stub, HandleId id,
@ -2968,15 +2932,6 @@ DoSetPropFallback(JSContext* cx, BaselineFrame* frame, ICSetProp_Fallback* stub_
if (attached)
return true;
if (!attached &&
lhs.isObject() &&
!TryAttachUnboxedSetPropStub(cx, script, stub, id, obj, rhs, &attached))
{
return false;
}
if (attached)
return true;
if (!attached &&
lhs.isObject() &&
!TryAttachTypedObjectSetPropStub(cx, script, stub, id, obj, rhs, &attached))
@ -3242,67 +3197,6 @@ ICSetPropNativeAddCompiler::generateStubCode(MacroAssembler& masm)
return true;
}
bool
ICSetProp_Unboxed::Compiler::generateStubCode(MacroAssembler& masm)
{
MOZ_ASSERT(engine_ == Engine::Baseline);
Label failure;
// Guard input is an object.
masm.branchTestObject(Assembler::NotEqual, R0, &failure);
AllocatableGeneralRegisterSet regs(availableGeneralRegs(2));
Register scratch = regs.takeAny();
// Unbox and group guard.
Register object = masm.extractObject(R0, ExtractTemp0);
masm.loadPtr(Address(ICStubReg, ICSetProp_Unboxed::offsetOfGroup()), scratch);
masm.branchPtr(Assembler::NotEqual, Address(object, JSObject::offsetOfGroup()), scratch,
&failure);
if (needsUpdateStubs()) {
// Stow both R0 and R1 (object and value).
EmitStowICValues(masm, 2);
// Move RHS into R0 for TypeUpdate check.
masm.moveValue(R1, R0);
// Call the type update stub.
if (!callTypeUpdateIC(masm, sizeof(Value)))
return false;
// Unstow R0 and R1 (object and key)
EmitUnstowICValues(masm, 2);
// The TypeUpdate IC may have smashed object. Rederive it.
masm.unboxObject(R0, object);
// Trigger post barriers here on the values being written. Fields which
// objects can be written to also need update stubs.
LiveGeneralRegisterSet saveRegs;
saveRegs.add(R0);
saveRegs.add(R1);
saveRegs.addUnchecked(object);
saveRegs.add(ICStubReg);
BaselineEmitPostWriteBarrierSlot(masm, object, R1, scratch, saveRegs, cx);
}
// Compute the address being written to.
masm.load32(Address(ICStubReg, ICSetProp_Unboxed::offsetOfFieldOffset()), scratch);
BaseIndex address(object, scratch, TimesOne);
EmitUnboxedPreBarrierForBaseline(masm, address, fieldType_);
masm.storeUnboxedProperty(address, fieldType_,
ConstantOrRegister(TypedOrValueRegister(R1)), &failure);
EmitReturnFromIC(masm);
masm.bind(&failure);
EmitStubGuardFailure(masm);
return true;
}
bool
ICSetProp_TypedObject::Compiler::generateStubCode(MacroAssembler& masm)
{

Просмотреть файл

@ -1235,70 +1235,6 @@ class ICSetPropNativeAddCompiler : public ICStubCompiler
ICUpdatedStub* getStub(ICStubSpace* space);
};
class ICSetProp_Unboxed : public ICUpdatedStub
{
friend class ICStubSpace;
GCPtrObjectGroup group_;
uint32_t fieldOffset_;
ICSetProp_Unboxed(JitCode* stubCode, ObjectGroup* group, uint32_t fieldOffset)
: ICUpdatedStub(ICStub::SetProp_Unboxed, stubCode),
group_(group),
fieldOffset_(fieldOffset)
{
(void) fieldOffset_; // Silence clang warning
}
public:
GCPtrObjectGroup& group() {
return group_;
}
static size_t offsetOfGroup() {
return offsetof(ICSetProp_Unboxed, group_);
}
static size_t offsetOfFieldOffset() {
return offsetof(ICSetProp_Unboxed, fieldOffset_);
}
class Compiler : public ICStubCompiler {
protected:
RootedObjectGroup group_;
uint32_t fieldOffset_;
JSValueType fieldType_;
MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm);
virtual int32_t getKey() const {
return static_cast<int32_t>(engine_) |
(static_cast<int32_t>(kind) << 1) |
(static_cast<int32_t>(fieldType_) << 17);
}
public:
Compiler(JSContext* cx, ObjectGroup* group, uint32_t fieldOffset,
JSValueType fieldType)
: ICStubCompiler(cx, ICStub::SetProp_Unboxed, Engine::Baseline),
group_(cx, group),
fieldOffset_(fieldOffset),
fieldType_(fieldType)
{}
ICUpdatedStub* getStub(ICStubSpace* space) {
ICUpdatedStub* stub = newStub<ICSetProp_Unboxed>(space, getStubCode(), group_,
fieldOffset_);
if (!stub || !stub->initUpdatingChain(cx, space))
return nullptr;
return stub;
}
bool needsUpdateStubs() {
return fieldType_ == JSVAL_TYPE_OBJECT;
}
};
};
class ICSetProp_TypedObject : public ICUpdatedStub
{
friend class ICStubSpace;
@ -2595,6 +2531,9 @@ IsCacheableDOMProxy(JSObject* obj)
struct IonOsrTempData;
void EmitUnboxedPreBarrierForBaseline(MacroAssembler &masm, const BaseIndex& address,
JSValueType type);
} // namespace jit
} // namespace js

Просмотреть файл

@ -70,7 +70,6 @@ namespace jit {
\
_(SetProp_Fallback) \
_(SetProp_NativeAdd) \
_(SetProp_Unboxed) \
_(SetProp_TypedObject) \
_(SetProp_CallScripted) \
_(SetProp_CallNative) \

Просмотреть файл

@ -214,6 +214,42 @@ GetCacheIRReceiverForNativeSetSlot(ICCacheIR_Updated* stub, ReceiverGuard* recei
return true;
}
static bool
GetCacheIRReceiverForUnboxedProperty(ICCacheIR_Updated* stub, ReceiverGuard* receiver)
{
// We match:
//
// GuardIsObject 0
// GuardGroup 0
// GuardType 1 type | GuardIsObjectOrNull 1
// StoreUnboxedProperty 0
*receiver = ReceiverGuard();
CacheIRReader reader(stub->stubInfo());
ObjOperandId objId = ObjOperandId(0);
ValOperandId rhsId = ValOperandId(1);
if (!reader.matchOp(CacheOp::GuardIsObject, objId))
return false;
if (!reader.matchOp(CacheOp::GuardGroup, objId))
return false;
ObjectGroup* group = stub->stubInfo()->getStubField<ObjectGroup*>(stub, reader.stubOffset());
if (reader.matchOp(CacheOp::GuardType, rhsId)) {
reader.valueType(); // Skip.
} else {
if (!reader.matchOp(CacheOp::GuardIsObjectOrNull, rhsId))
return false;
}
if (!reader.matchOp(CacheOp::StoreUnboxedProperty))
return false;
*receiver = ReceiverGuard(group, nullptr);
return true;
}
bool
BaselineInspector::maybeInfoForPropertyOp(jsbytecode* pc, ReceiverVector& receivers,
ObjectGroupVector& convertUnboxedGroups)
@ -243,12 +279,12 @@ BaselineInspector::maybeInfoForPropertyOp(jsbytecode* pc, ReceiverVector& receiv
return true;
}
} else if (stub->isCacheIR_Updated()) {
if (!GetCacheIRReceiverForNativeSetSlot(stub->toCacheIR_Updated(), &receiver)) {
if (!GetCacheIRReceiverForNativeSetSlot(stub->toCacheIR_Updated(), &receiver) &&
!GetCacheIRReceiverForUnboxedProperty(stub->toCacheIR_Updated(), &receiver))
{
receivers.clear();
return true;
}
} else if (stub->isSetProp_Unboxed()) {
receiver = ReceiverGuard(stub->toSetProp_Unboxed()->group(), nullptr);
} else {
receivers.clear();
return true;

Просмотреть файл

@ -679,9 +679,11 @@ GetPropIRGenerator::tryAttachDOMProxyUnshadowed(HandleObject obj, ObjOperandId o
MOZ_ASSERT(IsCacheableDOMProxy(obj));
RootedObject checkObj(cx_, obj->staticPrototype());
if (!checkObj)
return false;
RootedNativeObject holder(cx_);
RootedShape shape(cx_);
NativeGetPropCacheability canCache = CanAttachNativeGetProp(cx_, checkObj, id, &holder, &shape,
pc_, engine_, canAttachGetter_,
isTemporarilyUnoptimizable_);
@ -1563,6 +1565,8 @@ SetPropIRGenerator::tryAttachStub()
return true;
if (tryAttachUnboxedExpandoSetSlot(obj, objId, id, rhsValId))
return true;
if (tryAttachUnboxedProperty(obj, objId, id, rhsValId))
return true;
}
return false;
}
@ -1661,3 +1665,37 @@ SetPropIRGenerator::tryAttachUnboxedExpandoSetSlot(HandleObject obj, ObjOperandI
EmitStoreSlotAndReturn(writer, expandoId, expando, propShape, rhsId);
return true;
}
static void
EmitGuardUnboxedPropertyType(CacheIRWriter& writer, JSValueType propType, ValOperandId valId)
{
if (propType == JSVAL_TYPE_OBJECT) {
// Unboxed objects store NullValue as nullptr object.
writer.guardIsObjectOrNull(valId);
} else {
writer.guardType(valId, propType);
}
}
bool
SetPropIRGenerator::tryAttachUnboxedProperty(HandleObject obj, ObjOperandId objId, HandleId id,
ValOperandId rhsId)
{
if (!obj->is<UnboxedPlainObject>() || !cx_->runtime()->jitSupportsFloatingPoint)
return false;
const UnboxedLayout::Property* property = obj->as<UnboxedPlainObject>().layout().lookup(id);
if (!property)
return false;
writer.guardGroup(objId, obj->group());
EmitGuardUnboxedPropertyType(writer, property->type, rhsId);
writer.storeUnboxedProperty(objId, property->type,
UnboxedPlainObject::offsetOfData() + property->offset,
rhsId);
writer.returnFromIC();
setUpdateStubInfo(id);
preliminaryObjectAction_ = PreliminaryObjectAction::Unlink;
return true;
}

Просмотреть файл

@ -139,6 +139,7 @@ enum class CacheKind : uint8_t
#define CACHE_IR_OPS(_) \
_(GuardIsObject) \
_(GuardIsObjectOrNull) \
_(GuardIsString) \
_(GuardIsSymbol) \
_(GuardIsInt32Index) \
@ -171,6 +172,7 @@ enum class CacheKind : uint8_t
\
_(StoreFixedSlot) \
_(StoreDynamicSlot) \
_(StoreUnboxedProperty) \
\
/* The *Result ops load a value into the cache's result register. */ \
_(LoadFixedSlotResult) \
@ -223,6 +225,7 @@ class StubField
// These fields take up 64 bits on all platforms.
RawInt64,
First64BitType = RawInt64,
DOMExpandoGeneration,
Value,
Limit
@ -378,7 +381,7 @@ class MOZ_RAII CacheIRWriter : public JS::CustomAutoRooter
return stubDataSize_;
}
void copyStubData(uint8_t* dest) const;
bool stubDataEquals(const uint8_t* stubData) const;
bool stubDataEqualsMaybeUpdate(uint8_t* stubData) const;
bool operandIsDead(uint32_t operandId, uint32_t currentInstruction) const {
if (operandId >= operandLastUsed_.length())
@ -428,6 +431,9 @@ class MOZ_RAII CacheIRWriter : public JS::CustomAutoRooter
static_assert(sizeof(type) == sizeof(uint8_t), "JSValueType should fit in a byte");
buffer_.writeByte(uint32_t(type));
}
void guardIsObjectOrNull(ValOperandId val) {
writeOpWithOperandId(CacheOp::GuardIsObjectOrNull, val);
}
void guardShape(ObjOperandId obj, Shape* shape) {
writeOpWithOperandId(CacheOp::GuardShape, obj);
addStubField(uintptr_t(shape), StubField::Type::Shape);
@ -540,7 +546,7 @@ class MOZ_RAII CacheIRWriter : public JS::CustomAutoRooter
ValOperandId res(nextOperandId_++);
writeOpWithOperandId(CacheOp::LoadDOMExpandoValueGuardGeneration, obj);
addStubField(uintptr_t(expandoAndGeneration), StubField::Type::RawWord);
addStubField(expandoAndGeneration->generation, StubField::Type::RawInt64);
addStubField(expandoAndGeneration->generation, StubField::Type::DOMExpandoGeneration);
writeOperandId(res);
return res;
}
@ -561,6 +567,14 @@ class MOZ_RAII CacheIRWriter : public JS::CustomAutoRooter
addStubField(offset, StubField::Type::RawWord);
writeOperandId(rhs);
}
void storeUnboxedProperty(ObjOperandId obj, JSValueType type, size_t offset,
ValOperandId rhs)
{
writeOpWithOperandId(CacheOp::StoreUnboxedProperty, obj);
buffer_.writeByte(uint32_t(type));
addStubField(offset, StubField::Type::RawWord);
writeOperandId(rhs);
}
void loadUndefinedResult() {
writeOp(CacheOp::LoadUndefinedResult);
@ -864,6 +878,8 @@ class MOZ_RAII SetPropIRGenerator : public IRGenerator
ValOperandId rhsId);
bool tryAttachUnboxedExpandoSetSlot(HandleObject obj, ObjOperandId objId, HandleId id,
ValOperandId rhsId);
bool tryAttachUnboxedProperty(HandleObject obj, ObjOperandId objId, HandleId id,
ValOperandId rhsId);
public:
SetPropIRGenerator(JSContext* cx, jsbytecode* pc, CacheKind cacheKind,

Просмотреть файл

@ -673,6 +673,7 @@ CacheIRStubInfo::copyStubData(ICStub* src, ICStub* dest) const
*reinterpret_cast<uintptr_t*>(srcBytes + offset);
break;
case StubField::Type::RawInt64:
case StubField::Type::DOMExpandoGeneration:
*reinterpret_cast<uint64_t*>(destBytes + offset) =
*reinterpret_cast<uint64_t*>(srcBytes + offset);
break;
@ -768,6 +769,7 @@ CacheIRWriter::copyStubData(uint8_t* dest) const
InitGCPtr<jsid>(destWords, field.asWord());
break;
case StubField::Type::RawInt64:
case StubField::Type::DOMExpandoGeneration:
*reinterpret_cast<uint64_t*>(destWords) = field.asInt64();
break;
case StubField::Type::Value:
@ -791,6 +793,7 @@ jit::TraceCacheIRStub(JSTracer* trc, T* stub, const CacheIRStubInfo* stubInfo)
switch (fieldType) {
case StubField::Type::RawWord:
case StubField::Type::RawInt64:
case StubField::Type::DOMExpandoGeneration:
break;
case StubField::Type::Shape:
TraceNullableEdge(trc, &stubInfo->getStubField<T, Shape*>(stub, offset),
@ -834,12 +837,19 @@ template
void jit::TraceCacheIRStub(JSTracer* trc, IonICStub* stub, const CacheIRStubInfo* stubInfo);
bool
CacheIRWriter::stubDataEquals(const uint8_t* stubData) const
CacheIRWriter::stubDataEqualsMaybeUpdate(uint8_t* stubData) const
{
MOZ_ASSERT(!failed());
const uintptr_t* stubDataWords = reinterpret_cast<const uintptr_t*>(stubData);
// If DOMExpandoGeneration fields are different but all other stub fields
// are exactly the same, we overwrite the old stub data instead of attaching
// a new stub, as the old stub is never going to succeed. This works because
// even Ion stubs read the DOMExpandoGeneration field from the stub instead
// of baking it in.
bool expandoGenerationIsDifferent = false;
for (const StubField& field : stubFields_) {
if (field.sizeIsWord()) {
if (field.asWord() != *stubDataWords)
@ -848,11 +858,17 @@ CacheIRWriter::stubDataEquals(const uint8_t* stubData) const
continue;
}
if (field.asInt64() != *reinterpret_cast<const uint64_t*>(stubDataWords))
return false;
if (field.asInt64() != *reinterpret_cast<const uint64_t*>(stubDataWords)) {
if (field.type() != StubField::Type::DOMExpandoGeneration)
return false;
expandoGenerationIsDifferent = true;
}
stubDataWords += sizeof(uint64_t) / sizeof(uintptr_t);
}
if (expandoGenerationIsDifferent)
copyStubData(stubData);
return true;
}
@ -1040,6 +1056,26 @@ CacheIRCompiler::emitGuardIsObject()
return true;
}
bool
CacheIRCompiler::emitGuardIsObjectOrNull()
{
ValOperandId inputId = reader.valOperandId();
JSValueType knownType = allocator.knownType(inputId);
if (knownType == JSVAL_TYPE_OBJECT || knownType == JSVAL_TYPE_NULL)
return true;
ValueOperand input = allocator.useValueRegister(masm, inputId);
FailurePath* failure;
if (!addFailurePath(&failure))
return false;
Label done;
masm.branchTestObject(Assembler::Equal, input, &done);
masm.branchTestNull(Assembler::NotEqual, input, failure->label());
masm.bind(&done);
return true;
}
bool
CacheIRCompiler::emitGuardIsString()
{
@ -1144,6 +1180,9 @@ CacheIRCompiler::emitGuardType()
case JSVAL_TYPE_SYMBOL:
masm.branchTestSymbol(Assembler::NotEqual, input, failure->label());
break;
case JSVAL_TYPE_INT32:
masm.branchTestInt32(Assembler::NotEqual, input, failure->label());
break;
case JSVAL_TYPE_DOUBLE:
masm.branchTestNumber(Assembler::NotEqual, input, failure->label());
break;

Просмотреть файл

@ -16,6 +16,7 @@ namespace jit {
// BaselineCacheIRCompiler and IonCacheIRCompiler.
#define CACHE_IR_SHARED_OPS(_) \
_(GuardIsObject) \
_(GuardIsObjectOrNull) \
_(GuardIsString) \
_(GuardIsSymbol) \
_(GuardIsInt32Index) \

Просмотреть файл

@ -4,6 +4,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/DebugOnly.h"
#include "jit/CacheIRCompiler.h"
#include "jit/IonCaches.h"
#include "jit/IonIC.h"
@ -17,6 +19,8 @@
using namespace js;
using namespace js::jit;
using mozilla::DebugOnly;
namespace js {
namespace jit {
@ -26,11 +30,13 @@ class MOZ_RAII IonCacheIRCompiler : public CacheIRCompiler
public:
friend class AutoSaveLiveRegisters;
IonCacheIRCompiler(JSContext* cx, const CacheIRWriter& writer, IonIC* ic, IonScript* ionScript)
IonCacheIRCompiler(JSContext* cx, const CacheIRWriter& writer, IonIC* ic, IonScript* ionScript,
IonICStub* stub)
: CacheIRCompiler(cx, writer, Mode::Ion),
writer_(writer),
ic_(ic),
ionScript_(ionScript),
stub_(stub),
nextStubField_(0),
#ifdef DEBUG
calledPrepareVMCall_(false),
@ -42,13 +48,16 @@ class MOZ_RAII IonCacheIRCompiler : public CacheIRCompiler
}
MOZ_MUST_USE bool init();
JitCode* compile(IonICStub* stub);
JitCode* compile();
private:
const CacheIRWriter& writer_;
IonIC* ic_;
IonScript* ionScript_;
// The stub we're generating code for.
IonICStub* stub_;
CodeOffsetJump rejoinOffset_;
Vector<CodeOffset, 4, SystemAllocPolicy> nextCodeOffsets_;
Maybe<LiveRegisterSet> liveRegs_;
@ -100,6 +109,14 @@ class MOZ_RAII IonCacheIRCompiler : public CacheIRCompiler
return (T)readStubInt64(offset, StubField::Type::RawInt64);
}
uint64_t* expandoGenerationStubFieldPtr(uint32_t offset) {
DebugOnly<uint64_t> generation =
readStubInt64(offset, StubField::Type::DOMExpandoGeneration);
uint64_t* ptr = reinterpret_cast<uint64_t*>(stub_->stubDataStart() + offset);
MOZ_ASSERT(*ptr == generation);
return ptr;
}
void prepareVMCall(MacroAssembler& masm);
MOZ_MUST_USE bool callVM(MacroAssembler& masm, const VMFunction& fun);
@ -360,7 +377,7 @@ IonCacheIRCompiler::init()
}
JitCode*
IonCacheIRCompiler::compile(IonICStub* stub)
IonCacheIRCompiler::compile()
{
masm.setFramePushed(ionScript_->frameSize());
if (cx_->spsProfiler.enabled())
@ -412,7 +429,7 @@ IonCacheIRCompiler::compile(IonICStub* stub)
for (CodeOffset offset : nextCodeOffsets_) {
Assembler::PatchDataWithValueCheck(CodeLocationLabel(newStubCode, offset),
ImmPtr(stub->nextCodeRawPtr()),
ImmPtr(stub_->nextCodeRawPtr()),
ImmPtr((void*)-1));
}
if (stubJitCodeOffset_) {
@ -832,6 +849,12 @@ IonCacheIRCompiler::emitStoreDynamicSlot()
MOZ_CRASH("Baseline-specific op");
}
bool
IonCacheIRCompiler::emitStoreUnboxedProperty()
{
MOZ_CRASH("Baseline-specific op");
}
bool
IonCacheIRCompiler::emitLoadTypedObjectResult()
{
@ -908,17 +931,18 @@ IonCacheIRCompiler::emitLoadDOMExpandoValueGuardGeneration()
Register obj = allocator.useRegister(masm, reader.objOperandId());
ExpandoAndGeneration* expandoAndGeneration =
rawWordStubField<ExpandoAndGeneration*>(reader.stubOffset());
uint64_t generation = rawInt64StubField<uint64_t>(reader.stubOffset());
uint64_t* generationFieldPtr = expandoGenerationStubFieldPtr(reader.stubOffset());
AutoScratchRegister scratch(allocator, masm);
AutoScratchRegister scratch1(allocator, masm);
AutoScratchRegister scratch2(allocator, masm);
ValueOperand output = allocator.defineValueRegister(masm, reader.valOperandId());
FailurePath* failure;
if (!addFailurePath(&failure))
return false;
masm.loadPtr(Address(obj, ProxyObject::offsetOfValues()), scratch);
Address expandoAddr(scratch, ProxyObject::offsetOfExtraSlotInValues(GetDOMProxyExpandoSlot()));
masm.loadPtr(Address(obj, ProxyObject::offsetOfValues()), scratch1);
Address expandoAddr(scratch1, ProxyObject::offsetOfExtraSlotInValues(GetDOMProxyExpandoSlot()));
// Guard the ExpandoAndGeneration* matches the proxy's ExpandoAndGeneration.
masm.loadValue(expandoAddr, output);
@ -927,9 +951,11 @@ IonCacheIRCompiler::emitLoadDOMExpandoValueGuardGeneration()
// Guard expandoAndGeneration->generation matches the expected generation.
masm.movePtr(ImmPtr(expandoAndGeneration), output.scratchReg());
masm.movePtr(ImmPtr(generationFieldPtr), scratch1);
masm.branch64(Assembler::NotEqual,
Address(output.scratchReg(), ExpandoAndGeneration::offsetOfGeneration()),
Imm64(generation),
Address(scratch1, 0),
scratch2,
failure->label());
// Load expandoAndGeneration->expando into the output Value register.
@ -950,11 +976,6 @@ IonIC::attachCacheIRStub(JSContext* cx, const CacheIRWriter& writer, CacheKind k
if (writer.failed() || !outerScript->hasIonScript())
return false;
JitContext jctx(cx, nullptr);
IonCacheIRCompiler compiler(cx, writer, this, outerScript->ionScript());
if (!compiler.init())
return false;
JitZone* jitZone = cx->zone()->jitZone();
uint32_t stubDataOffset = sizeof(IonICStub);
@ -988,7 +1009,7 @@ IonIC::attachCacheIRStub(JSContext* cx, const CacheIRWriter& writer, CacheKind k
for (IonICStub* stub = firstStub_; stub; stub = stub->next()) {
if (stub->stubInfo() != stubInfo)
continue;
if (!writer.stubDataEquals(stub->stubDataStart()))
if (!writer.stubDataEqualsMaybeUpdate(stub->stubDataStart()))
continue;
return true;
}
@ -1006,12 +1027,16 @@ IonIC::attachCacheIRStub(JSContext* cx, const CacheIRWriter& writer, CacheKind k
return false;
IonICStub* newStub = new(newStubMem) IonICStub(fallbackLabel_.raw(), stubInfo);
writer.copyStubData(newStub->stubDataStart());
JitCode* code = compiler.compile(newStub);
if (!code)
JitContext jctx(cx, nullptr);
IonCacheIRCompiler compiler(cx, writer, this, outerScript->ionScript(), newStub);
if (!compiler.init())
return false;
writer.copyStubData(newStub->stubDataStart());
JitCode* code = compiler.compile();
if (!code)
return false;
attachStub(newStub, code);
return true;

Просмотреть файл

@ -372,11 +372,6 @@ ICStub::trace(JSTracer* trc)
}
break;
}
case ICStub::SetProp_Unboxed: {
ICSetProp_Unboxed* propStub = toSetProp_Unboxed();
TraceEdge(trc, &propStub->group(), "baseline-setprop-unboxed-stub-group");
break;
}
case ICStub::SetProp_TypedObject: {
ICSetProp_TypedObject* propStub = toSetProp_TypedObject();
TraceEdge(trc, &propStub->shape(), "baseline-setprop-typedobject-stub-shape");

Просмотреть файл

@ -171,6 +171,18 @@ ABIArgGenerator::next(MIRType type)
return softNext(type);
}
bool
js::jit::IsUnaligned(const wasm::MemoryAccessDesc& access)
{
if (!access.align())
return false;
if (access.type() == Scalar::Float64 && access.align() >= 4)
return false;
return access.align() < access.byteSize();
}
// Encode a standard register when it is being used as src1, the dest, and an
// extra register. These should never be called with an InvalidReg.
uint32_t

Просмотреть файл

@ -108,6 +108,8 @@ class ABIArgGenerator
uint32_t stackBytesConsumedSoFar() const { return stackOffset_; }
};
bool IsUnaligned(const wasm::MemoryAccessDesc& access);
static constexpr Register ABINonArgReg0 = r4;
static constexpr Register ABINonArgReg1 = r5;
static constexpr Register ABINonArgReg2 = r6;

Просмотреть файл

@ -613,7 +613,7 @@ LIRGeneratorARM::visitWasmLoad(MWasmLoad* ins)
LAllocation ptr = useRegisterAtStart(base);
if (ins->access().isUnaligned()) {
if (IsUnaligned(ins->access())) {
// Unaligned access expected! Revert to a byte load.
LDefinition ptrCopy = tempCopy(base, 0);
@ -662,7 +662,7 @@ LIRGeneratorARM::visitWasmStore(MWasmStore* ins)
LAllocation ptr = useRegisterAtStart(base);
if (ins->access().isUnaligned()) {
if (IsUnaligned(ins->access())) {
// Unaligned access expected! Revert to a byte store.
LDefinition ptrCopy = tempCopy(base, 0);

Просмотреть файл

@ -1524,6 +1524,12 @@ class InstGS : public Instruction
{ }
};
inline bool
IsUnaligned(const wasm::MemoryAccessDesc& access)
{
return access.align() && access.align() < access.byteSize();
}
} // namespace jit
} // namespace js

Просмотреть файл

@ -1915,7 +1915,7 @@ CodeGeneratorMIPSShared::emitWasmLoad(T* lir)
BaseIndex address(HeapReg, ptr, TimesOne);
if (mir->access().isUnaligned()) {
if (IsUnaligned(mir->access())) {
Register temp = ToRegister(lir->getTemp(1));
if (isFloat) {
@ -2000,7 +2000,7 @@ CodeGeneratorMIPSShared::emitWasmStore(T* lir)
BaseIndex address(HeapReg, ptr, TimesOne);
if (mir->access().isUnaligned()) {
if (IsUnaligned(mir->access())) {
Register temp = ToRegister(lir->getTemp(1));
if (isFloat) {

Просмотреть файл

@ -324,7 +324,7 @@ LIRGeneratorMIPSShared::visitWasmLoad(MWasmLoad* ins)
LAllocation ptr = useRegisterAtStart(base);
if (ins->access().isUnaligned()) {
if (IsUnaligned(ins->access())) {
if (ins->type() == MIRType::Int64) {
auto* lir = new(alloc()) LWasmUnalignedLoadI64(ptr, temp());
if (ins->access().offset())
@ -367,7 +367,7 @@ LIRGeneratorMIPSShared::visitWasmStore(MWasmStore* ins)
MDefinition* value = ins->value();
LAllocation baseAlloc = useRegisterAtStart(base);
if (ins->access().isUnaligned()) {
if (IsUnaligned(ins->access())) {
if (ins->type() == MIRType::Int64) {
LInt64Allocation valueAlloc = useInt64RegisterAtStart(value);
auto* lir = new(alloc()) LWasmUnalignedStoreI64(baseAlloc, valueAlloc, temp());

Просмотреть файл

@ -490,7 +490,7 @@ CodeGeneratorMIPS::emitWasmLoadI64(T* lir)
masm.memoryBarrier(mir->access().barrierBefore());
MOZ_ASSERT(INT64LOW_OFFSET == 0);
if (mir->access().isUnaligned()) {
if (IsUnaligned(mir->access())) {
Register temp = ToRegister(lir->getTemp(1));
if (byteSize <= 4) {
@ -577,7 +577,7 @@ CodeGeneratorMIPS::emitWasmStoreI64(T* lir)
masm.memoryBarrier(mir->access().barrierBefore());
MOZ_ASSERT(INT64LOW_OFFSET == 0);
if (mir->access().isUnaligned()) {
if (IsUnaligned(mir->access())) {
Register temp = ToRegister(lir->getTemp(1));
if (byteSize <= 4) {

Просмотреть файл

@ -449,7 +449,7 @@ CodeGeneratorMIPS64::emitWasmLoadI64(T* lir)
masm.memoryBarrier(mir->access().barrierBefore());
if (mir->access().isUnaligned()) {
if (IsUnaligned(mir->access())) {
Register temp = ToRegister(lir->getTemp(1));
masm.ma_load_unaligned(ToOutRegister64(lir).reg, BaseIndex(HeapReg, ptr, TimesOne),
@ -514,7 +514,7 @@ CodeGeneratorMIPS64::emitWasmStoreI64(T* lir)
masm.memoryBarrier(mir->access().barrierBefore());
if (mir->access().isUnaligned()) {
if (IsUnaligned(mir->access())) {
Register temp = ToRegister(lir->getTemp(1));
masm.ma_store_unaligned(ToRegister64(lir->value()).reg, BaseIndex(HeapReg, ptr, TimesOne),

Просмотреть файл

@ -729,7 +729,6 @@ class MemoryAccessDesc
TrapOffset trapOffset() const { return *trapOffset_; }
bool isAtomic() const { return (barrierBefore_ | barrierAfter_) != jit::MembarNobits; }
bool isSimd() const { return Scalar::isSimdType(type_); }
bool isUnaligned() const { return align() && align() < byteSize(); }
bool isPlainAsmJS() const { return !hasTrap(); }
void clearOffset() { offset_ = 0; }

Просмотреть файл

@ -146,10 +146,10 @@ static const size_t gMaxStackSize = 128 * sizeof(size_t) * 1024;
*/
static const TimeDuration MAX_TIMEOUT_INTERVAL = TimeDuration::FromSeconds(1800.0);
#ifdef NIGHTLY_BUILD
# define SHARED_MEMORY_DEFAULT 1
#else
#ifdef RELEASE_OR_BETA
# define SHARED_MEMORY_DEFAULT 0
#else
# define SHARED_MEMORY_DEFAULT 1
#endif
using JobQueue = GCVector<JSObject*, 0, SystemAllocPolicy>;

Просмотреть файл

@ -1649,4 +1649,6 @@ function test(sharedMem) {
}
test(false);
test(true);
if (this.SharedArrayBuffer)
test(true);

Просмотреть файл

@ -3399,7 +3399,7 @@ class BaseCompiler
// This is the temp register passed as the last argument to load()
MOZ_MUST_USE size_t loadTemps(MemoryAccessDesc& access) {
#if defined(JS_CODEGEN_ARM)
if (access.isUnaligned()) {
if (IsUnaligned(access)) {
switch (access.type()) {
case Scalar::Float32:
return 2;
@ -3460,7 +3460,7 @@ class BaseCompiler
masm.mov(ScratchRegX86, dest.i32());
}
#elif defined(JS_CODEGEN_ARM)
if (access.isUnaligned()) {
if (IsUnaligned(access)) {
switch (dest.tag) {
case AnyReg::I64:
masm.wasmUnalignedLoadI64(access, ptr, ptr, dest.i64(), tmp1);
@ -3492,7 +3492,7 @@ class BaseCompiler
MOZ_MUST_USE size_t storeTemps(MemoryAccessDesc& access) {
#if defined(JS_CODEGEN_ARM)
if (access.isUnaligned()) {
if (IsUnaligned(access)) {
// See comment in store() about how this temp could be avoided for
// unaligned i8/i16/i32 stores with some restructuring elsewhere.
return 1;
@ -3547,7 +3547,7 @@ class BaseCompiler
masm.wasmStore(access, value, dstAddr);
}
#elif defined(JS_CODEGEN_ARM)
if (access.isUnaligned()) {
if (IsUnaligned(access)) {
// TODO / OPTIMIZE (bug 1331264): We perform the copy on the i32
// path (and allocate the temp for the copy) because we will destroy
// the value in the temp. We could avoid the copy and the temp if
@ -6515,7 +6515,7 @@ BaseCompiler::emitLoad(ValType type, Scalar::Type viewType)
case ValType::I32: {
RegI32 rp = popMemoryAccess(&access, &omitBoundsCheck);
#ifdef JS_CODEGEN_ARM
RegI32 rv = access.isUnaligned() ? needI32() : rp;
RegI32 rv = IsUnaligned(access) ? needI32() : rp;
#else
RegI32 rv = rp;
#endif

Просмотреть файл

@ -7257,25 +7257,31 @@ PresShell::HandleEvent(nsIFrame* aFrame,
nsPresContext* rootPresContext = framePresContext->GetRootPresContext();
NS_ASSERTION(rootPresContext == mPresContext->GetRootPresContext(),
"How did we end up outside the connected prescontext/viewmanager hierarchy?");
// If we aren't starting our event dispatch from the root frame of the root prescontext,
// then someone must be capturing the mouse. In that case we don't want to search the popup
// list.
if (framePresContext == rootPresContext &&
frame == mFrameConstructor->GetRootFrame()) {
nsIFrame* popupFrame =
nsLayoutUtils::GetPopupFrameForEventCoordinates(rootPresContext, aEvent);
// If a remote browser is currently capturing input break out if we
// detect a chrome generated popup.
if (popupFrame && capturingContent &&
EventStateManager::IsRemoteTarget(capturingContent)) {
capturingContent = nullptr;
}
// If the popupFrame is an ancestor of the 'frame', the frame should
// handle the event, otherwise, the popup should handle it.
if (popupFrame &&
!nsContentUtils::ContentIsCrossDocDescendantOf(
framePresContext->GetPresShell()->GetDocument(),
popupFrame->GetContent())) {
nsIFrame* popupFrame =
nsLayoutUtils::GetPopupFrameForEventCoordinates(rootPresContext, aEvent);
// If a remote browser is currently capturing input break out if we
// detect a chrome generated popup.
if (popupFrame && capturingContent &&
EventStateManager::IsRemoteTarget(capturingContent)) {
capturingContent = nullptr;
}
// If the popupFrame is an ancestor of the 'frame', the frame should
// handle the event, otherwise, the popup should handle it.
if (popupFrame &&
!nsContentUtils::ContentIsCrossDocDescendantOf(
framePresContext->GetPresShell()->GetDocument(),
popupFrame->GetContent())) {
// If we aren't starting our event dispatch from the root frame of the
// root prescontext, then someone must be capturing the mouse. In that
// case we only want to use the popup list if the capture is
// inside the popup.
if (framePresContext == rootPresContext &&
frame == mFrameConstructor->GetRootFrame()) {
frame = popupFrame;
} else if (capturingContent &&
nsContentUtils::ContentIsDescendantOf(
capturingContent, popupFrame->GetContent())) {
frame = popupFrame;
}
}

Просмотреть файл

@ -90,24 +90,22 @@ GetSize(nsPresContext* aPresContext)
return size;
}
static nsresult
static void
GetWidth(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
nsSize size = GetSize(aPresContext);
float pixelWidth = aPresContext->AppUnitsToFloatCSSPixels(size.width);
aResult.SetFloatValue(pixelWidth, eCSSUnit_Pixel);
return NS_OK;
}
static nsresult
static void
GetHeight(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
nsSize size = GetSize(aPresContext);
float pixelHeight = aPresContext->AppUnitsToFloatCSSPixels(size.height);
aResult.SetFloatValue(pixelHeight, eCSSUnit_Pixel);
return NS_OK;
}
inline static nsDeviceContext*
@ -147,27 +145,25 @@ GetDeviceSize(nsPresContext* aPresContext)
return size;
}
static nsresult
static void
GetDeviceWidth(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
nsSize size = GetDeviceSize(aPresContext);
float pixelWidth = aPresContext->AppUnitsToFloatCSSPixels(size.width);
aResult.SetFloatValue(pixelWidth, eCSSUnit_Pixel);
return NS_OK;
}
static nsresult
static void
GetDeviceHeight(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
nsSize size = GetDeviceSize(aPresContext);
float pixelHeight = aPresContext->AppUnitsToFloatCSSPixels(size.height);
aResult.SetFloatValue(pixelHeight, eCSSUnit_Pixel);
return NS_OK;
}
static nsresult
static void
GetOrientation(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
@ -181,10 +177,9 @@ GetOrientation(nsPresContext* aPresContext, const nsMediaFeature*,
}
aResult.SetIntValue(orientation, eCSSUnit_Enumerated);
return NS_OK;
}
static nsresult
static void
GetDeviceOrientation(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
@ -198,20 +193,18 @@ GetDeviceOrientation(nsPresContext* aPresContext, const nsMediaFeature*,
}
aResult.SetIntValue(orientation, eCSSUnit_Enumerated);
return NS_OK;
}
static nsresult
static void
GetIsResourceDocument(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
nsIDocument* doc = aPresContext->Document();
aResult.SetIntValue(doc && doc->IsResourceDoc() ? 1 : 0, eCSSUnit_Integer);
return NS_OK;
}
// Helper for two features below
static nsresult
static void
MakeArray(const nsSize& aSize, nsCSSValue& aResult)
{
RefPtr<nsCSSValue::Array> a = nsCSSValue::Array::Create(2);
@ -220,24 +213,23 @@ MakeArray(const nsSize& aSize, nsCSSValue& aResult)
a->Item(1).SetIntValue(aSize.height, eCSSUnit_Integer);
aResult.SetArrayValue(a, eCSSUnit_Array);
return NS_OK;
}
static nsresult
static void
GetAspectRatio(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
return MakeArray(GetSize(aPresContext), aResult);
MakeArray(GetSize(aPresContext), aResult);
}
static nsresult
static void
GetDeviceAspectRatio(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
return MakeArray(GetDeviceSize(aPresContext), aResult);
MakeArray(GetDeviceSize(aPresContext), aResult);
}
static nsresult
static void
GetColor(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
@ -257,10 +249,9 @@ GetColor(nsPresContext* aPresContext, const nsMediaFeature*,
// color components differ.
depth /= 3;
aResult.SetIntValue(int32_t(depth), eCSSUnit_Integer);
return NS_OK;
}
static nsresult
static void
GetColorIndex(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
@ -271,10 +262,9 @@ GetColorIndex(nsPresContext* aPresContext, const nsMediaFeature*,
// return zero. Given that there isn't any better information
// exposed, we don't have much other choice.
aResult.SetIntValue(0, eCSSUnit_Integer);
return NS_OK;
}
static nsresult
static void
GetMonochrome(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
@ -282,10 +272,9 @@ GetMonochrome(nsPresContext* aPresContext, const nsMediaFeature*,
// FIXME: On a monochrome device, return the actual color depth, not
// 0!
aResult.SetIntValue(0, eCSSUnit_Integer);
return NS_OK;
}
static nsresult
static void
GetResolution(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
@ -299,20 +288,18 @@ GetResolution(nsPresContext* aPresContext, const nsMediaFeature*,
}
aResult.SetFloatValue(dpi, eCSSUnit_Inch);
return NS_OK;
}
static nsresult
static void
GetScan(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
// Since Gecko doesn't support the 'tv' media type, the 'scan'
// feature is never present.
aResult.Reset();
return NS_OK;
}
static nsresult
static void
GetDisplayMode(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
@ -321,7 +308,7 @@ GetDisplayMode(nsPresContext* aPresContext, const nsMediaFeature*,
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(container);
if (!baseWindow) {
aResult.SetIntValue(NS_STYLE_DISPLAY_MODE_BROWSER, eCSSUnit_Enumerated);
return NS_OK;
return;
}
nsCOMPtr<nsIWidget> mainWidget;
baseWindow->GetMainWidget(getter_AddRefs(mainWidget));
@ -340,20 +327,18 @@ GetDisplayMode(nsPresContext* aPresContext, const nsMediaFeature*,
}
aResult.SetIntValue(displayMode, eCSSUnit_Enumerated);
return NS_OK;
}
static nsresult
static void
GetGrid(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
// Gecko doesn't support grid devices (e.g., ttys), so the 'grid'
// feature is always 0.
aResult.SetIntValue(0, eCSSUnit_Integer);
return NS_OK;
}
static nsresult
static void
GetDevicePixelRatio(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
@ -363,19 +348,17 @@ GetDevicePixelRatio(nsPresContext* aPresContext, const nsMediaFeature*,
} else {
aResult.SetFloatValue(1.0, eCSSUnit_Number);
}
return NS_OK;
}
static nsresult
static void
GetTransform3d(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
// Gecko supports 3d transforms, so this feature is always 1.
aResult.SetIntValue(1, eCSSUnit_Integer);
return NS_OK;
}
static nsresult
static void
GetSystemMetric(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
nsCSSValue& aResult)
{
@ -383,7 +366,7 @@ GetSystemMetric(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
if (ShouldResistFingerprinting(aPresContext)) {
// If "privacy.resistFingerprinting" is enabled, then we simply don't
// return any system-backed media feature values. (No spoofed values returned.)
return NS_OK;
return;
}
MOZ_ASSERT(aFeature->mValueType == nsMediaFeature::eBoolInteger,
@ -391,16 +374,15 @@ GetSystemMetric(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
nsIAtom *metricAtom = *aFeature->mData.mMetric;
bool hasMetric = nsCSSRuleProcessor::HasSystemMetric(metricAtom);
aResult.SetIntValue(hasMetric ? 1 : 0, eCSSUnit_Integer);
return NS_OK;
}
static nsresult
static void
GetWindowsTheme(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
nsCSSValue& aResult)
{
aResult.Reset();
if (ShouldResistFingerprinting(aPresContext)) {
return NS_OK;
return;
}
#ifdef XP_WIN
@ -409,7 +391,7 @@ GetWindowsTheme(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
// Classic mode should fail to match.
if (windowsThemeId == LookAndFeel::eWindowsTheme_Classic)
return NS_OK;
return;
// Look up the appropriate theme string
for (size_t i = 0; i < ArrayLength(themeStrings); ++i) {
@ -420,16 +402,15 @@ GetWindowsTheme(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
}
}
#endif
return NS_OK;
}
static nsresult
static void
GetOperatingSystemVersion(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
nsCSSValue& aResult)
{
aResult.Reset();
if (ShouldResistFingerprinting(aPresContext)) {
return NS_OK;
return;
}
#ifdef XP_WIN
@ -446,15 +427,13 @@ GetOperatingSystemVersion(nsPresContext* aPresContext, const nsMediaFeature* aFe
}
}
#endif
return NS_OK;
}
static nsresult
static void
GetIsGlyph(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
nsCSSValue& aResult)
{
aResult.SetIntValue(aPresContext->IsGlyph() ? 1 : 0, eCSSUnit_Integer);
return NS_OK;
}
/*

Просмотреть файл

@ -16,10 +16,9 @@ class nsPresContext;
class nsCSSValue;
struct nsMediaFeature;
typedef nsresult
(* nsMediaFeatureValueGetter)(nsPresContext* aPresContext,
const nsMediaFeature* aFeature,
nsCSSValue& aResult);
typedef void (*nsMediaFeatureValueGetter)(nsPresContext* aPresContext,
const nsMediaFeature* aFeature,
nsCSSValue& aResult);
struct nsMediaFeature
{

Просмотреть файл

@ -217,9 +217,8 @@ nsMediaQueryResultCacheKey::Matches(nsPresContext* aPresContext) const
for (uint32_t i = 0; i < mFeatureCache.Length(); ++i) {
const FeatureEntry *entry = &mFeatureCache[i];
nsCSSValue actual;
nsresult rv =
(entry->mFeature->mGetter)(aPresContext, entry->mFeature, actual);
NS_ENSURE_SUCCESS(rv, false); // any better ideas?
entry->mFeature->mGetter(aPresContext, entry->mFeature, actual);
for (uint32_t j = 0; j < entry->mExpressions.Length(); ++j) {
const ExpressionEntry &eentry = entry->mExpressions[j];
@ -479,9 +478,7 @@ nsMediaQuery::Matches(nsPresContext* aPresContext,
for (uint32_t i = 0, i_end = mExpressions.Length(); match && i < i_end; ++i) {
const nsMediaExpression &expr = mExpressions[i];
nsCSSValue actual;
nsresult rv =
(expr.mFeature->mGetter)(aPresContext, expr.mFeature, actual);
NS_ENSURE_SUCCESS(rv, false); // any better ideas?
expr.mFeature->mGetter(aPresContext, expr.mFeature, actual);
match = expr.Matches(aPresContext, actual);
if (aKey) {

Просмотреть файл

@ -29,6 +29,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
#include "mozilla/dom/BoxObject.h"
#include "mozilla/TextEvents.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -227,7 +228,6 @@ nsXULTooltipListener::HandleEvent(nsIDOMEvent* aEvent)
nsAutoString type;
aEvent->GetType(type);
if (type.EqualsLiteral("DOMMouseScroll") ||
type.EqualsLiteral("keydown") ||
type.EqualsLiteral("mousedown") ||
type.EqualsLiteral("mouseup") ||
type.EqualsLiteral("dragstart")) {
@ -235,6 +235,16 @@ nsXULTooltipListener::HandleEvent(nsIDOMEvent* aEvent)
return NS_OK;
}
if (type.EqualsLiteral("keydown")) {
// Hide the tooltip if a non-modifier key is pressed.
WidgetKeyboardEvent* keyEvent = aEvent->WidgetEventPtr()->AsKeyboardEvent();
if (!keyEvent->IsModifierKeyEvent()) {
HideTooltip();
}
return NS_OK;
}
if (type.EqualsLiteral("popuphiding")) {
DestroyTooltip();
return NS_OK;
@ -430,8 +440,11 @@ nsXULTooltipListener::ShowTooltip()
this, true);
doc->AddSystemEventListener(NS_LITERAL_STRING("mouseup"),
this, true);
#ifndef XP_WIN
// On Windows, key events don't close tooltips.
doc->AddSystemEventListener(NS_LITERAL_STRING("keydown"),
this, true);
#endif
}
mSourceNode = nullptr;
}
@ -669,7 +682,9 @@ nsXULTooltipListener::DestroyTooltip()
doc->RemoveSystemEventListener(NS_LITERAL_STRING("mousedown"), this,
true);
doc->RemoveSystemEventListener(NS_LITERAL_STRING("mouseup"), this, true);
#ifndef XP_WIN
doc->RemoveSystemEventListener(NS_LITERAL_STRING("keydown"), this, true);
#endif
}
// remove the popuphidden listener from tooltip

Просмотреть файл

@ -56,7 +56,7 @@
.equ CONFIG_SPATIAL_RESAMPLING , 1
.equ CONFIG_REALTIME_ONLY , 0
.equ CONFIG_ONTHEFLY_BITPACKING , 0
.equ CONFIG_ERROR_CONCEALMENT , 1
.equ CONFIG_ERROR_CONCEALMENT , 0
.equ CONFIG_SHARED , 0
.equ CONFIG_STATIC , 1
.equ CONFIG_SMALL , 0

Просмотреть файл

@ -6,5 +6,5 @@
/* in the file PATENTS. All contributing project authors may */
/* be found in the AUTHORS file in the root of the source tree. */
#include "vpx/vpx_codec.h"
static const char* const cfg = "--target=generic-gnu --enable-external-build --disable-examples --disable-install-docs --disable-unit-tests --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic --enable-error-concealment";
static const char* const cfg = "--target=generic-gnu --enable-external-build --disable-examples --disable-install-docs --disable-unit-tests --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic";
const char *vpx_codec_build_config(void) {return cfg;}

Просмотреть файл

@ -65,7 +65,7 @@
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_REALTIME_ONLY 0
#define CONFIG_ONTHEFLY_BITPACKING 0
#define CONFIG_ERROR_CONCEALMENT 1
#define CONFIG_ERROR_CONCEALMENT 0
#define CONFIG_SHARED 0
#define CONFIG_STATIC 1
#define CONFIG_SMALL 0

Просмотреть файл

@ -56,7 +56,7 @@
.equ CONFIG_SPATIAL_RESAMPLING , 1
.equ CONFIG_REALTIME_ONLY , 1
.equ CONFIG_ONTHEFLY_BITPACKING , 0
.equ CONFIG_ERROR_CONCEALMENT , 1
.equ CONFIG_ERROR_CONCEALMENT , 0
.equ CONFIG_SHARED , 0
.equ CONFIG_STATIC , 1
.equ CONFIG_SMALL , 0

Просмотреть файл

@ -6,5 +6,5 @@
/* in the file PATENTS. All contributing project authors may */
/* be found in the AUTHORS file in the root of the source tree. */
#include "vpx/vpx_codec.h"
static const char* const cfg = "--target=armv7-linux-gcc --enable-external-build --disable-examples --disable-install-docs --disable-unit-tests --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic --enable-error-concealment --enable-runtime-cpu-detect --enable-realtime-only";
static const char* const cfg = "--target=armv7-linux-gcc --enable-external-build --disable-examples --disable-install-docs --disable-unit-tests --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic --enable-runtime-cpu-detect --enable-realtime-only";
const char *vpx_codec_build_config(void) {return cfg;}

Просмотреть файл

@ -65,7 +65,7 @@
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_REALTIME_ONLY 1
#define CONFIG_ONTHEFLY_BITPACKING 0
#define CONFIG_ERROR_CONCEALMENT 1
#define CONFIG_ERROR_CONCEALMENT 0
#define CONFIG_SHARED 0
#define CONFIG_STATIC 1
#define CONFIG_SMALL 0

Просмотреть файл

@ -53,7 +53,7 @@
%define CONFIG_SPATIAL_RESAMPLING 1
%define CONFIG_REALTIME_ONLY 0
%define CONFIG_ONTHEFLY_BITPACKING 0
%define CONFIG_ERROR_CONCEALMENT 1
%define CONFIG_ERROR_CONCEALMENT 0
%define CONFIG_SHARED 0
%define CONFIG_STATIC 1
%define CONFIG_SMALL 0

Просмотреть файл

@ -6,5 +6,5 @@
/* in the file PATENTS. All contributing project authors may */
/* be found in the AUTHORS file in the root of the source tree. */
#include "vpx/vpx_codec.h"
static const char* const cfg = "--target=x86-linux-gcc --enable-external-build --disable-examples --disable-install-docs --disable-unit-tests --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic --enable-error-concealment --enable-postproc --enable-vp9-postproc --as=yasm";
static const char* const cfg = "--target=x86-linux-gcc --enable-external-build --disable-examples --disable-install-docs --disable-unit-tests --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic --enable-postproc --enable-vp9-postproc --as=yasm";
const char *vpx_codec_build_config(void) {return cfg;}

Просмотреть файл

@ -65,7 +65,7 @@
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_REALTIME_ONLY 0
#define CONFIG_ONTHEFLY_BITPACKING 0
#define CONFIG_ERROR_CONCEALMENT 1
#define CONFIG_ERROR_CONCEALMENT 0
#define CONFIG_SHARED 0
#define CONFIG_STATIC 1
#define CONFIG_SMALL 0

Просмотреть файл

@ -53,7 +53,7 @@
%define CONFIG_SPATIAL_RESAMPLING 1
%define CONFIG_REALTIME_ONLY 0
%define CONFIG_ONTHEFLY_BITPACKING 0
%define CONFIG_ERROR_CONCEALMENT 1
%define CONFIG_ERROR_CONCEALMENT 0
%define CONFIG_SHARED 0
%define CONFIG_STATIC 1
%define CONFIG_SMALL 0

Просмотреть файл

@ -6,5 +6,5 @@
/* in the file PATENTS. All contributing project authors may */
/* be found in the AUTHORS file in the root of the source tree. */
#include "vpx/vpx_codec.h"
static const char* const cfg = "--target=x86_64-linux-gcc --enable-external-build --disable-examples --disable-install-docs --disable-unit-tests --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic --enable-error-concealment --enable-postproc --enable-vp9-postproc --as=yasm";
static const char* const cfg = "--target=x86_64-linux-gcc --enable-external-build --disable-examples --disable-install-docs --disable-unit-tests --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic --enable-postproc --enable-vp9-postproc --as=yasm";
const char *vpx_codec_build_config(void) {return cfg;}

Просмотреть файл

@ -65,7 +65,7 @@
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_REALTIME_ONLY 0
#define CONFIG_ONTHEFLY_BITPACKING 0
#define CONFIG_ERROR_CONCEALMENT 1
#define CONFIG_ERROR_CONCEALMENT 0
#define CONFIG_SHARED 0
#define CONFIG_STATIC 1
#define CONFIG_SMALL 0

Просмотреть файл

@ -53,7 +53,7 @@
%define CONFIG_SPATIAL_RESAMPLING 1
%define CONFIG_REALTIME_ONLY 0
%define CONFIG_ONTHEFLY_BITPACKING 0
%define CONFIG_ERROR_CONCEALMENT 1
%define CONFIG_ERROR_CONCEALMENT 0
%define CONFIG_SHARED 0
%define CONFIG_STATIC 1
%define CONFIG_SMALL 0

Просмотреть файл

@ -6,5 +6,5 @@
/* in the file PATENTS. All contributing project authors may */
/* be found in the AUTHORS file in the root of the source tree. */
#include "vpx/vpx_codec.h"
static const char* const cfg = "--target=x86-darwin9-gcc --enable-external-build --disable-examples --disable-install-docs --disable-unit-tests --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic --enable-error-concealment --enable-postproc --enable-vp9-postproc --as=yasm";
static const char* const cfg = "--target=x86-darwin9-gcc --enable-external-build --disable-examples --disable-install-docs --disable-unit-tests --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic --enable-postproc --enable-vp9-postproc --as=yasm";
const char *vpx_codec_build_config(void) {return cfg;}

Просмотреть файл

@ -65,7 +65,7 @@
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_REALTIME_ONLY 0
#define CONFIG_ONTHEFLY_BITPACKING 0
#define CONFIG_ERROR_CONCEALMENT 1
#define CONFIG_ERROR_CONCEALMENT 0
#define CONFIG_SHARED 0
#define CONFIG_STATIC 1
#define CONFIG_SMALL 0

Просмотреть файл

@ -53,7 +53,7 @@
%define CONFIG_SPATIAL_RESAMPLING 1
%define CONFIG_REALTIME_ONLY 0
%define CONFIG_ONTHEFLY_BITPACKING 0
%define CONFIG_ERROR_CONCEALMENT 1
%define CONFIG_ERROR_CONCEALMENT 0
%define CONFIG_SHARED 0
%define CONFIG_STATIC 1
%define CONFIG_SMALL 0

Просмотреть файл

@ -6,5 +6,5 @@
/* in the file PATENTS. All contributing project authors may */
/* be found in the AUTHORS file in the root of the source tree. */
#include "vpx/vpx_codec.h"
static const char* const cfg = "--target=x86_64-darwin9-gcc --enable-external-build --disable-examples --disable-install-docs --disable-unit-tests --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic --enable-error-concealment --enable-postproc --enable-vp9-postproc --as=yasm";
static const char* const cfg = "--target=x86_64-darwin9-gcc --enable-external-build --disable-examples --disable-install-docs --disable-unit-tests --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic --enable-postproc --enable-vp9-postproc --as=yasm";
const char *vpx_codec_build_config(void) {return cfg;}

Просмотреть файл

@ -65,7 +65,7 @@
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_REALTIME_ONLY 0
#define CONFIG_ONTHEFLY_BITPACKING 0
#define CONFIG_ERROR_CONCEALMENT 1
#define CONFIG_ERROR_CONCEALMENT 0
#define CONFIG_SHARED 0
#define CONFIG_STATIC 1
#define CONFIG_SMALL 0

Просмотреть файл

@ -53,7 +53,7 @@
%define CONFIG_SPATIAL_RESAMPLING 1
%define CONFIG_REALTIME_ONLY 0
%define CONFIG_ONTHEFLY_BITPACKING 0
%define CONFIG_ERROR_CONCEALMENT 1
%define CONFIG_ERROR_CONCEALMENT 0
%define CONFIG_SHARED 0
%define CONFIG_STATIC 1
%define CONFIG_SMALL 0

Просмотреть файл

@ -6,5 +6,5 @@
/* in the file PATENTS. All contributing project authors may */
/* be found in the AUTHORS file in the root of the source tree. */
#include "vpx/vpx_codec.h"
static const char* const cfg = "--target=x86-win32-gcc --enable-external-build --disable-examples --disable-install-docs --disable-unit-tests --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic --enable-error-concealment --enable-postproc --enable-vp9-postproc --as=yasm";
static const char* const cfg = "--target=x86-win32-gcc --enable-external-build --disable-examples --disable-install-docs --disable-unit-tests --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic --enable-postproc --enable-vp9-postproc --as=yasm";
const char *vpx_codec_build_config(void) {return cfg;}

Просмотреть файл

@ -65,7 +65,7 @@
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_REALTIME_ONLY 0
#define CONFIG_ONTHEFLY_BITPACKING 0
#define CONFIG_ERROR_CONCEALMENT 1
#define CONFIG_ERROR_CONCEALMENT 0
#define CONFIG_SHARED 0
#define CONFIG_STATIC 1
#define CONFIG_SMALL 0

Просмотреть файл

@ -53,7 +53,7 @@
%define CONFIG_SPATIAL_RESAMPLING 1
%define CONFIG_REALTIME_ONLY 0
%define CONFIG_ONTHEFLY_BITPACKING 0
%define CONFIG_ERROR_CONCEALMENT 1
%define CONFIG_ERROR_CONCEALMENT 0
%define CONFIG_SHARED 0
%define CONFIG_STATIC 1
%define CONFIG_SMALL 0

Просмотреть файл

@ -6,5 +6,5 @@
/* in the file PATENTS. All contributing project authors may */
/* be found in the AUTHORS file in the root of the source tree. */
#include "vpx/vpx_codec.h"
static const char* const cfg = "--target=x86_64-win64-vs12 --enable-external-build --disable-examples --disable-install-docs --disable-unit-tests --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic --enable-error-concealment --enable-postproc --enable-vp9-postproc --as=yasm";
static const char* const cfg = "--target=x86_64-win64-vs12 --enable-external-build --disable-examples --disable-install-docs --disable-unit-tests --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic --enable-postproc --enable-vp9-postproc --as=yasm";
const char *vpx_codec_build_config(void) {return cfg;}

Просмотреть файл

@ -65,7 +65,7 @@
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_REALTIME_ONLY 0
#define CONFIG_ONTHEFLY_BITPACKING 0
#define CONFIG_ERROR_CONCEALMENT 1
#define CONFIG_ERROR_CONCEALMENT 0
#define CONFIG_SHARED 0
#define CONFIG_STATIC 1
#define CONFIG_SMALL 0

Просмотреть файл

@ -193,7 +193,6 @@ cd $TEMP_DIR
echo "Generate config files."
all_platforms="--enable-external-build --disable-examples --disable-install-docs --disable-unit-tests"
all_platforms="${all_platforms} --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic"
all_platforms="${all_platforms} --enable-error-concealment"
x86_platforms="--enable-postproc --enable-vp9-postproc --as=yasm"
arm_platforms="--enable-runtime-cpu-detect --enable-realtime-only"
gen_config_files linux/x64 "--target=x86_64-linux-gcc ${all_platforms} ${x86_platforms}"

Просмотреть файл

@ -72,7 +72,6 @@ files = {
'libvpx/vp8/decoder/decodeframe.c',
'libvpx/vp8/decoder/decodemv.c',
'libvpx/vp8/decoder/detokenize.c',
'libvpx/vp8/decoder/error_concealment.c',
'libvpx/vp8/decoder/onyxd_if.c',
'libvpx/vp8/decoder/threading.c',
'libvpx/vp8/encoder/bitstream.c',
@ -333,7 +332,6 @@ files = {
'libvpx/vp8/decoder/decodeframe.c',
'libvpx/vp8/decoder/decodemv.c',
'libvpx/vp8/decoder/detokenize.c',
'libvpx/vp8/decoder/error_concealment.c',
'libvpx/vp8/decoder/onyxd_if.c',
'libvpx/vp8/decoder/threading.c',
'libvpx/vp8/encoder/bitstream.c',
@ -583,7 +581,6 @@ files = {
'libvpx/vp8/decoder/decodeframe.c',
'libvpx/vp8/decoder/decodemv.c',
'libvpx/vp8/decoder/detokenize.c',
'libvpx/vp8/decoder/error_concealment.c',
'libvpx/vp8/decoder/onyxd_if.c',
'libvpx/vp8/decoder/threading.c',
'libvpx/vp8/encoder/arm/neon/denoising_neon.c',
@ -794,7 +791,6 @@ files = {
'libvpx/vp8/decoder/decodeframe.c',
'libvpx/vp8/decoder/decodemv.c',
'libvpx/vp8/decoder/detokenize.c',
'libvpx/vp8/decoder/error_concealment.c',
'libvpx/vp8/decoder/onyxd_if.c',
'libvpx/vp8/decoder/threading.c',
'libvpx/vp8/encoder/bitstream.c',

Просмотреть файл

@ -1591,10 +1591,26 @@ public abstract class GeckoApp
return uri != null && !AboutPages.isAboutHome(uri);
}
protected int getNewTabFlags() {
final boolean isFirstTab = !mWasFirstTabShownAfterActivityUnhidden;
final SafeIntent intent = new SafeIntent(getIntent());
final String action = intent.getAction();
int flags = Tabs.LOADURL_NEW_TAB | Tabs.LOADURL_USER_ENTERED | Tabs.LOADURL_EXTERNAL;
if (ACTION_HOMESCREEN_SHORTCUT.equals(action)) {
flags |= Tabs.LOADURL_PINNED;
}
if (isFirstTab) {
flags |= Tabs.LOADURL_FIRST_AFTER_ACTIVITY_UNHIDDEN;
}
return flags;
}
private void initialize() {
mInitialized = true;
final boolean isFirstTab = !mWasFirstTabShownAfterActivityUnhidden;
mWasFirstTabShownAfterActivityUnhidden = true; // Reset since we'll be loading a tab.
final SafeIntent intent = new SafeIntent(getIntent());
@ -1634,13 +1650,7 @@ public abstract class GeckoApp
processActionViewIntent(new Runnable() {
@Override
public void run() {
int flags = Tabs.LOADURL_NEW_TAB | Tabs.LOADURL_USER_ENTERED | Tabs.LOADURL_EXTERNAL;
if (ACTION_HOMESCREEN_SHORTCUT.equals(action)) {
flags |= Tabs.LOADURL_PINNED;
}
if (isFirstTab) {
flags |= Tabs.LOADURL_FIRST_AFTER_ACTIVITY_UNHIDDEN;
}
final int flags = getNewTabFlags();
loadStartupTab(passedUri, intent, flags);
}
});

Просмотреть файл

@ -70,6 +70,7 @@ public class Tabs implements BundleEventListener {
public static final int LOADURL_EXTERNAL = 1 << 7;
/** Indicates the tab is the first shown after Firefox is hidden and restored. */
public static final int LOADURL_FIRST_AFTER_ACTIVITY_UNHIDDEN = 1 << 8;
public static final int LOADURL_CUSTOMTAB = 1 << 9;
private static final long PERSIST_TABS_AFTER_MILLISECONDS = 1000 * 2;
@ -893,6 +894,7 @@ public class Tabs implements BundleEventListener {
boolean desktopMode = (flags & LOADURL_DESKTOP) != 0;
boolean external = (flags & LOADURL_EXTERNAL) != 0;
final boolean isFirstShownAfterActivityUnhidden = (flags & LOADURL_FIRST_AFTER_ACTIVITY_UNHIDDEN) != 0;
final boolean customTab = (flags & LOADURL_CUSTOMTAB) != 0;
data.putString("url", url);
data.putString("engine", searchEngine);
@ -901,6 +903,7 @@ public class Tabs implements BundleEventListener {
data.putBoolean("isPrivate", isPrivate);
data.putBoolean("pinned", (flags & LOADURL_PINNED) != 0);
data.putBoolean("desktopMode", desktopMode);
data.putBoolean("customTab", customTab);
final boolean needsNewTab;
final String applicationId = (intent == null) ? null :

Просмотреть файл

@ -103,6 +103,11 @@ public class CustomTabsActivity extends GeckoApp implements Tabs.OnTabsChangedLi
}
@Override
protected int getNewTabFlags() {
return Tabs.LOADURL_CUSTOMTAB | super.getNewTabFlags();
}
@Override
public void onDestroy() {
super.onDestroy();

Просмотреть файл

@ -1649,7 +1649,8 @@ var BrowserApp = {
isPrivate: (data.isPrivate === true),
pinned: (data.pinned === true),
delayLoad: (delayLoad === true),
desktopMode: (data.desktopMode === true)
desktopMode: (data.desktopMode === true),
customTab: ("customTab" in data) ? data.customTab : false
};
params.userRequested = url;
@ -3329,6 +3330,13 @@ nsBrowserAccess.prototype = {
aWhere == Ci.nsIBrowserDOMWindow.OPEN_SWITCHTAB);
let isPrivate = false;
if (aOpener != null) {
let parent = BrowserApp.getTabForWindow(aOpener.top);
if ((parent != null) && ("isCustomTab" in parent)) {
newTab = newTab && !parent.isCustomTab;
}
}
if (newTab) {
let parentId = -1;
if (!isExternal && aOpener) {
@ -3597,6 +3605,7 @@ Tab.prototype = {
// The search term the user entered to load the current URL
this.userRequested = "userRequested" in aParams ? aParams.userRequested : "";
this.isSearch = "isSearch" in aParams ? aParams.isSearch : false;
this.isCustomTab = "customTab" in aParams ? aParams.customTab : false;
try {
this.browser.loadURIWithFlags(aURL, flags, referrerURI, charset, postData);

Просмотреть файл

@ -635,10 +635,11 @@ nsNotifyAddrListener::CheckAdaptersAddresses(void)
// that are UP. If the checksum is the same as previous check, nothing
// of interest changed!
//
ULONG sum = 0;
ULONG sumAll = 0;
if (ret == ERROR_SUCCESS) {
bool linkUp = false;
ULONG sum = 0;
for (PIP_ADAPTER_ADDRESSES adapter = adapterList; adapter;
adapter = adapter->Next) {
@ -649,9 +650,9 @@ nsNotifyAddrListener::CheckAdaptersAddresses(void)
continue;
}
sum <<= 2;
// Add chars from AdapterName to the checksum.
for (int i = 0; adapter->AdapterName[i]; ++i) {
sum <<= 2;
sum += adapter->AdapterName[i];
}
@ -665,6 +666,7 @@ nsNotifyAddrListener::CheckAdaptersAddresses(void)
}
}
linkUp = true;
sumAll ^= sum;
}
mLinkUp = linkUp;
mStatusKnown = true;
@ -673,7 +675,7 @@ nsNotifyAddrListener::CheckAdaptersAddresses(void)
if (mLinkUp) {
/* Store the checksum only if one or more interfaces are up */
mIPInterfaceChecksum = sum;
mIPInterfaceChecksum = sumAll;
}
CoUninitialize();

Просмотреть файл

@ -2218,7 +2218,6 @@ MOZ_WEBRTC_HARDWARE_AEC_NS=
MOZ_SCTP=
MOZ_ANDROID_OMX=
MOZ_OMX_PLUGIN=
MOZ_VPX_ERROR_CONCEALMENT=
VPX_USE_YASM=
VPX_ASFLAGS=
VPX_AS_CONVERSION=
@ -2818,7 +2817,6 @@ if test -n "$MOZ_WEBRTC"; then
dnl opt/production builds (via MOZ_CRASH())
AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
MOZ_RAW=1
MOZ_VPX_ERROR_CONCEALMENT=1
dnl enable once Signaling lands
MOZ_WEBRTC_SIGNALING=1
@ -2979,10 +2977,6 @@ MOZ_ARG_WITH_BOOL(system-libvpx,
MOZ_LIBVPX_CFLAGS=
MOZ_LIBVPX_LIBS=
if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
fi
_SAVE_CFLAGS=$CFLAGS
_SAVE_LIBS=$LIBS
if test -n "$MOZ_SYSTEM_LIBVPX"; then
@ -5488,7 +5482,6 @@ AC_SUBST_LIST(FFVPX_ASFLAGS)
AC_SUBST(MOZ_DIRECTSHOW)
AC_SUBST(MOZ_ANDROID_OMX)
AC_SUBST(MOZ_OMX_PLUGIN)
AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
AC_SUBST(VPX_USE_YASM)
AC_SUBST_LIST(VPX_ASFLAGS)
AC_SUBST(VPX_AS_CONVERSION)

Просмотреть файл

@ -1373,12 +1373,12 @@ class TreeMetadataEmitter(LoggingMixin):
install_prefix="web-platform/")
for path, tests in manifest:
for test_type, path, tests in manifest:
path = mozpath.join(tests_root, path)
for test in tests:
if test.item_type not in ["testharness", "reftest"]:
continue
if test_type not in ["testharness", "reftest", "wdspec"]:
continue
for test in tests:
obj.tests.append({
'path': path,
'here': mozpath.dirname(path),

Просмотреть файл

@ -510,7 +510,7 @@ class MarionetteRefTestExecutor(RefTestExecutor):
marionette.execute_async_script(self.wait_script)
screenshot = marionette.screenshot()
screenshot = marionette.screenshot(full=False)
# strip off the data:img/png, part of the url
if screenshot.startswith("data:image/png;base64,"):
screenshot = screenshot.split(",", 1)[1]

Просмотреть файл

@ -20,6 +20,7 @@ import wptmanifest
import wpttest
from vcs import git
manifest = None # Module that will be imported relative to test_root
manifestitem = None
logger = structuredlog.StructuredLogger("web-platform-tests")
@ -66,8 +67,8 @@ def update_expected(test_paths, serve_root, log_file_names,
def do_delayed_imports(serve_root):
global manifest
from manifest import manifest
global manifest, manifestitem
from manifest import manifest, item as manifestitem
def files_in_repo(repo_root):
@ -112,7 +113,7 @@ def unexpected_changes(manifests, change_data, files_changed):
rv = []
return [fn for fn, tests in root_manifest if fn in files_changed and change_data.get(fn) != "M"]
return [fn for _, fn, _ in root_manifest if fn in files_changed and change_data.get(fn) != "M"]
# For each testrun
# Load all files and scan for the suite_start entry
@ -295,9 +296,13 @@ def create_test_tree(metadata_path, test_manifest, property_order=None,
boolean_properties=None):
expected_map = {}
id_test_map = {}
exclude_types = frozenset(["stub", "helper", "manual"])
include_types = set(manifest.item_types) - exclude_types
for test_path, tests in test_manifest.itertypes(*include_types):
exclude_types = frozenset(["stub", "helper", "manual", "support", "conformancechecker"])
all_types = [item.item_type for item in manifestitem.__dict__.itervalues()
if type(item) == type and
issubclass(item, manifestitem.ManifestItem) and
item.item_type is not None]
include_types = set(all_types) - exclude_types
for _, test_path, tests in test_manifest.itertypes(*include_types):
expected_data = load_expected(test_manifest, metadata_path, test_path, tests,
property_order=property_order,
boolean_properties=boolean_properties)

Просмотреть файл

@ -46,10 +46,10 @@ class Unchunked(TestChunker):
class HashChunker(TestChunker):
def __call__(self, manifest):
chunk_index = self.chunk_number - 1
for test_path, tests in manifest:
for test_type, test_path, tests in manifest:
h = int(hashlib.md5(test_path).hexdigest(), 16)
if h % self.total_chunks == chunk_index:
yield test_path, tests
yield test_type, test_path, tests
class DirectoryHashChunker(TestChunker):
@ -60,10 +60,10 @@ class DirectoryHashChunker(TestChunker):
"""
def __call__(self, manifest):
chunk_index = self.chunk_number - 1
for test_path, tests in manifest:
for test_type, test_path, tests in manifest:
h = int(hashlib.md5(os.path.dirname(test_path)).hexdigest(), 16)
if h % self.total_chunks == chunk_index:
yield test_path, tests
yield test_type, test_path, tests
class EqualTimeChunker(TestChunker):
@ -85,7 +85,7 @@ class EqualTimeChunker(TestChunker):
by_dir = OrderedDict()
total_time = 0
for i, (test_path, tests) in enumerate(manifest_items):
for i, (test_type, test_path, tests) in enumerate(manifest_items):
test_dir = tuple(os.path.split(test_path)[0].split(os.path.sep)[:3])
if not test_dir in by_dir:
@ -96,7 +96,7 @@ class EqualTimeChunker(TestChunker):
"long" else wpttest.LONG_TIMEOUT for test in tests)
data.time += time
total_time += time
data.tests.append((test_path, tests))
data.tests.append((test_type, test_path, tests))
return by_dir, total_time
@ -352,14 +352,14 @@ class TestFilter(object):
self.manifest.add_exclude(test_manifests, item)
def __call__(self, manifest_iter):
for test_path, tests in manifest_iter:
for test_type, test_path, tests in manifest_iter:
include_tests = set()
for test in tests:
if self.manifest.include(test):
include_tests.add(test)
if include_tests:
yield test_path, include_tests
yield test_type, test_path, include_tests
class TagFilter(object):
def __init__(self, tags):
@ -406,14 +406,14 @@ class ManifestLoader(object):
pass
if not json_data:
manifest_file = manifest.Manifest(None, url_base)
manifest_file = manifest.Manifest(url_base)
else:
try:
manifest_file = manifest.Manifest.from_json(tests_path, json_data)
except manifest.ManifestVersionMismatch:
manifest_file = manifest.Manifest(None, url_base)
manifest_file = manifest.Manifest(url_base)
manifest_update.update(tests_path, url_base, manifest_file)
manifest_update.update(tests_path, manifest_file, True)
manifest.write(manifest_file, manifest_path)
@ -522,14 +522,14 @@ class TestLoader(object):
if self.chunker is not None:
manifest_items = self.chunker(manifest_items)
for test_path, tests in manifest_items:
for test_type, test_path, tests in manifest_items:
manifest_file = iter(tests).next().manifest
metadata_path = self.manifests[manifest_file]["metadata_path"]
inherit_metadata, test_metadata = self.load_metadata(manifest_file, metadata_path, test_path)
for test in iterfilter(self.meta_filters,
self.iter_wpttest(inherit_metadata, test_metadata, tests)):
yield test_path, test.test_type, test
yield test_path, test_type, test
def iter_wpttest(self, inherit_metadata, test_metadata, tests):
for manifest_test in tests:

Просмотреть файл

@ -124,14 +124,12 @@ class GetSyncTargetCommit(Step):
class LoadManifest(Step):
"""Load the test manifest"""
provides = ["manifest_path", "test_manifest", "old_manifest"]
provides = ["manifest_path", "test_manifest"]
def create(self, state):
from manifest import manifest
state.manifest_path = os.path.join(state.metadata_path, "MANIFEST.json")
# Conservatively always rebuild the manifest when doing a sync
state.old_manifest = manifest.load(state.tests_path, state.manifest_path)
state.test_manifest = manifest.Manifest(None, "/")
state.test_manifest = manifest.Manifest("/")
class UpdateManifest(Step):
@ -139,7 +137,7 @@ class UpdateManifest(Step):
def create(self, state):
from manifest import manifest, update
update.update(state.sync["path"], "/", state.test_manifest)
update.update(state.sync["path"], state.test_manifest)
manifest.write(state.test_manifest, state.manifest_path)

Просмотреть файл

@ -0,0 +1,5 @@
[2d.composite.operation.clear.html]
type: testharness
[Canvas test: 2d.composite.operation.clear]
expected: FAIL

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше