MozReview-Commit-ID: 5599Z7kxjk3
This commit is contained in:
Phil Ringnalda 2016-11-07 20:38:29 -08:00
Родитель 0b5f008629 fc2821e969
Коммит 2c7a3afd66
84 изменённых файлов: 1079 добавлений и 934 удалений

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

@ -14,3 +14,5 @@ skip-if = (os == "linux" && (debug || asan))
skip-if = (os == "linux" && (debug || asan))
[browser_popupNotification_checkbox.js]
skip-if = (os == "linux" && (debug || asan))
[browser_reshow_in_background.js]
skip-if = (os == "linux" && (debug || asan))

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

@ -0,0 +1,52 @@
"use strict";
/**
* Tests that when PopupNotifications for background tabs are reshown, they
* don't show up in the foreground tab, but only in the background tab that
* they belong to.
*/
add_task(function* test_background_notifications_dont_reshow_in_foreground() {
// Our initial tab will be A. Let's open two more tabs B and C, but keep
// A selected. Then, we'll trigger a PopupNotification in C, and then make
// it reshow.
let tabB = gBrowser.addTab("about:blank");
let tabC = gBrowser.addTab("about:blank");
let seenEvents = [];
let options = {
dismissed: false,
eventCallback(popupEvent) {
seenEvents.push(popupEvent);
},
};
let notification =
PopupNotifications.show(tabC.linkedBrowser, "test-notification",
"", "plugins-notification-icon",
null, null, options);
Assert.deepEqual(seenEvents, [], "Should have seen no events yet.");
yield BrowserTestUtils.switchTab(gBrowser, tabB);
Assert.deepEqual(seenEvents, [], "Should have seen no events yet.");
notification.reshow();
Assert.deepEqual(seenEvents, [], "Should have seen no events yet.");
let panelShown =
BrowserTestUtils.waitForEvent(PopupNotifications.panel, "popupshown");
yield BrowserTestUtils.switchTab(gBrowser, tabC);
yield panelShown;
Assert.equal(seenEvents.length, 2, "Should have seen two events.");
Assert.equal(seenEvents[0], "showing", "Should have said popup was showing.");
Assert.equal(seenEvents[1], "shown", "Should have said popup was shown.");
let panelHidden =
BrowserTestUtils.waitForEvent(PopupNotifications.panel, "popuphidden");
PopupNotifications.remove(notification);
yield panelHidden;
yield BrowserTestUtils.removeTab(tabB);
yield BrowserTestUtils.removeTab(tabC);
});

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

