merge mozilla-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2016-02-02 11:50:53 +01:00
commit 9468a26fac
274 changed files with 4668 additions and 3403 deletions

View File

@ -122,8 +122,15 @@ public:
*/
inline void ScheduleTextUpdate(nsIContent* aTextNode)
{
if (mTextHash.PutEntry(aTextNode))
ScheduleProcessing();
// Make sure we are not called with a node that is not in the DOM tree or
// not visible.
MOZ_ASSERT(aTextNode->GetParentNode(), "A text node is not in DOM");
MOZ_ASSERT(aTextNode->GetPrimaryFrame(), "A text node doesn't have a frame");
MOZ_ASSERT(aTextNode->GetPrimaryFrame()->StyleVisibility()->IsVisible(),
"A text node is not visible");
mTextHash.PutEntry(aTextNode);
ScheduleProcessing();
}
/**

View File

@ -144,12 +144,6 @@
}
}
function sendErrorReport() {
var event = new CustomEvent("AboutNetErrorSendReport", {bubbles:true});
document.dispatchEvent(event);
}
function initPage()
{
var err = getErrorCode();
@ -260,13 +254,7 @@
var event = new CustomEvent("AboutNetErrorSetAutomatic",
{bubbles:true, detail:evt.target.checked});
document.dispatchEvent(event);
if (evt.target.checked) {
sendErrorReport();
}
}, false);
var retryBtn = document.getElementById('reportCertificateErrorRetry');
retryBtn.addEventListener('click', sendErrorReport, false);
}
}
if (getErrorCode() == "weakCryptoUsed" || getErrorCode() == "sslv3Used") {
@ -527,12 +515,6 @@
<p>
<input type="checkbox" id="automaticallyReportInFuture" />
<label for="automaticallyReportInFuture" id="automaticallyReportInFuture">&errorReporting.automatic2;</label>
<span id="reportingState">
<button id="reportCertificateErrorRetry">&errorReporting.tryAgain;</button>
<span id="reportSendingMessage">&errorReporting.sending;</span>
<span id="reportSentMessage">&errorReporting.sent;</span>
</span>
</p>
</div>

View File

@ -96,13 +96,6 @@
}));
});
var retryBtn = document.getElementById("reportCertificateErrorRetry");
retryBtn.addEventListener("click", function () {
document.dispatchEvent(new CustomEvent("AboutCertErrorSendReport", {
bubbles: true
}));
});
addEventListener("AboutCertErrorOptions", function (event) {
var options = JSON.parse(event.detail);
if (options && options.enabled) {
@ -287,12 +280,6 @@
<p>
<input type="checkbox" id="automaticallyReportInFuture" />
<label for="automaticallyReportInFuture" id="automaticallyReportInFuture">&errorReporting.automatic;</label>
<span id="reportingState">
<button id="reportCertificateErrorRetry">&errorReporting.tryAgain;</button>
<span id="reportSendingMessage">&errorReporting.sending;</span>
<span id="reportSentMessage">&errorReporting.sent;</span>
</span>
</p>
</div>

View File

@ -111,8 +111,8 @@ var FullZoom = {
// nsIContentPrefObserver
onContentPrefSet: function FullZoom_onContentPrefSet(aGroup, aName, aValue) {
this._onContentPrefChanged(aGroup, aValue);
onContentPrefSet: function FullZoom_onContentPrefSet(aGroup, aName, aValue, aIsPrivate) {
this._onContentPrefChanged(aGroup, aValue, aIsPrivate);
},
onContentPrefRemoved: function FullZoom_onContentPrefRemoved(aGroup, aName) {
@ -127,7 +127,7 @@ var FullZoom = {
* @param aValue The new value of the changed preference. Pass undefined to
* indicate the preference's removal.
*/
_onContentPrefChanged: function FullZoom__onContentPrefChanged(aGroup, aValue) {
_onContentPrefChanged: function FullZoom__onContentPrefChanged(aGroup, aValue, aIsPrivate) {
if (this._isNextContentPrefChangeInternal) {
// Ignore changes that FullZoom itself makes. This works because the
// content pref service calls callbacks before notifying observers, and it
@ -140,9 +140,10 @@ var FullZoom = {
if (!browser.currentURI)
return;
let ctxt = this._loadContextFromBrowser(browser);
let domain = this._cps2.extractDomain(browser.currentURI.spec);
if (aGroup) {
if (aGroup == domain)
if (aGroup == domain && ctxt.usePrivateBrowsing == aIsPrivate)
this._applyPrefToZoom(aValue, browser);
return;
}
@ -154,7 +155,6 @@ var FullZoom = {
// zoom should be set to the new global preference now that the global
// preference has changed.
let hasPref = false;
let ctxt = this._loadContextFromBrowser(browser);
let token = this._getBrowserToken(browser);
this._cps2.getByDomainAndName(browser.currentURI.spec, this.name, ctxt, {
handleResult: function () { hasPref = true; },

View File

@ -2716,100 +2716,23 @@ var BrowserOnClick = {
},
onSSLErrorReport: function(browser, documentURI, location, securityInfo) {
function showReportStatus(reportStatus) {
gBrowser.selectedBrowser
.messageManager
.sendAsyncMessage("Browser:SSLErrorReportStatus",
{
reportStatus: reportStatus,
documentURI: documentURI
});
}
if (!Services.prefs.getBoolPref("security.ssl.errorReporting.enabled")) {
showReportStatus("error");
Cu.reportError("User requested certificate error report sending, but certificate error reporting is disabled");
return;
}
let bin = TLS_ERROR_REPORT_TELEMETRY_MANUAL_SEND;
if (Services.prefs.getBoolPref("security.ssl.errorReporting.automatic")) {
bin = TLS_ERROR_REPORT_TELEMETRY_AUTO_SEND;
}
Services.telemetry.getHistogramById("TLS_ERROR_REPORT_UI").add(bin);
let serhelper = Cc["@mozilla.org/network/serialization-helper;1"]
.getService(Ci.nsISerializationHelper);
let transportSecurityInfo = serhelper.deserializeObject(securityInfo);
transportSecurityInfo.QueryInterface(Ci.nsITransportSecurityInfo)
showReportStatus("activity");
/*
* Requested info for the report:
* - Domain of bad connection
* - Error type (e.g. Pinning, domain mismatch, etc)
* - Cert chain (at minimum, same data to distrust each cert in the
* chain)
* - Request data (e.g. User Agent, IP, Timestamp)
*
* The request data should be added to the report by the receiving server.
*/
// Convert the nsIX509CertList into a format that can be parsed into
// JSON
let asciiCertChain = [];
if (transportSecurityInfo.failedCertChain) {
let certs = transportSecurityInfo.failedCertChain.getEnumerator();
while (certs.hasMoreElements()) {
let cert = certs.getNext();
cert.QueryInterface(Ci.nsIX509Cert);
asciiCertChain.push(btoa(getDERString(cert)));
}
}
let report = {
hostname: location.hostname,
port: location.port,
timestamp: Math.round(Date.now() / 1000),
errorCode: transportSecurityInfo.errorCode,
failedCertChain: asciiCertChain,
userAgent: window.navigator.userAgent,
version: 1,
build: gAppInfo.appBuildID,
product: gAppInfo.name,
channel: UpdateUtils.UpdateChannel
}
let reportURL = Services.prefs.getCharPref("security.ssl.errorReporting.url");
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
try {
xhr.open("POST", reportURL);
} catch (e) {
Cu.reportError("xhr.open exception", e);
showReportStatus("error");
}
xhr.onerror = function (e) {
// error making request to reportURL
Cu.reportError("xhr onerror", e);
showReportStatus("error");
};
xhr.onload = function (event) {
if (xhr.status !== 201 && xhr.status !== 0) {
// request returned non-success status
Cu.reportError("xhr returned failure code", xhr.status);
showReportStatus("error");
} else {
showReportStatus("complete");
}
};
xhr.send(JSON.stringify(report));
let errorReporter = Cc["@mozilla.org/securityreporter;1"]
.getService(Ci.nsISecurityReporter);
// if location.port is the empty string, set to -1 (for consistency with
// port values from nsIURI)
let port = location.port === "" ? -1 : location.port;
errorReporter.reportTLSError(transportSecurityInfo,
location.hostname, port);
},
onAboutCertError: function (browser, elementId, isTopFrame, location, securityInfoAsString) {

View File

@ -210,10 +210,8 @@ const TLS_ERROR_REPORT_TELEMETRY_FAILURE = 7;
var AboutCertErrorListener = {
init(chromeGlobal) {
addMessageListener("AboutCertErrorDetails", this);
addMessageListener("Browser:SSLErrorReportStatus", this);
chromeGlobal.addEventListener("AboutCertErrorLoad", this, false, true);
chromeGlobal.addEventListener("AboutCertErrorSetAutomatic", this, false, true);
chromeGlobal.addEventListener("AboutCertErrorSendReport", this, false, true);
},
get isAboutCertError() {
@ -232,9 +230,6 @@ var AboutCertErrorListener = {
case "AboutCertErrorSetAutomatic":
this.onSetAutomatic(event);
break;
case "AboutCertErrorSendReport":
this.onSendReport();
break;
}
},
@ -247,9 +242,6 @@ var AboutCertErrorListener = {
case "AboutCertErrorDetails":
this.onDetails(msg);
break;
case "Browser:SSLErrorReportStatus":
this.onReportStatus(msg);
break;
}
},
@ -258,6 +250,11 @@ var AboutCertErrorListener = {
let ownerDoc = originalTarget.ownerDocument;
ClickEventHandler.onAboutCertError(originalTarget, ownerDoc);
// Set up the TLS Error Reporting UI - reports are sent automatically
// (from nsHttpChannel::OnStopRequest) if the user has previously enabled
// automatic sending of reports. The UI ensures that a report is sent
// for the certificate error currently displayed if the user enables it
// here.
let automatic = Services.prefs.getBoolPref("security.ssl.errorReporting.automatic");
content.dispatchEvent(new content.CustomEvent("AboutCertErrorOptions", {
detail: JSON.stringify({
@ -265,10 +262,6 @@ var AboutCertErrorListener = {
automatic,
})
}));
if (automatic) {
this.onSendReport();
}
},
onDetails(msg) {
@ -277,68 +270,31 @@ var AboutCertErrorListener = {
},
onSetAutomatic(event) {
if (event.detail) {
this.onSendReport();
}
sendAsyncMessage("Browser:SetSSLErrorReportAuto", {
automatic: event.detail
});
},
onSendReport() {
let doc = content.document;
let location = doc.location.href;
// if we're enabling reports, send a report for this failure
if (event.detail) {
let doc = content.document;
let location = doc.location.href;
let serhelper = Cc["@mozilla.org/network/serialization-helper;1"]
.getService(Ci.nsISerializationHelper);
let serhelper = Cc["@mozilla.org/network/serialization-helper;1"]
.getService(Ci.nsISerializationHelper);
let serializable = docShell.failedChannel.securityInfo
.QueryInterface(Ci.nsITransportSecurityInfo)
.QueryInterface(Ci.nsISerializable);
let serializable = docShell.failedChannel.securityInfo
.QueryInterface(Ci.nsITransportSecurityInfo)
.QueryInterface(Ci.nsISerializable);
let serializedSecurityInfo = serhelper.serializeToString(serializable);
let serializedSecurityInfo = serhelper.serializeToString(serializable);
sendAsyncMessage("Browser:SendSSLErrorReport", {
documentURI: doc.documentURI,
location: {hostname: doc.location.hostname, port: doc.location.port},
securityInfo: serializedSecurityInfo
});
},
onReportStatus(msg) {
let doc = content.document;
if (doc.documentURI != msg.data.documentURI) {
return;
sendAsyncMessage("Browser:SendSSLErrorReport", {
documentURI: doc.documentURI,
location: {hostname: doc.location.hostname, port: doc.location.port},
securityInfo: serializedSecurityInfo
});
}
let reportSendingMsg = doc.getElementById("reportSendingMessage");
let reportSentMsg = doc.getElementById("reportSentMessage");
let retryBtn = doc.getElementById("reportCertificateErrorRetry");
switch (msg.data.reportStatus) {
case "activity":
// Hide the button that was just clicked
retryBtn.style.removeProperty("display");
reportSentMsg.style.removeProperty("display");
reportSendingMsg.style.display = "block";
break;
case "error":
// show the retry button
retryBtn.style.display = "block";
reportSendingMsg.style.removeProperty("display");
sendAsyncMessage("Browser:SSLErrorReportTelemetry",
{reportStatus: TLS_ERROR_REPORT_TELEMETRY_FAILURE});
break;
case "complete":
// Show a success indicator
reportSentMsg.style.display = "block";
reportSendingMsg.style.removeProperty("display");
sendAsyncMessage("Browser:SSLErrorReportTelemetry",
{reportStatus: TLS_ERROR_REPORT_TELEMETRY_SUCCESS});
break;
}
}
},
};
AboutCertErrorListener.init(this);
@ -348,8 +304,6 @@ var AboutNetErrorListener = {
init: function(chromeGlobal) {
chromeGlobal.addEventListener('AboutNetErrorLoad', this, false, true);
chromeGlobal.addEventListener('AboutNetErrorSetAutomatic', this, false, true);
chromeGlobal.addEventListener('AboutNetErrorSendReport', this, false, true);
chromeGlobal.addEventListener('AboutNetErrorUIExpanded', this, false, true);
chromeGlobal.addEventListener('AboutNetErrorOverride', this, false, true);
},
@ -369,13 +323,6 @@ var AboutNetErrorListener = {
case "AboutNetErrorSetAutomatic":
this.onSetAutomatic(aEvent);
break;
case "AboutNetErrorSendReport":
this.onSendReport(aEvent);
break;
case "AboutNetErrorUIExpanded":
sendAsyncMessage("Browser:SSLErrorReportTelemetry",
{reportStatus: TLS_ERROR_REPORT_TELEMETRY_EXPANDED});
break;
case "AboutNetErrorOverride":
this.onOverride(aEvent);
break;
@ -385,91 +332,46 @@ var AboutNetErrorListener = {
onPageLoad: function(evt) {
let automatic = Services.prefs.getBoolPref("security.ssl.errorReporting.automatic");
content.dispatchEvent(new content.CustomEvent("AboutNetErrorOptions", {
detail: JSON.stringify({
enabled: Services.prefs.getBoolPref("security.ssl.errorReporting.enabled"),
automatic: automatic
})
}
));
detail: JSON.stringify({
enabled: Services.prefs.getBoolPref("security.ssl.errorReporting.enabled"),
automatic: automatic
})
}));
sendAsyncMessage("Browser:SSLErrorReportTelemetry",
{reportStatus: TLS_ERROR_REPORT_TELEMETRY_UI_SHOWN});
if (automatic) {
this.onSendReport(evt);
}
// hide parts of the UI we don't need yet
let contentDoc = content.document;
let reportSendingMsg = contentDoc.getElementById("reportSendingMessage");
let reportSentMsg = contentDoc.getElementById("reportSentMessage");
let retryBtn = contentDoc.getElementById("reportCertificateErrorRetry");
reportSendingMsg.style.display = "none";
reportSentMsg.style.display = "none";
retryBtn.style.display = "none";
},
onSetAutomatic: function(evt) {
sendAsyncMessage("Browser:SetSSLErrorReportAuto", {
automatic: evt.detail
automatic: evt.detail
});
// if we're enabling reports, send a report for this failure
if (evt.detail) {
let contentDoc = content.document;
let location = contentDoc.location.href;
let serhelper = Cc["@mozilla.org/network/serialization-helper;1"]
.getService(Ci.nsISerializationHelper);
let serializable = docShell.failedChannel.securityInfo
.QueryInterface(Ci.nsITransportSecurityInfo)
.QueryInterface(Ci.nsISerializable);
let serializedSecurityInfo = serhelper.serializeToString(serializable);
sendAsyncMessage("Browser:SendSSLErrorReport", {
documentURI: contentDoc.documentURI,
location: {
hostname: contentDoc.location.hostname,
port: contentDoc.location.port
},
securityInfo: serializedSecurityInfo
});
},
onSendReport: function(evt) {
let contentDoc = content.document;
let reportSendingMsg = contentDoc.getElementById("reportSendingMessage");
let reportSentMsg = contentDoc.getElementById("reportSentMessage");
let retryBtn = contentDoc.getElementById("reportCertificateErrorRetry");
addMessageListener("Browser:SSLErrorReportStatus", function(message) {
// show and hide bits - but only if this is a message for the right
// document - we'll compare on document URI
if (contentDoc.documentURI === message.data.documentURI) {
switch(message.data.reportStatus) {
case "activity":
// Hide the button that was just clicked
retryBtn.style.display = "none";
reportSentMsg.style.display = "none";
reportSendingMsg.style.removeProperty("display");
break;
case "error":
// show the retry button
retryBtn.style.removeProperty("display");
reportSendingMsg.style.display = "none";
sendAsyncMessage("Browser:SSLErrorReportTelemetry",
{reportStatus: TLS_ERROR_REPORT_TELEMETRY_FAILURE});
break;
case "complete":
// Show a success indicator
reportSentMsg.style.removeProperty("display");
reportSendingMsg.style.display = "none";
sendAsyncMessage("Browser:SSLErrorReportTelemetry",
{reportStatus: TLS_ERROR_REPORT_TELEMETRY_SUCCESS});
break;
}
}
});
let location = contentDoc.location.href;
let serhelper = Cc["@mozilla.org/network/serialization-helper;1"]
.getService(Ci.nsISerializationHelper);
let serializable = docShell.failedChannel.securityInfo
.QueryInterface(Ci.nsITransportSecurityInfo)
.QueryInterface(Ci.nsISerializable);
let serializedSecurityInfo = serhelper.serializeToString(serializable);
sendAsyncMessage("Browser:SendSSLErrorReport", {
documentURI: contentDoc.documentURI,
location: {
hostname: contentDoc.location.hostname,
port: contentDoc.location.port
},
securityInfo: serializedSecurityInfo
});
}
},
onOverride: function(evt) {

View File

@ -28,13 +28,12 @@ registerCleanupFunction(() => {
add_task(function* test_send_report_neterror() {
yield testSendReportAutomatically(URL_BAD_CHAIN, "succeed", "neterror");
yield testSendReportAutomatically(URL_NO_CERT, "nocert", "neterror");
yield testSendReportFailRetry(URL_NO_CERT, "nocert", "neterror");
yield testSetAutomatic(URL_NO_CERT, "nocert", "neterror");
});
add_task(function* test_send_report_certerror() {
yield testSendReportAutomatically(URL_BAD_CERT, "badcert", "certerror");
yield testSendReportFailRetry(URL_BAD_CERT, "badcert", "certerror");
yield testSetAutomatic(URL_BAD_CERT, "badcert", "certerror");
});
@ -65,10 +64,11 @@ function* testSendReportAutomatically(testURL, suffix, errorURISuffix) {
let browser = tab.linkedBrowser;
// Load the page and wait for the error report submission.
let promiseReport = createErrorReportPromise(browser);
let promiseStatus = createReportResponseStatusPromise(URL_REPORTS + suffix);
browser.loadURI(testURL);
yield promiseReport;
ok(true, "SSL error report submitted successfully");
ok(!isErrorStatus(yield promiseStatus),
"SSL error report submitted successfully");
// Check that we loaded the right error page.
yield checkErrorPage(browser, errorURISuffix);
@ -78,30 +78,6 @@ function* testSendReportAutomatically(testURL, suffix, errorURISuffix) {
cleanup();
};
function* testSendReportFailRetry(testURL, suffix, errorURISuffix) {
try {
yield testSendReportAutomatically(testURL, "error", errorURISuffix);
ok(false, "sending a report should have failed");
} catch (err) {
ok(err, "saw a failure notification");
}
Services.prefs.setCharPref(PREF_REPORT_URL, URL_REPORTS + suffix);
let browser = gBrowser.selectedBrowser;
let promiseReport = createErrorReportPromise(browser);
let promiseRetry = ContentTask.spawn(browser, null, function* () {
content.document.getElementById("reportCertificateErrorRetry").click();
});
yield Promise.all([promiseReport, promiseRetry]);
ok(true, "SSL error report submitted successfully");
// Cleanup.
gBrowser.removeCurrentTab();
cleanup();
}
function* testSetAutomatic(testURL, suffix, errorURISuffix) {
Services.prefs.setBoolPref(PREF_REPORT_ENABLED, true);
Services.prefs.setBoolPref(PREF_REPORT_AUTOMATIC, false);
@ -118,15 +94,15 @@ function* testSetAutomatic(testURL, suffix, errorURISuffix) {
// Check that we loaded the right error page.
yield checkErrorPage(browser, errorURISuffix);
let statusPromise = createReportResponseStatusPromise(URL_REPORTS + suffix);
// Click the checkbox, enable automatic error reports.
let promiseReport = createErrorReportPromise(browser);
yield ContentTask.spawn(browser, null, function* () {
content.document.getElementById("automaticallyReportInFuture").click();
});
// Wait for the error report submission.
yield promiseReport;
ok(true, "SSL error report submitted successfully");
yield statusPromise;
let isAutomaticReportingEnabled = () =>
Services.prefs.getBoolPref(PREF_REPORT_AUTOMATIC);
@ -170,32 +146,22 @@ function* testSendReportDisabled(testURL, errorURISuffix) {
gBrowser.removeTab(tab);
}
function createErrorReportPromise(browser) {
return ContentTask.spawn(browser, null, function* () {
let type = "Browser:SSLErrorReportStatus";
let active = false;
function isErrorStatus(status) {
return status < 200 || status >= 300;
}
yield new Promise((resolve, reject) => {
addMessageListener(type, function onReportStatus(message) {
switch (message.data.reportStatus) {
case "activity":
active = true;
break;
case "complete":
removeMessageListener(type, onReportStatus);
if (active) {
resolve(message.data.reportStatus);
} else {
reject("activity should be seen before success");
}
break;
case "error":
removeMessageListener(type, onReportStatus);
reject("sending the report failed");
break;
}
});
});
// use the observer service to see when a report is sent
function createReportResponseStatusPromise(expectedURI) {
return new Promise(resolve => {
let observer = (subject, topic, data) => {
subject.QueryInterface(Ci.nsIHttpChannel);
let requestURI = subject.URI.spec;
if (requestURI == expectedURI) {
Services.obs.removeObserver(observer, "http-on-examine-response");
resolve(subject.responseStatus);
}
};
Services.obs.addObserver(observer, "http-on-examine-response", false);
});
}

View File

@ -85,7 +85,7 @@ function handleRequest(request, response) {
break;
default:
response.setStatusLine("1.1", 500, "Server error");
response.write("<html>succeed, nocert or error expected</html>");
response.write("<html>succeed, nocert or error expected (got " + request.queryString + ")</html>");
break;
}
}

View File

@ -0,0 +1,4 @@
# The source "build" only needs a mozconfig because we use the build system as
# our script for generating it. This allows us to run configure without any
# extra dependencies on specific toolchains, e.g. gtk3.
ac_add_options --disable-compile-environment

View File

@ -36,6 +36,3 @@ you know there's a good reason why this site doesn't use trusted identification.
<!ENTITY certerror.copyToClipboard.label "Copy text to clipboard">
<!ENTITY errorReporting.automatic "Report errors like this to help Mozilla identify misconfigured sites">
<!ENTITY errorReporting.sending "Sending report">
<!ENTITY errorReporting.sent "Report sent">
<!ENTITY errorReporting.tryAgain "Try again">

View File

@ -206,9 +206,6 @@ functionality specific to firefox. -->
<!ENTITY errorReporting.automatic2 "Report errors like this to help Mozilla identify and block malicious sites">
<!ENTITY errorReporting.learnMore "Learn more…">
<!ENTITY errorReporting.sending "Sending report">
<!ENTITY errorReporting.sent "Report sent">
<!ENTITY errorReporting.tryAgain "Try again">
<!ENTITY remoteXUL.title "Remote XUL">
<!ENTITY remoteXUL.longDesc "<p><ul><li>Please contact the website owners to inform them of this problem.</li></ul></p>">

View File

@ -7,6 +7,9 @@
#include "mozilla/BasePrincipal.h"
#include "nsDocShell.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsIAddonPolicyService.h"
#include "nsIContentSecurityPolicy.h"
#include "nsIObjectInputStream.h"
@ -121,7 +124,13 @@ OriginAttributes::CreateSuffix(nsACString& aStr) const
}
if (!mAddonId.IsEmpty()) {
MOZ_RELEASE_ASSERT(mAddonId.FindCharInSet(dom::quota::QuotaManager::kReplaceChars) == kNotFound);
if (mAddonId.FindCharInSet(dom::quota::QuotaManager::kReplaceChars) != kNotFound) {
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Crash_AddonId"),
NS_ConvertUTF16toUTF8(mAddonId));
#endif
MOZ_CRASH();
}
params->Set(NS_LITERAL_STRING("addonId"), mAddonId);
}

View File

@ -32,8 +32,13 @@ EXPORTS.mozilla = [
'BasePrincipal.h'
]
UNIFIED_SOURCES += [
SOURCES += [
# Compile this separately since nsExceptionHandler.h conflicts
# with something from nsNullPrincipal.cpp.
'BasePrincipal.cpp',
]
UNIFIED_SOURCES += [
'DomainPolicy.cpp',
'nsJSPrincipals.cpp',
'nsNullPrincipal.cpp',

View File

@ -27,6 +27,7 @@
#include "nsXPIDLString.h"
#include "nsCRT.h"
#include "nsCRTGlue.h"
#include "nsDocShell.h"
#include "nsError.h"
#include "nsDOMCID.h"
#include "nsIXPConnect.h"

View File

@ -530,7 +530,7 @@ case "$target" in
MSVS_VERSION=2013
MSVC_C_RUNTIME_DLL=msvcr120.dll
MSVC_CXX_RUNTIME_DLL=msvcp120.dll
elif test "$_CC_MAJOR_VERSION" = "19"; then
elif test "$_CC_MAJOR_VERSION" = "19" -a "$_CC_BUILD_VERSION" -ge "23506"; then
_CC_SUITE=14
MSVS_VERSION=2015
MSVC_C_RUNTIME_DLL=vcruntime140.dll
@ -557,7 +557,7 @@ case "$target" in
CXXFLAGS="$CXXFLAGS -wd4091"
else
AC_MSG_ERROR([This version (${_CC_MAJOR_VERSION}.${_CC_MINOR_VERSION}.${_CC_BUILD_VERSION}) of the MSVC compiler is unsupported.
You must install Visual C++ 2013 Update 3 or newer in order to build.
You must install Visual C++ 2013 Update 3, Visual C++ 2015 Update 1, or newer in order to build.
See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
fi
AC_SUBST(MSVS_VERSION)

View File

@ -72,7 +72,6 @@ skip-if = buildapp == 'mulet'
[browser_bug655270.js]
[browser_bug655273.js]
[browser_bug670318.js]
skip-if = (os == 'mac' && debug) # Bug 1241704
[browser_bug673467.js]
[browser_bug852909.js]
[browser_bug92473.js]

View File

@ -14,7 +14,7 @@ add_task(function* test() {
yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" },
function* (browser) {
yield ContentTask.spawn(browser, URL, function* (URL) {
let history = docShell.sessionHistory;
let history = docShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory;
let count = 0;
let testDone = {};

View File

@ -10,6 +10,9 @@
#include "nsContentUtils.h"
#include "nsCExternalHandlerService.h"
#include "mozilla/UniquePtr.h"
using namespace mozilla;
using namespace mozilla::dom;
USING_ARCHIVEREADER_NAMESPACE
@ -191,8 +194,8 @@ ArchiveReaderZipEvent::Exec()
}
// Read the name:
nsAutoArrayPtr<char> filename(new char[filenameLen + 1]);
rv = inputStream->Read(filename, filenameLen, &ret);
auto filename = MakeUnique<char[]>(filenameLen + 1);
rv = inputStream->Read(filename.get(), filenameLen, &ret);
if (NS_FAILED(rv) || ret != filenameLen) {
return RunShare(NS_ERROR_UNEXPECTED);
}
@ -201,7 +204,8 @@ ArchiveReaderZipEvent::Exec()
// We ignore the directories:
if (filename[filenameLen - 1] != '/') {
mFileList.AppendElement(new ArchiveZipItem(filename, centralStruct, mEncoding));
mFileList.AppendElement(new ArchiveZipItem(filename.get(), centralStruct,
mEncoding));
}
// Ignore the rest

View File

@ -128,6 +128,11 @@
#include <cutils/properties.h>
#endif
#ifdef MOZ_PAY
#include "nsIPaymentContentHelperService.h"
#include "mozilla/dom/DOMRequest.h"
#endif
namespace mozilla {
namespace dom {
@ -2672,6 +2677,36 @@ Navigator::MozE10sEnabled()
return true;
}
#ifdef MOZ_PAY
already_AddRefed<DOMRequest>
Navigator::MozPay(JSContext* aCx,
JS::Handle<JS::Value> aJwts,
ErrorResult& aRv)
{
if (!mWindow || !mWindow->GetDocShell()) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
nsresult rv;
nsCOMPtr<nsIPaymentContentHelperService> service =
do_GetService("@mozilla.org/payment/content-helper-service;1", &rv);
if (!service) {
aRv.Throw(rv);
return nullptr;
}
RefPtr<nsIDOMDOMRequest> request;
rv = service->Pay(mWindow, aJwts, getter_AddRefs(request));
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return nullptr;
}
return request.forget().downcast<DOMRequest>();
}
#endif // MOZ_PAY
/* static */
already_AddRefed<nsPIDOMWindowInner>
Navigator::GetWindowFromGlobal(JSObject* aGlobal)

View File

@ -42,6 +42,7 @@ class WakeLock;
class ArrayBufferViewOrBlobOrStringOrFormData;
struct MobileIdOptions;
class ServiceWorkerContainer;
class DOMRequest;
} // namespace dom
} // namespace mozilla
@ -315,6 +316,12 @@ public:
bool MozE10sEnabled();
#ifdef MOZ_PAY
already_AddRefed<DOMRequest> MozPay(JSContext* aCx,
JS::Handle<JS::Value> aJwts,
ErrorResult& aRv);
#endif // MOZ_PAY
static void GetAcceptLanguages(nsTArray<nsString>& aLanguages);
// WebIDL helper methods

View File

@ -8,6 +8,8 @@
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/WebKitCSSMatrixBinding.h"
#include "nsCSSParser.h"
#include "nsStyleTransformMatrix.h"
namespace mozilla {
namespace dom {
@ -56,11 +58,58 @@ WebKitCSSMatrix*
WebKitCSSMatrix::SetMatrixValue(const nsAString& aTransformList,
ErrorResult& aRv)
{
DOMMatrix::SetMatrixValue(aTransformList, aRv);
if (NS_WARN_IF(aRv.Failed())) {
// An empty string is a no-op.
if (aTransformList.IsEmpty()) {
return this;
}
nsCSSValue value;
nsCSSParser parser;
bool parseSuccess = parser.ParseTransformProperty(aTransformList,
true,
value);
if (!parseSuccess) {
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
return nullptr;
}
// A value of "none" results in a 2D identity matrix.
if (value.GetUnit() == eCSSUnit_None) {
mMatrix3D = nullptr;
mMatrix2D = new gfx::Matrix();
return this;
}
// A value other than a transform-list is a syntax error.
if (value.GetUnit() != eCSSUnit_SharedList) {
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
return nullptr;
}
RuleNodeCacheConditions dummy;
nsStyleTransformMatrix::TransformReferenceBox dummyBox;
bool contains3dTransform = false;
gfx::Matrix4x4 transform = nsStyleTransformMatrix::ReadTransforms(
value.GetSharedListValue()->mHead,
nullptr, nullptr, dummy, dummyBox,
nsPresContext::AppUnitsPerCSSPixel(),
&contains3dTransform);
if (!contains3dTransform) {
mMatrix3D = nullptr;
mMatrix2D = new gfx::Matrix();
SetA(transform._11);
SetB(transform._12);
SetC(transform._21);
SetD(transform._22);
SetE(transform._41);
SetF(transform._42);
} else {
mMatrix3D = new gfx::Matrix4x4(transform);
mMatrix2D = nullptr;
}
return this;
}

View File

@ -3282,15 +3282,39 @@ nsIDocument::ElementFromPoint(float aX, float aY)
return ElementFromPointHelper(aX, aY, false, true);
}
void
nsIDocument::ElementsFromPoint(float aX, float aY,
nsTArray<RefPtr<Element>>& aElements)
{
ElementsFromPointHelper(aX, aY, nsIDocument::FLUSH_LAYOUT, aElements);
}
Element*
nsDocument::ElementFromPointHelper(float aX, float aY,
bool aIgnoreRootScrollFrame,
bool aFlushLayout)
{
// As per the the spec, we return null if either coord is negative
if (!aIgnoreRootScrollFrame && (aX < 0 || aY < 0)) {
nsAutoTArray<RefPtr<Element>, 1> elementArray;
ElementsFromPointHelper(aX, aY,
((aIgnoreRootScrollFrame ? nsIDocument::IGNORE_ROOT_SCROLL_FRAME : 0) |
(aFlushLayout ? nsIDocument::FLUSH_LAYOUT : 0) |
nsIDocument::IS_ELEMENT_FROM_POINT),
elementArray);
if (elementArray.IsEmpty()) {
return nullptr;
}
return elementArray[0];
}
void
nsDocument::ElementsFromPointHelper(float aX, float aY,
uint32_t aFlags,
nsTArray<RefPtr<mozilla::dom::Element>>& aElements)
{
// As per the the spec, we return null if either coord is negative
if (!(aFlags & nsIDocument::IGNORE_ROOT_SCROLL_FRAME) && (aX < 0 || aY < 0)) {
return;
}
nscoord x = nsPresContext::CSSPixelsToAppUnits(aX);
nscoord y = nsPresContext::CSSPixelsToAppUnits(aY);
@ -3298,32 +3322,58 @@ nsDocument::ElementFromPointHelper(float aX, float aY,
// Make sure the layout information we get is up-to-date, and
// ensure we get a root frame (for everything but XUL)
if (aFlushLayout)
if (aFlags & nsIDocument::FLUSH_LAYOUT) {
FlushPendingNotifications(Flush_Layout);
}
nsIPresShell *ps = GetShell();
if (!ps) {
return nullptr;
return;
}
nsIFrame *rootFrame = ps->GetRootFrame();
// XUL docs, unlike HTML, have no frame tree until everything's done loading
if (!rootFrame) {
return nullptr; // return null to premature XUL callers as a reminder to wait
return; // return null to premature XUL callers as a reminder to wait
}
nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt,
nsTArray<nsIFrame*> outFrames;
// Emulate what GetFrameAtPoint does, since we want all the frames under our
// point.
nsLayoutUtils::GetFramesForArea(rootFrame, nsRect(pt, nsSize(1, 1)), outFrames,
nsLayoutUtils::IGNORE_PAINT_SUPPRESSION | nsLayoutUtils::IGNORE_CROSS_DOC |
(aIgnoreRootScrollFrame ? nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME : 0));
if (!ptFrame) {
return nullptr;
((aFlags & nsIDocument::IGNORE_ROOT_SCROLL_FRAME) ? nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME : 0));
// Dunno when this would ever happen, as we should at least have a root frame under us?
if (outFrames.IsEmpty()) {
return;
}
nsIContent* elem = GetContentInThisDocument(ptFrame);
if (elem && !elem->IsElement()) {
elem = elem->GetParent();
// Used to filter out repeated elements in sequence.
nsIContent* lastAdded = nullptr;
for (uint32_t i = 0; i < outFrames.Length(); i++) {
nsIContent* node = GetContentInThisDocument(outFrames[i]);
if (!node || !node->IsElement()) {
// If this helper is called via ElementsFromPoint, we need to make sure
// our frame is an element. Otherwise return whatever the top frame is
// even if it isn't the top-painted element.
if (!(aFlags & nsIDocument::IS_ELEMENT_FROM_POINT)) {
continue;
}
node = node->GetParent();
}
if (node && node != lastAdded) {
aElements.AppendElement(node->AsElement());
lastAdded = node;
// If this helper is called via ElementFromPoint, just return the first
// element we find.
if (aFlags & nsIDocument::IS_ELEMENT_FROM_POINT) {
return;
}
}
}
return elem ? elem->AsElement() : nullptr;
}
nsresult

View File

@ -1031,8 +1031,12 @@ public:
const nsAString& aAttrValue) const override;
virtual Element* ElementFromPointHelper(float aX, float aY,
bool aIgnoreRootScrollFrame,
bool aFlushLayout) override;
bool aIgnoreRootScrollFrame,
bool aFlushLayout) override;
virtual void ElementsFromPointHelper(float aX, float aY,
uint32_t aFlags,
nsTArray<RefPtr<mozilla::dom::Element>>& aElements) override;
virtual nsresult NodesFromRectHelper(float aX, float aY,
float aTopSize, float aRightSize,

View File

@ -2340,6 +2340,7 @@ CreateNativeGlobalForInner(JSContext* aCx,
if (aNewInner->GetOuterWindow()) {
top = aNewInner->GetTopInternal();
}
JS::CompartmentOptions options;
// Sometimes add-ons load their own XUL windows, either as separate top-level
@ -2353,6 +2354,8 @@ CreateNativeGlobalForInner(JSContext* aCx,
options.creationOptions().setSameZoneAs(top->GetGlobalJSObject());
}
xpc::InitGlobalObjectOptions(options, aPrincipal);
// Determine if we need the Components object.
bool needComponents = nsContentUtils::IsSystemPrincipal(aPrincipal) ||
TreatAsRemoteXUL(aPrincipal);

View File

@ -1669,6 +1669,16 @@ public:
bool aIgnoreRootScrollFrame,
bool aFlushLayout) = 0;
enum ElementsFromPointFlags {
IGNORE_ROOT_SCROLL_FRAME = 1,
FLUSH_LAYOUT = 2,
IS_ELEMENT_FROM_POINT = 4
};
virtual void ElementsFromPointHelper(float aX, float aY,
uint32_t aFlags,
nsTArray<RefPtr<mozilla::dom::Element>>& aElements) = 0;
virtual nsresult NodesFromRectHelper(float aX, float aY,
float aTopSize, float aRightSize,
float aBottomSize, float aLeftSize,
@ -2531,6 +2541,9 @@ public:
virtual mozilla::dom::DOMStringList* StyleSheetSets() = 0;
virtual void EnableStyleSheetsForSet(const nsAString& aSheetSet) = 0;
Element* ElementFromPoint(float aX, float aY);
void ElementsFromPoint(float aX,
float aY,
nsTArray<RefPtr<mozilla::dom::Element>>& aElements);
/**
* Retrieve the location of the caret position (DOM node and character

View File

@ -11,7 +11,6 @@
#include "nsDOMNavigationTiming.h"
#include "nsContentUtils.h"
#include "nsIScriptSecurityManager.h"
#include "nsGlobalWindow.h"
#include "nsIDOMWindow.h"
#include "nsILoadInfo.h"
#include "nsIURI.h"
@ -30,8 +29,6 @@
#include "mozilla/Preferences.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/TimeStamp.h"
#include "SharedWorker.h"
#include "ServiceWorker.h"
#include "js/HeapAPI.h"
#include "GeckoProfiler.h"
#include "WorkerPrivate.h"
@ -918,37 +915,6 @@ PerformanceBase::ClearResourceTimings()
mResourceEntries.Clear();
}
DOMHighResTimeStamp
PerformanceBase::TranslateTime(DOMHighResTimeStamp aTime,
const WindowOrWorkerOrSharedWorkerOrServiceWorker& aTimeSource,
ErrorResult& aRv)
{
TimeStamp otherCreationTimeStamp;
if (aTimeSource.IsWindow()) {
RefPtr<nsPerformance> performance = aTimeSource.GetAsWindow().GetPerformance();
if (NS_WARN_IF(!performance)) {
aRv.Throw(NS_ERROR_FAILURE);
}
otherCreationTimeStamp = performance->CreationTimeStamp();
} else if (aTimeSource.IsWorker()) {
otherCreationTimeStamp = aTimeSource.GetAsWorker().CreationTimeStamp();
} else if (aTimeSource.IsSharedWorker()) {
SharedWorker& sharedWorker = aTimeSource.GetAsSharedWorker();
WorkerPrivate* workerPrivate = sharedWorker.GetWorkerPrivate();
otherCreationTimeStamp = workerPrivate->CreationTimeStamp();
} else if (aTimeSource.IsServiceWorker()) {
ServiceWorker& serviceWorker = aTimeSource.GetAsServiceWorker();
WorkerPrivate* workerPrivate = serviceWorker.GetWorkerPrivate();
otherCreationTimeStamp = workerPrivate->CreationTimeStamp();
} else {
MOZ_CRASH("This should not be possible.");
}
return RoundTime(
aTime + (otherCreationTimeStamp - CreationTimeStamp()).ToMilliseconds());
}
DOMHighResTimeStamp
PerformanceBase::RoundTime(double aTime) const
{

View File

@ -30,7 +30,6 @@ namespace dom {
class PerformanceEntry;
class PerformanceObserver;
class WindowOrWorkerOrSharedWorkerOrServiceWorker;
} // namespace dom
} // namespace mozilla
@ -318,11 +317,6 @@ public:
virtual DOMHighResTimeStamp Now() const = 0;
DOMHighResTimeStamp
TranslateTime(DOMHighResTimeStamp aTime,
const mozilla::dom::WindowOrWorkerOrSharedWorkerOrServiceWorker& aTimeSource,
mozilla::ErrorResult& aRv);
void Mark(const nsAString& aName, mozilla::ErrorResult& aRv);
void ClearMarks(const mozilla::dom::Optional<nsAString>& aName);
void Measure(const nsAString& aName,

View File

@ -3803,8 +3803,8 @@ ArrayBufferBuilder::getArrayBuffer(JSContext* aCx)
}
mMapPtr = nullptr;
// The memory-mapped contents will be released when obj been finalized(GCed
// or neutered).
// The memory-mapped contents will be released when the ArrayBuffer becomes
// detached or is GC'd.
return obj;
}

View File

@ -1 +0,0 @@
/* nothing here */

View File

@ -257,7 +257,6 @@ support-files =
file_explicit_user_agent.sjs
referrer_change_server.sjs
file_change_policy_redirect.html
empty_worker.js
file_bug1198095.js
[test_anonymousContent_api.html]
@ -868,7 +867,6 @@ skip-if = e10s || os != 'linux' || buildapp != 'browser'
[test_change_policy.html]
skip-if = buildapp == 'b2g' #no ssl support
[test_document.all_iteration.html]
[test_performance_translate.html]
[test_bug1198095.html]
[test_bug1187157.html]
[test_bug769117.html]

View File

@ -1,75 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for performance.translate()</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="test_performance_user_timing.js"></script>
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
function testBasic() {
ok("translateTime" in performance, "Performance.translateTime exists.");
try {
performance.translateTime(0, null);
ok(false, "Wrong use of performance.translateTime.");
} catch(e) {
ok(true, "Wrong use of performance.translateTime.");
}
next();
}
function testWindow() {
is(performance.translateTime(42, this), 42, "translating time with the same window.");
var now = performance.now();
var ifr = document.createElement('iframe');
ifr.src = 'file_empty.html';
document.body.appendChild(ifr);
ifr.onload = function() {
var a = performance.translateTime(0, ifr.contentWindow);
ok (a >= now, "Time has been translated from a window that started loading later than we did");
next();
}
}
function testWorker() {
var now = performance.now();
var w = new Worker('empty_worker.js');
var a = performance.translateTime(0, w);
// bug 1226147
ok (a >= now, "Time has been translated from a Worker that started loading later than we did");
next();
}
function testSharedWorker() {
var now = performance.now();
var w = new SharedWorker('empty_worker.js');
var a = performance.translateTime(0, w);
ok (a >= now, "Time has been translated from a SharedWorker that started loading later than we did");
next();
}
var tests = [ testBasic, testWindow, testWorker, testSharedWorker ];
function next() {
if (!tests.length) {
SimpleTest.finish();
return;
}
var test = tests.shift();
test();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(next);
</script>
</pre>
</body>
</html>

View File

@ -3023,6 +3023,11 @@ RegisterDOMNames();
// The return value is whatever the ProtoHandleGetter we used
// returned. This should be the DOM prototype for the global.
//
// Typically this method's caller will want to ensure that
// xpc::InitGlobalObjectOptions is called before, and xpc::InitGlobalObject is
// called after, this method, to ensure that this global object and its
// compartment are consistent with other global objects.
template <class T, ProtoHandleGetter GetProto>
JS::Handle<JSObject*>
CreateGlobal(JSContext* aCx, T* aNative, nsWrapperCache* aCache,

View File

@ -2273,8 +2273,7 @@ nsGonkCameraControl::CreatePoster(Image* aImage, uint32_t aWidth, uint32_t aHeig
// ARGB is 32 bits / pixel
size_t tmpLength = mWidth * mHeight * sizeof(uint32_t);
nsAutoArrayPtr<uint8_t> tmp;
tmp = new uint8_t[tmpLength];
UniquePtr<uint8_t[]> tmp = MakeUnique<uint8_t[]>(tmpLength);
GrallocImage* nativeImage = static_cast<GrallocImage*>(mImage.get());
android::sp<GraphicBuffer> graphicBuffer = nativeImage->GetGraphicBuffer();
@ -2284,7 +2283,7 @@ nsGonkCameraControl::CreatePoster(Image* aImage, uint32_t aWidth, uint32_t aHeig
uint32_t stride = mWidth * 4;
int err = libyuv::ConvertToARGB(static_cast<uint8_t*>(graphicSrc),
srcLength, tmp, stride, 0, 0,
srcLength, tmp.get(), stride, 0, 0,
mWidth, mHeight, mWidth, mHeight,
libyuv::kRotate0, libyuv::FOURCC_NV21);
@ -2307,7 +2306,7 @@ nsGonkCameraControl::CreatePoster(Image* aImage, uint32_t aWidth, uint32_t aHeig
}
nsString opt;
nsresult rv = encoder->InitFromData(tmp, tmpLength, mWidth,
nsresult rv = encoder->InitFromData(tmp.get(), tmpLength, mWidth,
mHeight, stride,
imgIEncoder::INPUT_FORMAT_HOSTARGB,
opt);

View File

@ -7,6 +7,7 @@
#include "mozilla/dom/TextDecoder.h"
#include "mozilla/dom/EncodingUtils.h"
#include "mozilla/dom/UnionTypes.h"
#include "mozilla/UniquePtrExtensions.h"
#include "nsContentUtils.h"
#include <stdint.h>
@ -65,18 +66,18 @@ TextDecoder::Decode(const char* aInput, const int32_t aLength,
}
// Need a fallible allocator because the caller may be a content
// and the content can specify the length of the string.
nsAutoArrayPtr<char16_t> buf(new (fallible) char16_t[outLen + 1]);
auto buf = MakeUniqueFallible<char16_t[]>(outLen + 1);
if (!buf) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}
int32_t length = aLength;
rv = mDecoder->Convert(aInput, &length, buf, &outLen);
rv = mDecoder->Convert(aInput, &length, buf.get(), &outLen);
MOZ_ASSERT(mFatal || rv != NS_ERROR_ILLEGAL_INPUT);
buf[outLen] = 0;
if (!aOutDecodedString.Append(buf, outLen, fallible)) {
if (!aOutDecodedString.Append(buf.get(), outLen, fallible)) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}

View File

@ -6,6 +6,7 @@
#include "mozilla/dom/TextEncoder.h"
#include "mozilla/dom/EncodingUtils.h"
#include "mozilla/UniquePtrExtensions.h"
#include "nsContentUtils.h"
namespace mozilla {
@ -54,18 +55,18 @@ TextEncoder::Encode(JSContext* aCx,
}
// Need a fallible allocator because the caller may be a content
// and the content can specify the length of the string.
nsAutoArrayPtr<char> buf(new (fallible) char[maxLen + 1]);
auto buf = MakeUniqueFallible<char[]>(maxLen + 1);
if (!buf) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}
int32_t dstLen = maxLen;
rv = mEncoder->Convert(data, &srcLen, buf, &dstLen);
rv = mEncoder->Convert(data, &srcLen, buf.get(), &dstLen);
// Now reset the encoding algorithm state to the default values for encoding.
int32_t finishLen = maxLen - dstLen;
rv = mEncoder->Finish(buf + dstLen, &finishLen);
rv = mEncoder->Finish(&buf[dstLen], &finishLen);
if (NS_SUCCEEDED(rv)) {
dstLen += finishLen;
}

View File

@ -1107,7 +1107,7 @@ Event::TimeStamp() const
MOZ_ASSERT(workerPrivate);
TimeDuration duration =
mEvent->timeStamp - workerPrivate->CreationTimeStamp();
mEvent->timeStamp - workerPrivate->NowBaseTimeStamp();
return duration.ToMilliseconds();
}

View File

@ -2006,6 +2006,7 @@ EventStateManager::GetContentViewer(nsIContentViewer** aCv)
nsCOMPtr<mozIDOMWindowProxy> focusedWindow;
fm->GetFocusedWindow(getter_AddRefs(focusedWindow));
if (!focusedWindow) return NS_ERROR_FAILURE;
auto* ourWindow = nsPIDOMWindowOuter::From(focusedWindow);

View File

@ -74,9 +74,8 @@ function testWorkerEvents() {
var worker = new Worker(window.URL.createObjectURL(blob));
worker.onmessage = function(evt) {
var timeAfterEvent = window.performance.now();
var time = window.performance.translateTime(evt.data, worker);
ok(time >= timeBeforeEvent &&
time <= timeAfterEvent,
ok(evt.data > timeBeforeEvent &&
evt.data < timeAfterEvent,
"Event timestamp in dedicated worker (" + evt.data +
") is in expected range: (" +
timeBeforeEvent + ", " + timeAfterEvent + ")");

View File

@ -250,15 +250,13 @@ Directory::GetPath(nsAString& aRetval) const
already_AddRefed<Promise>
Directory::GetFilesAndDirectories()
{
nsresult error = NS_OK;
nsString realPath;
ErrorResult rv;
RefPtr<GetDirectoryListingTask> task =
new GetDirectoryListingTask(mFileSystem, mPath, mFilters, rv);
if (NS_WARN_IF(rv.Failed())) {
return nullptr;
}
task->SetError(error);
FileSystemPermissionRequest::RequestForTask(task);
return task->GetPromise();
}

View File

@ -8,6 +8,7 @@
#include "mozilla/dom/HTMLFrameSetElementBinding.h"
#include "mozilla/dom/EventHandlerBinding.h"
#include "nsGlobalWindow.h"
#include "mozilla/UniquePtrExtensions.h"
NS_IMPL_NS_NEW_HTML_ELEMENT(FrameSet)
@ -81,7 +82,7 @@ HTMLFrameSetElement::SetAttr(int32_t aNameSpaceID,
*/
if (aAttribute == nsGkAtoms::rows && aNameSpaceID == kNameSpaceID_None) {
int32_t oldRows = mNumRows;
ParseRowCol(aValue, mNumRows, getter_Transfers(mRowSpecs));
ParseRowCol(aValue, mNumRows, &mRowSpecs);
if (mNumRows != oldRows) {
mCurrentRowColHint = NS_STYLE_HINT_FRAMECHANGE;
@ -89,7 +90,7 @@ HTMLFrameSetElement::SetAttr(int32_t aNameSpaceID,
} else if (aAttribute == nsGkAtoms::cols &&
aNameSpaceID == kNameSpaceID_None) {
int32_t oldCols = mNumCols;
ParseRowCol(aValue, mNumCols, getter_Transfers(mColSpecs));
ParseRowCol(aValue, mNumCols, &mColSpecs);
if (mNumCols != oldCols) {
mCurrentRowColHint = NS_STYLE_HINT_FRAMECHANGE;
@ -116,19 +117,19 @@ HTMLFrameSetElement::GetRowSpec(int32_t *aNumValues,
const nsAttrValue* value = GetParsedAttr(nsGkAtoms::rows);
if (value && value->Type() == nsAttrValue::eString) {
nsresult rv = ParseRowCol(value->GetStringValue(), mNumRows,
getter_Transfers(mRowSpecs));
&mRowSpecs);
NS_ENSURE_SUCCESS(rv, rv);
}
if (!mRowSpecs) { // we may not have had an attr or had an empty attr
mRowSpecs = new nsFramesetSpec[1];
mRowSpecs = MakeUnique<nsFramesetSpec[]>(1);
mNumRows = 1;
mRowSpecs[0].mUnit = eFramesetUnit_Relative;
mRowSpecs[0].mValue = 1;
}
}
*aSpecs = mRowSpecs;
*aSpecs = mRowSpecs.get();
*aNumValues = mNumRows;
return NS_OK;
}
@ -146,19 +147,19 @@ HTMLFrameSetElement::GetColSpec(int32_t *aNumValues,
const nsAttrValue* value = GetParsedAttr(nsGkAtoms::cols);
if (value && value->Type() == nsAttrValue::eString) {
nsresult rv = ParseRowCol(value->GetStringValue(), mNumCols,
getter_Transfers(mColSpecs));
&mColSpecs);
NS_ENSURE_SUCCESS(rv, rv);
}
if (!mColSpecs) { // we may not have had an attr or had an empty attr
mColSpecs = new nsFramesetSpec[1];
mColSpecs = MakeUnique<nsFramesetSpec[]>(1);
mNumCols = 1;
mColSpecs[0].mUnit = eFramesetUnit_Relative;
mColSpecs[0].mValue = 1;
}
}
*aSpecs = mColSpecs;
*aSpecs = mColSpecs.get();
*aNumValues = mNumCols;
return NS_OK;
}
@ -205,7 +206,7 @@ HTMLFrameSetElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
nsresult
HTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
int32_t& aNumSpecs,
nsFramesetSpec** aSpecs)
UniquePtr<nsFramesetSpec[]>* aSpecs)
{
if (aValue.IsEmpty()) {
aNumSpecs = 0;
@ -233,7 +234,7 @@ HTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
commaX = spec.FindChar(sComma, commaX + 1);
}
nsFramesetSpec* specs = new (fallible) nsFramesetSpec[count];
auto specs = MakeUniqueFallible<nsFramesetSpec[]>(count);
if (!specs) {
*aSpecs = nullptr;
aNumSpecs = 0;
@ -327,7 +328,7 @@ HTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
aNumSpecs = count;
// Transfer ownership to caller here
*aSpecs = specs;
*aSpecs = Move(specs);
return NS_OK;
}

View File

@ -8,6 +8,7 @@
#define HTMLFrameSetElement_h
#include "mozilla/Attributes.h"
#include "mozilla/UniquePtr.h"
#include "nsIDOMHTMLFrameSetElement.h"
#include "nsGenericHTMLElement.h"
@ -144,8 +145,8 @@ protected:
private:
nsresult ParseRowCol(const nsAString& aValue,
int32_t& aNumSpecs,
nsFramesetSpec** aSpecs);
int32_t& aNumSpecs,
UniquePtr<nsFramesetSpec[]>* aSpecs);
/**
* The number of size specs in our "rows" attr
@ -163,11 +164,11 @@ private:
/**
* The parsed representation of the "rows" attribute
*/
nsAutoArrayPtr<nsFramesetSpec> mRowSpecs; // parsed, non-computed dimensions
UniquePtr<nsFramesetSpec[]> mRowSpecs; // parsed, non-computed dimensions
/**
* The parsed representation of the "cols" attribute
*/
nsAutoArrayPtr<nsFramesetSpec> mColSpecs; // parsed, non-computed dimensions
UniquePtr<nsFramesetSpec[]> mColSpecs; // parsed, non-computed dimensions
};
} // namespace dom

View File

@ -10,7 +10,7 @@ interface nsIContentURIGrouper;
interface nsILoadContext;
interface mozIStorageConnection;
[scriptable, uuid(746c7a02-f6c1-4869-b434-7c8b86e60e61)]
[scriptable, uuid(43635c53-b445-4c4e-8cc5-562697299b55)]
interface nsIContentPrefObserver : nsISupports
{
/**
@ -20,8 +20,13 @@ interface nsIContentPrefObserver : nsISupports
* if it's a global pref (applies to all sites)
* @param aName the name of the pref that was set
* @param aValue the new value of the pref
* @param aIsPrivate an optional flag determining whether the
* original context is private or not
*/
void onContentPrefSet(in AString aGroup, in AString aName, in nsIVariant aValue);
void onContentPrefSet(in AString aGroup,
in AString aName,
in nsIVariant aValue,
[optional] in boolean aIsPrivate);
/**
* Called when a content pref is removed.

View File

@ -673,10 +673,6 @@ ContentChild::Init(MessageLoop* aIOLoop,
}
sSingleton = this;
// Make sure there's an nsAutoScriptBlocker on the stack when dispatching
// urgent messages.
GetIPCChannel()->BlockScripts();
// If communications with the parent have broken down, take the process
// down so it's not hanging around.
bool abortOnError = true;

View File

@ -38,6 +38,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/TextEvents.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/unused.h"
#include "BlobParent.h"
#include "nsCOMPtr.h"
@ -2125,25 +2126,25 @@ TabParent::RecvEnableDisableCommands(const nsString& aAction,
{
nsCOMPtr<nsIRemoteBrowser> remoteBrowser = do_QueryInterface(mFrameElement);
if (remoteBrowser) {
nsAutoArrayPtr<const char*> enabledCommands, disabledCommands;
UniquePtr<const char*[]> enabledCommands, disabledCommands;
if (aEnabledCommands.Length()) {
enabledCommands = new const char* [aEnabledCommands.Length()];
enabledCommands = MakeUnique<const char*[]>(aEnabledCommands.Length());
for (uint32_t c = 0; c < aEnabledCommands.Length(); c++) {
enabledCommands[c] = aEnabledCommands[c].get();
}
}
if (aDisabledCommands.Length()) {
disabledCommands = new const char* [aDisabledCommands.Length()];
disabledCommands = MakeUnique<const char*[]>(aDisabledCommands.Length());
for (uint32_t c = 0; c < aDisabledCommands.Length(); c++) {
disabledCommands[c] = aDisabledCommands[c].get();
}
}
remoteBrowser->EnableDisableCommands(aAction,
aEnabledCommands.Length(), enabledCommands,
aDisabledCommands.Length(), disabledCommands);
aEnabledCommands.Length(), enabledCommands.get(),
aDisabledCommands.Length(), disabledCommands.get());
}
return true;

View File

@ -107,6 +107,7 @@ MP4Decoder::CanHandleMediaType(const nsACString& aMIMETypeExcludingCodecs,
aMIMETypeExcludingCodecs.EqualsASCII(VIDEO_3GPP) ||
#endif
aMIMETypeExcludingCodecs.EqualsASCII("video/mp4") ||
aMIMETypeExcludingCodecs.EqualsASCII("video/quicktime") ||
aMIMETypeExcludingCodecs.EqualsASCII("video/x-m4v");
if (!isMP4Audio && !isMP4Video) {
return false;

View File

@ -427,7 +427,7 @@ TEST(MP4Demuxer, GetNextKeyframe)
});
}
TEST(MP4Demuxer, ZeroInMoov)
TEST(MP4Demuxer, ZeroInLastMoov)
{
RefPtr<MP4DemuxerBinding> binding = new MP4DemuxerBinding("short-zero-in-moov.mp4");
binding->RunTestAndWait([binding] () {
@ -436,3 +436,12 @@ TEST(MP4Demuxer, ZeroInMoov)
});
}
TEST(MP4Demuxer, ZeroInMoovQuickTime)
{
RefPtr<MP4DemuxerBinding> binding = new MP4DemuxerBinding("short-zero-inband.mov");
binding->RunTestAndWait([binding] () {
// It demuxes without error. That is sufficient.
binding->mTaskQueue->BeginShutdown();
});
}

View File

@ -49,6 +49,7 @@ TEST_HARNESS_FILES.gtest += [
'noise.mp3',
'noise_vbr.mp3',
'short-zero-in-moov.mp4',
'short-zero-inband.mov',
'small-shot.mp3',
'test.webm',
'test_case_1224361.vp8.ivf',

Binary file not shown.

View File

@ -24,6 +24,7 @@
#include "mozilla/dom/ToJSValue.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "mozilla/UniquePtr.h"
#include "nsIMmsService.h"
#include "nsIMobileMessageCallback.h"
#include "nsIMobileMessageDatabaseService.h"
@ -424,7 +425,7 @@ MobileMessageManager::GetMessages(const MobileMessageFilter& aFilter,
endDate = aFilter.mEndDate.Value();
}
nsAutoArrayPtr<const char16_t*> ptrNumbers;
UniquePtr<const char16_t*[]> ptrNumbers;
uint32_t numbersCount = 0;
if (!aFilter.mNumbers.IsNull() &&
aFilter.mNumbers.Value().Length()) {
@ -432,7 +433,7 @@ MobileMessageManager::GetMessages(const MobileMessageFilter& aFilter,
uint32_t index;
numbersCount = numbers.Length();
ptrNumbers = new const char16_t* [numbersCount];
ptrNumbers = MakeUnique<const char16_t*[]>(numbersCount);
for (index = 0; index < numbersCount; index++) {
ptrNumbers[index] = numbers[index].get();
}
@ -464,7 +465,7 @@ MobileMessageManager::GetMessages(const MobileMessageFilter& aFilter,
nsCOMPtr<nsICursorContinueCallback> continueCallback;
nsresult rv = dbService->CreateMessageCursor(hasStartDate, startDate,
hasEndDate, endDate,
ptrNumbers, numbersCount,
ptrNumbers.get(), numbersCount,
delivery,
hasRead, read,
hasThreadId, threadId,

View File

@ -22,6 +22,7 @@
#include "mozilla/dom/File.h"
#include "mozilla/dom/ToJSValue.h"
#include "mozilla/dom/mobilemessage/Constants.h" // For MessageType
#include "mozilla/UniquePtr.h"
#include "nsContentUtils.h"
#include "nsTArrayHelpers.h"
#include "xpcpublic.h"
@ -830,12 +831,12 @@ MobileMessageCursorParent::DoRequest(const CreateMessageCursorRequest& aRequest)
const SmsFilterData& filter = aRequest.filter();
const nsTArray<nsString>& numbers = filter.numbers();
nsAutoArrayPtr<const char16_t*> ptrNumbers;
UniquePtr<const char16_t*[]> ptrNumbers;
uint32_t numbersCount = numbers.Length();
if (numbersCount) {
uint32_t index;
ptrNumbers = new const char16_t* [numbersCount];
ptrNumbers = MakeUnique<const char16_t*[]>(numbersCount);
for (index = 0; index < numbersCount; index++) {
ptrNumbers[index] = numbers[index].get();
}
@ -845,7 +846,7 @@ MobileMessageCursorParent::DoRequest(const CreateMessageCursorRequest& aRequest)
filter.startDate(),
filter.hasEndDate(),
filter.endDate(),
ptrNumbers, numbersCount,
ptrNumbers.get(), numbersCount,
filter.delivery(),
filter.hasRead(),
filter.read(),

View File

@ -111,7 +111,6 @@ NetworkStatsAlarm.prototype = {
const NETWORKSTATSMANAGER_CONTRACTID = "@mozilla.org/networkStatsManager;1";
const NETWORKSTATSMANAGER_CID = Components.ID("{ceb874cd-cc1a-4e65-b404-cc2d3e42425f}");
const nsIDOMMozNetworkStatsManager = Ci.nsIDOMMozNetworkStatsManager;
function NetworkStatsManager() {
if (DEBUG) {
@ -122,40 +121,25 @@ function NetworkStatsManager() {
NetworkStatsManager.prototype = {
__proto__: DOMRequestIpcHelper.prototype,
checkPrivileges: function checkPrivileges() {
if (!this.hasPrivileges) {
throw Components.Exception("Permission denied", Cr.NS_ERROR_FAILURE);
}
},
getSamples: function getSamples(aNetwork, aStart, aEnd, aOptions) {
this.checkPrivileges();
if (aStart.constructor.name !== "Date" ||
aEnd.constructor.name !== "Date" ||
!(aNetwork instanceof this.window.MozNetworkStatsInterface) ||
aStart > aEnd) {
if (aStart > aEnd) {
throw Components.results.NS_ERROR_INVALID_ARG;
}
let appManifestURL = null;
let browsingTrafficOnly = false;
let serviceType = null;
if (aOptions) {
// appManifestURL is used to query network statistics by app;
// serviceType is used to query network statistics by system service.
// It is illegal to specify both of them at the same time.
if (aOptions.appManifestURL && aOptions.serviceType) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
}
// browsingTrafficOnly is meaningful only when querying by app.
if (!aOptions.appManifestURL && aOptions.browsingTrafficOnly) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
}
appManifestURL = aOptions.appManifestURL;
serviceType = aOptions.serviceType;
browsingTrafficOnly = aOptions.browsingTrafficOnly || false;
// appManifestURL is used to query network statistics by app;
// serviceType is used to query network statistics by system service.
// It is illegal to specify both of them at the same time.
if (aOptions.appManifestURL && aOptions.serviceType) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
}
// browsingTrafficOnly is meaningful only when querying by app.
if (!aOptions.appManifestURL && aOptions.browsingTrafficOnly) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
}
let appManifestURL = aOptions.appManifestURL;
let serviceType = aOptions.serviceType;
let browsingTrafficOnly = aOptions.browsingTrafficOnly;
// TODO Bug 929410 Date object cannot correctly pass through cpmm/ppmm IPC
// This is just a work-around by passing timestamp numbers.
@ -175,12 +159,6 @@ NetworkStatsManager.prototype = {
},
clearStats: function clearStats(aNetwork) {
this.checkPrivileges();
if (!aNetwork instanceof this.window.MozNetworkStatsInterface) {
throw Components.results.NS_ERROR_INVALID_ARG;
}
let request = this.createRequest();
cpmm.sendAsyncMessage("NetworkStats:Clear",
{ network: aNetwork.toJSON(),
@ -189,8 +167,6 @@ NetworkStatsManager.prototype = {
},
clearAllStats: function clearAllStats() {
this.checkPrivileges();
let request = this.createRequest();
cpmm.sendAsyncMessage("NetworkStats:ClearAll",
{id: this.getRequestId(request)});
@ -198,17 +174,6 @@ NetworkStatsManager.prototype = {
},
addAlarm: function addAlarm(aNetwork, aThreshold, aOptions) {
this.checkPrivileges();
if (!aOptions) {
aOptions = Object.create(null);
}
if (aOptions.startTime && aOptions.startTime.constructor.name !== "Date" ||
!(aNetwork instanceof this.window.MozNetworkStatsInterface)) {
throw Components.results.NS_ERROR_INVALID_ARG;
}
let request = this.createRequest();
cpmm.sendAsyncMessage("NetworkStats:SetAlarm",
{id: this.getRequestId(request),
@ -222,13 +187,8 @@ NetworkStatsManager.prototype = {
},
getAllAlarms: function getAllAlarms(aNetwork) {
this.checkPrivileges();
let network = null;
if (aNetwork) {
if (!aNetwork instanceof this.window.MozNetworkStatsInterface) {
throw Components.results.NS_ERROR_INVALID_ARG;
}
network = aNetwork.toJSON();
}
@ -241,8 +201,6 @@ NetworkStatsManager.prototype = {
},
removeAlarms: function removeAlarms(aAlarmId) {
this.checkPrivileges();
if (aAlarmId == 0) {
aAlarmId = -1;
}
@ -257,8 +215,6 @@ NetworkStatsManager.prototype = {
},
getAvailableNetworks: function getAvailableNetworks() {
this.checkPrivileges();
let request = this.createRequest();
cpmm.sendAsyncMessage("NetworkStats:GetAvailableNetworks",
{ id: this.getRequestId(request) });
@ -266,8 +222,6 @@ NetworkStatsManager.prototype = {
},
getAvailableServiceTypes: function getAvailableServiceTypes() {
this.checkPrivileges();
let request = this.createRequest();
cpmm.sendAsyncMessage("NetworkStats:GetAvailableServiceTypes",
{ id: this.getRequestId(request) });
@ -275,12 +229,10 @@ NetworkStatsManager.prototype = {
},
get sampleRate() {
this.checkPrivileges();
return cpmm.sendSyncMessage("NetworkStats:SampleRate")[0];
},
get maxStorageAge() {
this.checkPrivileges();
return cpmm.sendSyncMessage("NetworkStats:MaxStorageAge")[0];
},
@ -390,27 +342,7 @@ NetworkStatsManager.prototype = {
},
init: function(aWindow) {
// Set navigator.mozNetworkStats to null.
if (!Services.prefs.getBoolPref("dom.mozNetworkStats.enabled")) {
return null;
}
let principal = aWindow.document.nodePrincipal;
let secMan = Services.scriptSecurityManager;
let perm = principal == secMan.getSystemPrincipal() ?
Ci.nsIPermissionManager.ALLOW_ACTION :
Services.perms.testExactPermissionFromPrincipal(principal,
"networkstats-manage");
// Only pages with perm set can use the netstats.
this.hasPrivileges = perm == Ci.nsIPermissionManager.ALLOW_ACTION;
if (DEBUG) {
debug("has privileges: " + this.hasPrivileges);
}
if (!this.hasPrivileges) {
return null;
}
this.initDOMRequestHelper(aWindow, ["NetworkStats:Get:Return",
"NetworkStats:GetAvailableNetworks:Return",
@ -443,16 +375,10 @@ NetworkStatsManager.prototype = {
},
classID : NETWORKSTATSMANAGER_CID,
QueryInterface : XPCOMUtils.generateQI([nsIDOMMozNetworkStatsManager,
Ci.nsIDOMGlobalPropertyInitializer,
Ci.nsISupportsWeakReference,
Ci.nsIObserver]),
classInfo : XPCOMUtils.generateCI({classID: NETWORKSTATSMANAGER_CID,
contractID: NETWORKSTATSMANAGER_CONTRACTID,
classDescription: "NetworkStatsManager",
interfaces: [nsIDOMMozNetworkStatsManager],
flags: nsIClassInfo.DOM_OBJECT})
contractID : NETWORKSTATSMANAGER_CONTRACTID,
QueryInterface : XPCOMUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer,
Ci.nsISupportsWeakReference,
Ci.nsIObserver]),
}
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([NetworkStatsAlarm,

View File

@ -12,4 +12,3 @@ contract @mozilla.org/networkstatsalarm;1 {a93ea13e-409c-4189-9b1e-95fff220be55}
component {ceb874cd-cc1a-4e65-b404-cc2d3e42425f} NetworkStatsManager.js
contract @mozilla.org/networkStatsManager;1 {ceb874cd-cc1a-4e65-b404-cc2d3e42425f}
category JavaScript-navigator-property mozNetworkStats @mozilla.org/networkStatsManager;1

View File

@ -12,7 +12,6 @@ XPIDL_SOURCES += [
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
XPIDL_SOURCES += [
'nsIDOMNetworkStatsManager.idl',
'nsINetworkStatsServiceProxy.idl',
]

View File

@ -48,32 +48,30 @@ var steps = [
};
req.onerror = function () {
ok(req.error.name == "InvalidInterface", "Get InvalidInterface error");
is(req.error.name, "InvalidInterface", "Get InvalidInterface error");
next();
}
},
function () {
ok(true, "Calling addAlarm() with invalid network or parameters.");
var msg = "TypeError: Not enough arguments to MozNetworkStatsManager.addAlarm.";
try {
navigator.mozNetworkStats.addAlarm();
} catch(ex) {
ok(ex.result == SpecialPowers.Cr.NS_ERROR_XPC_NOT_ENOUGH_ARGS,
"addAlarm() throws NS_ERROR_XPC_NOT_ENOUGH_ARGS exception when no parameters");
is(ex.toString(), msg, "addAlarm() throws \"" + msg + "\" when no parameters");
}
try {
navigator.mozNetworkStats.addAlarm(100000);
} catch(ex) {
ok(ex.result == SpecialPowers.Cr.NS_ERROR_XPC_NOT_ENOUGH_ARGS,
"addAlarm() throws NS_ERROR_XPC_NOT_ENOUGH_ARGS exception when no network");
is(ex.toString(), msg, "addAlarm() throws " + msg + " when no network");
}
try {
navigator.mozNetworkStats.addAlarm(new window.MozNetworkStatsInterface(wifi));
} catch(ex) {
ok(ex.result == SpecialPowers.Cr.NS_ERROR_XPC_NOT_ENOUGH_ARGS,
"addAlarm() throws NS_ERROR_XPC_NOT_ENOUGH_ARGS exception when no threshold");
is(ex.toString(), msg, "addAlarm() throws " + msg + " when no threshold");
}
req = navigator.mozNetworkStats
@ -84,7 +82,7 @@ var steps = [
};
req.onerror = function () {
ok(req.error.name == "InvalidThresholdValue", "Get InvalidThresholdValue error");
is(req.error.name, "InvalidThresholdValue", "Get InvalidThresholdValue error");
next();
}
},
@ -109,8 +107,8 @@ var steps = [
.getAllAlarms(new window.MozNetworkStatsInterface(wifi));
req.onsuccess = function () {
ok(req.result.length == 1, "Only one alarm");
ok(req.result[0].alarmId == 1, "Get correct alarmId");
is(req.result.length, 1, "Only one alarm");
is(req.result[0].alarmId, 1, "Get correct alarmId");
next();
};
@ -226,8 +224,8 @@ SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", true]]},
ok('mozNetworkStats' in navigator, "navigator.mozNetworkStats should exist");
ok(navigator.mozNetworkStats instanceof SpecialPowers.Ci.nsIDOMMozNetworkStatsManager,
"navigator.mozNetworkStats should be a nsIDOMMozNetworkStatsManager object");
ok(navigator.mozNetworkStats instanceof MozNetworkStatsManager,
"navigator.mozNetworkStats should be a MozNetworkStatsManager object");
test();
});

View File

@ -333,8 +333,8 @@ SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", true]]},
ok('mozNetworkStats' in navigator, "navigator.mozNetworkStats should exist");
ok(navigator.mozNetworkStats instanceof SpecialPowers.Ci.nsIDOMMozNetworkStatsManager,
"navigator.mozNetworkStats should be a nsIDOMMozNetworkStatsManager object");
ok(navigator.mozNetworkStats instanceof MozNetworkStatsManager,
"navigator.mozNetworkStats should be a MozNetworkStatsManager object");
test();
});

View File

@ -22,10 +22,8 @@ SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", false]]},
ok(!SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"),
"Preference 'dom.mozNetworkStats.enabled' is false.");
ok('mozNetworkStats' in navigator, "navigator.mozNetworkStats should exist");
is(navigator.mozNetworkStats, null,
"mozNetworkStats should be null when not enabled.");
ok(!('mozNetworkStats' in navigator),
"navigator.mozNetworkStats should not exist when pref not set");
SimpleTest.finish();
});

View File

@ -27,25 +27,11 @@
ok(!SpecialPowers.hasPermission("networkstats-manage", document),
"Has no permission 'networkstats-manage'.");
ok('mozNetworkStats' in navigator, "navigator.mozNetworkStats should exist");
ok(!('mozNetworkStats' in navigator),
"navigator.mozNetworkStats should not exist when permission not set");
is(navigator.mozNetworkStats, null,
"mozNetworkStats should be null when no permission.");
var error;
try {
navigator.mozNetworkStats.getAvailableNetworks;
ok(false,
"Accessing navigator.mozNetworkStats.getAvailableNetworks should throw!");
} catch (ex) {
error = ex;
}
ok(error,
"Got an exception accessing navigator.mozNetworkStats.getAvailableNetworks");
SimpleTest.finish();
}
SimpleTest.finish();
}
</script>
</pre>
</body>

View File

@ -30,8 +30,8 @@ SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", true]]},
ok('mozNetworkStats' in navigator, "navigator.mozNetworkStats should exist");
ok(navigator.mozNetworkStats instanceof SpecialPowers.Ci.nsIDOMMozNetworkStatsManager,
"navigator.mozNetworkStats should be a nsIDOMMozNetworkStatsManager object");
ok(navigator.mozNetworkStats instanceof MozNetworkStatsManager,
"navigator.mozNetworkStats should be a MozNetworkStatsManager object");
SimpleTest.finish();
});

View File

@ -41,8 +41,8 @@ function filterTimestamp(date) {
}
function getNetworks() {
return [{ id: '0', type: Ci.nsIDOMMozNetworkStatsManager.WIFI },
{ id: '1234', type: Ci.nsIDOMMozNetworkStatsManager.MOBILE }];
return [{ id: '0', type: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI },
{ id: '1234', type: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE }];
}
function compareNetworks(networkA, networkB) {

View File

@ -158,12 +158,12 @@ add_test(function test_queue() {
};
// Fill networks with fake network interfaces to enable netd async requests.
var network = {id: "1234", type: Ci.nsIDOMMozNetworkStatsManager.MOBILE};
var network = {id: "1234", type: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE};
var netId1 = NetworkStatsService.getNetworkId(network.id, network.type);
NetworkStatsService._networks[netId1] = { network: network,
interfaceName: "net1" };
network = {id: "5678", type: Ci.nsIDOMMozNetworkStatsManager.MOBILE};
network = {id: "5678", type: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE};
var netId2 = NetworkStatsService.getNetworkId(network.id, network.type);
NetworkStatsService._networks[netId2] = { network: network,
interfaceName: "net2" };

View File

@ -10,9 +10,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
const PAYMENTCONTENTHELPER_CID =
Components.ID("{a920adc0-c36e-4fd0-8de0-aac1ac6ebbd0}");
const PAYMENT_IPC_MSG_NAMES = ["Payment:Success",
"Payment:Failed"];
@ -22,39 +19,82 @@ XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
"@mozilla.org/childprocessmessagemanager;1",
"nsIMessageSender");
function PaymentContentHelper() {
var _debug;
try {
_debug = Services.prefs.getPrefType(PREF_DEBUG) == Ci.nsIPrefBranch.PREF_BOOL
&& Services.prefs.getBoolPref(PREF_DEBUG);
} catch(e) {
_debug = false;
}
function LOG(s) {
if (!_debug) {
return;
}
dump("-*- PaymentContentHelper: " + s + "\n");
}
function PaymentContentHelper(aWindow) {
this.initDOMRequestHelper(aWindow, PAYMENT_IPC_MSG_NAMES);
};
PaymentContentHelper.prototype = {
__proto__: DOMRequestIpcHelper.prototype,
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavigatorPayment,
Ci.nsIDOMGlobalPropertyInitializer,
Ci.nsISupportsWeakReference,
Ci.nsIObserver]),
classID: PAYMENTCONTENTHELPER_CID,
classInfo: XPCOMUtils.generateCI({
classID: PAYMENTCONTENTHELPER_CID,
contractID: "@mozilla.org/payment/content-helper;1",
classDescription: "Payment Content Helper",
flags: Ci.nsIClassInfo.DOM_OBJECT,
interfaces: [Ci.nsINavigatorPayment]
}),
receiveMessage: function receiveMessage(aMessage) {
let name = aMessage.name;
let msg = aMessage.json;
if (_debug) {
LOG("Received message '" + name + "': " + JSON.stringify(msg));
}
let requestId = msg.requestId;
let request = this.takeRequest(requestId);
if (!request) {
return;
}
switch (name) {
case "Payment:Success":
Services.DOMRequest.fireSuccess(request, msg.result);
break;
case "Payment:Failed":
Services.DOMRequest.fireError(request, msg.errorMsg);
break;
}
},
};
function PaymentContentHelperService() {
};
PaymentContentHelperService.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPaymentContentHelperService]),
classID: Components.ID("{80035846-6732-4fcc-961b-f336b65218f4}"),
contractID: "@mozilla.org/payment/content-helper-service;1",
_xpcom_factory: XPCOMUtils.generateSingletonFactory(PaymentContentHelperService),
// keys are windows and values are PaymentContentHelpers
helpers: new WeakMap(),
// nsINavigatorPayment
pay: function pay(aWindow, aJwts) {
let requestHelper = this.helpers.get(aWindow);
if (!requestHelper) {
requestHelper = new PaymentContentHelper(aWindow);
this.helpers.set(aWindow, requestHelper);
}
let request = requestHelper.createRequest();
let requestId = requestHelper.getRequestId(request);
pay: function pay(aJwts) {
let request = this.createRequest();
let requestId = this.getRequestId(request);
let docShell = this._window.QueryInterface(Ci.nsIInterfaceRequestor)
let docShell = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
if (!docShell.isActive) {
if (this._debug) {
this.LOG("The caller application is a background app. No request " +
"will be sent");
if (_debug) {
LOG("The caller application is a background app. No request will be " +
"sent");
}
let runnable = {
run: function run() {
Services.DOMRequest.fireError(request, "BACKGROUND_APP");
@ -75,61 +115,6 @@ PaymentContentHelper.prototype = {
});
return request;
},
// nsIDOMGlobalPropertyInitializer
init: function(aWindow) {
try {
if (!Services.prefs.getBoolPref("dom.mozPay.enabled")) {
return null;
}
} catch (e) {
return null;
}
this._window = aWindow;
this.initDOMRequestHelper(aWindow, PAYMENT_IPC_MSG_NAMES);
try {
this._debug =
Services.prefs.getPrefType(PREF_DEBUG) == Ci.nsIPrefBranch.PREF_BOOL
&& Services.prefs.getBoolPref(PREF_DEBUG);
} catch(e) {
this._debug = false;
}
return Cu.exportFunction(this.pay.bind(this), aWindow);
},
// nsIFrameMessageListener
receiveMessage: function receiveMessage(aMessage) {
let name = aMessage.name;
let msg = aMessage.json;
if (this._debug) {
this.LOG("Received message '" + name + "': " + JSON.stringify(msg));
}
let requestId = msg.requestId;
let request = this.takeRequest(requestId);
if (!request) {
return;
}
switch (name) {
case "Payment:Success":
Services.DOMRequest.fireSuccess(request, msg.result);
break;
case "Payment:Failed":
Services.DOMRequest.fireError(request, msg.errorMsg);
break;
}
},
LOG: function LOG(s) {
if (!this._debug) {
return;
}
dump("-*- PaymentContentHelper: " + s + "\n");
}
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PaymentContentHelper]);
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PaymentContentHelperService]);

View File

@ -1,6 +1,5 @@
component {a920adc0-c36e-4fd0-8de0-aac1ac6ebbd0} Payment.js
contract @mozilla.org/payment/content-helper;1 {a920adc0-c36e-4fd0-8de0-aac1ac6ebbd0}
category JavaScript-navigator-property mozPay @mozilla.org/payment/content-helper;1
component {80035846-6732-4fcc-961b-f336b65218f4} Payment.js
contract @mozilla.org/payment/content-helper-service;1 {80035846-6732-4fcc-961b-f336b65218f4}
component {b8bce4e7-fbf0-4719-a634-b1bf9018657c} PaymentFlowInfo.js
contract @mozilla.org/payment/flow-info;1 {b8bce4e7-fbf0-4719-a634-b1bf9018657c}

View File

@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPIDL_SOURCES += [
'nsINavigatorPayment.idl',
'nsIPaymentContentHelperService.idl',
'nsIPaymentFlowInfo.idl',
'nsIPaymentProviderStrategy.idl',
'nsIPaymentUIGlue.idl',

View File

@ -5,13 +5,14 @@
#include "domstubs.idl"
interface nsIDOMDOMRequest;
interface mozIDOMWindow;
[scriptable, uuid(44fb7308-7d7b-4975-8a27-e01fe9623bdb)]
interface nsINavigatorPayment : nsISupports
[scriptable, uuid(80035846-6732-4fcc-961b-f336b65218f4)]
interface nsIPaymentContentHelperService : nsISupports
{
// The 'jwts' parameter can be either a single DOMString or an array of
// DOMStrings. In both cases, it represents the base64url encoded and
// digitally signed payment information. Each payment provider should
// define its supported JWT format.
nsIDOMDOMRequest pay(in jsval jwts);
nsIDOMDOMRequest pay(in mozIDOMWindow window, in jsval jwts);
};

View File

@ -0,0 +1,91 @@
/* 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/. */
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cm = Components.manager;
const Cu = Components.utils;
const CONTRACT_ID = "@mozilla.org/payment/ui-glue;1";
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
var oldClassID, oldFactory;
var newClassID = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator).generateUUID();
var newFactory = {
createInstance: function(aOuter, aIID) {
if (aOuter) {
throw Components.results.NS_ERROR_NO_AGGREGATION;
}
return new MockPaymentsUIGlueInstance().QueryInterface(aIID);
},
lockFactory: function(aLock) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory])
};
addMessageListener("MockPaymentsUIGlue.init", function (message) {
try {
oldClassID = registrar.contractIDToCID(CONTRACT_ID);
oldFactory = Cm.getClassObject(oldClassID, Ci.nsIFactory);
} catch (ex) {
oldClassID = "";
oldFactory = null;
dump("TEST-INFO | can't get payments ui glue registered component, " +
"assuming there is none\n");
}
if (oldFactory) {
registrar.unregisterFactory(oldClassID, oldFactory);
}
registrar.registerFactory(newClassID, "", CONTRACT_ID, newFactory);});
addMessageListener("MockPaymentsUIGlue.cleanup", function (message) {
if (oldClassID) {
registrar.registerFactory(oldClassID, "", CONTRACT_ID, null);
}
});
var payments = new Map();
function MockPaymentsUIGlueInstance() {
};
MockPaymentsUIGlueInstance.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPaymentUIGlue]),
confirmPaymentRequest: function(aRequestId,
aRequests,
aSuccessCb,
aErrorCb) {
aSuccessCb.onresult(aRequestId, aRequests[0].type);
},
showPaymentFlow: function(aRequestId,
aPaymentFlowInfo,
aErrorCb) {
let win = Services.ww.openWindow(null,
null,
"_blank",
"chrome,dialog=no,resizable,scrollbars,centerscreen",
null);
payments.set(aRequestId, win);
let docshell = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
docshell.paymentRequestId = aRequestId;
win.document.location = aPaymentFlowInfo.uri + aPaymentFlowInfo.jwt;
},
closePaymentFlow: function(aRequestId) {
payments.get(aRequestId).close();
payments.delete(aRequestId);
return Promise.resolve();
},
};

View File

@ -1,12 +1,11 @@
[DEFAULT]
skip-if=true # This test uses MockPaymentsUIGlue which uses __exposedProps__
# we need to move this to a chrome test, but these are not
# available in b2g or android for now.
skip-if=buildapp != 'b2g' && toolkit != 'android'
support-files=
file_mozpayproviderchecker.html
file_payprovidersuccess.html
file_payproviderfailure.html
MockPaymentsUIChromeScript.js
[test_mozpaymentprovider.html]
[test_mozpay_callbacks.html]

View File

@ -79,7 +79,11 @@ function runTest() {
tests.shift()();
}
SpecialPowers.MockPaymentsUIGlue.init(window);
const uiGlue = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('MockPaymentsUIChromeScript.js'));
SimpleTest.registerCleanupFunction(() => {
uiGlue.sendAsyncMessage("MockPaymentsUIGlue.cleanup", {});
});
uiGlue.sendAsyncMessage("MockPaymentsUIGlue.init", {});
SpecialPowers.pushPrefEnv({
"set": [
@ -88,13 +92,13 @@ SpecialPowers.pushPrefEnv({
["dom.payment.provider.1.name", "SuccessProvider"],
["dom.payment.provider.1.description", ""],
["dom.payment.provider.1.uri",
"http://mochi.test:8888/tests/dom/payment/tests/mochitest/file_payprovidersuccess.html?req="],
"https://example.com:443/tests/dom/payment/tests/mochitest/file_payprovidersuccess.html?req="],
["dom.payment.provider.1.type", "mozilla/payments/test/success"],
["dom.payment.provider.1.requestMethod", "GET"],
["dom.payment.provider.2.name", "FailureProvider"],
["dom.payment.provider.2.description", ""],
["dom.payment.provider.2.uri",
"http://mochi.test:8888/tests/dom/payment/tests/mochitest/file_payproviderfailure.html?req="],
"https://example.com:443/tests/dom/payment/tests/mochitest/file_payproviderfailure.html?req="],
["dom.payment.provider.2.type", "mozilla/payments/test/failure"],
["dom.payment.provider.2.requestMethod", "GET"],
]

View File

@ -20,7 +20,7 @@ var gData = [
{
perm: ["networkstats-manage"],
obj: "mozNetworkStats",
idl: "nsIDOMMozNetworkStatsManager",
webidl: "MozNetworkStatsManager",
settings: [["dom.mozNetworkStats.enabled", true]],
},
]

View File

@ -2,7 +2,7 @@ load 41276-1.html
load 48856-1.html
load 110650-1.html
skip-if(!haveTestPlugin) script 539897-1.html
skip-if(!haveTestPlugin) script 540114-1.html
asserts(0-1) skip-if(!haveTestPlugin) script 540114-1.html
load 570884.html
# This test relies on the reading of screenX/Y forcing a round trip to
# the X server, which is a bad assumption for <browser remote>.

View File

@ -6,6 +6,8 @@
#include "mozilla/dom/SVGFEConvolveMatrixElement.h"
#include "mozilla/dom/SVGFEConvolveMatrixElementBinding.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/UniquePtrExtensions.h"
#include "DOMSVGAnimatedNumberList.h"
#include "nsSVGUtils.h"
#include "nsSVGFilterInstance.h"
@ -203,7 +205,7 @@ SVGFEConvolveMatrixElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstan
if (orderX > NS_SVG_OFFSCREEN_MAX_DIMENSION ||
orderY > NS_SVG_OFFSCREEN_MAX_DIMENSION)
return failureDescription;
nsAutoArrayPtr<float> kernel(new (fallible) float[orderX * orderY]);
UniquePtr<float[]> kernel = MakeUniqueFallible<float[]>(orderX * orderY);
if (!kernel)
return failureDescription;
for (uint32_t i = 0; i < kmLength; i++) {

View File

@ -7,6 +7,7 @@
#include "TelephonyChild.h"
#include "mozilla/dom/telephony/TelephonyDialCallback.h"
#include "mozilla/UniquePtr.h"
#include "TelephonyIPCService.h"
USING_TELEPHONY_NAMESPACE
@ -212,12 +213,13 @@ TelephonyRequestChild::DoResponse(const DialResponseMMISuccess& aResponse)
uint32_t count = info.get_ArrayOfnsString().Length();
const nsTArray<nsString>& additionalInformation = info.get_ArrayOfnsString();
nsAutoArrayPtr<const char16_t*> additionalInfoPtrs(new const char16_t*[count]);
auto additionalInfoPtrs = MakeUnique<const char16_t*[]>(count);
for (size_t i = 0; i < count; ++i) {
additionalInfoPtrs[i] = additionalInformation[i].get();
}
callback->NotifyDialMMISuccessWithStrings(statusMessage, count, additionalInfoPtrs);
callback->NotifyDialMMISuccessWithStrings(statusMessage, count,
additionalInfoPtrs.get());
break;
}
case AdditionalInformation::TArrayOfnsMobileCallForwardingOptions: {

View File

@ -37,9 +37,11 @@ support-files =
[test_bug830396.xul]
[test_bug830858.xul]
[test_bug1224790-1.xul]
skip-if = os != 'cocoa'
# synthesizeNativeOSXClick does not work on 10.6
skip-if = os != 'mac' || os_version == '10.6'
[test_bug1224790-2.xul]
skip-if = os != 'cocoa'
# synthesizeNativeOSXClick does not work on 10.6
skip-if = os != 'mac' || os_version == '10.6'
[test_callback_wrapping.xul]
[test_clonewrapper.xul]
[test_cyclecollector.xul]

View File

@ -308,4 +308,19 @@ test(function() {
var m = new WebKitCSSMatrix("matrix(1,0,0,0,0,0)");
assert_throws("NotSupportedError", function() { m.inverse(); }, "Inverting an invertible matrix should throw.")
}, "Test that inverting an invertible matrix throws.");
test(function() {
var m1 = new WebKitCSSMatrix("translate(10px, 10px)");
var m2 = new DOMMatrix();
m2.translateSelf(10, 10);
assert_true(RoughCompareMatrix(m1, m2), "translate in constructor should result in translated matrix");
assert_throws("SyntaxError", function() { new WebKitCSSMatrix("translate(10em, 10em)"); }, "Transform function may not contain relative units.")
assert_throws("SyntaxError", function() { new WebKitCSSMatrix("translate(10%, 10%)"); }, "Transform function may not contain percentage.")
}, "Test constructor with translate");
test(function() {
assert_throws("SyntaxError", function() { new WebKitCSSMatrix("initial"); }, "initial is not a valid constructor argument.")
assert_throws("SyntaxError", function() { new WebKitCSSMatrix("inherit"); }, "inherit is not a valid constructor arugment.")
}, "Test invalid constructor arguments.");
</script>

View File

@ -278,7 +278,7 @@ partial interface Document {
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-document-interface
partial interface Document {
Element? elementFromPoint (float x, float y);
sequence<Element> elementsFromPoint (float x, float y);
CaretPosition? caretPositionFromPoint (float x, float y);
[Pref="dom.document.scrollingElement.enabled"]

View File

@ -14,15 +14,15 @@ dictionary NetworkStatsGetOptions
* Note that, these two options cannot be specified at the same time for now;
* others, an NS_ERROR_NOT_IMPLMENTED exception will be thrown.
*/
DOMString appManifestURL;
DOMString serviceType;
DOMString? appManifestURL = null;
DOMString serviceType = "";
/**
* If it is set as true, only the browsing traffic, which is generated from
* the mozbrowser iframe element within an app, is returned in result.
* If it is set as false or not set, the total traffic, which is generated
* from both the mozapp and mozbrowser iframe elements, is returned.
*/
boolean browsingTrafficOnly;
boolean browsingTrafficOnly = false;
};
dictionary NetworkStatsAlarmOptions

View File

@ -1,14 +1,14 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "nsISupports.idl"
interface nsIDOMDOMRequest;
[scriptable, uuid(72c4e583-389d-4d1b-9424-702feabb6055)]
interface nsIDOMMozNetworkStatsManager : nsISupports
{
[NavigatorProperty="mozNetworkStats",
JSImplementation="@mozilla.org/networkStatsManager;1",
CheckAnyPermissions="networkstats-manage",
Pref="dom.mozNetworkStats.enabled"]
interface MozNetworkStatsManager {
/**
* Constants for known interface types.
*/
@ -21,12 +21,12 @@ interface nsIDOMMozNetworkStatsManager : nsISupports
* If options is provided, per-app or per-system service usage will be
* retrieved; otherwise the target will be overall system usage.
*
* If success, the request result will be an nsIDOMMozNetworkStats object.
* If success, the request result will be an MozNetworkStats object.
*/
nsIDOMDOMRequest getSamples(in nsISupports network,
in jsval start,
in jsval end,
[optional] in jsval options /* NetworkStatsGetOptions */);
DOMRequest getSamples(MozNetworkStatsInterface network,
Date start,
Date end,
optional NetworkStatsGetOptions options);
/**
* Install an alarm on a network. The network must be in the return of
@ -39,9 +39,9 @@ interface nsIDOMMozNetworkStatsManager : nsISupports
*
* If success, the |result| field of the DOMRequest keeps the alarm Id.
*/
nsIDOMDOMRequest addAlarm(in nsISupports network,
in long long threshold,
[optional] in jsval options /* NetworkStatsAlarmOptions */);
DOMRequest addAlarm(MozNetworkStatsInterface network,
long long threshold,
optional NetworkStatsAlarmOptions options);
/**
* Obtain all alarms for those networks returned by getAvailableNetworks().
@ -55,33 +55,33 @@ interface nsIDOMMozNetworkStatsManager : nsISupports
* - threshold
* - data
*/
nsIDOMDOMRequest getAllAlarms([optional] in nsISupports network);
DOMRequest getAllAlarms(optional MozNetworkStatsInterface network);
/**
* Remove all network alarms. If an |alarmId| is provided, then only that
* alarm is removed.
*/
nsIDOMDOMRequest removeAlarms([optional] in long alarmId);
DOMRequest removeAlarms(optional unsigned long alarmId = 0);
/**
* Remove all stats related with the provided network from DB.
*/
nsIDOMDOMRequest clearStats(in nsISupports network);
DOMRequest clearStats(MozNetworkStatsInterface network);
/**
* Remove all stats in the database.
*/
nsIDOMDOMRequest clearAllStats();
DOMRequest clearAllStats();
/**
* Return available networks that used to be saved in the database.
*/
nsIDOMDOMRequest getAvailableNetworks(); // array of MozNetworkStatsInterface.
DOMRequest getAvailableNetworks(); // array of MozNetworkStatsInterface.
/**
* Return available service types that used to be saved in the database.
*/
nsIDOMDOMRequest getAvailableServiceTypes(); // array of string.
DOMRequest getAvailableServiceTypes(); // array of string.
/**
* Minimum time in milliseconds between samples stored in the database.

View File

@ -465,3 +465,14 @@ partial interface Navigator {
readonly attribute boolean mozE10sEnabled;
};
#endif
#ifdef MOZ_PAY
partial interface Navigator {
[Throws, NewObject, Pref="dom.mozPay.enabled"]
// The 'jwts' parameter can be either a single DOMString or an array of
// DOMStrings. In both cases, it represents the base64url encoded and
// digitally signed payment information. Each payment provider should
// define its supported JWT format.
DOMRequest mozPay(any jwts);
};
#endif

View File

@ -17,9 +17,6 @@ typedef sequence <PerformanceEntry> PerformanceEntryList;
interface Performance {
[DependsOn=DeviceState, Affects=Nothing]
DOMHighResTimeStamp now();
[Throws]
DOMHighResTimeStamp translateTime(DOMHighResTimeStamp time, (Window or Worker or SharedWorker or ServiceWorker) timeSource);
};
[Exposed=Window]

View File

@ -750,6 +750,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
'MozNetworkStatsAlarm.webidl',
'MozNetworkStatsData.webidl',
'MozNetworkStatsInterface.webidl',
'MozNetworkStatsManager.webidl',
'MozSpeakerManager.webidl',
'MozWifiCapabilities.webidl',
'MozWifiManager.webidl',

View File

@ -32,7 +32,7 @@ DOMHighResTimeStamp
Performance::Now() const
{
TimeDuration duration =
TimeStamp::Now() - mWorkerPrivate->CreationTimeStamp();
TimeStamp::Now() - mWorkerPrivate->NowBaseTimeStamp();
return RoundTime(duration.ToMilliseconds());
}
@ -52,7 +52,7 @@ Performance::GetPerformanceTimingFromString(const nsAString& aProperty)
}
if (aProperty.EqualsLiteral("navigationStart")) {
return mWorkerPrivate->CreationTime();
return mWorkerPrivate->NowBaseTime();
}
MOZ_CRASH("IsPerformanceTimingAttribute and GetPerformanceTimingFromString are out of sync");
@ -77,13 +77,13 @@ Performance::InsertUserEntry(PerformanceEntry* aEntry)
TimeStamp
Performance::CreationTimeStamp() const
{
return mWorkerPrivate->CreationTimeStamp();
return mWorkerPrivate->NowBaseTimeStamp();
}
DOMHighResTimeStamp
Performance::CreationTime() const
{
return mWorkerPrivate->CreationTime();
return mWorkerPrivate->NowBaseTime();
}
void

View File

@ -101,13 +101,6 @@ ServiceWorker::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
aRv = workerPrivate->SendMessageEvent(aCx, aMessage, aTransferable, Move(clientInfo));
}
WorkerPrivate*
ServiceWorker::GetWorkerPrivate() const
{
ServiceWorkerPrivate* workerPrivate = mInfo->WorkerPrivate();
return workerPrivate->GetWorkerPrivate();
}
} // namespace workers
} // namespace dom
} // namespace mozilla

View File

@ -67,9 +67,6 @@ public:
const Optional<Sequence<JS::Value>>& aTransferable,
ErrorResult& aRv);
WorkerPrivate*
GetWorkerPrivate() const;
private:
// This class can only be created from the ServiceWorkerManager.
ServiceWorker(nsPIDOMWindowInner* aWindow, ServiceWorkerInfo* aInfo);

View File

@ -126,12 +126,6 @@ public:
void
NoteStoppedControllingDocuments();
WorkerPrivate*
GetWorkerPrivate() const
{
return mWorkerPrivate;
}
void
Activated();

View File

@ -2223,11 +2223,25 @@ WorkerPrivateParent<Derived>::WorkerPrivateParent(
aParent->CopyJSSettings(mJSSettings);
MOZ_ASSERT(IsDedicatedWorker());
mNowBaseTimeStamp = aParent->NowBaseTimeStamp();
mNowBaseTimeHighRes = aParent->NowBaseTime();
}
else {
AssertIsOnMainThread();
RuntimeService::GetDefaultJSSettings(mJSSettings);
if (IsDedicatedWorker() && mLoadInfo.mWindow &&
mLoadInfo.mWindow->GetPerformance()) {
mNowBaseTimeStamp = mLoadInfo.mWindow->GetPerformance()->GetDOMTiming()->
GetNavigationStartTimeStamp();
mNowBaseTimeHighRes =
mLoadInfo.mWindow->GetPerformance()->GetDOMTiming()->
GetNavigationStartHighRes();
} else {
mNowBaseTimeStamp = CreationTimeStamp();
mNowBaseTimeHighRes = CreationTime();
}
}
}

View File

@ -192,6 +192,8 @@ private:
WorkerType mWorkerType;
TimeStamp mCreationTimeStamp;
DOMHighResTimeStamp mCreationTimeHighRes;
TimeStamp mNowBaseTimeStamp;
DOMHighResTimeStamp mNowBaseTimeHighRes;
protected:
// The worker is owned by its thread, which is represented here. This is set
@ -553,6 +555,16 @@ public:
return mCreationTimeHighRes;
}
TimeStamp NowBaseTimeStamp() const
{
return mNowBaseTimeStamp;
}
DOMHighResTimeStamp NowBaseTime() const
{
return mNowBaseTimeHighRes;
}
nsIPrincipal*
GetPrincipal() const
{

View File

@ -437,8 +437,12 @@ DedicatedWorkerGlobalScope::WrapGlobalObject(JSContext* aCx,
behaviors.setDiscardSource(discardSource)
.extraWarningsOverride().set(extraWarnings);
const bool inCertifiedApp = mWorkerPrivate->IsInCertifiedApp();
const bool sharedMemoryEnabled = xpc::SharedMemoryEnabled();
JS::CompartmentCreationOptions& creationOptions = options.creationOptions();
creationOptions.setSharedMemoryAndAtomicsEnabled(xpc::SharedMemoryEnabled());
creationOptions.setSharedMemoryAndAtomicsEnabled(sharedMemoryEnabled)
.setExperimentalDateTimeFormatFormatToPartsEnabled(inCertifiedApp);
return DedicatedWorkerGlobalScopeBinding_workers::Wrap(aCx, this, this,
options,

View File

@ -17,8 +17,11 @@
#include "xptcall.h"
#include "txXPathObjectAdaptor.h"
#include "mozilla/Attributes.h"
#include "mozilla/UniquePtr.h"
#include "nsContentUtils.h"
#include "nsIClassInfo.h"
#include "nsIInterfaceInfo.h"
#include "js/RootingAPI.h"
NS_IMPL_ISUPPORTS(txXPathObjectAdaptor, txIXPathObject)
@ -295,23 +298,38 @@ txXPCOMExtensionFunctionCall::GetParamType(const nsXPTParamInfo &aParam,
}
}
class txParamArrayHolder
class txParamArrayHolder : public JS::Traceable
{
public:
txParamArrayHolder()
: mCount(0)
{
}
txParamArrayHolder(txParamArrayHolder&& rhs)
: mArray(mozilla::Move(rhs.mArray))
, mCount(rhs.mCount)
{
rhs.mCount = 0;
}
~txParamArrayHolder();
bool Init(uint8_t aCount);
operator nsXPTCVariant*() const
{
return mArray;
return mArray.get();
}
static void trace(txParamArrayHolder* holder, JSTracer* trc) { holder->trace(trc); }
void trace(JSTracer* trc) {
for (uint8_t i = 0; i < mCount; ++i) {
if (mArray[i].type == nsXPTType::T_JSVAL) {
JS::UnsafeTraceRoot(trc, &mArray[i].val.j, "txParam value");
}
}
}
private:
nsAutoArrayPtr<nsXPTCVariant> mArray;
mozilla::UniquePtr<nsXPTCVariant[]> mArray;
uint8_t mCount;
};
@ -338,8 +356,12 @@ bool
txParamArrayHolder::Init(uint8_t aCount)
{
mCount = aCount;
mArray = new nsXPTCVariant[mCount];
memset(mArray, 0, mCount * sizeof(nsXPTCVariant));
mArray = mozilla::MakeUnique<nsXPTCVariant[]>(mCount);
if (!mArray) {
return false;
}
memset(mArray.get(), 0, mCount * sizeof(nsXPTCVariant));
return true;
}
@ -363,8 +385,8 @@ txXPCOMExtensionFunctionCall::evaluate(txIEvalContext* aContext,
uint8_t paramCount = methodInfo->GetParamCount();
uint8_t inArgs = paramCount - 1;
txParamArrayHolder invokeParams;
if (!invokeParams.Init(paramCount)) {
JS::Rooted<txParamArrayHolder> invokeParams(nsContentUtils::RootingCxForThread());
if (!invokeParams.get().Init(paramCount)) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -385,7 +407,7 @@ txXPCOMExtensionFunctionCall::evaluate(txIEvalContext* aContext,
// Create context wrapper.
context = new txFunctionEvaluationContext(aContext, mState);
nsXPTCVariant &invokeParam = invokeParams[0];
nsXPTCVariant &invokeParam = invokeParams.get()[0];
invokeParam.type = paramInfo.GetType();
invokeParam.SetValNeedsCleanup();
NS_ADDREF((txIFunctionEvaluationContext*&)invokeParam.val.p = context);
@ -412,7 +434,7 @@ txXPCOMExtensionFunctionCall::evaluate(txIEvalContext* aContext,
return NS_ERROR_FAILURE;
}
nsXPTCVariant &invokeParam = invokeParams[i];
nsXPTCVariant &invokeParam = invokeParams.get()[i];
if (paramInfo.IsOut()) {
// We don't support out values.
return NS_ERROR_FAILURE;
@ -500,7 +522,7 @@ txXPCOMExtensionFunctionCall::evaluate(txIEvalContext* aContext,
return NS_ERROR_FAILURE;
}
nsXPTCVariant &returnParam = invokeParams[inArgs];
nsXPTCVariant &returnParam = invokeParams.get()[inArgs];
returnParam.type = returnInfo.GetType();
if (returnType == eSTRING) {
nsString *value = new nsString();
@ -514,7 +536,7 @@ txXPCOMExtensionFunctionCall::evaluate(txIEvalContext* aContext,
}
}
rv = NS_InvokeByIndex(mHelper, mMethodIndex, paramCount, invokeParams);
rv = NS_InvokeByIndex(mHelper, mMethodIndex, paramCount, invokeParams.get());
// In case someone is holding on to the txFunctionEvaluationContext which
// could thus stay alive longer than this function.

View File

@ -39,6 +39,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/EncodingUtils.h"
#include "mozilla/UniquePtr.h"
using namespace mozilla;
using mozilla::dom::EncodingUtils;
@ -523,9 +524,9 @@ handleNode(nsINode* aNode, txStylesheetCompiler* aCompiler)
dom::Element* element = aNode->AsElement();
uint32_t attsCount = element->GetAttrCount();
nsAutoArrayPtr<txStylesheetAttr> atts;
UniquePtr<txStylesheetAttr[]> atts;
if (attsCount > 0) {
atts = new txStylesheetAttr[attsCount];
atts = MakeUnique<txStylesheetAttr[]>(attsCount);
uint32_t counter;
for (counter = 0; counter < attsCount; ++counter) {
txStylesheetAttr& att = atts[counter];
@ -541,7 +542,7 @@ handleNode(nsINode* aNode, txStylesheetCompiler* aCompiler)
rv = aCompiler->startElement(ni->NamespaceID(),
ni->NameAtom(),
ni->GetPrefixAtom(), atts,
ni->GetPrefixAtom(), atts.get(),
attsCount);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -5,6 +5,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/Move.h"
#include "mozilla/UniquePtr.h"
#include "txStylesheetCompiler.h"
#include "txStylesheetCompileHandlers.h"
@ -124,9 +125,9 @@ txStylesheetCompiler::startElement(const char16_t *aName,
nsresult rv = flushCharacters();
NS_ENSURE_SUCCESS(rv, rv);
nsAutoArrayPtr<txStylesheetAttr> atts;
UniquePtr<txStylesheetAttr[]> atts;
if (aAttrCount > 0) {
atts = new txStylesheetAttr[aAttrCount];
atts = MakeUnique<txStylesheetAttr[]>(aAttrCount);
}
bool hasOwnNamespaceMap = false;
@ -169,7 +170,7 @@ txStylesheetCompiler::startElement(const char16_t *aName,
getter_AddRefs(localname), &namespaceID);
NS_ENSURE_SUCCESS(rv, rv);
return startElementInternal(namespaceID, localname, prefix, atts,
return startElementInternal(namespaceID, localname, prefix, atts.get(),
aAttrCount);
}

View File

@ -1773,14 +1773,6 @@ nsPermissionManager::AddInternal(nsIPrincipal* aPrincipal,
// If requested, create the entry in the DB.
if (aDBOperation == eWriteToDB) {
uint32_t appId;
rv = aPrincipal->GetAppId(&appId);
NS_ENSURE_SUCCESS(rv, rv);
bool isInBrowserElement;
rv = aPrincipal->GetIsInBrowserElement(&isInBrowserElement);
NS_ENSURE_SUCCESS(rv, rv);
UpdateDB(eOperationAdding, mStmtInsert, id, origin, aType, aPermission,
aExpireType, aExpireTime, aModificationTime);
}
@ -2948,4 +2940,3 @@ nsPermissionManager::FetchPermissions() {
}
return NS_OK;
}

View File

@ -184,8 +184,8 @@ struct RectTyped :
{
*aOut = IntRectTyped<units>(int32_t(this->X()), int32_t(this->Y()),
int32_t(this->Width()), int32_t(this->Height()));
return RectTyped<units>(F(aOut->x), F(aOut->y),
F(aOut->width), F(aOut->height))
return RectTyped<units, F>(F(aOut->x), F(aOut->y),
F(aOut->width), F(aOut->height))
.IsEqualEdges(*this);
}

View File

@ -140,6 +140,15 @@ SharedSurface_EGLImage::ProducerReleaseImpl()
mGL->fFinish();
}
void
SharedSurface_EGLImage::ProducerReadAcquireImpl()
{
// Wait on the fence, because presumably we're going to want to read this surface
if (mSync) {
mEGL->fClientWaitSync(Display(), mSync, 0, LOCAL_EGL_FOREVER);
}
}
EGLDisplay
SharedSurface_EGLImage::Display() const
{

View File

@ -71,6 +71,9 @@ public:
virtual void ProducerAcquireImpl() override {}
virtual void ProducerReleaseImpl() override;
virtual void ProducerReadAcquireImpl() override;
virtual void ProducerReadReleaseImpl() override {};
virtual GLuint ProdTexture() override {
return mProdTex;
}

View File

@ -357,23 +357,44 @@ DecomposeIntoNoRepeatRects(const gfx::Rect& aRect,
gfx::IntRect
Compositor::ComputeBackdropCopyRect(const gfx::Rect& aRect,
const gfx::Rect& aClipRect,
const gfx::Matrix4x4& aTransform)
const gfx::Matrix4x4& aTransform,
gfx::Matrix4x4* aOutTransform,
gfx::Rect* aOutLayerQuad)
{
gfx::Rect renderBounds = mRenderBounds;
// Compute the clip.
gfx::IntPoint offset = GetCurrentRenderTarget()->GetOrigin();
gfx::IntPoint rtOffset = GetCurrentRenderTarget()->GetOrigin();
gfx::IntSize rtSize = GetCurrentRenderTarget()->GetSize();
gfx::Rect renderBounds(0, 0, rtSize.width, rtSize.height);
renderBounds.IntersectRect(renderBounds, aClipRect);
renderBounds.MoveBy(offset);
renderBounds.MoveBy(rtOffset);
// Apply the layer transform.
gfx::Rect dest = aTransform.TransformAndClipBounds(aRect, renderBounds);
dest -= offset;
gfx::RectDouble dest = aTransform.TransformAndClipBounds(
gfx::RectDouble(aRect.x, aRect.y, aRect.width, aRect.height),
gfx::RectDouble(renderBounds.x, renderBounds.y, renderBounds.width, renderBounds.height));
dest -= rtOffset;
// Ensure we don't round out to -1, which trips up Direct3D.
dest.IntersectRect(dest, gfx::RectDouble(0, 0, rtSize.width, rtSize.height));
if (aOutLayerQuad) {
*aOutLayerQuad = gfx::Rect(dest.x, dest.y, dest.width, dest.height);
}
// Round out to integer.
gfx::IntRect result;
dest.RoundOut();
dest.ToIntRect(&result);
// Create a transform from adjusted clip space to render target space,
// translate it for the backdrop rect, then transform it into the backdrop's
// uv-space.
gfx::Matrix4x4 transform;
transform.PostScale(rtSize.width, rtSize.height, 1.0);
transform.PostTranslate(-result.x, -result.y, 0.0);
transform.PostScale(1 / float(result.width), 1 / float(result.height), 1.0);
*aOutTransform = transform;
return result;
}

View File

@ -518,11 +518,16 @@ protected:
* Given a layer rect, clip, and transform, compute the area of the backdrop that
* needs to be copied for mix-blending. The output transform translates from 0..1
* space into the backdrop rect space.
*
* The transformed layer quad is also optionally returned - this is the same as
* the result rect, before rounding.
*/
gfx::IntRect ComputeBackdropCopyRect(
const gfx::Rect& aRect,
const gfx::Rect& aClipRect,
const gfx::Matrix4x4& aTransform);
const gfx::Matrix4x4& aTransform,
gfx::Matrix4x4* aOutTransform,
gfx::Rect* aOutLayerQuad = nullptr);
/**
* Render time for the current composition.
@ -552,8 +557,6 @@ protected:
RefPtr<gfx::DrawTarget> mTarget;
gfx::IntRect mTargetBounds;
gfx::Rect mRenderBounds;
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
FenceHandle mReleaseFenceHandle;
#endif

View File

@ -3149,6 +3149,7 @@ AsyncPanZoomController::ReportCheckerboard(const TimeStamp& aSampleTime)
if (!mCheckerboardEvent && (recordTrace || forTelemetry)) {
mCheckerboardEvent = MakeUnique<CheckerboardEvent>(recordTrace);
}
mPotentialCheckerboardTracker.InTransform(IsTransformingState(mState));
if (magnitude) {
mPotentialCheckerboardTracker.CheckerboardSeen();
}
@ -3634,7 +3635,6 @@ void AsyncPanZoomController::DispatchStateChangeNotification(PanZoomState aOldSt
if (RefPtr<GeckoContentController> controller = GetGeckoContentController()) {
if (!IsTransformingState(aOldState) && IsTransformingState(aNewState)) {
mPotentialCheckerboardTracker.TransformStarted();
controller->NotifyAPZStateChange(
GetGuid(), APZStateChange::TransformBegin);
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
@ -3645,7 +3645,6 @@ void AsyncPanZoomController::DispatchStateChangeNotification(PanZoomState aOldSt
}
#endif
} else if (IsTransformingState(aOldState) && !IsTransformingState(aNewState)) {
mPotentialCheckerboardTracker.TransformStopped();
controller->NotifyAPZStateChange(
GetGuid(), APZStateChange::TransformEnd);
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)

View File

@ -40,21 +40,29 @@ PotentialCheckerboardDurationTracker::CheckerboardDone()
}
void
PotentialCheckerboardDurationTracker::TransformStarted()
PotentialCheckerboardDurationTracker::InTransform(bool aInTransform)
{
MOZ_ASSERT(!mInTransform);
if (!Tracking()) {
mCurrentPeriodStart = TimeStamp::Now();
if (aInTransform == mInTransform) {
// no-op
return;
}
mInTransform = true;
}
void
PotentialCheckerboardDurationTracker::TransformStopped()
{
MOZ_ASSERT(mInTransform);
mInTransform = false;
if (!Tracking()) {
// Because !Tracking(), mInTransform must be false, and so aInTransform
// must be true (or we would have early-exited this function already).
// Therefore, we are starting a potential checkerboard period.
mInTransform = aInTransform;
mCurrentPeriodStart = TimeStamp::Now();
return;
}
mInTransform = aInTransform;
if (!Tracking()) {
// Tracking() must have been true at the start of this function, or we
// would have taken the other !Tracking branch above. If it's false now,
// it means we just stopped tracking, so we are ending a potential
// checkerboard period.
mozilla::Telemetry::AccumulateTimeDelta(
mozilla::Telemetry::CHECKERBOARD_POTENTIAL_DURATION,
mCurrentPeriodStart);

View File

@ -39,15 +39,10 @@ public:
void CheckerboardDone();
/**
* This should be called when a transform is started. Calls to this must be
* interleaved with calls to TransformStopped().
* This should be called at composition time, to indicate if the APZC is in
* a transforming state or not.
*/
void TransformStarted();
/**
* This should be called when a transform is stopped. Calls to this must be
* interleaved with calls to TransformStarted().
*/
void TransformStopped();
void InTransform(bool aInTransform);
private:
bool Tracking() const;

View File

@ -118,6 +118,7 @@ public:
static already_AddRefed<gfxShmSharedReadLock>
Open(mozilla::layers::ISurfaceAllocator* aAllocator, const mozilla::layers::ShmemSection& aShmemSection)
{
MOZ_RELEASE_ASSERT(aShmemSection.shmem().IsReadable());
RefPtr<gfxShmSharedReadLock> readLock = new gfxShmSharedReadLock(aAllocator, aShmemSection);
return readLock.forget();
}

View File

@ -522,6 +522,8 @@ BufferTextureHost::Upload(nsIntRegion *aRegion)
// We don't have a buffer; a possible cause is that the IPDL actor
// is already dead. This inevitably happens as IPDL actors can die
// at any time, so we want to silently return in this case.
// another possible cause is that IPDL failed to map the shmem when
// deserializing it.
return false;
}
if (!mCompositor) {
@ -651,9 +653,19 @@ ShmemTextureHost::ShmemTextureHost(const ipc::Shmem& aShmem,
ISurfaceAllocator* aDeallocator,
TextureFlags aFlags)
: BufferTextureHost(aDesc, aFlags)
, mShmem(MakeUnique<ipc::Shmem>(aShmem))
, mDeallocator(aDeallocator)
{
if (aShmem.IsReadable()) {
mShmem = MakeUnique<ipc::Shmem>(aShmem);
} else {
// This can happen if we failed to map the shmem on this process, perhaps
// because it was big and we didn't have enough contiguous address space
// available, even though we did on the child process.
// As a result this texture will be in an invalid state and Lock will
// always fail.
gfxCriticalError() << "Failed to create a valid ShmemTextureHost";
}
MOZ_COUNT_CTOR(ShmemTextureHost);
}

Some files were not shown because too many files have changed in this diff Show More