@ -7,10 +7,16 @@
* Tests if different response content types are handled correctly.
*/
add_task(function* () {
function* content_type_test(isHTTPS) {
let { L10N } = require("devtools/client/netmonitor/l10n");
let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
let pageURL = isHTTPS ? HTTPS_CONTENT_TYPE_WITHOUT_CACHE_URL
: CONTENT_TYPE_WITHOUT_CACHE_URL;
let imageURL = isHTTPS ? HTTPS_TEST_IMAGE
: TEST_IMAGE;
let sjsURL = isHTTPS ? HTTPS_CONTENT_TYPE_SJS
: CONTENT_TYPE_SJS;
let { tab, monitor } = yield initNetMonitor(pageURL);
info("Starting test... ");
let { document, Editor, NetMonitorView } = monitor.panelWin;
@ -18,77 +24,95 @@ add_task(function* () {
RequestsMenu.lazyUpdate = false;
let wait = waitForNetworkEvents(monitor, 7);
let wait = waitForNetworkEvents(monitor, 8);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
let okStatus = isHTTPS ? "Connected" : "OK";
verifyRequestItemTarget(RequestsMenu.getItemAtIndex(0),
"GET", CONTENT_TYPE_SJS + "?fmt=xml", {
"GET", sjsURL + "?fmt=xml", {
status: 200,
statusText: "OK",
statusText: okStatus,
type: "xml",
fullMimeType: "text/xml; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 42),
time: true
});
verifyRequestItemTarget(RequestsMenu.getItemAtIndex(1),
"GET", CONTENT_TYPE_SJS + "?fmt=css", {
"GET", sjsURL + "?fmt=css", {
status: 200,
statusText: "OK",
statusText: okStatus,
type: "css",
fullMimeType: "text/css; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 34),
time: true
});
verifyRequestItemTarget(RequestsMenu.getItemAtIndex(2),
"GET", CONTENT_TYPE_SJS + "?fmt=js", {
"GET", sjsURL + "?fmt=js", {
status: 200,
statusText: "OK",
statusText: okStatus,
type: "js",
fullMimeType: "application/javascript; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 34),
time: true
});
verifyRequestItemTarget(RequestsMenu.getItemAtIndex(3),
"GET", CONTENT_TYPE_SJS + "?fmt=json", {
"GET", sjsURL + "?fmt=json", {
status: 200,
statusText: "OK",
statusText: okStatus,
type: "json",
fullMimeType: "application/json; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 29),
time: true
});
verifyRequestItemTarget(RequestsMenu.getItemAtIndex(4),
"GET", CONTENT_TYPE_SJS + "?fmt=bogus", {
status: 404,
statusText: "Not Found",
type: "html",
fullMimeType: "text/html; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 24),
time: true
});
if (!isHTTPS) {
// 404 doesn't work on HTTPS test harness.
verifyRequestItemTarget(RequestsMenu.getItemAtIndex(4),
"GET", sjsURL + "?fmt=bogus", {
status: 404,
statusText: "Not Found",
type: "html",
fullMimeType: "text/html; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 24),
time: true
});
}
verifyRequestItemTarget(RequestsMenu.getItemAtIndex(5),
"GET", TEST_IMAGE, {
"GET", imageURL, {
fuzzyUrl: true,
status: 200,
statusText: "OK",
statusText: okStatus,
type: "png",
fullMimeType: "image/png",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 580),
time: true
});
verifyRequestItemTarget(RequestsMenu.getItemAtIndex(6),
"GET", CONTENT_TYPE_SJS + "?fmt=gzip", {
"GET", sjsURL + "?fmt=gzip", {
status: 200,
statusText: "OK",
statusText: okStatus,
type: "plain",
fullMimeType: "text/plain",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 73),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 10.73),
time: true
});
if (isHTTPS) {
// Brotli is enabled only on HTTPS.
verifyRequestItemTarget(RequestsMenu.getItemAtIndex(6),
"GET", sjsURL + "?fmt=gzip", {
status: 200,
statusText: okStatus,
type: "plain",
fullMimeType: "text/plain",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 73),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 10.73),
time: true
});
}
let onEvent = waitForResponseBodyDisplayed();
EventUtils.sendMouseEvent({ type: "mousedown" },
@ -116,6 +140,11 @@ add_task(function* () {
yield selectIndexAndWaitForTabUpdated(6);
yield testResponseTab("gzip");
if (isHTTPS) {
yield selectIndexAndWaitForTabUpdated(7);
yield testResponseTab("br");
}
yield teardown(monitor);
function* testResponseTab(type) {
@ -240,6 +269,17 @@ add_task(function* () {
"The mode active in the source editor is incorrect for the gzip request.");
break;
}
case "br": {
checkVisibility("textarea");
let expected = "X".repeat(64);
let editor = yield NetMonitorView.editor("#response-content-textarea");
is(editor.getText(), expected,
"The text shown in the source editor is incorrect for the brotli request.");
is(editor.getMode(), Editor.modes.text,
"The mode active in the source editor is incorrect for the brotli request.");
break;
}
}
}
@ -252,4 +292,12 @@ add_task(function* () {
function waitForResponseBodyDisplayed() {
return monitor.panelWin.once(monitor.panelWin.EVENTS.RESPONSE_BODY_DISPLAYED);
}
}
add_task(function* () {
yield* content_type_test(false);
});
add_task(function* () {
yield* content_type_test(true);
});

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

@ -16,7 +16,7 @@ add_task(function* () {
RequestsMenu.lazyUpdate = false;
let wait = waitForNetworkEvents(monitor, 7);
let wait = waitForNetworkEvents(monitor, 8);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});

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

@ -18,7 +18,7 @@ add_task(function* () {
RequestsMenu.lazyUpdate = false;
let wait = waitForNetworkEvents(monitor, 7);
let wait = waitForNetworkEvents(monitor, 8);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});

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

@ -44,7 +44,7 @@ add_task(function* () {
function waitForEvents() {
return promise.all([
waitForNetworkEvents(monitor, 7),
waitForNetworkEvents(monitor, 8),
monitor.panelWin.once(EVENTS.RESPONSE_IMAGE_THUMBNAIL_DISPLAYED)
]);
}

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

@ -15,7 +15,7 @@ add_task(function* test() {
let { RequestsMenu } = NetMonitorView;
RequestsMenu.lazyUpdate = true;
let onEvents = waitForNetworkEvents(monitor, 7);
let onEvents = waitForNetworkEvents(monitor, 8);
let onThumbnail = monitor.panelWin.once(EVENTS.RESPONSE_IMAGE_THUMBNAIL_DISPLAYED);
yield performRequests();

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

@ -13,12 +13,14 @@ var NetworkHelper = require("devtools/shared/webconsole/network-helper");
var { Toolbox } = require("devtools/client/framework/toolbox");
const EXAMPLE_URL = "http://example.com/browser/devtools/client/netmonitor/test/";
const HTTPS_EXAMPLE_URL = "https://example.com/browser/devtools/client/netmonitor/test/";
const API_CALLS_URL = EXAMPLE_URL + "html_api-calls-test-page.html";
const SIMPLE_URL = EXAMPLE_URL + "html_simple-test-page.html";
const NAVIGATE_URL = EXAMPLE_URL + "html_navigate-test-page.html";
const CONTENT_TYPE_URL = EXAMPLE_URL + "html_content-type-test-page.html";
const CONTENT_TYPE_WITHOUT_CACHE_URL = EXAMPLE_URL + "html_content-type-without-cache-test-page.html";
const HTTPS_CONTENT_TYPE_WITHOUT_CACHE_URL = HTTPS_EXAMPLE_URL + "html_content-type-without-cache-test-page.html";
const CYRILLIC_URL = EXAMPLE_URL + "html_cyrillic-test-page.html";
const STATUS_CODES_URL = EXAMPLE_URL + "html_status-codes-test-page.html";
const POST_DATA_URL = EXAMPLE_URL + "html_post-data-test-page.html";
@ -44,6 +46,7 @@ const CORS_URL = EXAMPLE_URL + "html_cors-test-page.html";
const SIMPLE_SJS = EXAMPLE_URL + "sjs_simple-test-server.sjs";
const CONTENT_TYPE_SJS = EXAMPLE_URL + "sjs_content-type-test-server.sjs";
const HTTPS_CONTENT_TYPE_SJS = HTTPS_EXAMPLE_URL + "sjs_content-type-test-server.sjs";
const STATUS_CODES_SJS = EXAMPLE_URL + "sjs_status-codes-test-server.sjs";
const SORTING_SJS = EXAMPLE_URL + "sjs_sorting-test-server.sjs";
const HTTPS_REDIRECT_SJS = EXAMPLE_URL + "sjs_https-redirect-test-server.sjs";
@ -54,6 +57,7 @@ const HSTS_BASE_URL = EXAMPLE_URL;
const HSTS_PAGE_URL = CUSTOM_GET_URL;
const TEST_IMAGE = EXAMPLE_URL + "test-image.png";
const HTTPS_TEST_IMAGE = HTTPS_EXAMPLE_URL + "test-image.png";
const TEST_IMAGE_DATA_URI = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg==";
const FRAME_SCRIPT_UTILS_URL = "chrome://devtools/content/shared/frame-script-utils.js";

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

@ -35,7 +35,9 @@
get("sjs_content-type-test-server.sjs?fmt=bogus", function() {
get("test-image.png?v=" + Math.random(), function() {
get("sjs_content-type-test-server.sjs?fmt=gzip", function() {
// Done.
get("sjs_content-type-test-server.sjs?fmt=br", function() {
// Done.
});
});
});
});

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

@ -232,6 +232,17 @@ function handleRequest(request, response) {
doubleGzipCompressString(data, observer);
break;
}
case "br": {
response.setStatusLine(request.httpVersion, status, "Connected");
response.setHeader("Content-Type", "text/plain", false);
response.setHeader("Content-Encoding", "br", false);
setCacheHeaders();
response.setHeader("Content-Length", "10", false);
// Use static data since we cannot encode brotli.
response.write("\x1b\x3f\x00\x00\x24\xb0\xe2\x99\x80\x12");
response.finish();
break;
}
case "hls-m3u8": {
response.setStatusLine(request.httpVersion, status, "OK");
response.setHeader("Content-Type", "application/x-mpegurl", false);

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

@ -62,7 +62,7 @@ exports.viewSourceInDebugger = Task.async(function* (toolbox, sourceURL, sourceL
yield toolbox.selectTool("jsdebugger");
const source = dbg._selectors().getSourceByURL(dbg._getState(), sourceURL);
if (source) {
dbg._actions().selectSourceByURL(sourceURL, { line: sourceLine });
dbg._actions().selectSourceURL(sourceURL, { line: sourceLine });
return true;
}

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

@ -11,8 +11,9 @@
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/test" +
"/test-bug-766001-js-console-links.html";
// Force the old debugger UI since it's directly used (see Bug 1301705)
Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false);
// Force the new debugger UI, in case this gets uplifted with the old
// debugger still turned on
Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", true);
registerCleanupFunction(function* () {
Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
});
@ -79,10 +80,9 @@ function test() {
yield hud.ui.once("source-in-debugger-opened");
let toolbox = yield gDevTools.getToolbox(hud.target);
let {panelWin: { DebuggerView: view }} = toolbox.getPanel("jsdebugger");
is(view.Sources.selectedValue,
getSourceActor(view.Sources, url),
let dbg = toolbox.getPanel("jsdebugger");
is(dbg._selectors().getSelectedSource(dbg._getState()).get("url"),
url,
"expected source url");
is(view.editor.getCursor().line, line - 1, "expected source line");
}
}

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

@ -446,7 +446,7 @@ NetworkResponseListener.prototype = {
.getService(Ci.nsIStreamConverterService);
let encodings = encodingHeader.split(/\s*\t*,\s*\t*/);
let nextListener = this;
let acceptedEncodings = ["gzip", "deflate", "x-gzip", "x-deflate"];
let acceptedEncodings = ["gzip", "deflate", "br", "x-gzip", "x-deflate"];
for (let i in encodings) {
// There can be multiple conversions applied
let enc = encodings[i].toLowerCase();

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

@ -644,11 +644,8 @@ nsAttrValue::ToString(nsAString& aResult) const
{
aResult.Truncate();
MiscContainer *container = GetMiscContainer();
DeclarationBlock* decl = container->mValue.mCSSDeclaration;
// XXXheycam Once we support CSSOM access to them, we should
// probably serialize ServoDeclarationBlock like this too.
if (decl && decl->IsGecko()) {
decl->AsGecko()->ToString(aResult);
if (DeclarationBlock* decl = container->mValue.mCSSDeclaration) {
decl->ToString(aResult);
}
const_cast<nsAttrValue*>(this)->SetMiscAtomOrString(&aResult);

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

@ -110,6 +110,7 @@
#include "mozilla/layers/APZCTreeManager.h" // for layers::ZoomToRectBehavior
#include "mozilla/dom/Promise.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/gfx/GPUProcessManager.h"
#ifdef XP_WIN
#undef GetClassName
@ -4092,6 +4093,29 @@ nsDOMWindowUtils::ForceReflowInterrupt()
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::TerminateGPUProcess()
{
GPUProcessManager* pm = GPUProcessManager::Get();
if (pm) {
pm->KillProcess();
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetGpuProcessPid(int32_t* aPid)
{
GPUProcessManager* pm = GPUProcessManager::Get();
if (pm) {
*aPid = pm->GPUProcessPid();
} else {
*aPid = -1;
}
return NS_OK;
}
NS_INTERFACE_MAP_BEGIN(nsTranslationNodeList)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsITranslationNodeList)

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

@ -268,6 +268,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1276553
promises.push(BrowserTestUtils.waitForMessage(b2.messageManager, 'test:pagehide', msg => pagehide2 = true));
promises.push(BrowserTestUtils.waitForMessage(b1.messageManager, 'test:pageshow', msg => pagehide1));
promises.push(BrowserTestUtils.waitForMessage(b2.messageManager, 'test:pageshow', msg => pagehide2));
// For swapping remote browsers, we'll also receive Content:LocationChange
if (b1.isRemoteBrowser) {
promises.push(BrowserTestUtils.waitForMessage(b1.messageManager, 'Content:LocationChange'));
}
promises.push(Promise.resolve().then(() => {
let f1 = b1.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader;
let f2 = b2.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader;
@ -286,6 +292,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1276553
// For swapping there should be a pagehide followed by a pageshow.
promises.push(BrowserTestUtils.waitForMessage(browser.messageManager,
'test:pagehide', msg => pagehide = true));
// For swapping remote browsers, we'll also receive Content:LocationChange
if (browser.isRemoteBrowser) {
promises.push(BrowserTestUtils.waitForMessage(browser.messageManager,
'Content:LocationChange'));
}
}
promises.push(BrowserTestUtils.waitForMessage(browser.messageManager,
'test:pageshow', msg => {

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

@ -49,7 +49,7 @@ interface nsIJSRAIIHelper;
interface nsIContentPermissionRequest;
interface nsIObserver;
[scriptable, uuid(46b44e33-13c2-4eb3-bf80-76a4e0857ccc)]
[scriptable, uuid(c471d440-004b-4c50-a6f2-747db5f443b6)]
interface nsIDOMWindowUtils : nsISupports {
/**
@ -1965,6 +1965,16 @@ interface nsIDOMWindowUtils : nsISupports {
*/
void forceReflowInterrupt();
/**
* Terminate the GPU process. Used for testing GPU process restarts.
*/
void terminateGPUProcess();
/**
* Returns the GPU process pid, or -1 if there is no GPU process.
*/
readonly attribute int32_t gpuProcessPid;
const long MOUSE_BUTTONS_NO_BUTTON = 0x00;
const long MOUSE_BUTTONS_LEFT_BUTTON = 0x01;
const long MOUSE_BUTTONS_RIGHT_BUTTON = 0x02;

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

@ -223,6 +223,12 @@ DelayedDeleteSubprocess(GeckoChildProcessHost* aSubprocess)
PostTask(mozilla::MakeAndAddRef<DeleteTask<GeckoChildProcessHost>>(aSubprocess));
}
void
GPUProcessHost::KillProcess()
{
KillHard("DiagnosticKill");
}
void
GPUProcessHost::DestroyProcess()
{

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

@ -96,6 +96,9 @@ public:
void SetListener(Listener* aListener);
// Used for tests and diagnostics
void KillProcess();
private:
// Called on the main thread.
void OnChannelConnectedTask();

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

@ -386,6 +386,16 @@ GPUProcessManager::CleanShutdown()
mVsyncIOThread = nullptr;
}
void
GPUProcessManager::KillProcess()
{
if (!mProcess) {
return;
}
mProcess->KillProcess();
}
void
GPUProcessManager::DestroyProcess()
{
@ -606,6 +616,15 @@ GPUProcessManager::CreateContentImageBridge(base::ProcessId aOtherProcess,
return true;
}
base::ProcessId
GPUProcessManager::GPUProcessPid()
{
base::ProcessId gpuPid = mGPUChild
? mGPUChild->OtherPid()
: -1;
return gpuPid;
}
bool
GPUProcessManager::CreateContentVRManager(base::ProcessId aOtherProcess,
ipc::Endpoint<PVRManagerChild>* aOutEndpoint)

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

@ -133,6 +133,12 @@ public:
// true if the message was sent, false if not.
bool NotifyGpuObservers(const char* aTopic);
// Used for tests and diagnostics
void KillProcess();
// Returns -1 if there is no GPU process, or the platform pid for it.
base::ProcessId GPUProcessPid();
// Returns access to the PGPU protocol if a GPU process is present.
GPUChild* GetGPUChild() {
return mGPUChild;

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

@ -604,14 +604,13 @@ Layer::SnapTransformTranslation(const Matrix4x4& aTransform,
}
Matrix matrix2D;
Matrix4x4 result;
if (aTransform.CanDraw2D(&matrix2D) &&
!matrix2D.HasNonTranslation() &&
matrix2D.HasNonIntegerTranslation()) {
auto snappedTranslation = IntPoint::Round(matrix2D.GetTranslation());
Matrix snappedMatrix = Matrix::Translation(snappedTranslation.x,
snappedTranslation.y);
result = Matrix4x4::From2D(snappedMatrix);
Matrix4x4 result = Matrix4x4::From2D(snappedMatrix);
if (aResidualTransform) {
// set aResidualTransform so that aResidual * snappedMatrix == matrix2D.
// (I.e., appying snappedMatrix after aResidualTransform gives the
@ -623,6 +622,13 @@ Layer::SnapTransformTranslation(const Matrix4x4& aTransform,
return result;
}
return SnapTransformTranslation3D(aTransform, aResidualTransform);
}
Matrix4x4
Layer::SnapTransformTranslation3D(const Matrix4x4& aTransform,
Matrix* aResidualTransform)
{
if(aTransform.IsSingular() ||
aTransform.HasPerspectiveComponent() ||
aTransform.HasNonTranslation() ||
@ -672,7 +678,7 @@ Layer::SnapTransformTranslation(const Matrix4x4& aTransform,
// Translate transformed origin to transformed snap since the
// residual transform would trnslate the snap to the origin.
Point3D transformedShift = transformedSnap - transformedOrigin;
result = aTransform;
Matrix4x4 result = aTransform;
result.PostTranslate(transformedShift.x,
transformedShift.y,
transformedShift.z);

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

@ -1821,6 +1821,8 @@ protected:
*/
gfx::Matrix4x4 SnapTransformTranslation(const gfx::Matrix4x4& aTransform,
gfx::Matrix* aResidualTransform);
gfx::Matrix4x4 SnapTransformTranslation3D(const gfx::Matrix4x4& aTransform,
gfx::Matrix* aResidualTransform);
/**
* See comment for SnapTransformTranslation.
* This function implements type 2 snapping. If aTransform is a translation

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

@ -37,18 +37,23 @@ BasicContainerLayer::ComputeEffectiveTransforms(const Matrix4x4& aTransformToSur
// are aligned in device space, so it doesn't really matter how we snap
// containers.
Matrix residual;
Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface;
if (!Extend3DContext() && !Is3DContextLeaf()) {
// For 3D transform leaked from extended parent layer.
Matrix4x4 transformToSurface = aTransformToSurface;
bool participate3DCtx = Extend3DContext() || Is3DContextLeaf();
if (!participate3DCtx &&
GetContentFlags() & CONTENT_BACKFACE_HIDDEN) {
// For backface-hidden layers
transformToSurface.ProjectTo2D();
}
Matrix4x4 idealTransform = GetLocalTransform() * transformToSurface;
if (!participate3DCtx &&
!(GetContentFlags() & CONTENT_BACKFACE_HIDDEN)) {
// For non-backface-hidden layers,
// 3D components are required to handle CONTENT_BACKFACE_HIDDEN.
idealTransform.ProjectTo2D();
}
if (!idealTransform.CanDraw2D()) {
if (!Extend3DContext() ||
(!idealTransform.Is2D() && Creates3DContextWithExtendingChildren())) {
if (!Creates3DContextWithExtendingChildren()) {
idealTransform.ProjectTo2D();
}
if (!Extend3DContext()) {
mEffectiveTransform = idealTransform;
ComputeEffectiveTransformsForChildren(Matrix4x4());
ComputeEffectiveTransformForMaskLayers(Matrix4x4());
@ -84,12 +89,12 @@ BasicContainerLayer::ComputeEffectiveTransforms(const Matrix4x4& aTransformToSur
(GetMixBlendMode() != CompositionOp::OP_OVER && HasMultipleChildren()) ||
(GetEffectiveOpacity() != 1.0 && ((HasMultipleChildren() && !Extend3DContext()) || hasSingleBlendingChild));
if (!Extend3DContext()) {
idealTransform.ProjectTo2D();
}
mEffectiveTransform =
!mUseIntermediateSurface ?
idealTransform : SnapTransformTranslation(idealTransform, &residual);
idealTransform :
(!(GetContentFlags() & CONTENT_BACKFACE_HIDDEN) ?
SnapTransformTranslation(idealTransform, &residual) :
SnapTransformTranslation3D(idealTransform, &residual));
Matrix4x4 childTransformToSurface =
(!mUseIntermediateSurface ||
(mUseIntermediateSurface && !Extend3DContext() /* 2D */)) ?

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

@ -2,7 +2,7 @@ load(libdir + 'wasm.js');
const WasmPage = 64 * 1024;
const emptyModule = wasmTextToBinary('(module)');
const moduleBinary = wasmTextToBinary('(module (func (export "f") (result i32) (i32.const 42)))');
// 'WebAssembly' data property on global object
const wasmDesc = Object.getOwnPropertyDescriptor(this, 'WebAssembly');
@ -70,8 +70,8 @@ assertErrorMessage(() => new Module(1), TypeError, "first argument must be an Ar
assertErrorMessage(() => new Module({}), TypeError, "first argument must be an ArrayBuffer or typed array object");
assertErrorMessage(() => new Module(new Uint8Array()), CompileError, /failed to match magic number/);
assertErrorMessage(() => new Module(new ArrayBuffer()), CompileError, /failed to match magic number/);
assertEq(new Module(emptyModule) instanceof Module, true);
assertEq(new Module(emptyModule.buffer) instanceof Module, true);
assertEq(new Module(moduleBinary) instanceof Module, true);
assertEq(new Module(moduleBinary.buffer) instanceof Module, true);
// 'WebAssembly.Module.prototype' data property
const moduleProtoDesc = Object.getOwnPropertyDescriptor(Module, 'prototype');
@ -87,7 +87,7 @@ assertEq(String(moduleProto), "[object Object]");
assertEq(Object.getPrototypeOf(moduleProto), Object.prototype);
// 'WebAssembly.Module' instance objects
const m1 = new Module(emptyModule);
const m1 = new Module(moduleBinary);
assertEq(typeof m1, "object");
assertEq(String(m1), "[object WebAssembly.Module]");
assertEq(Object.getPrototypeOf(m1), moduleProto);
@ -137,6 +137,14 @@ assertEq(exportsDesc.writable, true);
assertEq(exportsDesc.enumerable, true);
assertEq(exportsDesc.configurable, true);
// Exported WebAssembly functions
const f = i1.exports.f;
assertEq(f instanceof Function, true);
assertEq(f.length, 0);
assertEq('name' in f, true);
assertEq(Function.prototype.call.call(f), 42);
assertErrorMessage(() => new f(), TypeError, /is not a constructor/);
// 'WebAssembly.Memory' data property
const memoryDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'Memory');
assertEq(typeof memoryDesc.value, "function");
@ -379,5 +387,5 @@ function assertCompileSuccess(bytes) {
drainJobQueue();
assertEq(module instanceof Module, true);
}
assertCompileSuccess(emptyModule);
assertCompileSuccess(emptyModule.buffer);
assertCompileSuccess(moduleBinary);
assertCompileSuccess(moduleBinary.buffer);

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

@ -930,6 +930,17 @@ class MacroAssembler : public MacroAssemblerSpecific
// temp may be invalid only if the chip has the POPCNT instruction.
inline void popcnt64(Register64 src, Register64 dest, Register temp) PER_ARCH;
// ===============================================================
// Condition functions
template <typename T1, typename T2>
inline void cmp32Set(Condition cond, T1 lhs, T2 rhs, Register dest)
DEFINED_ON(x86_shared, arm, arm64, mips32, mips64);
template <typename T1, typename T2>
inline void cmpPtrSet(Condition cond, T1 lhs, T2 rhs, Register dest)
PER_ARCH;
// ===============================================================
// Branch functions
@ -965,7 +976,7 @@ class MacroAssembler : public MacroAssemblerSpecific
// When a fail label is not defined it will fall through to next instruction,
// else jump to the fail label.
inline void branch64(Condition cond, Register64 lhs, Imm64 val, Label* success,
Label* fail = nullptr) DEFINED_ON(x86, x64, arm, mips32, mips64);
Label* fail = nullptr) PER_ARCH;
inline void branch64(Condition cond, Register64 lhs, Register64 rhs, Label* success,
Label* fail = nullptr) DEFINED_ON(x86, x64, arm, mips32, mips64);
// On x86 and x64 NotEqual and Equal conditions are allowed for the branch64 variants

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

@ -997,6 +997,25 @@ MacroAssembler::rotateRight64(Register shift, Register64 src, Register64 dest, R
bind(&done);
}
// ===============================================================
// Condition functions
template <typename T1, typename T2>
void
MacroAssembler::cmp32Set(Condition cond, T1 lhs, T2 rhs, Register dest)
{
cmp32(lhs, rhs);
emitSet(cond, dest);
}
template <typename T1, typename T2>
void
MacroAssembler::cmpPtrSet(Condition cond, T1 lhs, T2 rhs, Register dest)
{
cmpPtr(lhs, rhs);
emitSet(cond, dest);
}
// ===============================================================
// Bit counting functions

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

@ -1459,19 +1459,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
ma_mov(Imm32(1), dest, cond);
}
template <typename T1, typename T2>
void cmpPtrSet(Assembler::Condition cond, T1 lhs, T2 rhs, Register dest)
{
cmpPtr(lhs, rhs);
emitSet(cond, dest);
}
template <typename T1, typename T2>
void cmp32Set(Assembler::Condition cond, T1 lhs, T2 rhs, Register dest)
{
cmp32(lhs, rhs);
emitSet(cond, dest);
}
void testNullSet(Condition cond, const ValueOperand& value, Register dest) {
cond = testNull(cond, value);
emitSet(cond, dest);

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

@ -673,6 +673,25 @@ MacroAssembler::rshift64Arithmetic(Register shift, Register64 srcDest)
MOZ_CRASH("NYI: rshift64Arithmetic");
}
// ===============================================================
// Condition functions
template <typename T1, typename T2>
void
MacroAssembler::cmp32Set(Condition cond, T1 lhs, T2 rhs, Register dest)
{
cmp32(lhs, rhs);
emitSet(cond, dest);
}
template <typename T1, typename T2>
void
MacroAssembler::cmpPtrSet(Condition cond, T1 lhs, T2 rhs, Register dest)
{
cmpPtr(lhs, rhs);
emitSet(cond, dest);
}
// ===============================================================
// Rotation functions
@ -829,6 +848,12 @@ MacroAssembler::branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, L
branch32(cond, Address(scratch, 0), rhs, label);
}
void
MacroAssembler::branch64(Condition cond, Register64 lhs, Imm64 val, Label* success, Label* fail)
{
MOZ_CRASH("NYI: branch64 reg-imm");
}
void
MacroAssembler::branch64(Condition cond, const Address& lhs, Imm64 val, Label* label)
{

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

@ -420,18 +420,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
Cset(ARMRegister(dest, 64), cond);
}
template <typename T1, typename T2>
void cmpPtrSet(Condition cond, T1 lhs, T2 rhs, Register dest) {
cmpPtr(lhs, rhs);
emitSet(cond, dest);
}
template <typename T1, typename T2>
void cmp32Set(Condition cond, T1 lhs, T2 rhs, Register dest) {
cmp32(lhs, rhs);
emitSet(cond, dest);
}
void testNullSet(Condition cond, const ValueOperand& value, Register dest) {
cond = testNull(cond, value);
emitSet(cond, dest);

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

@ -663,6 +663,20 @@ MacroAssembler::rotateRight64(Register shift, Register64 src, Register64 dest, R
bind(&done);
}
template <typename T1, typename T2>
void
MacroAssembler::cmpPtrSet(Condition cond, T1 lhs, T2 rhs, Register dest)
{
ma_cmp_set(dest, lhs, rhs, cond);
}
template <typename T1, typename T2>
void
MacroAssembler::cmp32Set(Condition cond, T1 lhs, T2 rhs, Register dest)
{
ma_cmp_set(dest, lhs, rhs, cond);
}
// ===============================================================
// Bit counting functions

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

@ -969,18 +969,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
// convert it to double. Else, branch to failure.
void ensureDouble(const ValueOperand& source, FloatRegister dest, Label* failure);
template <typename T1, typename T2>
void cmpPtrSet(Assembler::Condition cond, T1 lhs, T2 rhs, Register dest)
{
ma_cmp_set(dest, lhs, rhs, cond);
}
template <typename T1, typename T2>
void cmp32Set(Assembler::Condition cond, T1 lhs, T2 rhs, Register dest)
{
ma_cmp_set(dest, lhs, rhs, cond);
}
protected:
bool buildOOLFakeExitFrame(void* fakeReturnAddr);

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

@ -400,6 +400,23 @@ MacroAssembler::rotateRight64(Register count, Register64 src, Register64 dest, R
ma_dror(dest.reg, src.reg, count);
}
// ===============================================================
// Condition functions
template <typename T1, typename T2>
void
MacroAssembler::cmpPtrSet(Condition cond, T1 lhs, T2 rhs, Register dest)
{
ma_cmp_set(dest, lhs, rhs, cond);
}
template <typename T1, typename T2>
void
MacroAssembler::cmp32Set(Condition cond, T1 lhs, T2 rhs, Register dest)
{
ma_cmp_set(dest, lhs, rhs, cond);
}
// ===============================================================
// Bit counting functions

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

@ -982,19 +982,9 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64
// convert it to double. Else, branch to failure.
void ensureDouble(const ValueOperand& source, FloatRegister dest, Label* failure);
template <typename T1, typename T2>
void cmpPtrSet(Assembler::Condition cond, T1 lhs, T2 rhs, Register dest)
{
ma_cmp_set(dest, lhs, rhs, cond);
}
void cmpPtrSet(Assembler::Condition cond, Address lhs, ImmPtr rhs, Register dest);
void cmpPtrSet(Assembler::Condition cond, Register lhs, Address rhs, Register dest);
template <typename T1, typename T2>
void cmp32Set(Assembler::Condition cond, T1 lhs, T2 rhs, Register dest)
{
ma_cmp_set(dest, lhs, rhs, cond);
}
void cmp32Set(Assembler::Condition cond, Register lhs, Address rhs, Register dest);
void cmp64Set(Assembler::Condition cond, Register lhs, Imm32 rhs, Register dest)

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

@ -455,6 +455,17 @@ MacroAssembler::rotateRight64(Imm32 count, Register64 src, Register64 dest, Regi
rotateRight64(count, src, dest);
}
// ===============================================================
// Condition functions
template <typename T1, typename T2>
void
MacroAssembler::cmpPtrSet(Condition cond, T1 lhs, T2 rhs, Register dest)
{
cmpPtr(lhs, rhs);
emitSet(cond, dest);
}
// ===============================================================
// Bit counting functions

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

@ -513,13 +513,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
testq(rhs, lhs);
}
template <typename T1, typename T2>
void cmpPtrSet(Assembler::Condition cond, T1 lhs, T2 rhs, Register dest)
{
cmpPtr(lhs, rhs);
emitSet(cond, dest);
}
/////////////////////////////////////////////////////////////////
// Common interface.
/////////////////////////////////////////////////////////////////

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

@ -453,6 +453,17 @@ MacroAssembler::rshift32Arithmetic(Imm32 shift, Register srcDest)
sarl(shift, srcDest);
}
// ===============================================================
// Condition functions
template <typename T1, typename T2>
void
MacroAssembler::cmp32Set(Condition cond, T1 lhs, T2 rhs, Register dest)
{
cmp32(lhs, rhs);
emitSet(cond, dest);
}
// ===============================================================
// Branch instructions

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

@ -1302,13 +1302,6 @@ class MacroAssemblerX86Shared : public Assembler
}
}
template <typename T1, typename T2>
void cmp32Set(Assembler::Condition cond, T1 lhs, T2 rhs, Register dest)
{
cmp32(lhs, rhs);
emitSet(cond, dest);
}
// Emit a JMP that can be toggled to a CMP. See ToggleToJmp(), ToggleToCmp().
CodeOffset toggledJump(Label* label) {
CodeOffset offset(size());

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

@ -610,6 +610,17 @@ MacroAssembler::popcnt64(Register64 src, Register64 dest, Register tmp)
xorl(dest.high, dest.high);
}
// ===============================================================
// Condition functions
template <typename T1, typename T2>
void
MacroAssembler::cmpPtrSet(Condition cond, T1 lhs, T2 rhs, Register dest)
{
cmpPtr(lhs, rhs);
emitSet(cond, dest);
}
// ===============================================================
// Branch functions

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

@ -553,13 +553,6 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
test32(lhs, Imm32(rhs.value));
}
template <typename T1, typename T2>
void cmpPtrSet(Assembler::Condition cond, T1 lhs, T2 rhs, Register dest)
{
cmpPtr(lhs, rhs);
emitSet(cond, dest);
}
/////////////////////////////////////////////////////////////////
// Common interface.
/////////////////////////////////////////////////////////////////

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

@ -378,7 +378,7 @@ static const JSPropertySpec function_properties[] = {
static bool
ResolveInterpretedFunctionPrototype(JSContext* cx, HandleFunction fun, HandleId id)
{
MOZ_ASSERT(fun->isInterpreted() || fun->isWasmNative());
MOZ_ASSERT(fun->isInterpreted() || fun->isAsmJSNative());
MOZ_ASSERT(id == NameToId(cx->names().prototype));
// Assert that fun is not a compiler-created function object, which

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

@ -40,7 +40,7 @@ class JSFunction : public js::NativeObject
ClassConstructor,
Getter,
Setter,
Wasm, /* function is wasm module or exported function */
AsmJS, /* function is an asm.js module or exported function */
FunctionKindLimit
};
@ -66,7 +66,7 @@ class JSFunction : public js::NativeObject
FUNCTION_KIND_SHIFT = 13,
FUNCTION_KIND_MASK = 0x7 << FUNCTION_KIND_SHIFT,
WASM_KIND = Wasm << FUNCTION_KIND_SHIFT,
ASMJS_KIND = AsmJS << FUNCTION_KIND_SHIFT,
ARROW_KIND = Arrow << FUNCTION_KIND_SHIFT,
METHOD_KIND = Method << FUNCTION_KIND_SHIFT,
CLASSCONSTRUCTOR_KIND = ClassConstructor << FUNCTION_KIND_SHIFT,
@ -77,8 +77,8 @@ class JSFunction : public js::NativeObject
NATIVE_FUN = 0,
NATIVE_CTOR = NATIVE_FUN | CONSTRUCTOR,
NATIVE_CLASS_CTOR = NATIVE_FUN | CONSTRUCTOR | CLASSCONSTRUCTOR_KIND,
WASM_CTOR = WASM_KIND | NATIVE_CTOR,
ASMJS_LAMBDA_CTOR = WASM_KIND | NATIVE_CTOR | LAMBDA,
ASMJS_CTOR = ASMJS_KIND | NATIVE_CTOR,
ASMJS_LAMBDA_CTOR = ASMJS_KIND | NATIVE_CTOR | LAMBDA,
INTERPRETED_METHOD = INTERPRETED | METHOD_KIND,
INTERPRETED_METHOD_GENERATOR = INTERPRETED | METHOD_KIND,
INTERPRETED_CLASS_CONSTRUCTOR = INTERPRETED | CLASSCONSTRUCTOR_KIND | CONSTRUCTOR,
@ -173,7 +173,7 @@ class JSFunction : public js::NativeObject
bool isConstructor() const { return flags() & CONSTRUCTOR; }
/* Possible attributes of a native function: */
bool isWasmNative() const { return kind() == Wasm; }
bool isAsmJSNative() const { return kind() == AsmJS; }
/* Possible attributes of an interpreted function: */
bool isExprBody() const { return flags() & EXPR_BODY; }
@ -215,7 +215,7 @@ class JSFunction : public js::NativeObject
/* Compound attributes: */
bool isBuiltin() const {
return (isNative() && !isWasmNative()) || isSelfHostedBuiltin();
return (isNative() && !isAsmJSNative()) || isSelfHostedBuiltin();
}
bool isNamedLambda() const {

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

@ -791,7 +791,7 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope, HandleScrip
} else if (function->isInterpreted()) {
funEnclosingScope = function->nonLazyScript()->enclosingScope();
} else {
MOZ_ASSERT(function->isWasmNative());
MOZ_ASSERT(function->isAsmJSNative());
return xdr->fail(JS::TranscodeResult_Failure_AsmJSNotSupported);
}
@ -3210,7 +3210,7 @@ js::detail::CopyScript(JSContext* cx, HandleScript src, HandleScript dst,
RootedFunction innerFun(cx, &obj->as<JSFunction>());
if (innerFun->isNative()) {
if (cx->compartment() != innerFun->compartment()) {
MOZ_ASSERT(innerFun->isWasmNative());
MOZ_ASSERT(innerFun->isAsmJSNative());
JS_ReportErrorASCII(cx, "AsmJS modules do not yet support cloning.");
return false;
}

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

@ -8152,7 +8152,7 @@ NewAsmJSModuleFunction(ExclusiveContext* cx, JSFunction* origFun, HandleObject m
RootedAtom name(cx, origFun->name());
JSFunction::Flags flags = origFun->isLambda() ? JSFunction::ASMJS_LAMBDA_CTOR
: JSFunction::WASM_CTOR;
: JSFunction::ASMJS_CTOR;
JSFunction* moduleFun =
NewNativeConstructor(cx, InstantiateAsmJS, origFun->nargs(), name,
gc::AllocKind::FUNCTION_EXTENDED, TenuredObject,

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

@ -191,7 +191,7 @@ static const Register StackPointer = RealStackPointer;
// temp register for load/store that has a single-byte persona.
static const Register ScratchRegX86 = ebx;
# define QUOT_REM_I64_CALLOUT
# define INT_DIV_I64_CALLOUT
#endif
#ifdef JS_CODEGEN_ARM
@ -206,7 +206,7 @@ static const Register FuncPtrCallTemp = CallTempReg1;
// worth it yet. CallTempReg2 seems safe.
static const Register ScratchRegARM = CallTempReg2;
# define QUOT_REM_I64_CALLOUT
# define INT_DIV_I64_CALLOUT
# define I64_TO_FLOAT_CALLOUT
# define FLOAT_TO_I64_CALLOUT
#endif
@ -945,11 +945,7 @@ class BaseCompiler
}
RegI32 fromI64(RegI64 r) {
#ifdef JS_PUNBOX64
return RegI32(r.reg.reg);
#else
return RegI32(r.reg.low);
#endif
return RegI32(lowPart(r));
}
RegI64 widenI32(RegI32 r) {
@ -1000,8 +996,6 @@ class BaseCompiler
freeI64(r);
needI32(except);
#endif
}
void freeF64(RegF64 r) {
@ -2522,19 +2516,10 @@ class BaseCompiler
}
}
void checkDivideByZeroI64(RegI64 rhs, RegI64 srcDest, Label* done) {
void checkDivideByZeroI64(RegI64 r) {
MOZ_ASSERT(!isCompilingAsmJS());
#if defined(JS_CODEGEN_X64)
masm.testq(rhs.reg.reg, rhs.reg.reg);
masm.j(Assembler::Zero, trap(Trap::IntegerDivideByZero));
#elif defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_ARM)
Label nonZero;
masm.branchTest32(Assembler::NonZero, rhs.reg.low, rhs.reg.low, &nonZero);
masm.branchTest32(Assembler::Zero, rhs.reg.high, rhs.reg.high, trap(Trap::IntegerDivideByZero));
masm.bind(&nonZero);
#else
MOZ_CRASH("BaseCompiler platform hook: checkDivideByZeroI64");
#endif
ScratchI32 scratch(*this);
masm.branchTest64(Assembler::Zero, r.reg, r.reg, scratch, trap(Trap::IntegerDivideByZero));
}
void checkDivideSignedOverflowI32(RegI32 rhs, RegI32 srcDest, Label* done, bool zeroOnOverflow) {
@ -2554,7 +2539,6 @@ class BaseCompiler
}
void checkDivideSignedOverflowI64(RegI64 rhs, RegI64 srcDest, Label* done, bool zeroOnOverflow) {
#if defined(JS_CODEGEN_X64) || defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_ARM)
MOZ_ASSERT(!isCompilingAsmJS());
Label notmin;
masm.branch64(Assembler::NotEqual, srcDest.reg, Imm64(INT64_MIN), &notmin);
@ -2566,16 +2550,13 @@ class BaseCompiler
masm.jump(trap(Trap::IntegerOverflow));
}
masm.bind(&notmin);
#else
MOZ_CRASH("BaseCompiler platform hook: checkDivideSignedOverflowI64");
#endif
}
#ifndef QUOT_REM_I64_CALLOUT
#ifndef INT_DIV_I64_CALLOUT
void quotientI64(RegI64 rhs, RegI64 srcDest, IsUnsigned isUnsigned) {
Label done;
checkDivideByZeroI64(rhs, srcDest, &done);
checkDivideByZeroI64(rhs);
if (!isUnsigned)
checkDivideSignedOverflowI64(rhs, srcDest, &done, ZeroOnOverflow(false));
@ -2600,7 +2581,7 @@ class BaseCompiler
void remainderI64(RegI64 rhs, RegI64 srcDest, IsUnsigned isUnsigned) {
Label done;
checkDivideByZeroI64(rhs, srcDest, &done);
checkDivideByZeroI64(rhs);
if (!isUnsigned)
checkDivideSignedOverflowI64(rhs, srcDest, &done, ZeroOnOverflow(true));
@ -2623,7 +2604,7 @@ class BaseCompiler
# endif
masm.bind(&done);
}
#endif
#endif // INT_DIV_I64_CALLOUT
void pop2xI32ForShiftOrRotate(RegI32* r0, RegI32* r1) {
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
@ -2712,7 +2693,20 @@ class BaseCompiler
#endif
}
void extendI32ToI64(RegI32 src, RegI64 dest) {
RegI64 popI32ForSignExtendI64() {
#if defined(JS_CODEGEN_X86)
need2xI32(specific_edx, specific_eax);
RegI32 r0 = popI32ToSpecific(specific_eax);
RegI64 x0 = RegI64(Register64(specific_edx.reg, specific_eax.reg));
(void)r0; // x0 is the widening of r0
#else
RegI32 r0 = popI32();
RegI64 x0 = widenI32(r0);
#endif
return x0;
}
void signExtendI32ToI64(RegI32 src, RegI64 dest) {
#if defined(JS_CODEGEN_X64)
masm.movslq(src.reg, dest.reg.reg);
#elif defined(JS_CODEGEN_X86)
@ -2724,7 +2718,7 @@ class BaseCompiler
masm.ma_mov(src.reg, dest.reg.low);
masm.ma_asr(Imm32(31), src.reg, dest.reg.high);
#else
MOZ_CRASH("BaseCompiler platform hook: extendI32ToI64");
MOZ_CRASH("BaseCompiler platform hook: signExtendI32ToI64");
#endif
}
@ -2923,7 +2917,7 @@ class BaseCompiler
# endif
return true;
}
#endif
#endif // FLOAT_TO_I64_CALLOUT
#ifndef I64_TO_FLOAT_CALLOUT
bool convertI64ToFloatNeedsTemp(bool isUnsigned) const {
@ -2955,7 +2949,7 @@ class BaseCompiler
MOZ_CRASH("BaseCompiler platform hook: convertI64ToF64");
# endif
}
#endif
#endif // I64_TO_FLOAT_CALLOUT
void cmp64Set(Assembler::Condition cond, RegI64 lhs, RegI64 rhs, RegI32 dest) {
#if defined(JS_CODEGEN_X64)
@ -3186,17 +3180,14 @@ class BaseCompiler
};
#endif
private:
void checkOffset(MemoryAccessDesc* access, RegI32 ptr) {
if (access->offset() >= OffsetGuardLimit) {
masm.branchAdd32(Assembler::CarrySet,
Imm32(access->offset()), ptr.reg,
masm.branchAdd32(Assembler::CarrySet, Imm32(access->offset()), ptr.reg,
trap(Trap::OutOfBounds));
access->clearOffset();
}
}
public:
// This is the temp register passed as the last argument to load()
MOZ_MUST_USE size_t loadStoreTemps(MemoryAccessDesc& access) {
#if defined(JS_CODEGEN_ARM)
@ -3505,7 +3496,7 @@ class BaseCompiler
masm.append(access, st.getOffset(), masm.framePushed());
}
}
#endif
#endif // JS_CODEGEN_ARM
////////////////////////////////////////////////////////////
@ -3597,7 +3588,7 @@ class BaseCompiler
ValTypeVector& signature, ExprType retType);
MOZ_MUST_USE bool emitUnaryMathBuiltinCall(SymbolicAddress callee, ValType operandType);
MOZ_MUST_USE bool emitBinaryMathBuiltinCall(SymbolicAddress callee, ValType operandType);
#ifdef QUOT_REM_I64_CALLOUT
#ifdef INT_DIV_I64_CALLOUT
MOZ_MUST_USE bool emitDivOrModI64BuiltinCall(SymbolicAddress callee, ValType operandType);
#endif
MOZ_MUST_USE bool emitGetLocal();
@ -3641,7 +3632,7 @@ class BaseCompiler
void emitQuotientU32();
void emitRemainderI32();
void emitRemainderU32();
#ifndef QUOT_REM_I64_CALLOUT
#ifndef INT_DIV_I64_CALLOUT
void emitQuotientI64();
void emitQuotientU64();
void emitRemainderI64();
@ -3693,7 +3684,10 @@ class BaseCompiler
void emitSqrtF64();
template<bool isUnsigned> MOZ_MUST_USE bool emitTruncateF32ToI32();
template<bool isUnsigned> MOZ_MUST_USE bool emitTruncateF64ToI32();
#ifndef FLOAT_TO_I64_CALLOUT
#ifdef FLOAT_TO_I64_CALLOUT
MOZ_MUST_USE bool emitConvertFloatingToInt64Callout(SymbolicAddress callee, ValType operandType,
ValType resultType);
#else
template<bool isUnsigned> MOZ_MUST_USE bool emitTruncateF32ToI64();
template<bool isUnsigned> MOZ_MUST_USE bool emitTruncateF64ToI64();
#endif
@ -3708,7 +3702,10 @@ class BaseCompiler
void emitConvertF32ToF64();
void emitConvertI32ToF64();
void emitConvertU32ToF64();
#ifndef I64_TO_FLOAT_CALLOUT
#ifdef I64_TO_FLOAT_CALLOUT
MOZ_MUST_USE bool emitConvertInt64ToFloatingCallout(SymbolicAddress callee, ValType operandType,
ValType resultType);
#else
void emitConvertI64ToF32();
void emitConvertU64ToF32();
void emitConvertI64ToF64();
@ -3718,14 +3715,6 @@ class BaseCompiler
void emitReinterpretI64AsF64();
MOZ_MUST_USE bool emitGrowMemory();
MOZ_MUST_USE bool emitCurrentMemory();
#ifdef I64_TO_FLOAT_CALLOUT
MOZ_MUST_USE bool emitConvertInt64ToFloatingCallout(SymbolicAddress callee, ValType operandType,
ValType resultType);
#endif
#ifdef FLOAT_TO_I64_CALLOUT
MOZ_MUST_USE bool emitConvertFloatingToInt64Callout(SymbolicAddress callee, ValType operandType,
ValType resultType);
#endif
};
void
@ -3910,36 +3899,6 @@ BaseCompiler::emitQuotientU32()
pushI32(r0);
}
#ifndef QUOT_REM_I64_CALLOUT
void
BaseCompiler::emitQuotientI64()
{
# ifdef JS_PUNBOX64
RegI64 r0, r1;
pop2xI64ForIntDiv(&r0, &r1);
quotientI64(r1, r0, IsUnsigned(false));
freeI64(r1);
pushI64(r0);
# else
MOZ_CRASH("BaseCompiler platform hook: emitQuotientI64");
# endif
}
void
BaseCompiler::emitQuotientU64()
{
# ifdef JS_PUNBOX64
RegI64 r0, r1;
pop2xI64ForIntDiv(&r0, &r1);
quotientI64(r1, r0, IsUnsigned(true));
freeI64(r1);
pushI64(r0);
# else
MOZ_CRASH("BaseCompiler platform hook: emitQuotientU64");
# endif
}
#endif
void
BaseCompiler::emitRemainderI32()
{
@ -3973,7 +3932,35 @@ BaseCompiler::emitRemainderU32()
pushI32(r0);
}
#ifndef QUOT_REM_I64_CALLOUT
#ifndef INT_DIV_I64_CALLOUT
void
BaseCompiler::emitQuotientI64()
{
# ifdef JS_PUNBOX64
RegI64 r0, r1;
pop2xI64ForIntDiv(&r0, &r1);
quotientI64(r1, r0, IsUnsigned(false));
freeI64(r1);
pushI64(r0);
# else
MOZ_CRASH("BaseCompiler platform hook: emitQuotientI64");
# endif
}
void
BaseCompiler::emitQuotientU64()
{
# ifdef JS_PUNBOX64
RegI64 r0, r1;
pop2xI64ForIntDiv(&r0, &r1);
quotientI64(r1, r0, IsUnsigned(true));
freeI64(r1);
pushI64(r0);
# else
MOZ_CRASH("BaseCompiler platform hook: emitQuotientU64");
# endif
}
void
BaseCompiler::emitRemainderI64()
{
@ -4001,7 +3988,7 @@ BaseCompiler::emitRemainderU64()
MOZ_CRASH("BaseCompiler platform hook: emitRemainderU64");
# endif
}
#endif
#endif // INT_DIV_I64_CALLOUT
void
BaseCompiler::emitDivideF32()
@ -4579,7 +4566,7 @@ BaseCompiler::emitTruncateF64ToI64()
pushI64(x0);
return true;
}
#endif
#endif // FLOAT_TO_I64_CALLOUT
void
BaseCompiler::emitWrapI64ToI32()
@ -4594,15 +4581,9 @@ BaseCompiler::emitWrapI64ToI32()
void
BaseCompiler::emitExtendI32ToI64()
{
#if defined(JS_CODEGEN_X86)
need2xI32(specific_edx, specific_eax);
RegI32 r0 = popI32ToSpecific(specific_eax);
RegI64 x0 = RegI64(Register64(specific_edx.reg, specific_eax.reg));
#else
RegI32 r0 = popI32();
RegI64 x0 = widenI32(r0);
#endif
extendI32ToI64(r0, x0);
RegI64 x0 = popI32ForSignExtendI64();
RegI32 r0 = RegI32(lowPart(x0));
signExtendI32ToI64(r0, x0);
pushI64(x0);
// Note: no need to free r0, since it is part of x0
}
@ -4749,7 +4730,7 @@ BaseCompiler::emitConvertU64ToF64()
freeI64(r0);
pushF64(d0);
}
#endif
#endif // I64_TO_FLOAT_CALLOUT
void
BaseCompiler::emitReinterpretI32AsF32()
@ -5525,7 +5506,7 @@ BaseCompiler::emitBinaryMathBuiltinCall(SymbolicAddress callee, ValType operandT
return emitCommonMathCall(lineOrBytecode, callee, SigDD_, ExprType::F64);
}
#ifdef QUOT_REM_I64_CALLOUT
#ifdef INT_DIV_I64_CALLOUT
bool
BaseCompiler::emitDivOrModI64BuiltinCall(SymbolicAddress callee, ValType operandType)
{
@ -5544,7 +5525,7 @@ BaseCompiler::emitDivOrModI64BuiltinCall(SymbolicAddress callee, ValType operand
Label done;
checkDivideByZeroI64(rhs, srcDest, &done);
checkDivideByZeroI64(rhs);
if (callee == SymbolicAddress::DivI64)
checkDivideSignedOverflowI64(rhs, srcDest, &done, ZeroOnOverflow(false));
@ -5566,7 +5547,7 @@ BaseCompiler::emitDivOrModI64BuiltinCall(SymbolicAddress callee, ValType operand
return true;
}
#endif
#endif // INT_DIV_I64_CALLOUT
#ifdef I64_TO_FLOAT_CALLOUT
bool
@ -5605,7 +5586,7 @@ BaseCompiler::emitConvertInt64ToFloatingCallout(SymbolicAddress callee, ValType
return true;
}
#endif
#endif // I64_TO_FLOAT_CALLOUT
#ifdef FLOAT_TO_I64_CALLOUT
// `Callee` always takes a double, so a float32 input must be converted.
@ -5662,7 +5643,7 @@ BaseCompiler::emitConvertFloatingToInt64Callout(SymbolicAddress callee, ValType
return true;
}
#endif
#endif // FLOAT_TO_I64_CALLOUT
bool
BaseCompiler::emitGetLocal()
@ -6735,25 +6716,25 @@ BaseCompiler::emitBody()
case Expr::I64Mul:
CHECK_NEXT(emitBinary(emitMultiplyI64, ValType::I64));
case Expr::I64DivS:
#ifdef QUOT_REM_I64_CALLOUT
#ifdef INT_DIV_I64_CALLOUT
CHECK_NEXT(emitDivOrModI64BuiltinCall(SymbolicAddress::DivI64, ValType::I64));
#else
CHECK_NEXT(emitBinary(emitQuotientI64, ValType::I64));
#endif
case Expr::I64DivU:
#ifdef QUOT_REM_I64_CALLOUT
#ifdef INT_DIV_I64_CALLOUT
CHECK_NEXT(emitDivOrModI64BuiltinCall(SymbolicAddress::UDivI64, ValType::I64));
#else
CHECK_NEXT(emitBinary(emitQuotientU64, ValType::I64));
#endif
case Expr::I64RemS:
#ifdef QUOT_REM_I64_CALLOUT
#ifdef INT_DIV_I64_CALLOUT
CHECK_NEXT(emitDivOrModI64BuiltinCall(SymbolicAddress::ModI64, ValType::I64));
#else
CHECK_NEXT(emitBinary(emitRemainderI64, ValType::I64));
#endif
case Expr::I64RemU:
#ifdef QUOT_REM_I64_CALLOUT
#ifdef INT_DIV_I64_CALLOUT
CHECK_NEXT(emitDivOrModI64BuiltinCall(SymbolicAddress::UModI64, ValType::I64));
#else
CHECK_NEXT(emitBinary(emitRemainderU64, ValType::I64));
@ -7197,13 +7178,6 @@ BaseCompiler::emitFunction()
if (!pushControl(&functionEnd))
return false;
#ifdef JS_CODEGEN_ARM64
// FIXME: There is a hack up at the top to allow the baseline
// compiler to compile on ARM64 (by defining StackPointer), but
// the resulting code cannot run. So prevent it from running.
MOZ_CRASH("Several adjustments required for ARM64 operation");
#endif
if (!emitBody())
return false;
@ -7463,6 +7437,6 @@ js::wasm::BaselineCompileFunction(IonCompileTask* task)
return true;
}
#undef QUOT_REM_I64_CALLOUT
#undef INT_DIV_I64_CALLOUT
#undef I64_TO_FLOAT_CALLOUT
#undef FLOAT_TO_I64_CALLOUT

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

@ -656,11 +656,11 @@ Instance::callExport(JSContext* cx, uint32_t funcIndex, CallArgs args)
return false;
}
if (args.isConstructing()) {
// By spec, when a function is called as a constructor and this function
// returns a primary type, which is the case for all wasm exported
// functions, the returned value is discarded and an empty object is
// returned instead.
if (isAsmJS() && args.isConstructing()) {
// By spec, when a JS function is called as a constructor and this
// function returns a primary type, which is the case for all asm.js
// exported functions, the returned value is discarded and an empty
// object is returned instead.
PlainObject* obj = NewBuiltinClassInstance<PlainObject>(cx);
if (!obj)
return false;

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

@ -775,8 +775,15 @@ WasmInstanceObject::getExportedFunction(JSContext* cx, HandleWasmInstanceObject
return false;
unsigned numArgs = instance.metadata().lookupFuncExport(funcIndex).sig().args().length();
fun.set(NewNativeConstructor(cx, WasmCall, numArgs, name, gc::AllocKind::FUNCTION_EXTENDED,
SingletonObject, JSFunction::WASM_CTOR));
// asm.js needs to active like a normal JS function which are allowed to be
// used as constructors.
if (instance.isAsmJS()) {
fun.set(NewNativeConstructor(cx, WasmCall, numArgs, name, gc::AllocKind::FUNCTION_EXTENDED,
SingletonObject, JSFunction::ASMJS_CTOR));
} else {
fun.set(NewNativeFunction(cx, WasmCall, numArgs, name, gc::AllocKind::FUNCTION_EXTENDED));
}
if (!fun)
return false;

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

@ -139,10 +139,6 @@ class ReftestRunner(MozbuildObject):
args.xrePath = xre_path
args.ignoreWindowSize = True
# Don't enable oop for crashtest until they run oop in automation
if args.suite == 'reftest':
args.oop = True
return runreftestb2g.run_test_harness(parser, args)
def run_mulet_test(self, **kwargs):
@ -170,10 +166,7 @@ class ReftestRunner(MozbuildObject):
args.app = self.get_binary_path()
args.mulet = True
args.oop = True
if args.oop:
args.browser_arg = '-oop'
if not args.app.endswith('-bin'):
args.app = '%s-bin' % args.app
if not os.path.isfile(args.app):
@ -221,8 +214,6 @@ class ReftestRunner(MozbuildObject):
args = Namespace(**kwargs)
if args.suite not in ('reftest', 'crashtest', 'jstestbrowser'):
raise Exception('None or unrecognized reftest suite type.')
if hasattr(args, 'ipc'):
raise Exception('IPC tests not supported on Android.')
self._setup_objdir(args)
import remotereftest
@ -338,15 +329,6 @@ class MachCommands(MachCommandBase):
kwargs["suite"] = "jstestbrowser"
return self._run_reftest(**kwargs)
@Command('reftest-ipc',
category='testing',
description='Run IPC reftests (layout and graphics correctness, separate process).',
parser=get_parser)
def run_ipc(self, **kwargs):
kwargs["ipc"] = True
kwargs["suite"] = "reftest"
return self._run_reftest(**kwargs)
@Command('crashtest',
category='testing',
description='Run crashtests (Check if crashes on a page).',
@ -355,15 +337,6 @@ class MachCommands(MachCommandBase):
kwargs["suite"] = "crashtest"
return self._run_reftest(**kwargs)
@Command('crashtest-ipc',
category='testing',
description='Run IPC crashtests (Check if crashes on a page, separate process).',
parser=get_parser)
def run_crashtest_ipc(self, **kwargs):
kwargs["ipc"] = True
kwargs["suite"] = "crashtest"
return self._run_reftest(**kwargs)
def _run_reftest(self, **kwargs):
process_test_objects(kwargs)
reftest = self._spawn(ReftestRunner)

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

@ -317,20 +317,6 @@ class DesktopArgumentsParser(ReftestArgumentsParser):
dest="runTestsInParallel",
help="run tests in parallel if possible")
self.add_argument("--ipc",
action="store_true",
default=False,
help="Run in out-of-processes mode")
def _prefs_oop(self):
import mozinfo
prefs = ["layers.async-pan-zoom.enabled=true",
"browser.tabs.remote.autostart=true"]
if mozinfo.os == "win":
prefs.append("layers.acceleration.disabled=true")
return prefs
def _prefs_gpu(self):
if mozinfo.os != "win":
return ["layers.acceleration.force-enabled=true"]
@ -339,11 +325,6 @@ class DesktopArgumentsParser(ReftestArgumentsParser):
def validate(self, options, reftest):
super(DesktopArgumentsParser, self).validate(options, reftest)
if options.ipc:
for item in self._prefs_oop():
if item not in options.extraPrefs:
options.extraPrefs.append(item)
if options.runTestsInParallel:
if options.logFile is not None:
self.error("cannot specify logfile with parallel tests")
@ -502,12 +483,6 @@ class B2GArgumentParser(ReftestArgumentsParser):
default=False,
help="Run the tests on a B2G desktop build")
self.add_argument("--enable-oop",
action="store_true",
dest="oop",
default=False,
help="Run the tests out of process")
self.set_defaults(remoteTestRoot=None,
logFile="reftest.log",
autorun=True,

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

@ -261,10 +261,6 @@ class B2GRemoteReftest(RefTest):
prefs["browser.newtabpage.directory.source"] = ""
prefs["browser.newtabpage.directory.ping"] = ""
if options.oop:
prefs['browser.tabs.remote.autostart'] = True
prefs['reftest.browser.iframe.enabled'] = True
# Set the extra prefs.
profile.set_preferences(prefs)

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

@ -8,6 +8,7 @@
#define mozilla_Range_h
#include "mozilla/RangedPtr.h"
#include "mozilla/TypeTraits.h"
#include <stddef.h>
@ -35,6 +36,14 @@ public:
MOZ_ASSERT(aStart <= aEnd);
}
template<typename U,
class = typename EnableIf<IsConvertible<U (*)[], T (*)[]>::value,
int>::Type>
MOZ_IMPLICIT Range(const Range<U>& aOther)
: mStart(aOther.mStart),
mEnd(aOther.mEnd)
{}
RangedPtr<T> begin() const { return mStart; }
RangedPtr<T> end() const { return mEnd; }
size_t length() const { return mEnd - mStart; }

23
mfbt/tests/TestRange.cpp Normal file
Просмотреть файл

@ -0,0 +1,23 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#include "mozilla/Range.h"
#include "mozilla/TypeTraits.h"
using mozilla::IsConvertible;
using mozilla::Range;
static_assert(IsConvertible<Range<int>, Range<const int>>::value,
"Range should convert into const");
static_assert(!IsConvertible<Range<const int>, Range<int>>::value,
"Range should not drop const in conversion");
// We need a proper program so we have someplace to hang the static_asserts.
int
main()
{
return 0;
}

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

@ -33,6 +33,7 @@ CppUnitTests([
'TestMaybe',
'TestNotNull',
'TestPair',
'TestRange',
'TestRefPtr',
'TestRollingMean',
'TestSaturate',

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

@ -2409,6 +2409,10 @@ public abstract class GeckoApp
}
}
protected void onDone() {
moveTaskToBack(true);
}
@Override
public void onBackPressed() {
if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
@ -2439,7 +2443,7 @@ public abstract class GeckoApp
final Tabs tabs = Tabs.getInstance();
final Tab tab = tabs.getSelectedTab();
if (tab == null) {
moveTaskToBack(true);
onDone();
return;
}
@ -2469,7 +2473,7 @@ public abstract class GeckoApp
}
if (tab.isExternal()) {
moveTaskToBack(true);
onDone();
Tab nextSelectedTab = Tabs.getInstance().getNextTab(tab);
if (nextSelectedTab != null) {
int nextSelectedTabId = nextSelectedTab.getId();
@ -2487,7 +2491,7 @@ public abstract class GeckoApp
return;
}
moveTaskToBack(true);
onDone();
}
});
}

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

@ -5,21 +5,78 @@
package org.mozilla.gecko.customtabs;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.GeckoApp;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.util.ColorUtil;
import org.mozilla.gecko.util.GeckoRequest;
import org.mozilla.gecko.util.NativeJSObject;
import org.mozilla.gecko.util.ThreadUtils;
public class CustomTabsActivity extends GeckoApp {
import java.lang.reflect.Field;
import static android.support.customtabs.CustomTabsIntent.EXTRA_TOOLBAR_COLOR;
public class CustomTabsActivity extends GeckoApp implements Tabs.OnTabsChangedListener {
private static final String LOGTAG = "CustomTabsActivity";
private static final int NO_COLOR = -1;
private Toolbar toolbar;
private ActionBar actionBar;
private int tabId = -1;
private boolean useDomainTitle = true;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
updateActionBarWithToolbar(toolbar);
try {
// Since we don't create the Toolbar's TextView ourselves, this seems
// to be the only way of changing the ellipsize setting.
Field f = toolbar.getClass().getDeclaredField("mTitleTextView");
f.setAccessible(true);
TextView textView = (TextView) f.get(toolbar);
textView.setEllipsize(TextUtils.TruncateAt.START);
} catch (Exception e) {
// If we can't ellipsize at the start of the title, we shouldn't display the host
// so as to avoid displaying a misleadingly truncated host.
Log.w(LOGTAG, "Failed to get Toolbar TextView, using default title.");
useDomainTitle = false;
}
actionBar = getSupportActionBar();
updateToolbarColor(toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
Tabs.registerOnTabsChangedListener(this);
}
@Override
public void onDestroy() {
super.onDestroy();
Tabs.unregisterOnTabsChangedListener(this);
}
@Override
@ -28,40 +85,62 @@ public class CustomTabsActivity extends GeckoApp {
}
@Override
public void onBackPressed() {
final Tabs tabs = Tabs.getInstance();
final Tab tab = tabs.getSelectedTab();
protected void onDone() {
finish();
}
// Give Gecko a chance to handle the back press first, then fallback to the Java UI.
GeckoAppShell.sendRequestToGecko(new GeckoRequest("Browser:OnBackPressed", null) {
@Override
public void onResponse(NativeJSObject nativeJSObject) {
if (!nativeJSObject.getBoolean("handled")) {
// Default behavior is Gecko didn't prevent.
onDefault();
}
@Override
public void onTabChanged(Tab tab, Tabs.TabEvents msg, String data) {
if (tab == null) {
return;
}
if (tabId >= 0 && tab.getId() != tabId) {
return;
}
if (msg == Tabs.TabEvents.LOCATION_CHANGE) {
tabId = tab.getId();
final Uri uri = Uri.parse(tab.getURL());
String title = null;
if (uri != null) {
title = uri.getHost();
}
@Override
public void onError(NativeJSObject error) {
// Default behavior is Gecko didn't prevent, via failure.
onDefault();
if (!useDomainTitle || title == null || title.isEmpty()) {
actionBar.setTitle(AppConstants.MOZ_APP_BASENAME);
} else {
actionBar.setTitle(title);
}
}
}
// Return from Gecko thread, then back-press through the Java UI.
private void onDefault() {
ThreadUtils.postToUiThread(new Runnable() {
@Override
public void run() {
if (tab.doBack()) {
return;
}
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
tabs.closeTab(tab);
finish();
}
});
}
});
private void updateActionBarWithToolbar(final Toolbar toolbar) {
setSupportActionBar(toolbar);
final ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(true);
}
}
private void updateToolbarColor(final Toolbar toolbar) {
final int color = getIntent().getIntExtra(EXTRA_TOOLBAR_COLOR, NO_COLOR);
if (color == NO_COLOR) {
return;
}
toolbar.setBackgroundColor(color);
final Window window = getWindow();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(ColorUtil.darken(color, 0.25));
}
}
}

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

@ -0,0 +1,25 @@
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* 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/. */
package org.mozilla.gecko.util;
import android.graphics.Color;
public class ColorUtil {
public static int darken(final int color, final double fraction) {
int red = Color.red(color);
int green = Color.green(color);
int blue = Color.blue(color);
red = darkenColor(red, fraction);
green = darkenColor(green, fraction);
blue = darkenColor(blue, fraction);
final int alpha = Color.alpha(color);
return Color.argb(alpha, red, green, blue);
}
private static int darkenColor(final int color, final double fraction) {
return (int) Math.max(color - (color * fraction), 0);
}
}

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

@ -736,6 +736,7 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
'updater/PostUpdateHandler.java',
'updater/UpdateService.java',
'updater/UpdateServiceHelper.java',
'util/ColorUtil.java',
'util/DrawableUtil.java',
'util/ResourceDrawableUtils.java',
'util/TouchTargetUtil.java',

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

@ -3,7 +3,9 @@
- 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/. -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root_layout"
android:orientation="vertical"
android:layout_width="match_parent"
@ -14,9 +16,18 @@
in this tree. In a perfect world this should just include a GeckoView.
-->
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:elevation="4dp"
android:background="@color/text_and_tabs_tray_grey"
app:layout_scrollFlags="scroll|enterAlways"/>
<view class="org.mozilla.gecko.GeckoApp$MainLayout"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_below="@+id/toolbar"
android:layout_height="match_parent"
android:background="@android:color/transparent">

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

@ -10,10 +10,10 @@ worker:
implementation: docker-worker
max-run-time: 600
command: ["/bin/bash", "bin/upload.sh"]
docker-image: taskclusterprivate/upload_symbols:0.0.3
docker-image: taskclusterprivate/upload_symbols:0.0.4
env:
GECKO_HEAD_REPOSITORY: # see transforms
GECKO_HEAD_REV: # see transforms
ARTIFACT_TASKID: {"task-reference": "<build>"}
scopes:
- docker-worker:image:taskclusterprivate/upload_symbols:0.0.3
- docker-worker:image:taskclusterprivate/upload_symbols:0.0.4

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

@ -56,11 +56,6 @@ TEST_SUITES = {
'mach_command': 'crashtest',
'kwargs': {'test_file': None},
},
'crashtest-ipc': {
'aliases': ('Cipc', 'cipc'),
'mach_command': 'crashtest-ipc',
'kwargs': {'test_file': None},
},
'firefox-ui-functional': {
'aliases': ('Fxfn',),
'mach_command': 'firefox-ui-functional',
@ -112,11 +107,6 @@ TEST_SUITES = {
'mach_command': 'reftest',
'kwargs': {'tests': None},
},
'reftest-ipc': {
'aliases': ('Ripc',),
'mach_command': 'reftest-ipc',
'kwargs': {'test_file': None},
},
'web-platform-tests': {
'aliases': ('wpt',),
'mach_command': 'web-platform-tests',

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

@ -12,7 +12,6 @@ skip-if = true # Bug 1189784
[../tests/dom/media/tests/mochitest/test_dataChannel_noOffer.html]
[../tests/dom/media/tests/mochitest/test_enumerateDevices.html]
[../tests/dom/media/tests/mochitest/test_getUserMedia_addTrackRemoveTrack.html]
skip-if = true # Bug 1282897
[../tests/dom/media/tests/mochitest/test_getUserMedia_audioCapture.html]
skip-if = true # timeouts, see Bug 1264333
[../tests/dom/media/tests/mochitest/test_getUserMedia_basicAudio.html]
@ -32,11 +31,8 @@ skip-if = true # OverConstrained error, no windowshare on Android
[../tests/dom/media/tests/mochitest/test_getUserMedia_mediaStreamConstructors.html]
[../tests/dom/media/tests/mochitest/test_getUserMedia_peerIdentity.html]
[../tests/dom/media/tests/mochitest/test_getUserMedia_playAudioTwice.html]
skip-if = true # Bug 1282897
[../tests/dom/media/tests/mochitest/test_getUserMedia_playVideoAudioTwice.html]
skip-if = true # Bug 1282897
[../tests/dom/media/tests/mochitest/test_getUserMedia_playVideoTwice.html]
skip-if = true # Bug 1282897
[../tests/dom/media/tests/mochitest/test_getUserMedia_spinEventLoop.html]
[../tests/dom/media/tests/mochitest/test_getUserMedia_stopAudioStream.html]
[../tests/dom/media/tests/mochitest/test_getUserMedia_stopAudioStreamWithFollowupAudio.html]

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

@ -206,10 +206,6 @@ config = {
},
# local reftest suites
"all_reftest_suites": {
"reftest": {
"options": ["--suite=reftest"],
"tests": ["tests/reftest/tests/layout/reftests/reftest.list"]
},
"crashtest": {
"options": ["--suite=crashtest"],
"tests": ["tests/reftest/tests/testing/crashtest/crashtests.list"]
@ -219,34 +215,14 @@ config = {
"--suite=jstestbrowser"],
"tests": ["tests/jsreftest/tests/jstests.list"]
},
"reftest-ipc": {
"env": {
"MOZ_OMTC_ENABLED": "1",
"MOZ_DISABLE_CONTEXT_SHARING_GLX": "1"
},
"options": ["--suite=reftest",
"--setpref=browser.tabs.remote=true",
"--setpref=browser.tabs.remote.autostart=true",
"--setpref=extensions.e10sBlocksEnabling=false",
"--setpref=layers.async-pan-zoom.enabled=true"],
"tests": ["tests/reftest/tests/layout/reftests/reftest-sanity/reftest.list"]
"reftest": {
"options": ["--suite=reftest"],
"tests": ["tests/reftest/tests/layout/reftests/reftest.list"]
},
"reftest-no-accel": {
"options": ["--suite=reftest",
"--setpref=layers.acceleration.force-enabled=disabled"],
"tests": ["tests/reftest/tests/layout/reftests/reftest.list"]},
"crashtest-ipc": {
"env": {
"MOZ_OMTC_ENABLED": "1",
"MOZ_DISABLE_CONTEXT_SHARING_GLX": "1"
},
"options": ["--suite=crashtest",
"--setpref=browser.tabs.remote=true",
"--setpref=browser.tabs.remote.autostart=true",
"--setpref=extensions.e10sBlocksEnabling=false",
"--setpref=layers.async-pan-zoom.enabled=true"],
"tests": ["tests/reftest/tests/testing/crashtest/crashtests.list"]
},
},
"all_xpcshell_suites": {
"xpcshell": {

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

@ -171,10 +171,6 @@ config = {
},
# local reftest suites
"all_reftest_suites": {
"reftest": {
'options': ["--suite=reftest"],
'tests': ["tests/reftest/tests/layout/reftests/reftest.list"]
},
"crashtest": {
'options': ["--suite=crashtest"],
'tests': ["tests/reftest/tests/testing/crashtest/crashtests.list"]
@ -183,21 +179,9 @@ config = {
'options':["--extra-profile-file=tests/jsreftest/tests/user.js"],
'tests': ["tests/jsreftest/tests/jstests.list"]
},
"reftest-ipc": {
'options': ['--suite=reftest',
'--setpref=browser.tabs.remote=true',
'--setpref=browser.tabs.remote.autostart=true',
'--setpref=extensions.e10sBlocksEnabling=false',
'--setpref=layers.async-pan-zoom.enabled=true'],
'tests': ['tests/reftest/tests/layout/reftests/reftest-sanity/reftest.list']
},
"crashtest-ipc": {
'options': ['--suite=crashtest',
'--setpref=browser.tabs.remote=true',
'--setpref=browser.tabs.remote.autostart=true',
'--setpref=extensions.e10sBlocksEnabling=false',
'--setpref=layers.async-pan-zoom.enabled=true'],
'tests': ['tests/reftest/tests/testing/crashtest/crashtests.list']
"reftest": {
'options': ["--suite=reftest"],
'tests': ["tests/reftest/tests/layout/reftests/reftest.list"]
},
},
"all_xpcshell_suites": {

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

@ -184,10 +184,6 @@ config = {
},
# local reftest suites
"all_reftest_suites": {
"reftest": {
'options': ["--suite=reftest"],
'tests': ["tests/reftest/tests/layout/reftests/reftest.list"]
},
"crashtest": {
'options': ["--suite=crashtest"],
'tests': ["tests/reftest/tests/testing/crashtest/crashtests.list"]
@ -196,13 +192,14 @@ config = {
'options':["--extra-profile-file=tests/jsreftest/tests/user.js"],
'tests': ["tests/jsreftest/tests/jstests.list"]
},
"reftest-ipc": {
'options': ['--suite=reftest',
'--setpref=browser.tabs.remote=true',
'--setpref=browser.tabs.remote.autostart=true',
'--setpref=extensions.e10sBlocksEnabling=false',
'--setpref=layers.async-pan-zoom.enabled=true'],
'tests': ['tests/reftest/tests/layout/reftests/reftest-sanity/reftest.list']
"reftest": {
'options': ["--suite=reftest"],
'tests': ["tests/reftest/tests/layout/reftests/reftest.list"]
},
"reftest-gpu": {
'options': ["--suite=reftest",
"--setpref=layers.gpu-process.force-enabled=true"],
'tests': ["tests/reftest/tests/layout/reftests/reftest.list"]
},
"reftest-no-accel": {
"options": ["--suite=reftest",
@ -210,14 +207,6 @@ config = {
"--setpref=layers.acceleration.disabled=true"],
"tests": ["tests/reftest/tests/layout/reftests/reftest.list"]
},
"crashtest-ipc": {
"options": ["--suite=crashtest",
'--setpref=browser.tabs.remote=true',
'--setpref=browser.tabs.remote.autostart=true',
'--setpref=extensions.e10sBlocksEnabling=false',
'--setpref=layers.async-pan-zoom.enabled=true'],
"tests": ['tests/reftest/tests/testing/crashtest/crashtests.list'],
},
},
"all_xpcshell_suites": {
"xpcshell": {

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

@ -184,10 +184,6 @@ config = {
},
# local reftest suites
"all_reftest_suites": {
"reftest": {
'options': ["--suite=reftest"],
'tests': ["tests/reftest/tests/layout/reftests/reftest.list"]
},
"crashtest": {
'options': ["--suite=crashtest"],
'tests': ["tests/reftest/tests/testing/crashtest/crashtests.list"]
@ -196,13 +192,14 @@ config = {
'options':["--extra-profile-file=tests/jsreftest/tests/user.js"],
'tests': ["tests/jsreftest/tests/jstests.list"]
},
"reftest-ipc": {
'options': ['--suite=reftest',
'--setpref=browser.tabs.remote=true',
'--setpref=browser.tabs.remote.autostart=true',
'--setpref=extensions.e10sBlocksEnabling=false',
'--setpref=layers.async-pan-zoom.enabled=true'],
'tests': ['tests/reftest/tests/layout/reftests/reftest-sanity/reftest.list']
"reftest": {
'options': ["--suite=reftest"],
'tests': ["tests/reftest/tests/layout/reftests/reftest.list"]
},
"reftest-gpu": {
'options': ["--suite=reftest",
"--setpref=layers.gpu-process.force-enabled=true"],
'tests': ["tests/reftest/tests/layout/reftests/reftest.list"]
},
"reftest-no-accel": {
"options": ["--suite=reftest",
@ -210,14 +207,6 @@ config = {
"--setpref=layers.acceleration.disabled=true"],
"tests": ["tests/reftest/tests/layout/reftests/reftest.list"]
},
"crashtest-ipc": {
"options": ["--suite=crashtest",
'--setpref=browser.tabs.remote=true',
'--setpref=browser.tabs.remote.autostart=true',
'--setpref=extensions.e10sBlocksEnabling=false',
'--setpref=layers.async-pan-zoom.enabled=true'],
"tests": ['tests/reftest/tests/testing/crashtest/crashtests.list'],
},
},
"all_xpcshell_suites": {
"xpcshell": {

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

@ -78,11 +78,6 @@ class MozharnessRunner(MozbuildObject):
"config": desktop_unittest_config + [
"--mochitest-suite", "mochitest-devtools-chrome"]
},
"reftest": {
"script": "desktop_unittest.py",
"config": desktop_unittest_config + [
"--reftest-suite", "reftest"]
},
"crashtest": {
"script": "desktop_unittest.py",
"config": desktop_unittest_config + [
@ -93,21 +88,16 @@ class MozharnessRunner(MozbuildObject):
"config": desktop_unittest_config + [
"--reftest-suite", "jsreftest"]
},
"reftest-ipc": {
"reftest": {
"script": "desktop_unittest.py",
"config": desktop_unittest_config + [
"--reftest-suite", "reftest-ipc"]
"--reftest-suite", "reftest"]
},
"reftest-no-accel": {
"script": "desktop_unittest.py",
"config": desktop_unittest_config + [
"--reftest-suite", "reftest-no-accel"]
},
"crashtest-ipc": {
"script": "desktop_unittest.py",
"config": desktop_unittest_config + [
"--reftest-suite", "crashtest-ipc"]
},
"cppunittest": {
"script": "desktop_unittest.py",
"config": desktop_unittest_config + [

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

@ -113,31 +113,11 @@ reftest-b2g:
$(CHECK_TEST_ERROR); \
fi
reftest-ipc: TEST_PATH?=layout/reftests/reftest.list
reftest-ipc:
$(call RUN_REFTEST,'$(topsrcdir)/$(TEST_PATH)' $(OOP_CONTENT))
$(CHECK_TEST_ERROR)
reftest-ipc-gpu: TEST_PATH?=layout/reftests/reftest.list
reftest-ipc-gpu:
$(call RUN_REFTEST,'$(topsrcdir)/$(TEST_PATH)' $(OOP_CONTENT) $(GPU_RENDERING))
$(CHECK_TEST_ERROR)
crashtest: TEST_PATH?=testing/crashtest/crashtests.list
crashtest:
$(call RUN_REFTEST,'$(topsrcdir)/$(TEST_PATH)')
$(CHECK_TEST_ERROR)
crashtest-ipc: TEST_PATH?=testing/crashtest/crashtests.list
crashtest-ipc:
$(call RUN_REFTEST,'$(topsrcdir)/$(TEST_PATH)' $(OOP_CONTENT))
$(CHECK_TEST_ERROR)
crashtest-ipc-gpu: TEST_PATH?=testing/crashtest/crashtests.list
crashtest-ipc-gpu:
$(call RUN_REFTEST,'$(topsrcdir)/$(TEST_PATH)' $(OOP_CONTENT) $(GPU_RENDERING))
$(CHECK_TEST_ERROR)
jstestbrowser: TESTS_PATH?=test-stage/jsreftest/tests/
jstestbrowser:
$(MAKE) -C $(DEPTH)/config

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

@ -1084,13 +1084,6 @@ TelemetryImpl::AddSQLInfo(JSContext *cx, JS::Handle<JSObject*> rootObj, bool mai
statsObj, JSPROP_ENUMERATE);
}
NS_IMETHODIMP
TelemetryImpl::HistogramFrom(const nsACString &name, const nsACString &existing_name,
JSContext *cx, JS::MutableHandle<JS::Value> ret)
{
return TelemetryHistogram::HistogramFrom(name, existing_name, cx, ret);
}
NS_IMETHODIMP
TelemetryImpl::RegisterAddonHistogram(const nsACString &id,
const nsACString &name,

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

@ -594,6 +594,9 @@ internal_GetHistogramByName(const nsACString &name, Histogram **ret)
return NS_OK;
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
/**
* This clones a histogram |existing| with the id |existingId| to a
* new histogram with the name |newName|.
@ -624,26 +627,6 @@ internal_CloneHistogram(const nsACString& newName,
return clone;
}
/**
* This clones a histogram with the id |existingId| to a new histogram
* with the name |newName|.
* For simplicity this is limited to registered histograms.
*/
Histogram*
internal_CloneHistogram(const nsACString& newName,
mozilla::Telemetry::ID existingId)
{
Histogram *existing = nullptr;
nsresult rv = internal_GetHistogramByEnumId(existingId, &existing, GeckoProcessType_Default);
if (NS_FAILED(rv)) {
return nullptr;
}
return internal_CloneHistogram(newName, existingId, *existing);
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
GeckoProcessType
GetProcessFromName(const std::string& aString)
{
@ -2377,33 +2360,6 @@ TelemetryHistogram::GetHistogramName(mozilla::Telemetry::ID id)
return h.id();
}
nsresult
TelemetryHistogram::HistogramFrom(const nsACString &name,
const nsACString &existing_name,
JSContext *cx,
JS::MutableHandle<JS::Value> ret)
{
Histogram* clone = nullptr;
{
StaticMutexAutoLock locker(gTelemetryHistogramMutex);
mozilla::Telemetry::ID id;
nsresult rv
= internal_GetHistogramEnumId(PromiseFlatCString(existing_name).get(),
&id);
if (NS_FAILED(rv)) {
return rv;
}
clone = internal_CloneHistogram(name, id);
if (!clone) {
return NS_ERROR_FAILURE;
}
}
// Runs without protection from |gTelemetryHistogramMutex|
return internal_WrapAndReturnHistogram(clone, cx, ret);
}
nsresult
TelemetryHistogram::CreateHistogramSnapshots(JSContext *cx,
JS::MutableHandle<JS::Value> ret,

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

@ -61,10 +61,6 @@ GetKeyedHistogramById(const nsACString &name, JSContext *cx,
const char*
GetHistogramName(mozilla::Telemetry::ID id);
nsresult
HistogramFrom(const nsACString &name, const nsACString &existing_name,
JSContext *cx, JS::MutableHandle<JS::Value> ret);
nsresult
CreateHistogramSnapshots(JSContext *cx, JS::MutableHandle<JS::Value> ret,
bool subsession, bool clearSubsession);

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

@ -655,9 +655,6 @@ var Impl = {
_initialized: false,
_logger: null,
_prevValues: {},
// Regex that matches histograms we care about during startup.
// Keep this in sync with gen-histogram-bucket-ranges.py.
_startupHistogramRegex: /SQLITE|HTTP|SPDY|CACHE|DNS/,
_slowSQLStartup: {},
_hasWindowRestoredObserver: false,
_hasXulWindowVisibleObserver: false,
@ -1229,35 +1226,10 @@ var Impl = {
h.add(val);
},
/**
* Return true if we're interested in having a STARTUP_* histogram for
* the given histogram name.
*/
isInterestingStartupHistogram: function isInterestingStartupHistogram(name) {
return this._startupHistogramRegex.test(name);
},
getChildPayloads: function getChildPayloads() {
return this._childTelemetry.map(child => child.payload);
},
/**
* Make a copy of interesting histograms at startup.
*/
gatherStartupHistograms: function gatherStartupHistograms() {
this._log.trace("gatherStartupHistograms");
let info =
Telemetry.registeredHistograms(this.getDatasetType(), []);
let snapshots = Telemetry.histogramSnapshots;
for (let name of info) {
// Only duplicate histograms with actual data.
if (this.isInterestingStartupHistogram(name) && name in snapshots) {
Telemetry.histogramFrom("STARTUP_" + name, name);
}
}
},
/**
* Get the current session's payload using the provided
* simpleMeasurements and info, which are typically obtained by a call
@ -1580,8 +1552,6 @@ var Impl = {
cpml.addMessageListener(MESSAGE_TELEMETRY_GET_CHILD_THREAD_HANGS, this);
cpml.addMessageListener(MESSAGE_TELEMETRY_GET_CHILD_USS, this);
this.gatherStartupHistograms();
let delayedTask = new DeferredTask(function* () {
this._initialized = true;
@ -1803,7 +1773,6 @@ var Impl = {
// This function returns the current Telemetry payload to the caller.
// We only gather startup info once.
if (Object.keys(this._slowSQLStartup).length == 0) {
this.gatherStartupHistograms();
this._slowSQLStartup = Telemetry.slowSQL;
}
this.gatherMemory();
@ -1861,7 +1830,6 @@ var Impl = {
[this._startupIO.startupSessionRestoreReadBytes,
this._startupIO.startupSessionRestoreWriteBytes] = counters;
}
this.gatherStartupHistograms();
this._slowSQLStartup = Telemetry.slowSQL;
},

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

@ -13,9 +13,6 @@ import json
from collections import OrderedDict
# Keep this in sync with TelemetryController.
startup_histogram_re = re.compile("SQLITE|HTTP|SPDY|CACHE|DNS")
def main(argv):
filenames = argv
@ -50,9 +47,6 @@ def main(argv):
all_histograms.update({ name: parameters });
if startup_histogram_re.search(name) is not None:
all_histograms.update({ "STARTUP_" + name: parameters })
print json.dumps({ 'histograms': all_histograms})
main(sys.argv[1:])

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

@ -178,21 +178,6 @@ interface nsITelemetry : nsISupports
out uint32_t count,
[retval, array, size_is(count)] out string histograms);
/**
* Create a histogram using the current state of an existing histogram. The
* existing histogram must be registered in TelemetryHistograms.h.
*
* @param name Unique histogram name
* @param existing_name Existing histogram name
* The returned object has the following functions:
* add(int) - Adds an int value to the appropriate bucket
* snapshot() - Returns a snapshot of the histogram with the same data fields as in histogramSnapshots()
* clear() - Zeros out the histogram's buckets and sum
* dataset() - identifies what dataset this is in: DATASET_RELEASE_CHANNEL_OPTOUT or ...OPTIN
*/
[implicit_jscontext]
jsval histogramFrom(in ACString name, in ACString existing_name);
/**
* Create and return a histogram registered in TelemetryHistograms.h.
*

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

@ -110,7 +110,6 @@ function fakeIdleNotification(topic) {
function setupTestData() {
Telemetry.histogramFrom(IGNORE_CLONED_HISTOGRAM, IGNORE_HISTOGRAM_TO_CLONE);
Services.startup.interrupted = true;
Telemetry.registerAddonHistogram(ADDON_NAME, ADDON_HISTOGRAM,
Telemetry.HISTOGRAM_LINEAR,
@ -334,14 +333,6 @@ function checkPayload(payload, reason, successfulPings, savedPings) {
Assert.ok(TELEMETRY_TEST_FLAG in payload.histograms);
Assert.ok(TELEMETRY_TEST_COUNT in payload.histograms);
let rh = Telemetry.registeredHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, []);
for (let name of rh) {
if (/SQLITE/.test(name) && name in payload.histograms) {
let histogramName = ("STARTUP_" + name);
Assert.ok(histogramName in payload.histograms, histogramName + " must be available.");
}
}
Assert.ok(!(IGNORE_CLONED_HISTOGRAM in payload.histograms));
// Flag histograms should automagically spring to life.

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

@ -245,35 +245,6 @@ add_task(function* test_getHistogramById() {
do_check_eq(s.max, 10000);
});
add_task(function* test_histogramFrom() {
// Test one histogram of each type.
let names = [
"CYCLE_COLLECTOR", // EXPONENTIAL
"GC_REASON_2", // LINEAR
"GC_RESET", // BOOLEAN
"TELEMETRY_TEST_FLAG", // FLAG
"TELEMETRY_TEST_COUNT", // COUNT
];
for (let name of names) {
let [min, max, bucket_count] = [1, INT_MAX - 1, 10]
let original = Telemetry.getHistogramById(name);
let clone = Telemetry.histogramFrom("clone" + name, name);
compareHistograms(original, clone);
}
// Additionally, set TELEMETRY_TEST_FLAG and TELEMETRY_TEST_COUNT
// and check they get set on the clone.
let testFlag = Telemetry.getHistogramById("TELEMETRY_TEST_FLAG");
testFlag.add(1);
let testCount = Telemetry.getHistogramById("TELEMETRY_TEST_COUNT");
testCount.add();
let clone = Telemetry.histogramFrom("FlagClone", "TELEMETRY_TEST_FLAG");
compareHistograms(testFlag, clone);
clone = Telemetry.histogramFrom("CountClone", "TELEMETRY_TEST_COUNT");
compareHistograms(testCount, clone);
});
add_task(function* test_getSlowSQL() {
var slow = Telemetry.slowSQL;
do_check_true(("mainThread" in slow) && ("otherThreads" in slow));
@ -442,18 +413,14 @@ add_task(function* test_addons() {
add_task(function* test_expired_histogram() {
var test_expired_id = "TELEMETRY_TEST_EXPIRED";
var clone_id = "ExpiredClone";
var dummy = Telemetry.getHistogramById(test_expired_id);
var dummy_clone = Telemetry.histogramFrom(clone_id, test_expired_id);
var rh = Telemetry.registeredHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, []);
Assert.ok(!!rh);
dummy.add(1);
dummy_clone.add(1);
do_check_eq(Telemetry.histogramSnapshots["__expired__"], undefined);
do_check_eq(Telemetry.histogramSnapshots[test_expired_id], undefined);
do_check_eq(Telemetry.histogramSnapshots[clone_id], undefined);
do_check_eq(rh[test_expired_id], undefined);
});

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

@ -34,8 +34,7 @@ XPCOMUtils.defineLazyGetter(this, "gLogEnabled", function tm_gLogEnabled() {
function getPref(func, preference, defaultValue) {
try {
return Services.prefs[func](preference);
}
catch (e) {
} catch (e) {
}
return defaultValue;
}
@ -67,11 +66,11 @@ TimerManager.prototype = {
_timer: null,
/**
* The Checker Timer minimum delay interval as specified by the
* app.update.timerMinimumDelay pref. If the app.update.timerMinimumDelay
* pref doesn't exist this will default to 120000.
* The Checker Timer minimum delay interval as specified by the
* app.update.timerMinimumDelay pref. If the app.update.timerMinimumDelay
* pref doesn't exist this will default to 120000.
*/
_timerMinimumDelay: null,
_timerMinimumDelay: null,
/**
* The set of registered timers.
@ -88,30 +87,31 @@ TimerManager.prototype = {
// seconds.
var minFirstInterval = 10000;
switch (aTopic) {
case "utm-test-init":
// Enforce a minimum timer interval of 500 ms for tests and fall through
// to profile-after-change to initialize the timer.
minInterval = 500;
minFirstInterval = 500;
case "profile-after-change":
// Cancel the timer if it has already been initialized. This is primarily
// for tests.
this._timerMinimumDelay = Math.max(1000 * getPref("getIntPref", PREF_APP_UPDATE_TIMERMINIMUMDELAY, 120),
minInterval);
let firstInterval = Math.max(getPref("getIntPref", PREF_APP_UPDATE_TIMERFIRSTINTERVAL,
this._timerMinimumDelay), minFirstInterval);
this._canEnsureTimer = true;
this._ensureTimer(firstInterval);
break;
case "xpcom-shutdown":
Services.obs.removeObserver(this, "xpcom-shutdown");
case "utm-test-init":
// Enforce a minimum timer interval of 500 ms for tests and fall through
// to profile-after-change to initialize the timer.
minInterval = 500;
minFirstInterval = 500;
case "profile-after-change":
// Cancel the timer if it has already been initialized. This is primarily
// for tests.
this._timerMinimumDelay = Math.max(1000 * getPref("getIntPref", PREF_APP_UPDATE_TIMERMINIMUMDELAY, 120),
minInterval);
let firstInterval = Math.max(getPref("getIntPref", PREF_APP_UPDATE_TIMERFIRSTINTERVAL,
this._timerMinimumDelay), minFirstInterval);
this._canEnsureTimer = true;
this._ensureTimer(firstInterval);
break;
case "xpcom-shutdown":
Services.obs.removeObserver(this, "xpcom-shutdown");
// Release everything we hold onto.
this._cancelTimer();
for (var timerID in this._timers)
delete this._timers[timerID];
this._timers = null;
break;
// Release everything we hold onto.
this._cancelTimer();
for (var timerID in this._timers) {
delete this._timers[timerID];
}
this._timers = null;
break;
}
},
@ -128,8 +128,9 @@ TimerManager.prototype = {
notify: function TM_notify(timer) {
var nextDelay = null;
function updateNextDelay(delay) {
if (nextDelay === null || delay < nextDelay)
if (nextDelay === null || delay < nextDelay) {
nextDelay = delay;
}
}
// Each timer calls tryFire(), which figures out which is the one that
@ -149,9 +150,9 @@ TimerManager.prototype = {
callbackToFire = callback;
earliestIntendedTime = intendedTime;
selected = true;
}
else if (earliestIntendedTime !== null)
} else if (earliestIntendedTime !== null) {
skippedFirings = true;
}
}
// We do not need to updateNextDelay for the timer that actually fires;
// we'll update right after it fires, with the proper intended time.
@ -159,8 +160,9 @@ TimerManager.prototype = {
// earlier intended time); it is still ok that we did not update for
// the first one, since if we have skipped firings, the next delay
// will be the minimum delay anyhow.
if (!selected)
if (!selected) {
updateNextDelay(intendedTime - now);
}
}
var catMan = Cc["@mozilla.org/categorymanager;1"].
@ -190,18 +192,19 @@ TimerManager.prototype = {
// If the last update time is greater than the current time then reset
// it to 0 and the timer manager will correct the value when it fires
// next for this consumer.
if (lastUpdateTime > now)
if (lastUpdateTime > now) {
lastUpdateTime = 0;
}
if (lastUpdateTime == 0)
if (lastUpdateTime == 0) {
Services.prefs.setIntPref(prefLastUpdate, lastUpdateTime);
}
tryFire(function() {
tryFire(function () {
try {
Components.classes[cid][method](Ci.nsITimerCallback).notify(timer);
LOG("TimerManager:notify - notified " + cid);
}
catch (e) {
} catch (e) {
LOG("TimerManager:notify - error notifying component id: " +
cid + " ,error: " + e);
}
@ -222,18 +225,16 @@ TimerManager.prototype = {
timerData.lastUpdateTime = 0;
Services.prefs.setIntPref(prefLastUpdate, timerData.lastUpdateTime);
}
tryFire(function() {
tryFire(function () {
if (timerData.callback && timerData.callback.notify) {
try {
timerData.callback.notify(timer);
LOG("TimerManager:notify - notified timerID: " + timerID);
}
catch (e) {
} catch (e) {
LOG("TimerManager:notify - error notifying timerID: " + timerID +
", error: " + e);
}
}
else {
} else {
LOG("TimerManager:notify - timerID: " + timerID + " doesn't " +
"implement nsITimerCallback - skipping");
}
@ -245,14 +246,16 @@ TimerManager.prototype = {
}, timerData.lastUpdateTime + timerData.interval);
}
if (callbackToFire)
if (callbackToFire) {
callbackToFire();
}
if (nextDelay !== null) {
if (skippedFirings)
if (skippedFirings) {
timer.delay = this._timerMinimumDelay;
else
} else {
timer.delay = Math.max(nextDelay * 1000, this._timerMinimumDelay);
}
this.lastTimerReset = Date.now();
} else {
this._cancelTimer();
@ -263,9 +266,10 @@ TimerManager.prototype = {
* Starts the timer, if necessary, and ensures that it will fire soon enough
* to happen after time |interval| (in milliseconds).
*/
_ensureTimer: function(interval) {
if (!this._canEnsureTimer)
_ensureTimer: function (interval) {
if (!this._canEnsureTimer) {
return;
}
if (!this._timer) {
this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
this._timer.initWithCallback(this, interval,
@ -279,7 +283,7 @@ TimerManager.prototype = {
/**
* Stops the timer, if it is running.
*/
_cancelTimer: function() {
_cancelTimer: function () {
if (this._timer) {
this._timer.cancel();
this._timer = null;
@ -300,13 +304,15 @@ TimerManager.prototype = {
// the timer will be notified soon after a new profile's first use.
let lastUpdateTime = getPref("getIntPref", prefLastUpdate, 0);
let now = Math.round(Date.now() / 1000);
if (lastUpdateTime > now)
if (lastUpdateTime > now) {
lastUpdateTime = 0;
if (lastUpdateTime == 0)
}
if (lastUpdateTime == 0) {
Services.prefs.setIntPref(prefLastUpdate, lastUpdateTime);
this._timers[id] = { callback : callback,
interval : interval,
lastUpdateTime : lastUpdateTime };
}
this._timers[id] = {callback: callback,
interval: interval,
lastUpdateTime: lastUpdateTime};
this._ensureTimer(interval * 1000);
},

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

@ -23,84 +23,84 @@ const MAIN_TIMER_INTERVAL = 1000; // milliseconds
const CONSUMER_TIMER_INTERVAL = 1; // seconds
const TESTS = [ {
desc : "Test Timer Callback 1",
timerID : "test1-update-timer",
defaultInterval : "bogus",
prefInterval : "test1.timer.interval",
contractID : "@mozilla.org/test1/timercallback;1",
method : "createInstance",
classID : Components.ID("9c7ce81f-98bb-4729-adb4-4d0deb0f59e5"),
notified : false
desc: "Test Timer Callback 1",
timerID: "test1-update-timer",
defaultInterval: "bogus",
prefInterval: "test1.timer.interval",
contractID: "@mozilla.org/test1/timercallback;1",
method: "createInstance",
classID: Components.ID("9c7ce81f-98bb-4729-adb4-4d0deb0f59e5"),
notified: false
}, {
desc : "Test Timer Callback 2",
timerID : "test2-update-timer",
defaultInterval : 86400,
prefInterval : "test2.timer.interval",
contractID : "@mozilla.org/test2/timercallback;1",
method : "createInstance",
classID : Components.ID("512834f3-05bb-46be-84e0-81d881a140b7"),
notified : false
desc: "Test Timer Callback 2",
timerID: "test2-update-timer",
defaultInterval: 86400,
prefInterval: "test2.timer.interval",
contractID: "@mozilla.org/test2/timercallback;1",
method: "createInstance",
classID: Components.ID("512834f3-05bb-46be-84e0-81d881a140b7"),
notified: false
}, {
desc : "Test Timer Callback 3",
timerID : "test3-update-timer",
defaultInterval : CONSUMER_TIMER_INTERVAL,
prefInterval : "test3.timer.interval",
contractID : "@mozilla.org/test3/timercallback;1",
method : "createInstance",
classID : Components.ID("c8ac5027-8d11-4471-9d7c-fd692501b437"),
notified : false
desc: "Test Timer Callback 3",
timerID: "test3-update-timer",
defaultInterval: CONSUMER_TIMER_INTERVAL,
prefInterval: "test3.timer.interval",
contractID: "@mozilla.org/test3/timercallback;1",
method: "createInstance",
classID: Components.ID("c8ac5027-8d11-4471-9d7c-fd692501b437"),
notified: false
}, {
desc : "Test Timer Callback 4",
timerID : "test4-update-timer",
defaultInterval : CONSUMER_TIMER_INTERVAL,
prefInterval : "test4.timer.interval",
contractID : "@mozilla.org/test4/timercallback;1",
method : "createInstance",
classID : Components.ID("6b0e79f3-4ab8-414c-8f14-dde10e185727"),
notified : false
desc: "Test Timer Callback 4",
timerID: "test4-update-timer",
defaultInterval: CONSUMER_TIMER_INTERVAL,
prefInterval: "test4.timer.interval",
contractID: "@mozilla.org/test4/timercallback;1",
method: "createInstance",
classID: Components.ID("6b0e79f3-4ab8-414c-8f14-dde10e185727"),
notified: false
}, {
desc : "Test Timer Callback 5",
timerID : "test5-update-timer",
defaultInterval : CONSUMER_TIMER_INTERVAL,
prefInterval : "test5.timer.interval",
contractID : "@mozilla.org/test5/timercallback;1",
method : "createInstance",
classID : Components.ID("2f6b7b92-e40f-4874-bfbb-eeb2412c959d"),
notified : false
desc: "Test Timer Callback 5",
timerID: "test5-update-timer",
defaultInterval: CONSUMER_TIMER_INTERVAL,
prefInterval: "test5.timer.interval",
contractID: "@mozilla.org/test5/timercallback;1",
method: "createInstance",
classID: Components.ID("2f6b7b92-e40f-4874-bfbb-eeb2412c959d"),
notified: false
}, {
desc : "Test Timer Callback 6",
timerID : "test6-update-timer",
defaultInterval : 86400,
prefInterval : "test6.timer.interval",
contractID : "@mozilla.org/test6/timercallback;1",
method : "createInstance",
classID : Components.ID("8a95f611-b2ac-4c7e-8b73-9748c4839731"),
notified : false
desc: "Test Timer Callback 6",
timerID: "test6-update-timer",
defaultInterval: 86400,
prefInterval: "test6.timer.interval",
contractID: "@mozilla.org/test6/timercallback;1",
method: "createInstance",
classID: Components.ID("8a95f611-b2ac-4c7e-8b73-9748c4839731"),
notified: false
}, {
desc : "Test Timer Callback 7",
timerID : "test7-update-timer",
defaultInterval : CONSUMER_TIMER_INTERVAL,
prefInterval : "test7.timer.interval",
contractID : "@mozilla.org/test7/timercallback;1",
method : "createInstance",
classID : Components.ID("2d091020-e23c-11e2-a28f-0800200c9a66"),
notified : false
desc: "Test Timer Callback 7",
timerID: "test7-update-timer",
defaultInterval: CONSUMER_TIMER_INTERVAL,
prefInterval: "test7.timer.interval",
contractID: "@mozilla.org/test7/timercallback;1",
method: "createInstance",
classID: Components.ID("2d091020-e23c-11e2-a28f-0800200c9a66"),
notified: false
}, {
desc : "Test Timer Callback 8",
timerID : "test8-update-timer",
defaultInterval : CONSUMER_TIMER_INTERVAL,
contractID : "@mozilla.org/test8/timercallback;1",
classID : Components.ID("af878d4b-1d12-41f6-9a90-4e687367ecc1"),
notified : false,
lastUpdateTime : 0
desc: "Test Timer Callback 8",
timerID: "test8-update-timer",
defaultInterval: CONSUMER_TIMER_INTERVAL,
contractID: "@mozilla.org/test8/timercallback;1",
classID: Components.ID("af878d4b-1d12-41f6-9a90-4e687367ecc1"),
notified: false,
lastUpdateTime: 0
}, {
desc : "Test Timer Callback 9",
timerID : "test9-update-timer",
defaultInterval : CONSUMER_TIMER_INTERVAL,
contractID : "@mozilla.org/test9/timercallback;1",
classID : Components.ID("5136b201-d64c-4328-8cf1-1a63491cc117"),
notified : false,
lastUpdateTime : 0
desc: "Test Timer Callback 9",
timerID: "test9-update-timer",
defaultInterval: CONSUMER_TIMER_INTERVAL,
contractID: "@mozilla.org/test9/timercallback;1",
classID: Components.ID("5136b201-d64c-4328-8cf1-1a63491cc117"),
notified: false,
lastUpdateTime: 0
} ];
const DEBUG_TEST = false;
@ -116,15 +116,170 @@ XPCOMUtils.defineLazyServiceGetter(this, "gCatMan",
"@mozilla.org/categorymanager;1",
"nsICategoryManager");
XPCOMUtils.defineLazyGetter(this, "gCompReg", function() {
XPCOMUtils.defineLazyGetter(this, "gCompReg", function () {
return Cm.QueryInterface(Ci.nsIComponentRegistrar);
});
const gTest1TimerCallback = {
notify: function T1CB_notify(aTimer) {
do_throw("gTest1TimerCallback notify method should not have been called");
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};
const gTest1Factory = {
createInstance: function (aOuter, aIID) {
if (aOuter == null) {
return gTest1TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
const gTest2TimerCallback = {
notify: function T2CB_notify(aTimer) {
do_throw("gTest2TimerCallback notify method should not have been called");
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimer])
};
const gTest2Factory = {
createInstance: function (aOuter, aIID) {
if (aOuter == null) {
return gTest2TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
const gTest3TimerCallback = {
notify: function T3CB_notify(aTimer) {
do_throw("gTest3TimerCallback notify method should not have been called");
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};
const gTest3Factory = {
createInstance: function (aOuter, aIID) {
if (aOuter == null) {
return gTest3TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
const gTest4TimerCallback = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};
const gTest4Factory = {
createInstance: function (aOuter, aIID) {
if (aOuter == null) {
return gTest4TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
const gTest5TimerCallback = {
notify: function T5CB_notify(aTimer) {
gCatMan.deleteCategoryEntry(CATEGORY_UPDATE_TIMER, TESTS[4].desc, true);
TESTS[4].notified = true;
finished_test1thru7();
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};
const gTest5Factory = {
createInstance: function (aOuter, aIID) {
if (aOuter == null) {
return gTest5TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
const gTest6TimerCallback = {
notify: function T6CB_notify(aTimer) {
gCatMan.deleteCategoryEntry(CATEGORY_UPDATE_TIMER, TESTS[5].desc, true);
TESTS[5].notified = true;
finished_test1thru7();
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};
const gTest6Factory = {
createInstance: function (aOuter, aIID) {
if (aOuter == null) {
return gTest6TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
const gTest7TimerCallback = {
notify: function T7CB_notify(aTimer) {
gCatMan.deleteCategoryEntry(CATEGORY_UPDATE_TIMER, TESTS[6].desc, true);
TESTS[6].notified = true;
finished_test1thru7();
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};
const gTest7Factory = {
createInstance: function (aOuter, aIID) {
if (aOuter == null) {
return gTest7TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
const gTest8TimerCallback = {
notify: function T8CB_notify(aTimer) {
TESTS[7].notified = true;
TESTS[7].notifyTime = Date.now();
do_execute_soon(function () {
check_test8(gTest8TimerCallback);
});
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};
const gTest8Factory = {
createInstance: function (aOuter, aIID) {
if (aOuter == null) {
return gTest8TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
const gTest9TimerCallback = {
notify: function T9CB_notify(aTimer) {
TESTS[8].notified = true;
TESTS[8].notifyTime = Date.now();
do_execute_soon(function () {
check_test8(gTest9TimerCallback);
});
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};
const gTest9Factory = {
createInstance: function (aOuter, aIID) {
if (aOuter == null) {
return gTest9TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
function run_test() {
do_test_pending();
// Set the timer to fire every second
gPref.setIntPref(PREF_APP_UPDATE_TIMERMINIMUMDELAY, MAIN_TIMER_INTERVAL/1000);
gPref.setIntPref(PREF_APP_UPDATE_TIMERMINIMUMDELAY, MAIN_TIMER_INTERVAL / 1000);
gPref.setIntPref(PREF_APP_UPDATE_TIMERFIRSTINTERVAL, MAIN_TIMER_INTERVAL);
gPref.setBoolPref(PREF_APP_UPDATE_LOG_ALL, true);
@ -308,161 +463,6 @@ function check_test8(aTestTimerCallback) {
end_test();
}
const gTest1TimerCallback = {
notify: function T1CB_notify(aTimer) {
do_throw("gTest1TimerCallback notify method should not have been called");
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};
const gTest1Factory = {
createInstance: function(aOuter, aIID) {
if (aOuter == null) {
return gTest1TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
const gTest2TimerCallback = {
notify: function T2CB_notify(aTimer) {
do_throw("gTest2TimerCallback notify method should not have been called");
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimer])
};
const gTest2Factory = {
createInstance: function(aOuter, aIID) {
if (aOuter == null) {
return gTest2TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
const gTest3TimerCallback = {
notify: function T3CB_notify(aTimer) {
do_throw("gTest3TimerCallback notify method should not have been called");
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};
const gTest3Factory = {
createInstance: function(aOuter, aIID) {
if (aOuter == null) {
return gTest3TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
const gTest4TimerCallback = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};
const gTest4Factory = {
createInstance: function(aOuter, aIID) {
if (aOuter == null) {
return gTest4TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
const gTest5TimerCallback = {
notify: function T5CB_notify(aTimer) {
gCatMan.deleteCategoryEntry(CATEGORY_UPDATE_TIMER, TESTS[4].desc, true);
TESTS[4].notified = true;
finished_test1thru7();
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};
const gTest5Factory = {
createInstance: function(aOuter, aIID) {
if (aOuter == null) {
return gTest5TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
const gTest6TimerCallback = {
notify: function T6CB_notify(aTimer) {
gCatMan.deleteCategoryEntry(CATEGORY_UPDATE_TIMER, TESTS[5].desc, true);
TESTS[5].notified = true;
finished_test1thru7();
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};
const gTest6Factory = {
createInstance: function(aOuter, aIID) {
if (aOuter == null) {
return gTest6TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
const gTest7TimerCallback = {
notify: function T7CB_notify(aTimer) {
gCatMan.deleteCategoryEntry(CATEGORY_UPDATE_TIMER, TESTS[6].desc, true);
TESTS[6].notified = true;
finished_test1thru7();
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};
const gTest7Factory = {
createInstance: function(aOuter, aIID) {
if (aOuter == null) {
return gTest7TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
const gTest8TimerCallback = {
notify: function T8CB_notify(aTimer) {
TESTS[7].notified = true;
TESTS[7].notifyTime = Date.now();
do_execute_soon(function() {
check_test8(gTest8TimerCallback);
});
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};
const gTest8Factory = {
createInstance: function(aOuter, aIID) {
if (aOuter == null) {
return gTest8TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
const gTest9TimerCallback = {
notify: function T9CB_notify(aTimer) {
TESTS[8].notified = true;
TESTS[8].notifyTime = Date.now();
do_execute_soon(function() {
check_test8(gTest9TimerCallback);
});
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
};
const gTest9Factory = {
createInstance: function(aOuter, aIID) {
if (aOuter == null) {
return gTest9TimerCallback.QueryInterface(aIID);
}
throw Cr.NS_ERROR_NO_AGGREGATION;
}
};
/**
* Logs TEST-INFO messages.
*
@ -474,7 +474,7 @@ const gTest9Factory = {
*/
function logTestInfo(aText, aCaller) {
let caller = aCaller ? aCaller : Components.stack.caller;
let now = new Date;
let now = new Date();
let hh = now.getHours();
let mm = now.getMinutes();
let ss = now.getSeconds();
@ -484,8 +484,7 @@ function logTestInfo(aText, aCaller) {
(ss < 10 ? "0" + ss : ss) + ":";
if (ms < 10) {
time += "00";
}
else if (ms < 100) {
} else if (ms < 100) {
time += "0";
}
time += ms;

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

@ -290,6 +290,24 @@ var snapshotFormatters = {
delete data.info;
}
if (AppConstants.NIGHTLY_BUILD) {
let windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let gpuProcessPid = windowUtils.gpuProcessPid;
if (gpuProcessPid != -1) {
let gpuProcessKillButton = $.new("button");
gpuProcessKillButton.addEventListener("click", function() {
windowUtils.terminateGPUProcess();
});
gpuProcessKillButton.textContent = strings.GetStringFromName("gpuProcessKillButton");
addRow("diagnostics", "GPUProcessPid", gpuProcessPid);
addRow("diagnostics", "GPUProcess", [gpuProcessKillButton]);
}
}
// graphics-failures-tbody tbody
if ("failures" in data) {
// If indices is there, it should be the same length as failures,

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

@ -207,7 +207,8 @@
if (this.isEmpty(this.mHourField.value) ||
this.isEmpty(this.mMinuteField.value) ||
(this.mDayPeriodField && this.isEmpty(this.mDayPeriodField.value)) ||
(this.mSecondField && this.isEmpty(this.mSecondField.value))) {
(this.mSecondField && this.isEmpty(this.mSecondField.value)) ||
(this.mMillisecField && this.isEmpty(this.mMillisecField.value))) {
// We still need to notify picker in case any of the field has
// changed. If we can set input element value, then notifyPicker
// will be called in setFieldsFromInputValue().
@ -328,7 +329,7 @@
value = now.getMinutes();
} else if (aTargetField == this.mSecondField) {
value = now.getSeconds();
} else if (aTargetField == this.mMillisecondsField) {
} else if (aTargetField == this.mMillisecField) {
value = now.getMilliseconds();
} else {
this.log("Field not supported in incrementFieldValue.");

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

@ -86,6 +86,7 @@ d3d11videoCrashGuard = D3D11 Video Decoder
d3d9videoCrashGuard = D3D9 Video Decoder
glcontextCrashGuard = OpenGL
resetOnNextRestart = Reset on Next Restart
gpuProcessKillButton = Terminate GPU Process
minLibVersions = Expected minimum version
loadedLibVersions = Version in use

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

@ -1109,14 +1109,17 @@ PopupNotifications.prototype = {
_reshowNotifications: function PopupNotifications_reshowNotifications(anchor, browser) {
// Mark notifications anchored to this anchor as un-dismissed
let notifications = this._getNotificationsForBrowser(browser || this.tabbrowser.selectedBrowser);
browser = browser || this.tabbrowser.selectedBrowser;
let notifications = this._getNotificationsForBrowser(browser);
notifications.forEach(function (n) {
if (n.anchorElement == anchor)
n.dismissed = false;
});
// ...and then show them.
this._update(notifications, anchor);
if (this._isActiveBrowser(browser)) {
// ...and then show them.
this._update(notifications, anchor);
}
},
_swapBrowserNotifications: function PopupNotifications_swapBrowserNoficications(ourBrowser, otherBrowser) {

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

@ -355,6 +355,14 @@ this.DownloadUtils = {
// Figure out when today begins
let today = new Date(aNow.getFullYear(), aNow.getMonth(), aNow.getDate());
// Get locale to use for date/time formatting
// TODO: Remove Intl fallback when bug 1215247 is fixed.
const locale = typeof Intl === "undefined"
? undefined
: Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIXULChromeRegistry)
.getSelectedLocale("global", true);
// Figure out if the time is from today, yesterday, this week, etc.
let dateTimeCompact;
if (aDate >= today) {
@ -369,12 +377,15 @@ this.DownloadUtils = {
dateTimeCompact = gBundle.GetStringFromName(gStr.yesterday);
} else if (today - aDate < (6 * 24 * 60 * 60 * 1000)) {
// After last week started, show day of week
dateTimeCompact = aDate.toLocaleFormat("%A");
dateTimeCompact = typeof Intl === "undefined"
? aDate.toLocaleFormat("%A")
: aDate.toLocaleDateString(locale, { weekday: "long" });
} else {
// Show month/day
let month = aDate.toLocaleFormat("%B");
// Remove leading 0 by converting the date string to a number
let date = Number(aDate.toLocaleFormat("%d"));
let month = typeof Intl === "undefined"
? aDate.toLocaleFormat("%B")
: aDate.toLocaleDateString(locale, { month: "long" });
let date = aDate.getDate();
dateTimeCompact = gBundle.formatStringFromName(gStr.monthDate, [month, date], 2);
}

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

@ -84,6 +84,13 @@ function testAllGetReadableDates()
const sixdaysago = new Date(2000, 11, 25, 11, 30, 15);
const sevendaysago = new Date(2000, 11, 24, 11, 30, 15);
// TODO: Remove Intl fallback when bug 1215247 is fixed.
const locale = typeof Intl === "undefined"
? undefined
: Components.classes["@mozilla.org/chrome/chrome-registry;1"]
.getService(Components.interfaces.nsIXULChromeRegistry)
.getSelectedLocale("global", true);
let dts = Components.classes["@mozilla.org/intl/scriptabledateformat;1"].
getService(Components.interfaces.nsIScriptableDateFormat);
@ -93,10 +100,19 @@ function testAllGetReadableDates()
12, 30, 0));
testGetReadableDates(yesterday_11_30, "Yesterday");
testGetReadableDates(yesterday_12_30, "Yesterday");
testGetReadableDates(twodaysago, twodaysago.toLocaleFormat("%A"));
testGetReadableDates(sixdaysago, sixdaysago.toLocaleFormat("%A"));
testGetReadableDates(sevendaysago, sevendaysago.toLocaleFormat("%B") + " " +
sevendaysago.toLocaleFormat("%d"));
testGetReadableDates(twodaysago,
typeof Intl === "undefined"
? twodaysago.toLocaleFormat("%A")
: twodaysago.toLocaleDateString(locale, { weekday: "long" }));
testGetReadableDates(sixdaysago,
typeof Intl === "undefined"
? sixdaysago.toLocaleFormat("%A")
: sixdaysago.toLocaleDateString(locale, { weekday: "long" }));
testGetReadableDates(sevendaysago,
(typeof Intl === "undefined"
? sevendaysago.toLocaleFormat("%B")
: sevendaysago.toLocaleDateString(locale, { month: "long" })) + " " +
sevendaysago.getDate().toString().padStart(2, "0"));
let [, dateTimeFull] = DownloadUtils.getReadableDates(today_11_30);
do_check_eq(dateTimeFull, dts.FormatDateTime("", dts.dateFormatLong,

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

@ -20,7 +20,7 @@ js/src/ctypes/libffi/
js/src/dtoa.c
js/src/jit/arm64/vixl/
media/gmp-clearkey/0.1/openaes/
media/kiss_ftt/
media/kiss_fft/
media/libav/
media/libcubeb/
media/libjpeg/