Merge the last PGO-green inbound changeset to m-c.

This commit is contained in:
Ryan VanderMeulen 2012-08-16 20:50:16 -04:00
commit ee8393106e
67 changed files with 758 additions and 685 deletions

View File

@ -372,6 +372,7 @@ Services.obs.addObserver(function onSystemMessage(subject, topic, data) {
url: msg.uri,
origin: origin,
manifest: msg.manifest,
isActivity: (msg.type == 'activity'),
target: msg.target
});
}, 'system-messages-open-app', false);

View File

@ -5796,7 +5796,7 @@ MOZ_ARG_DISABLE_BOOL(crashreporter,
if test -n "$MOZ_CRASHREPORTER"; then
AC_DEFINE(MOZ_CRASHREPORTER)
if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
test -z "$SKIP_LIBRARY_CHECKS"; then
PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
AC_SUBST(MOZ_GTHREAD_CFLAGS)
@ -5805,7 +5805,7 @@ if test -n "$MOZ_CRASHREPORTER"; then
MOZ_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter. Use --disable-crashreporter to disable the crash reporter.])])
fi
if (test "$OS_ARCH" != "$HOST_OS_ARCH"); then
if test "$OS_ARCH" != "$HOST_OS_ARCH"; then
AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH. Use --disable-crashreporter.])
fi

View File

@ -13,6 +13,7 @@
const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
@ -31,6 +32,41 @@ var gIoService = Components.classes["@mozilla.org/network/io-service;1"]
var gETLDService = Components.classes["@mozilla.org/network/effective-tld-service;1"]
.getService(Components.interfaces.nsIEffectiveTLDService);
// These regexps represent the concrete syntax on the w3 spec as of 7-5-2012
// scheme = <scheme production from RFC 3986>
const R_SCHEME = new RegExp ("([a-zA-Z0-9\\-]+)", 'i');
const R_GETSCHEME = new RegExp ("^" + R_SCHEME.source + "(?=\\:)", 'i');
// scheme-source = scheme ":"
const R_SCHEMESRC = new RegExp ("^" + R_SCHEME.source + "\\:$", 'i');
// host-char = ALPHA / DIGIT / "-"
const R_HOSTCHAR = new RegExp ("[a-zA-Z0-9\\-]", 'i');
// host = "*" / [ "*." ] 1*host-char *( "." 1*host-char )
const R_HOST = new RegExp ("\\*|(((\\*\\.)?" + R_HOSTCHAR.source +
"+)(\\." + R_HOSTCHAR.source +"+)+)",'i');
// port = ":" ( 1*DIGIT / "*" )
const R_PORT = new RegExp ("(\\:([0-9]+|\\*))", 'i');
// host-source = [ scheme "://" ] host [ port ]
const R_HOSTSRC = new RegExp ("^((" + R_SCHEME.source + "\\:\\/\\/)?("
+ R_HOST.source + ")"
+ R_PORT.source + "?)$", 'i');
// ext-host-source = host-source "/" *( <VCHAR except ";" and ","> )
// ; ext-host-source is reserved for future use.
const R_EXTHOSTSRC = new RegExp ("^" + R_HOSTSRC.source + "\\/[:print:]+$", 'i');
// keyword-source = "'self'" / "'unsafe-inline'" / "'unsafe-eval'"
const R_KEYWORDSRC = new RegExp ("^('self'|'unsafe-inline'|'unsafe-eval')$", 'i');
// source-exp = scheme-source / host-source / keyword-source
const R_SOURCEEXP = new RegExp (R_SCHEMESRC.source + "|" +
R_HOSTSRC.source + "|" +
R_KEYWORDSRC.source, 'i');
var gPrefObserver = {
get debugEnabled () {
if (!this._branch)
@ -588,11 +624,8 @@ function CSPSourceList() {
* an instance of CSPSourceList
*/
CSPSourceList.fromString = function(aStr, self, enforceSelfChecks) {
// Source list is:
// <host-dir-value> ::= <source-list>
// | "'none'"
// <source-list> ::= <source>
// | <source-list>" "<source>
// source-list = *WSP [ source-expression *( 1*WSP source-expression ) *WSP ]
// / *WSP "'none'" *WSP
/* If self parameter is passed, convert to CSPSource,
unless it is already a CSPSource. */
@ -601,23 +634,33 @@ CSPSourceList.fromString = function(aStr, self, enforceSelfChecks) {
}
var slObj = new CSPSourceList();
if (aStr === "'none'")
return slObj;
if (aStr === "*") {
slObj._permitAllSources = true;
aStr = aStr.trim();
// w3 specifies case insensitive equality
if (aStr.toUpperCase() === "'NONE'"){
slObj._permitAllSources = false;
return slObj;
}
var tokens = aStr.split(/\s+/);
for (var i in tokens) {
if (tokens[i] === "") continue;
var src = CSPSource.create(tokens[i], self, enforceSelfChecks);
if (!src) {
CSPWarning(CSPLocalizer.getFormatStr("failedToParseUnrecognizedSource", [tokens[i]]));
if (!R_SOURCEEXP.test(tokens[i])){
CSPWarning(CSPLocalizer.getFormatStr("failedToParseUnrecognizedSource",
[tokens[i]]));
continue;
}
slObj._sources.push(src);
var src = CSPSource.create(tokens[i], self, enforceSelfChecks);
if (!src) {
CSPWarning(CSPLocalizer.getFormatStr("failedToParseUnrecognizedSource",
[tokens[i]]));
continue;
}
// if a source is a *, then we can permit all sources
if (src.permitAll){
slObj._permitAllSources = true;
return slObj;
} else {
slObj._sources.push(src);
}
}
return slObj;
@ -787,6 +830,9 @@ function CSPSource() {
this._port = undefined;
this._host = undefined;
//when set to true, this allows all source
this._permitAll = false;
// when set to true, this source represents 'self'
this._isSelf = false;
}
@ -924,6 +970,15 @@ CSPSource.fromString = function(aStr, self, enforceSelfChecks) {
return null;
}
var sObj = new CSPSource();
sObj._self = self;
// if equal, return does match
if (aStr === "*"){
sObj._permitAll = true;
return sObj;
}
if (!self && enforceSelfChecks) {
CSPError(CSPLocalizer.getStr("selfDataNotProvided"));
return null;
@ -933,12 +988,50 @@ CSPSource.fromString = function(aStr, self, enforceSelfChecks) {
self = CSPSource.create(self, undefined, false);
}
var sObj = new CSPSource();
sObj._self = self;
// check for scheme-source match
if (R_SCHEMESRC.test(aStr)){
var schemeSrcMatch = R_GETSCHEME.exec(aStr);
sObj._scheme = schemeSrcMatch[0];
if (!sObj._host) sObj._host = CSPHost.fromString("*");
if (!sObj._port) sObj._port = "*";
return sObj;
}
// take care of 'self' keyword
if (aStr === "'self'") {
if (!self) {
// check for host-source or ext-host-source match
if (R_HOSTSRC.test(aStr) || R_EXTHOSTSRC.test(aStr)){
var schemeMatch = R_GETSCHEME.exec(aStr);
if (!schemeMatch)
sObj._scheme = self.scheme;
else {
sObj._scheme = schemeMatch[0];
}
var hostMatch = R_HOST.exec(aStr);
if (!hostMatch) {
CSPError(CSPLocalizer.getFormatStr("couldntParseInvalidSource", [aStr]));
return null;
}
sObj._host = CSPHost.fromString(hostMatch[0]);
var portMatch = R_PORT.exec(aStr);
if (!portMatch) {
// gets the default port for the given scheme
defPort = Services.io.getProtocolHandler(sObj._scheme).defaultPort;
if (!defPort) {
CSPError(CSPLocalizer.getFormatStr("couldntParseInvalidSource", [aStr]));
return null;
}
sObj._port = defPort;
}
else {
// strip the ':' from the port
sObj._port = portMatch[0].substr(1);
}
return sObj;
}
// check for 'self' (case insensitive)
if (aStr.toUpperCase() === "'SELF'"){
if (!self){
CSPError(CSPLocalizer.getStr("selfKeywordNoSelfData"));
return null;
}
@ -946,125 +1039,14 @@ CSPSource.fromString = function(aStr, self, enforceSelfChecks) {
sObj._isSelf = true;
return sObj;
}
// We could just create a URI and then send this off to fromURI, but
// there's no way to leave out the scheme or wildcard the port in an nsURI.
// That has to be supported here.
// split it up
var chunks = aStr.split(":");
// If there is only one chunk, it's gotta be a host.
if (chunks.length == 1) {
sObj._host = CSPHost.fromString(chunks[0]);
if (!sObj._host) {
CSPError(CSPLocalizer.getFormatStr("couldntParseInvalidSource",[aStr]));
return null;
}
// enforce 'self' inheritance
if (enforceSelfChecks) {
// note: the non _scheme accessor checks sObj._self
if (!sObj.scheme || !sObj.port) {
CSPError(CSPLocalizer.getFormatStr("hostSourceWithoutData",[aStr]));
return null;
}
}
return sObj;
}
// If there are two chunks, it's either scheme://host or host:port
// ... but scheme://host can have an empty host.
// ... and host:port can have an empty host
if (chunks.length == 2) {
// is the last bit a port?
if (chunks[1] === "*" || chunks[1].match(/^\d+$/)) {
sObj._port = chunks[1];
// then the previous chunk *must* be a host or empty.
if (chunks[0] !== "") {
sObj._host = CSPHost.fromString(chunks[0]);
if (!sObj._host) {
CSPError(CSPLocalizer.getFormatStr("couldntParseInvalidSource",[aStr]));
return null;
}
}
// enforce 'self' inheritance
// (scheme:host requires port, host:port does too. Wildcard support is
// only available if the scheme and host are wildcarded)
if (enforceSelfChecks) {
// note: the non _scheme accessor checks sObj._self
if (!sObj.scheme || !sObj.host || !sObj.port) {
CSPError(CSPLocalizer.getFormatStr("sourceWithoutData",[aStr]));
return null;
}
}
}
// is the first bit a scheme?
else if (CSPSource.validSchemeName(chunks[0])) {
sObj._scheme = chunks[0];
// then the second bit *must* be a host or empty
if (chunks[1] === "") {
// Allow scheme-only sources! These default to wildcard host/port,
// especially since host and port don't always matter.
// Example: "javascript:" and "data:"
if (!sObj._host) sObj._host = CSPHost.fromString("*");
if (!sObj._port) sObj._port = "*";
} else {
// some host was defined.
// ... remove <= 3 leading slashes (from the scheme) and parse
var cleanHost = chunks[1].replace(/^\/{0,3}/,"");
// ... and parse
sObj._host = CSPHost.fromString(cleanHost);
if (!sObj._host) {
CSPError(CSPLocalizer.getFormatStr("couldntParseInvalidHost",[cleanHost]));
return null;
}
}
// enforce 'self' inheritance (scheme-only should be scheme:*:* now, and
// if there was a host provided it should be scheme:host:selfport
if (enforceSelfChecks) {
// note: the non _scheme accessor checks sObj._self
if (!sObj.scheme || !sObj.host || !sObj.port) {
CSPError(CSPLocalizer.getFormatStr("sourceWithoutData",[aStr]));
return null;
}
}
}
else {
// AAAH! Don't know what to do! No valid scheme or port!
CSPError(CSPLocalizer.getFormatStr("couldntParseInvalidSource",[aStr]));
return null;
}
return sObj;
}
// If there are three chunks, we got 'em all!
if (!CSPSource.validSchemeName(chunks[0])) {
CSPError(CSPLocalizer.getFormatStr("couldntParseScheme",[aStr]));
return null;
}
sObj._scheme = chunks[0];
if (!(chunks[2] === "*" || chunks[2].match(/^\d+$/))) {
CSPError(CSPLocalizer.getFormatStr("couldntParsePort",[aStr]));
return null;
}
sObj._port = chunks[2];
// ... remove <= 3 leading slashes (from the scheme) and parse
var cleanHost = chunks[1].replace(/^\/{0,3}/,"");
sObj._host = CSPHost.fromString(cleanHost);
return sObj._host ? sObj : null;
CSPError(CSPLocalizer.getFormatStr("couldntParseInvalidSource",[aStr]));
return null;
};
CSPSource.validSchemeName = function(aStr) {
// <scheme-name> ::= <alpha><scheme-suffix>
// <scheme-suffix> ::= <scheme-chr>
// | <scheme-suffix><scheme-chr>
// <scheme-suffix> ::= <scheme-chr>
// | <scheme-suffix><scheme-chr>
// <scheme-chr> ::= <letter> | <digit> | "+" | "." | "-"
return aStr.match(/^[a-zA-Z][a-zA-Z0-9+.-]*$/);
@ -1088,7 +1070,13 @@ CSPSource.prototype = {
return this._host;
},
/**
get permitAll () {
if (this._isSelf && this._self)
return this._self.permitAll;
return this._permitAll;
},
/**
* If this doesn't have a nonstandard port (hard-defined), use the default
* port for this source's scheme. Should never inherit port from 'self'.
*/

View File

@ -82,7 +82,7 @@ nsNodeInfo::nsNodeInfo(nsIAtom *aName, nsIAtom *aPrefix, PRInt32 aNamespaceID,
PRUint16 aNodeType, nsIAtom* aExtraName,
nsNodeInfoManager *aOwnerManager)
{
CHECK_VALID_NODEINFO(aNodeType, aName, aNamespaceID, aExtraName);
CheckValidNodeInfo(aNodeType, aName, aNamespaceID, aExtraName);
NS_ABORT_IF_FALSE(aOwnerManager, "Invalid aOwnerManager");
// Initialize mInner

View File

@ -17,6 +17,8 @@
#include "plhash.h"
#include "nsIAtom.h"
#include "nsCOMPtr.h"
#include "nsIDOMNode.h"
#include "nsGkAtoms.h"
class nsFixedSizeAllocator;
@ -63,45 +65,49 @@ private:
* this object, instead of always deleting the object we'll put the
* object in the cache unless the cache is already full.
*/
void LastRelease();
void LastRelease();
};
#define CHECK_VALID_NODEINFO(_nodeType, _name, _namespaceID, _extraName) \
NS_ABORT_IF_FALSE(_nodeType == nsIDOMNode::ELEMENT_NODE || \
_nodeType == nsIDOMNode::ATTRIBUTE_NODE || \
_nodeType == nsIDOMNode::TEXT_NODE || \
_nodeType == nsIDOMNode::CDATA_SECTION_NODE || \
_nodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE || \
_nodeType == nsIDOMNode::COMMENT_NODE || \
_nodeType == nsIDOMNode::DOCUMENT_NODE || \
_nodeType == nsIDOMNode::DOCUMENT_TYPE_NODE || \
_nodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE || \
_nodeType == PR_UINT16_MAX, \
"Invalid nodeType"); \
NS_ABORT_IF_FALSE((_nodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE || \
_nodeType == nsIDOMNode::DOCUMENT_TYPE_NODE) == \
(_extraName != nullptr), \
"Supply aExtraName for and only for PIs and doctypes"); \
NS_ABORT_IF_FALSE(_nodeType == nsIDOMNode::ELEMENT_NODE || \
_nodeType == nsIDOMNode::ATTRIBUTE_NODE || \
_nodeType == PR_UINT16_MAX || \
aNamespaceID == kNameSpaceID_None, \
"Only attributes and elements can be in a namespace"); \
NS_ABORT_IF_FALSE(_name && _name != nsGkAtoms::_empty, "Invalid localName");\
NS_ABORT_IF_FALSE(((_nodeType == nsIDOMNode::TEXT_NODE) == \
(_name == nsGkAtoms::textTagName)) && \
((_nodeType == nsIDOMNode::CDATA_SECTION_NODE) == \
(_name == nsGkAtoms::cdataTagName)) && \
((_nodeType == nsIDOMNode::COMMENT_NODE) == \
(_name == nsGkAtoms::commentTagName)) && \
((_nodeType == nsIDOMNode::DOCUMENT_NODE) == \
(_name == nsGkAtoms::documentNodeName)) && \
((_nodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE) == \
(_name == nsGkAtoms::documentFragmentNodeName)) && \
((_nodeType == nsIDOMNode::DOCUMENT_TYPE_NODE) == \
(_name == nsGkAtoms::documentTypeNodeName)) && \
((_nodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE) ==\
(_name == nsGkAtoms::processingInstructionTagName)), \
"Wrong localName for nodeType");
inline void
CheckValidNodeInfo(PRUint16 aNodeType, nsIAtom *aName, PRInt32 aNamespaceID,
nsIAtom* aExtraName)
{
NS_ABORT_IF_FALSE(aNodeType == nsIDOMNode::ELEMENT_NODE ||
aNodeType == nsIDOMNode::ATTRIBUTE_NODE ||
aNodeType == nsIDOMNode::TEXT_NODE ||
aNodeType == nsIDOMNode::CDATA_SECTION_NODE ||
aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE ||
aNodeType == nsIDOMNode::COMMENT_NODE ||
aNodeType == nsIDOMNode::DOCUMENT_NODE ||
aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE ||
aNodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE ||
aNodeType == PR_UINT16_MAX,
"Invalid nodeType");
NS_ABORT_IF_FALSE((aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE ||
aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE) ==
!!aExtraName,
"Supply aExtraName for and only for PIs and doctypes");
NS_ABORT_IF_FALSE(aNodeType == nsIDOMNode::ELEMENT_NODE ||
aNodeType == nsIDOMNode::ATTRIBUTE_NODE ||
aNodeType == PR_UINT16_MAX ||
aNamespaceID == kNameSpaceID_None,
"Only attributes and elements can be in a namespace");
NS_ABORT_IF_FALSE(aName && aName != nsGkAtoms::_empty, "Invalid localName");
NS_ABORT_IF_FALSE(((aNodeType == nsIDOMNode::TEXT_NODE) ==
(aName == nsGkAtoms::textTagName)) &&
((aNodeType == nsIDOMNode::CDATA_SECTION_NODE) ==
(aName == nsGkAtoms::cdataTagName)) &&
((aNodeType == nsIDOMNode::COMMENT_NODE) ==
(aName == nsGkAtoms::commentTagName)) &&
((aNodeType == nsIDOMNode::DOCUMENT_NODE) ==
(aName == nsGkAtoms::documentNodeName)) &&
((aNodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE) ==
(aName == nsGkAtoms::documentFragmentNodeName)) &&
((aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE) ==
(aName == nsGkAtoms::documentTypeNodeName)) &&
((aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE) ==
(aName == nsGkAtoms::processingInstructionTagName)),
"Wrong localName for nodeType");
}
#endif /* nsNodeInfo_h___ */

View File

@ -210,7 +210,7 @@ nsNodeInfoManager::GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
PRInt32 aNamespaceID, PRUint16 aNodeType,
nsIAtom* aExtraName /* = nullptr */)
{
CHECK_VALID_NODEINFO(aNodeType, aName, aNamespaceID, aExtraName);
CheckValidNodeInfo(aNodeType, aName, aNamespaceID, aExtraName);
nsINodeInfo::nsNodeInfoInner tmpKey(aName, aPrefix, aNamespaceID, aNodeType,
aExtraName);
@ -256,7 +256,7 @@ nsNodeInfoManager::GetNodeInfo(const nsAString& aName, nsIAtom *aPrefix,
#ifdef DEBUG
{
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aName);
CHECK_VALID_NODEINFO(aNodeType, nameAtom, aNamespaceID, nullptr);
CheckValidNodeInfo(aNodeType, nameAtom, aNamespaceID, nullptr);
}
#endif

View File

@ -159,29 +159,35 @@ test(
function test_CSPSource_fromString() {
// can't do these tests because "self" is not defined.
//"basic source should not be null.");
do_check_neq(null, CSPSource.fromString("a.com"));
do_check_neq(null, CSPSource.fromString("a.com", "http://abc.com"));
//"ldh characters should all work for host.");
do_check_neq(null, CSPSource.fromString("a2-c.com"));
do_check_neq(null, CSPSource.fromString("a2-c.com", "https://a.com"));
//"wildcard should work in first token for host.");
do_check_neq(null, CSPSource.fromString("*.a.com"));
do_check_neq(null, CSPSource.fromString("*.a.com", "http://abc.com"));
//print(" --- Ignore the following two errors if they print ---");
//"wildcard should not work in non-first token for host.");
do_check_eq(null, CSPSource.fromString("x.*.a.com"));
do_check_eq(null, CSPSource.fromString("x.*.a.com", "http://a.com"));
//"funny characters (#) should not work for host.");
do_check_eq(null, CSPSource.fromString("a#2-c.com"));
do_check_eq(null, CSPSource.fromString("a#2-c.com", "http://a.com"));
//print(" --- Stop ignoring errors that print ---\n");
//"failed to parse host with port.");
do_check_neq(null, CSPSource.create("a.com:23"));
do_check_neq(null, CSPSource.create("a.com:23", "http://a.com"));
//"failed to parse host with scheme.");
do_check_neq(null, CSPSource.create("https://a.com"));
do_check_neq(null, CSPSource.create("https://a.com", "http://a.com"));
//"failed to parse host with scheme and port.");
do_check_neq(null, CSPSource.create("https://a.com:200"));
do_check_neq(null, CSPSource.create("https://a.com:200", "http://a.com"));
//Check to make sure we don't match multiple instances with regex
do_check_eq(null, CSPSource.create("http://foo.com:bar.com:23"));
//Port parsing should work for all schemes
do_check_neq(null, CSPSource.create("data:"));
do_check_neq(null, CSPSource.create("javascript:"));
});
test(
@ -270,6 +276,7 @@ test(
var doubleSourceList = CSPSourceList.fromString("https://foo.com http://bar.com:88",
URI("http://self.com:88"));
var allSourceList = CSPSourceList.fromString("*");
var allAndMoreSourceList = CSPSourceList.fromString("* https://bar.com 'none'");
//'none' should permit none."
do_check_false( nullSourceList.permits("http://a.com"));
@ -293,6 +300,8 @@ test(
//"* does not permit a long host with no port"
do_check_true( allSourceList.permits("http://a.b.c.d.e.f.g.h.i.j.k.l.x.com"));
//* short circuts parsing
do_check_true(allAndMoreSourceList.permits("http://a.com"));
});
test(
@ -301,7 +310,7 @@ test(
// policy a /\ policy b intersects policies, not context (where 'self'
// values come into play)
var nullSourceList = CSPSourceList.fromString("'none'");
var simpleSourceList = CSPSourceList.fromString("a.com");
var simpleSourceList = CSPSourceList.fromString("http://a.com");
var doubleSourceList = CSPSourceList.fromString("https://foo.com http://bar.com:88");
var singleFooSourceList = CSPSourceList.fromString("https://foo.com");
var allSourceList = CSPSourceList.fromString("*");

View File

@ -103,7 +103,7 @@ XBLFinalize(JSFreeOp *fop, JSObject *obj)
static const uint32_t XBLPROTO_SLOT = 0;
static const uint32_t FIELD_SLOT = 1;
static bool
bool
ValueHasISupportsPrivate(const JS::Value &v)
{
if (!v.isObject()) {
@ -214,7 +214,7 @@ InstallXBLField(JSContext* cx,
return false;
}
static bool
bool
FieldGetterImpl(JSContext *cx, JS::CallArgs args)
{
const JS::Value &thisv = args.thisv();
@ -246,11 +246,11 @@ static JSBool
FieldGetter(JSContext *cx, unsigned argc, JS::Value *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
return JS::CallNonGenericMethod(cx, ValueHasISupportsPrivate, FieldGetterImpl,
args);
return JS::CallNonGenericMethod<ValueHasISupportsPrivate, FieldGetterImpl>
(cx, args);
}
static bool
bool
FieldSetterImpl(JSContext *cx, JS::CallArgs args)
{
const JS::Value &thisv = args.thisv();
@ -274,8 +274,8 @@ static JSBool
FieldSetter(JSContext *cx, unsigned argc, JS::Value *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
return JS::CallNonGenericMethod(cx, ValueHasISupportsPrivate, FieldSetterImpl,
args);
return JS::CallNonGenericMethod<ValueHasISupportsPrivate, FieldSetterImpl>
(cx, args);
}
static JSBool

View File

@ -212,7 +212,7 @@ IDBTransaction::OnRequestFinished()
NS_ASSERTION(mPendingRequests, "Mismatched calls!");
--mPendingRequests;
if (!mPendingRequests) {
NS_ASSERTION(mAbortCode || mReadyState == IDBTransaction::LOADING,
NS_ASSERTION(NS_FAILED(mAbortCode) || mReadyState == IDBTransaction::LOADING,
"Bad state!");
mReadyState = IDBTransaction::COMMITTING;
CommitOrRollback();
@ -843,7 +843,7 @@ CommitHelper::Run()
}
nsCOMPtr<nsIDOMEvent> event;
if (mAbortCode) {
if (NS_FAILED(mAbortCode)) {
if (mTransaction->GetMode() == IDBTransaction::VERSION_CHANGE) {
// This will make the database take a snapshot of it's DatabaseInfo
mTransaction->Database()->Close();
@ -898,16 +898,16 @@ CommitHelper::Run()
if (mConnection) {
IndexedDatabaseManager::SetCurrentWindow(database->GetOwner());
if (!mAbortCode && mUpdateFileRefcountFunction &&
if (NS_SUCCEEDED(mAbortCode) && mUpdateFileRefcountFunction &&
NS_FAILED(mUpdateFileRefcountFunction->UpdateDatabase(mConnection))) {
mAbortCode = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
if (!mAbortCode && NS_FAILED(WriteAutoIncrementCounts())) {
if (NS_SUCCEEDED(mAbortCode) && NS_FAILED(WriteAutoIncrementCounts())) {
mAbortCode = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
if (!mAbortCode) {
if (NS_SUCCEEDED(mAbortCode)) {
NS_NAMED_LITERAL_CSTRING(release, "COMMIT TRANSACTION");
nsresult rv = mConnection->ExecuteSimpleSQL(release);
if (NS_SUCCEEDED(rv)) {
@ -926,7 +926,7 @@ CommitHelper::Run()
}
}
if (mAbortCode) {
if (NS_FAILED(mAbortCode)) {
RevertAutoIncrementCounts();
NS_NAMED_LITERAL_CSTRING(rollback, "ROLLBACK TRANSACTION");
if (NS_FAILED(mConnection->ExecuteSimpleSQL(rollback))) {

View File

@ -2443,7 +2443,8 @@ _setvalue(NPP npp, NPPVariable variable, void *result)
case NPPVpluginKeepLibraryInMemory: {
NPBool bCached = (result != nullptr);
return inst->SetCached(bCached);
inst->SetCached(bCached);
return NPERR_NO_ERROR;
}
case NPPVpluginUsesDOMForCursorBool: {

View File

@ -88,15 +88,12 @@ class SharedPluginTexture {
public:
NS_INLINE_DECL_REFCOUNTING(SharedPluginTexture)
SharedPluginTexture() :
mCurrentHandle(0), mNeedNewImage(false), mLock("SharedPluginTexture.mLock")
SharedPluginTexture() : mLock("SharedPluginTexture.mLock")
{
}
~SharedPluginTexture()
{
// This will be destroyed in the compositor (as it normally is)
mCurrentHandle = 0;
}
TextureInfo Lock()
@ -115,9 +112,7 @@ public:
}
void Release(TextureInfo& aTextureInfo)
{
mNeedNewImage = true;
{
mTextureInfo = aTextureInfo;
mLock.Unlock();
}
@ -126,33 +121,25 @@ public:
{
MutexAutoLock lock(mLock);
if (!mNeedNewImage)
return mCurrentHandle;
if (!EnsureGLContext())
return 0;
mNeedNewImage = false;
if (mTextureInfo.mWidth == 0 || mTextureInfo.mHeight == 0)
return 0;
mCurrentHandle = sPluginContext->CreateSharedHandle(TextureImage::ThreadShared, (void*)mTextureInfo.mTexture, GLContext::TextureID);
SharedTextureHandle handle = sPluginContext->CreateSharedHandle(TextureImage::ThreadShared, (void*)mTextureInfo.mTexture, GLContext::TextureID);
// We want forget about this now, so delete the texture. Assigning it to zero
// ensures that we create a new one in Lock()
sPluginContext->fDeleteTextures(1, &mTextureInfo.mTexture);
mTextureInfo.mTexture = 0;
return mCurrentHandle;
return handle;
}
private:
TextureInfo mTextureInfo;
SharedTextureHandle mCurrentHandle;
bool mNeedNewImage;
Mutex mLock;
};
@ -1002,7 +989,7 @@ nsSurfaceTexture* nsNPAPIPluginInstance::CreateSurfaceTexture()
void nsNPAPIPluginInstance::OnSurfaceTextureFrameAvailable()
{
if (mRunning == RUNNING && mOwner)
RedrawPlugin();
AndroidBridge::Bridge()->ScheduleComposite();
}
void* nsNPAPIPluginInstance::AcquireContentWindow()
@ -1120,11 +1107,10 @@ nsNPAPIPluginInstance::GetJSObject(JSContext *cx, JSObject** outObject)
return NS_OK;
}
nsresult
void
nsNPAPIPluginInstance::SetCached(bool aCache)
{
mCached = aCache;
return NS_OK;
}
bool

View File

@ -232,7 +232,7 @@ public:
mozilla::TimeStamp StopTime();
// cache this NPAPI plugin
nsresult SetCached(bool aCache);
void SetCached(bool aCache);
already_AddRefed<nsPIDOMWindow> GetDOMWindow();

View File

@ -1499,7 +1499,7 @@ XMLHttpRequest::ReleaseProxy(ReleaseType aType)
new AsyncTeardownRunnable(mProxy);
mProxy = nullptr;
if (NS_DispatchToMainThread(runnable)) {
if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
NS_ERROR("Failed to dispatch teardown runnable!");
}
} else {

View File

@ -348,7 +348,8 @@ AlphaBoxBlur::AlphaBoxBlur(const Rect& aRect,
mHasDirtyRect = false;
}
if (rect.IsEmpty()) {
mRect = IntRect(rect.x, rect.y, rect.width, rect.height);
if (mRect.IsEmpty()) {
return;
}
@ -361,19 +362,15 @@ AlphaBoxBlur::AlphaBoxBlur(const Rect& aRect,
skipRect.Deflate(Size(aBlurRadius + aSpreadRadius));
mSkipRect = IntRect(skipRect.x, skipRect.y, skipRect.width, skipRect.height);
IntRect shadowIntRect(rect.x, rect.y, rect.width, rect.height);
mSkipRect.IntersectRect(mSkipRect, shadowIntRect);
if (mSkipRect.IsEqualInterior(shadowIntRect))
mSkipRect = mSkipRect.Intersect(mRect);
if (mSkipRect.IsEqualInterior(mRect))
return;
mSkipRect -= shadowIntRect.TopLeft();
mSkipRect -= mRect.TopLeft();
} else {
mSkipRect = IntRect(0, 0, 0, 0);
}
mRect = IntRect(rect.x, rect.y, rect.width, rect.height);
CheckedInt<int32_t> stride = RoundUpToMultipleOf4(mRect.width);
if (stride.isValid()) {
mStride = stride.value();

View File

@ -10,6 +10,7 @@
#include "gfxImageSurface.h"
#include "gfxSharedImageSurface.h"
#include "yuv_convert.h"
#include "gfxUtils.h"
#include "mozilla/layers/ImageBridgeChild.h"
#include "mozilla/layers/ImageContainerChild.h"
@ -464,28 +465,22 @@ PlanarYCbCrImage::GetAsSurface()
return result.forget();
}
nsRefPtr<gfxImageSurface> imageSurface =
new gfxImageSurface(mSize, gfxASurface::ImageFormatRGB24);
gfx::YUVType type =
gfx::TypeFromSize(mData.mYSize.width,
mData.mYSize.height,
mData.mCbCrSize.width,
mData.mCbCrSize.height);
gfxASurface::gfxImageFormat format = GetOffscreenFormat();
// Convert from YCbCr to RGB now
gfx::ConvertYCbCrToRGB32(mData.mYChannel,
mData.mCbChannel,
mData.mCrChannel,
imageSurface->Data(),
mData.mPicX,
mData.mPicY,
mData.mPicSize.width,
mData.mPicSize.height,
mData.mYStride,
mData.mCbCrStride,
imageSurface->Stride(),
type);
gfxIntSize size(mSize);
gfxUtils::GetYCbCrToRGBDestFormatAndSize(mData, format, size);
if (size.width > PlanarYCbCrImage::MAX_DIMENSION ||
size.height > PlanarYCbCrImage::MAX_DIMENSION) {
NS_ERROR("Illegal image dest width or height");
return nullptr;
}
nsRefPtr<gfxImageSurface> imageSurface =
new gfxImageSurface(mSize, format);
gfxUtils::ConvertYCbCrToRGB(mData, format, mSize,
imageSurface->Data(),
imageSurface->Stride());
mSurface = imageSurface;

View File

@ -93,7 +93,7 @@ InitPrefCaches()
#define CONTAINER_ENSURE_SUCCESS(status) \
PR_BEGIN_MACRO \
nsresult _status = status; /* eval once */ \
if (_status) { \
if (NS_FAILED(_status)) { \
LOG_CONTAINER_ERROR; \
DoError(); \
return _status; \

View File

@ -1037,7 +1037,7 @@ JSBool
MapObject::size(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, size_impl, args);
return CallNonGenericMethod<MapObject::is, MapObject::size_impl>(cx, args);
}
bool
@ -1059,7 +1059,7 @@ JSBool
MapObject::get(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, get_impl, args);
return CallNonGenericMethod<MapObject::is, MapObject::get_impl>(cx, args);
}
bool
@ -1077,7 +1077,7 @@ JSBool
MapObject::has(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, has_impl, args);
return CallNonGenericMethod<MapObject::is, MapObject::has_impl>(cx, args);
}
bool
@ -1100,7 +1100,7 @@ JSBool
MapObject::set(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, set_impl, args);
return CallNonGenericMethod<MapObject::is, MapObject::set_impl>(cx, args);
}
bool
@ -1130,7 +1130,7 @@ JSBool
MapObject::delete_(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, delete_impl, args);
return CallNonGenericMethod<MapObject::is, MapObject::delete_impl>(cx, args);
}
bool
@ -1409,7 +1409,7 @@ JSBool
SetObject::size(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, size_impl, args);
return CallNonGenericMethod<SetObject::is, SetObject::size_impl>(cx, args);
}
bool
@ -1427,7 +1427,7 @@ JSBool
SetObject::has(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, has_impl, args);
return CallNonGenericMethod<SetObject::is, SetObject::has_impl>(cx, args);
}
bool
@ -1449,7 +1449,7 @@ JSBool
SetObject::add(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, add_impl, args);
return CallNonGenericMethod<SetObject::is, SetObject::add_impl>(cx, args);
}
bool
@ -1470,7 +1470,7 @@ JSBool
SetObject::delete_(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, delete_impl, args);
return CallNonGenericMethod<SetObject::is, SetObject::delete_impl>(cx, args);
}
bool

View File

@ -296,13 +296,13 @@ CompileRegExpObject(JSContext *cx, RegExpObjectBuilder &builder, CallArgs args)
return true;
}
static bool
JS_ALWAYS_INLINE bool
IsRegExp(const Value &v)
{
return v.isObject() && v.toObject().hasClass(&RegExpClass);
}
static bool
JS_ALWAYS_INLINE bool
regexp_compile_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsRegExp(args.thisv()));
@ -310,11 +310,11 @@ regexp_compile_impl(JSContext *cx, CallArgs args)
return CompileRegExpObject(cx, builder, args);
}
static JSBool
JSBool
regexp_compile(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsRegExp, regexp_compile_impl, args);
return CallNonGenericMethod<IsRegExp, regexp_compile_impl>(cx, args);
}
static JSBool
@ -341,7 +341,7 @@ regexp_construct(JSContext *cx, unsigned argc, Value *vp)
return CompileRegExpObject(cx, builder, args);
}
static bool
JS_ALWAYS_INLINE bool
regexp_toString_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsRegExp(args.thisv()));
@ -354,11 +354,11 @@ regexp_toString_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
regexp_toString(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsRegExp, regexp_toString_impl, args);
return CallNonGenericMethod<IsRegExp, regexp_toString_impl>(cx, args);
}
static JSFunctionSpec regexp_methods[] = {

View File

@ -1527,16 +1527,20 @@ CallMethodIfWrapped(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallA
* value which is considered acceptable.
*
* Now to implement the actual method, write a JSNative that calls the method
* declared below, passing the appropriate arguments.
* declared below, passing the appropriate template and runtime arguments.
*
* static JSBool
* answer_getAnswer(JSContext *cx, unsigned argc, JS::Value *vp)
* {
* JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
* return JS::CallNonGenericMethod(cx, IsAnswerObject,
answer_getAnswer_impl, args);
* return JS::CallNonGenericMethod<IsAnswerObject, answer_getAnswer_impl>(cx, args);
* }
*
* Note that, because they are used as template arguments, the predicate
* and implementation functions must have external linkage. (This is
* unfortunate, but GCC wasn't inlining things as one would hope when we
* passed them as function arguments.)
*
* JS::CallNonGenericMethod will test whether |args.thisv()| is acceptable. If
* it is, it will call the provided implementation function, which will return
* a value and indicate success. If it is not, it will attempt to unwrap
@ -1547,14 +1551,25 @@ CallMethodIfWrapped(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallA
* Note: JS::CallNonGenericMethod will only work correctly if it's called in
* tail position in a JSNative. Do not call it from any other place.
*/
template<IsAcceptableThis Test, NativeImpl Impl>
JS_ALWAYS_INLINE bool
CallNonGenericMethod(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args)
CallNonGenericMethod(JSContext *cx, CallArgs args)
{
const Value &thisv = args.thisv();
if (test(thisv))
return impl(cx, args);
if (Test(thisv))
return Impl(cx, args);
return detail::CallMethodIfWrapped(cx, test, impl, args);
return detail::CallMethodIfWrapped(cx, Test, Impl, args);
}
JS_ALWAYS_INLINE bool
CallNonGenericMethod(JSContext *cx, IsAcceptableThis Test, NativeImpl Impl, CallArgs args)
{
const Value &thisv = args.thisv();
if (Test(thisv))
return Impl(cx, args);
return detail::CallMethodIfWrapped(cx, Test, Impl, args);
}
} /* namespace JS */

View File

@ -1397,13 +1397,13 @@ class ArraySharpDetector
}
};
static bool
JS_ALWAYS_INLINE bool
IsArray(const Value &v)
{
return v.isObject() && v.toObject().isArray();
}
static bool
JS_ALWAYS_INLINE bool
array_toSource_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsArray(args.thisv()));
@ -1472,12 +1472,12 @@ array_toSource_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
array_toSource(JSContext *cx, unsigned argc, Value *vp)
{
JS_CHECK_RECURSION(cx, return false);
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsArray, array_toSource_impl, args);
return CallNonGenericMethod<IsArray, array_toSource_impl>(cx, args);
}
#endif

View File

@ -46,14 +46,14 @@ Class js::BooleanClass = {
JS_ConvertStub
};
static bool
JS_ALWAYS_INLINE bool
IsBoolean(const Value &v)
{
return v.isBoolean() || (v.isObject() && v.toObject().hasClass(&BooleanClass));
}
#if JS_HAS_TOSOURCE
static bool
JS_ALWAYS_INLINE bool
bool_toSource_impl(JSContext *cx, CallArgs args)
{
const Value &thisv = args.thisv();
@ -72,15 +72,15 @@ bool_toSource_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
bool_toSource(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsBoolean, bool_toSource_impl, args);
return CallNonGenericMethod<IsBoolean, bool_toSource_impl>(cx, args);
}
#endif
static bool
JS_ALWAYS_INLINE bool
bool_toString_impl(JSContext *cx, CallArgs args)
{
const Value &thisv = args.thisv();
@ -91,14 +91,14 @@ bool_toString_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
bool_toString(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsBoolean, bool_toString_impl, args);
return CallNonGenericMethod<IsBoolean, bool_toString_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
bool_valueOf_impl(JSContext *cx, CallArgs args)
{
const Value &thisv = args.thisv();
@ -109,11 +109,11 @@ bool_valueOf_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
bool_valueOf(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsBoolean, bool_valueOf_impl, args);
return CallNonGenericMethod<IsBoolean, bool_valueOf_impl>(cx, args);
}
static JSFunctionSpec boolean_methods[] = {

View File

@ -1440,7 +1440,7 @@ GetCachedLocalTime(JSContext *cx, JSObject *obj, double *time)
return true;
}
static bool
JS_ALWAYS_INLINE bool
IsDate(const Value &v)
{
return v.isObject() && v.toObject().hasClass(&DateClass);
@ -1449,7 +1449,7 @@ IsDate(const Value &v)
/*
* See ECMA 15.9.5.4 thru 15.9.5.23
*/
static bool
JS_ALWAYS_INLINE bool
date_getTime_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1461,10 +1461,10 @@ static JSBool
date_getTime(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getTime_impl, args);
return CallNonGenericMethod<IsDate, date_getTime_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_getYear_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1489,10 +1489,10 @@ static JSBool
date_getYear(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getYear_impl, args);
return CallNonGenericMethod<IsDate, date_getYear_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_getFullYear_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1509,10 +1509,10 @@ static JSBool
date_getFullYear(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getFullYear_impl, args);
return CallNonGenericMethod<IsDate, date_getFullYear_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_getUTCFullYear_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1529,10 +1529,10 @@ static JSBool
date_getUTCFullYear(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getUTCFullYear_impl, args);
return CallNonGenericMethod<IsDate, date_getUTCFullYear_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_getMonth_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1549,10 +1549,10 @@ static JSBool
date_getMonth(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getMonth_impl, args);
return CallNonGenericMethod<IsDate, date_getMonth_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_getUTCMonth_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1566,10 +1566,10 @@ static JSBool
date_getUTCMonth(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getUTCMonth_impl, args);
return CallNonGenericMethod<IsDate, date_getUTCMonth_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_getDate_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1586,10 +1586,10 @@ static JSBool
date_getDate(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getDate_impl, args);
return CallNonGenericMethod<IsDate, date_getDate_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_getUTCDate_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1606,10 +1606,10 @@ static JSBool
date_getUTCDate(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getUTCDate_impl, args);
return CallNonGenericMethod<IsDate, date_getUTCDate_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_getDay_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1626,10 +1626,10 @@ static JSBool
date_getDay(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getDay_impl, args);
return CallNonGenericMethod<IsDate, date_getDay_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_getUTCDay_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1646,10 +1646,10 @@ static JSBool
date_getUTCDay(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getUTCDay_impl, args);
return CallNonGenericMethod<IsDate, date_getUTCDay_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_getHours_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1666,10 +1666,10 @@ static JSBool
date_getHours(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getHours_impl, args);
return CallNonGenericMethod<IsDate, date_getHours_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_getUTCHours_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1686,10 +1686,10 @@ static JSBool
date_getUTCHours(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getUTCHours_impl, args);
return CallNonGenericMethod<IsDate, date_getUTCHours_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_getMinutes_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1706,10 +1706,10 @@ static JSBool
date_getMinutes(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getMinutes_impl, args);
return CallNonGenericMethod<IsDate, date_getMinutes_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_getUTCMinutes_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1726,12 +1726,12 @@ static JSBool
date_getUTCMinutes(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getUTCMinutes_impl, args);
return CallNonGenericMethod<IsDate, date_getUTCMinutes_impl>(cx, args);
}
/* Date.getSeconds is mapped to getUTCSeconds */
static bool
JS_ALWAYS_INLINE bool
date_getUTCSeconds_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1748,12 +1748,12 @@ static JSBool
date_getUTCSeconds(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getUTCSeconds_impl, args);
return CallNonGenericMethod<IsDate, date_getUTCSeconds_impl>(cx, args);
}
/* Date.getMilliseconds is mapped to getUTCMilliseconds */
static bool
JS_ALWAYS_INLINE bool
date_getUTCMilliseconds_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1770,10 +1770,10 @@ static JSBool
date_getUTCMilliseconds(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getUTCMilliseconds_impl, args);
return CallNonGenericMethod<IsDate, date_getUTCMilliseconds_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_getTimezoneOffset_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1799,10 +1799,10 @@ static JSBool
date_getTimezoneOffset(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_getTimezoneOffset_impl, args);
return CallNonGenericMethod<IsDate, date_getTimezoneOffset_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_setTime_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1824,7 +1824,7 @@ static JSBool
date_setTime(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_setTime_impl, args);
return CallNonGenericMethod<IsDate, date_setTime_impl>(cx, args);
}
static bool
@ -1858,7 +1858,7 @@ GetMinsOrDefault(JSContext *cx, const CallArgs &args, unsigned i, double t, doub
}
/* ES5 15.9.5.28. */
static bool
JS_ALWAYS_INLINE bool
date_setMilliseconds_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1885,11 +1885,11 @@ static JSBool
date_setMilliseconds(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_setMilliseconds_impl, args);
return CallNonGenericMethod<IsDate, date_setMilliseconds_impl>(cx, args);
}
/* ES5 15.9.5.29. */
static bool
JS_ALWAYS_INLINE bool
date_setUTCMilliseconds_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1916,11 +1916,11 @@ static JSBool
date_setUTCMilliseconds(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_setUTCMilliseconds_impl, args);
return CallNonGenericMethod<IsDate, date_setUTCMilliseconds_impl>(cx, args);
}
/* ES5 15.9.5.30. */
static bool
JS_ALWAYS_INLINE bool
date_setSeconds_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1955,10 +1955,10 @@ static JSBool
date_setSeconds(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_setSeconds_impl, args);
return CallNonGenericMethod<IsDate, date_setSeconds_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_setUTCSeconds_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -1993,10 +1993,10 @@ static JSBool
date_setUTCSeconds(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_setUTCSeconds_impl, args);
return CallNonGenericMethod<IsDate, date_setUTCSeconds_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_setMinutes_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2036,10 +2036,10 @@ static JSBool
date_setMinutes(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_setMinutes_impl, args);
return CallNonGenericMethod<IsDate, date_setMinutes_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_setUTCMinutes_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2079,10 +2079,10 @@ static JSBool
date_setUTCMinutes(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_setUTCMinutes_impl, args);
return CallNonGenericMethod<IsDate, date_setUTCMinutes_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_setHours_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2127,10 +2127,10 @@ static JSBool
date_setHours(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_setHours_impl, args);
return CallNonGenericMethod<IsDate, date_setHours_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_setUTCHours_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2175,10 +2175,10 @@ static JSBool
date_setUTCHours(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_setUTCHours_impl, args);
return CallNonGenericMethod<IsDate, date_setUTCHours_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_setDate_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2208,10 +2208,10 @@ static JSBool
date_setDate(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_setDate_impl, args);
return CallNonGenericMethod<IsDate, date_setDate_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_setUTCDate_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2240,7 +2240,7 @@ static JSBool
date_setUTCDate(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_setUTCDate_impl, args);
return CallNonGenericMethod<IsDate, date_setUTCDate_impl>(cx, args);
}
static bool
@ -2264,7 +2264,7 @@ GetMonthOrDefault(JSContext *cx, const CallArgs &args, unsigned i, double t, dou
}
/* ES5 15.9.5.38. */
static bool
JS_ALWAYS_INLINE bool
date_setMonth_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2298,11 +2298,11 @@ static JSBool
date_setMonth(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_setMonth_impl, args);
return CallNonGenericMethod<IsDate, date_setMonth_impl>(cx, args);
}
/* ES5 15.9.5.39. */
static bool
JS_ALWAYS_INLINE bool
date_setUTCMonth_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2336,7 +2336,7 @@ static JSBool
date_setUTCMonth(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_setUTCMonth_impl, args);
return CallNonGenericMethod<IsDate, date_setUTCMonth_impl>(cx, args);
}
static double
@ -2356,7 +2356,7 @@ ThisUTCTimeOrZero(Handle<JSObject*> date)
}
/* ES5 15.9.5.40. */
static bool
JS_ALWAYS_INLINE bool
date_setFullYear_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2395,11 +2395,11 @@ static JSBool
date_setFullYear(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_setFullYear_impl, args);
return CallNonGenericMethod<IsDate, date_setFullYear_impl>(cx, args);
}
/* ES5 15.9.5.41. */
static bool
JS_ALWAYS_INLINE bool
date_setUTCFullYear_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2438,11 +2438,11 @@ static JSBool
date_setUTCFullYear(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_setUTCFullYear_impl, args);
return CallNonGenericMethod<IsDate, date_setUTCFullYear_impl>(cx, args);
}
/* ES5 Annex B.2.5. */
static bool
JS_ALWAYS_INLINE bool
date_setYear_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2482,7 +2482,7 @@ static JSBool
date_setYear(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_setYear_impl, args);
return CallNonGenericMethod<IsDate, date_setYear_impl>(cx, args);
}
/* constants for toString, toUTCString */
@ -2528,7 +2528,7 @@ print_iso_string(char* buf, size_t size, double utctime)
}
/* ES5 B.2.6. */
static bool
JS_ALWAYS_INLINE bool
date_toGMTString_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2553,10 +2553,10 @@ static JSBool
date_toGMTString(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_toGMTString_impl, args);
return CallNonGenericMethod<IsDate, date_toGMTString_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_toISOString_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2582,7 +2582,7 @@ static JSBool
date_toISOString(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_toISOString_impl, args);
return CallNonGenericMethod<IsDate, date_toISOString_impl>(cx, args);
}
/* ES5 15.9.5.44. */
@ -2838,7 +2838,7 @@ ToLocaleStringHelper(JSContext *cx, CallReceiver call, Handle<JSObject*> thisObj
}
/* ES5 15.9.5.5. */
static bool
JS_ALWAYS_INLINE bool
date_toLocaleString_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2851,11 +2851,11 @@ static JSBool
date_toLocaleString(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_toLocaleString_impl, args);
return CallNonGenericMethod<IsDate, date_toLocaleString_impl>(cx, args);
}
/* ES5 15.9.5.6. */
static bool
JS_ALWAYS_INLINE bool
date_toLocaleDateString_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2880,11 +2880,11 @@ static JSBool
date_toLocaleDateString(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_toLocaleDateString_impl, args);
return CallNonGenericMethod<IsDate, date_toLocaleDateString_impl>(cx, args);
}
/* ES5 15.9.5.7. */
static bool
JS_ALWAYS_INLINE bool
date_toLocaleTimeString_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2897,10 +2897,10 @@ static JSBool
date_toLocaleTimeString(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_toLocaleTimeString_impl, args);
return CallNonGenericMethod<IsDate, date_toLocaleTimeString_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_toLocaleFormat_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2926,11 +2926,11 @@ static JSBool
date_toLocaleFormat(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_toLocaleFormat_impl, args);
return CallNonGenericMethod<IsDate, date_toLocaleFormat_impl>(cx, args);
}
/* ES5 15.9.5.4. */
static bool
JS_ALWAYS_INLINE bool
date_toTimeString_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2943,11 +2943,11 @@ static JSBool
date_toTimeString(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_toTimeString_impl, args);
return CallNonGenericMethod<IsDate, date_toTimeString_impl>(cx, args);
}
/* ES5 15.9.5.3. */
static bool
JS_ALWAYS_INLINE bool
date_toDateString_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2960,11 +2960,11 @@ static JSBool
date_toDateString(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_toDateString_impl, args);
return CallNonGenericMethod<IsDate, date_toDateString_impl>(cx, args);
}
#if JS_HAS_TOSOURCE
static bool
JS_ALWAYS_INLINE bool
date_toSource_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -2988,11 +2988,11 @@ static JSBool
date_toSource(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_toSource_impl, args);
return CallNonGenericMethod<IsDate, date_toSource_impl>(cx, args);
}
#endif
static bool
JS_ALWAYS_INLINE bool
date_toString_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -3004,10 +3004,10 @@ static JSBool
date_toString(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_toString_impl, args);
return CallNonGenericMethod<IsDate, date_toString_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
date_valueOf_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsDate(args.thisv()));
@ -3022,7 +3022,7 @@ static JSBool
date_valueOf(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsDate, date_valueOf_impl, args);
return CallNonGenericMethod<IsDate, date_valueOf_impl>(cx, args);
}
static JSFunctionSpec date_static_methods[] = {

View File

@ -751,13 +751,13 @@ Iterator(JSContext *cx, unsigned argc, Value *vp)
return true;
}
static bool
JS_ALWAYS_INLINE bool
IsIterator(const Value &v)
{
return v.isObject() && v.toObject().hasClass(&PropertyIteratorObject::class_);
}
static bool
JS_ALWAYS_INLINE bool
iterator_next_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsIterator(args.thisv()));
@ -783,11 +783,11 @@ iterator_iterator(JSContext *cx, unsigned argc, Value *vp)
return true;
}
static JSBool
JSBool
iterator_next(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsIterator, iterator_next_impl, args);
return CallNonGenericMethod<IsIterator, iterator_next_impl>(cx, args);
}
static JSFunctionSpec iterator_methods[] = {
@ -1589,13 +1589,13 @@ CloseGenerator(JSContext *cx, JSObject *obj)
return SendToGenerator(cx, JSGENOP_CLOSE, obj, gen, UndefinedValue());
}
static bool
JS_ALWAYS_INLINE bool
IsGenerator(const Value &v)
{
return v.isObject() && v.toObject().hasClass(&GeneratorClass);
}
static bool
JS_ALWAYS_INLINE bool
generator_send_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsGenerator(args.thisv()));
@ -1625,14 +1625,14 @@ generator_send_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
generator_send(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsGenerator, generator_send_impl, args);
return CallNonGenericMethod<IsGenerator, generator_send_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
generator_next_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsGenerator(args.thisv()));
@ -1652,14 +1652,14 @@ generator_next_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
generator_next(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsGenerator, generator_next_impl, args);
return CallNonGenericMethod<IsGenerator, generator_next_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
generator_throw_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsGenerator(args.thisv()));
@ -1683,14 +1683,14 @@ generator_throw_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
generator_throw(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsGenerator, generator_throw_impl, args);
return CallNonGenericMethod<IsGenerator, generator_throw_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
generator_close_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsGenerator(args.thisv()));
@ -1717,11 +1717,11 @@ generator_close_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
generator_close(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsGenerator, generator_close_impl, args);
return CallNonGenericMethod<IsGenerator, generator_close_impl>(cx, args);
}
#define JSPROP_ROPERM (JSPROP_READONLY | JSPROP_PERMANENT)

View File

@ -463,7 +463,7 @@ Number(JSContext *cx, unsigned argc, Value *vp)
return true;
}
static bool
JS_ALWAYS_INLINE bool
IsNumber(const Value &v)
{
return v.isNumber() || (v.isObject() && v.toObject().hasClass(&NumberClass));
@ -478,7 +478,7 @@ Extract(const Value &v)
}
#if JS_HAS_TOSOURCE
static bool
JS_ALWAYS_INLINE bool
num_toSource_impl(JSContext *cx, CallArgs args)
{
double d = Extract(args.thisv());
@ -502,7 +502,7 @@ static JSBool
num_toSource(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsNumber, num_toSource_impl, args);
return CallNonGenericMethod<IsNumber, num_toSource_impl>(cx, args);
}
#endif
@ -593,7 +593,7 @@ IntToCString(ToCStringBuf *cbuf, int i, int base = 10)
static JSString * JS_FASTCALL
js_NumberToStringWithBase(JSContext *cx, double d, int base);
static bool
JS_ALWAYS_INLINE bool
num_toString_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsNumber(args.thisv()));
@ -626,10 +626,10 @@ static JSBool
num_toString(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsNumber, num_toString_impl, args);
return CallNonGenericMethod<IsNumber, num_toString_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
num_toLocaleString_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsNumber(args.thisv()));
@ -755,14 +755,14 @@ num_toLocaleString_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
num_toLocaleString(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsNumber, num_toLocaleString_impl, args);
return CallNonGenericMethod<IsNumber, num_toLocaleString_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
num_valueOf_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsNumber(args.thisv()));
@ -774,10 +774,9 @@ JSBool
js_num_valueOf(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsNumber, num_valueOf_impl, args);
return CallNonGenericMethod<IsNumber, num_valueOf_impl>(cx, args);
}
const unsigned MAX_PRECISION = 100;
static bool
@ -818,7 +817,7 @@ DToStrResult(JSContext *cx, double d, JSDToStrMode mode, int precision, CallArgs
* In the following three implementations, we allow a larger range of precision
* than ECMA requires; this is permitted by ECMA-262.
*/
static bool
JS_ALWAYS_INLINE bool
num_toFixed_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsNumber(args.thisv()));
@ -834,14 +833,14 @@ num_toFixed_impl(JSContext *cx, CallArgs args)
return DToStrResult(cx, Extract(args.thisv()), DTOSTR_FIXED, precision, args);
}
static JSBool
JSBool
num_toFixed(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsNumber, num_toFixed_impl, args);
return CallNonGenericMethod<IsNumber, num_toFixed_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
num_toExponential_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsNumber(args.thisv()));
@ -860,14 +859,14 @@ num_toExponential_impl(JSContext *cx, CallArgs args)
return DToStrResult(cx, Extract(args.thisv()), mode, precision + 1, args);
}
static JSBool
JSBool
num_toExponential(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsNumber, num_toExponential_impl, args);
return CallNonGenericMethod<IsNumber, num_toExponential_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
num_toPrecision_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsNumber(args.thisv()));
@ -898,11 +897,11 @@ num_toPrecision_impl(JSContext *cx, CallArgs args)
return DToStrResult(cx, d, mode, precision, args);
}
static JSBool
JSBool
num_toPrecision(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsNumber, num_toPrecision_impl, args);
return CallNonGenericMethod<IsNumber, num_toPrecision_impl>(cx, args);
}
static JSFunctionSpec number_methods[] = {

View File

@ -458,7 +458,7 @@ ThisToStringForStringProto(JSContext *cx, CallReceiver call)
return str;
}
static bool
JS_ALWAYS_INLINE bool
IsString(const Value &v)
{
return v.isString() || (v.isObject() && v.toObject().hasClass(&StringClass));
@ -484,7 +484,7 @@ str_quote(JSContext *cx, unsigned argc, Value *vp)
return true;
}
static bool
JS_ALWAYS_INLINE bool
str_toSource_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsString(args.thisv()));
@ -508,16 +508,16 @@ str_toSource_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
str_toSource(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsString, str_toSource_impl, args);
return CallNonGenericMethod<IsString, str_toSource_impl>(cx, args);
}
#endif /* JS_HAS_TOSOURCE */
static bool
JS_ALWAYS_INLINE bool
str_toString_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsString(args.thisv()));
@ -532,7 +532,7 @@ JSBool
js_str_toString(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsString, str_toString_impl, args);
return CallNonGenericMethod<IsString, str_toString_impl>(cx, args);
}
/*

View File

@ -116,13 +116,13 @@ getArrayBuffer(JSObject *obj)
return obj ? &obj->asArrayBuffer() : NULL;
}
static bool
JS_ALWAYS_INLINE bool
IsArrayBuffer(const Value &v)
{
return v.isObject() && v.toObject().hasClass(&ArrayBufferClass);
}
bool
JS_ALWAYS_INLINE bool
ArrayBufferObject::byteLengthGetterImpl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsArrayBuffer(args.thisv()));
@ -134,7 +134,7 @@ JSBool
ArrayBufferObject::byteLengthGetter(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsArrayBuffer, byteLengthGetterImpl, args);
return CallNonGenericMethod<IsArrayBuffer, byteLengthGetterImpl>(cx, args);
}
bool
@ -172,7 +172,7 @@ JSBool
ArrayBufferObject::fun_slice(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsArrayBuffer, fun_slice_impl, args);
return CallNonGenericMethod<IsArrayBuffer, fun_slice_impl>(cx, args);
}
/*
@ -315,7 +315,7 @@ JSBool
ArrayBufferObject::createDataViewForThis(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsArrayBuffer, createDataViewForThisImpl, args);
return CallNonGenericMethod<IsArrayBuffer, createDataViewForThisImpl>(cx, args);
}
void
@ -1423,7 +1423,8 @@ class TypedArrayTemplate
Getter(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsThisClass, GetterImpl<ValueGetter>, args);
return CallNonGenericMethod<ThisTypeArray::IsThisClass,
ThisTypeArray::GetterImpl<ValueGetter> >(cx, args);
}
// Define an accessor for a read-only property that invokes a native getter
@ -1498,7 +1499,7 @@ class TypedArrayTemplate
fun_subarray(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsThisClass, fun_subarray_impl, args);
return CallNonGenericMethod<ThisTypeArray::IsThisClass, ThisTypeArray::fun_subarray_impl>(cx, args);
}
/* move(begin, end, dest) */
@ -1561,7 +1562,7 @@ class TypedArrayTemplate
fun_move(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsThisClass, fun_move_impl, args);
return CallNonGenericMethod<ThisTypeArray::IsThisClass, ThisTypeArray::fun_move_impl>(cx, args);
}
/* set(array[, offset]) */
@ -1626,7 +1627,7 @@ class TypedArrayTemplate
fun_set(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsThisClass, fun_set_impl, args);
return CallNonGenericMethod<ThisTypeArray::IsThisClass, ThisTypeArray::fun_set_impl>(cx, args);
}
public:
@ -2114,7 +2115,7 @@ ArrayBufferObject::createTypedArrayFromBuffer(JSContext *cx, unsigned argc, Valu
{
typedef TypedArrayTemplate<T> ArrayType;
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsArrayBuffer, createTypedArrayFromBufferImpl<T>, args);
return CallNonGenericMethod<IsArrayBuffer, createTypedArrayFromBufferImpl<T> >(cx, args);
}
// this default implementation is only valid for integer types
@ -2460,7 +2461,7 @@ JSBool
DataViewObject::fun_getInt8(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, getInt8Impl, args);
return CallNonGenericMethod<is, getInt8Impl>(cx, args);
}
bool
@ -2481,7 +2482,7 @@ JSBool
DataViewObject::fun_getUint8(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, getUint8Impl, args);
return CallNonGenericMethod<is, getUint8Impl>(cx, args);
}
bool
@ -2502,7 +2503,7 @@ JSBool
DataViewObject::fun_getInt16(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, getInt16Impl, args);
return CallNonGenericMethod<is, getInt16Impl>(cx, args);
}
bool
@ -2523,7 +2524,7 @@ JSBool
DataViewObject::fun_getUint16(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, getUint16Impl, args);
return CallNonGenericMethod<is, getUint16Impl>(cx, args);
}
bool
@ -2544,7 +2545,7 @@ JSBool
DataViewObject::fun_getInt32(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, getInt32Impl, args);
return CallNonGenericMethod<is, getInt32Impl>(cx, args);
}
bool
@ -2565,7 +2566,7 @@ JSBool
DataViewObject::fun_getUint32(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, getUint32Impl, args);
return CallNonGenericMethod<is, getUint32Impl>(cx, args);
}
bool
@ -2587,7 +2588,7 @@ JSBool
DataViewObject::fun_getFloat32(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, getFloat32Impl, args);
return CallNonGenericMethod<is, getFloat32Impl>(cx, args);
}
bool
@ -2609,7 +2610,7 @@ JSBool
DataViewObject::fun_getFloat64(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, getFloat64Impl, args);
return CallNonGenericMethod<is, getFloat64Impl>(cx, args);
}
bool
@ -2629,7 +2630,7 @@ JSBool
DataViewObject::fun_setInt8(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, setInt8Impl, args);
return CallNonGenericMethod<is, setInt8Impl>(cx, args);
}
bool
@ -2649,7 +2650,7 @@ JSBool
DataViewObject::fun_setUint8(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, setUint8Impl, args);
return CallNonGenericMethod<is, setUint8Impl>(cx, args);
}
bool
@ -2669,7 +2670,7 @@ JSBool
DataViewObject::fun_setInt16(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, setInt16Impl, args);
return CallNonGenericMethod<is, setInt16Impl>(cx, args);
}
bool
@ -2689,7 +2690,7 @@ JSBool
DataViewObject::fun_setUint16(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, setUint16Impl, args);
return CallNonGenericMethod<is, setUint16Impl>(cx, args);
}
bool
@ -2709,7 +2710,7 @@ JSBool
DataViewObject::fun_setInt32(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, setInt32Impl, args);
return CallNonGenericMethod<is, setInt32Impl>(cx, args);
}
bool
@ -2729,7 +2730,7 @@ JSBool
DataViewObject::fun_setUint32(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, setUint32Impl, args);
return CallNonGenericMethod<is, setUint32Impl>(cx, args);
}
bool
@ -2749,7 +2750,7 @@ JSBool
DataViewObject::fun_setFloat32(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, setFloat32Impl, args);
return CallNonGenericMethod<is, setFloat32Impl>(cx, args);
}
bool
@ -2769,7 +2770,7 @@ JSBool
DataViewObject::fun_setFloat64(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, setFloat64Impl, args);
return CallNonGenericMethod<is, setFloat64Impl>(cx, args);
}
/***
@ -3217,7 +3218,7 @@ JSBool
DataViewObject::getter(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, is, getterImpl<ValueGetter>, args);
return CallNonGenericMethod<is, getterImpl<ValueGetter> >(cx, args);
}
template<Value ValueGetter(DataViewObject &view)>

View File

@ -118,13 +118,13 @@ GetKeyArg(JSContext *cx, CallArgs &args)
return JS_UnwrapObject(&key);
}
static bool
JS_ALWAYS_INLINE bool
IsWeakMap(const Value &v)
{
return v.isObject() && v.toObject().hasClass(&WeakMapClass);
}
static bool
JS_ALWAYS_INLINE bool
WeakMap_has_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsWeakMap(args.thisv()));
@ -149,14 +149,14 @@ WeakMap_has_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
WeakMap_has(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsWeakMap, WeakMap_has_impl, args);
return CallNonGenericMethod<IsWeakMap, WeakMap_has_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
WeakMap_get_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsWeakMap(args.thisv()));
@ -181,14 +181,14 @@ WeakMap_get_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
WeakMap_get(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsWeakMap, WeakMap_get_impl, args);
return CallNonGenericMethod<IsWeakMap, WeakMap_get_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
WeakMap_delete_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsWeakMap(args.thisv()));
@ -214,14 +214,14 @@ WeakMap_delete_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
WeakMap_delete(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsWeakMap, WeakMap_delete_impl, args);
return CallNonGenericMethod<IsWeakMap, WeakMap_delete_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
WeakMap_set_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsWeakMap(args.thisv()));
@ -266,11 +266,11 @@ WeakMap_set_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
WeakMap_set(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsWeakMap, WeakMap_set_impl, args);
return CallNonGenericMethod<IsWeakMap, WeakMap_set_impl>(cx, args);
}
JS_FRIEND_API(JSBool)

View File

@ -2124,9 +2124,28 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
gfxRect fillRect =
forceRepeatToCoverTiles ? areaToFill : tileRect.Intersect(areaToFill);
ctx->NewPath();
ctx->Translate(tileRect.TopLeft());
// If we can snap the gradient tile and fill rects, do so, but make sure
// that the gradient is scaled precisely to the tile rect.
gfxRect fillRectSnapped = fillRect;
// Don't snap the tileRect directly since that would lose information
// about the orientation of the current transform (i.e. vertical or
// horizontal flipping). Instead snap the corners independently so if
// the CTM has a flip, our Scale() below preserves the flip.
gfxPoint tileRectSnappedTopLeft = tileRect.TopLeft();
gfxPoint tileRectSnappedBottomRight = tileRect.BottomRight();
if (ctx->UserToDevicePixelSnapped(fillRectSnapped, true) &&
ctx->UserToDevicePixelSnapped(tileRectSnappedTopLeft, true) &&
ctx->UserToDevicePixelSnapped(tileRectSnappedBottomRight, true)) {
ctx->IdentityMatrix();
ctx->Rectangle(fillRectSnapped);
ctx->Translate(tileRectSnappedTopLeft);
ctx->Scale((tileRectSnappedBottomRight.x - tileRectSnappedTopLeft.x)/tileRect.width,
(tileRectSnappedBottomRight.y - tileRectSnappedTopLeft.y)/tileRect.height);
} else {
ctx->Rectangle(fillRect);
ctx->Translate(tileRect.TopLeft());
}
ctx->SetPattern(gradientPattern);
ctx->Rectangle(fillRect - tileRect.TopLeft(), true);
ctx->Fill();
ctx->SetMatrix(ctm);
}

View File

@ -0,0 +1,2 @@
<!DOCTYPE HTML>
<div style="height:100px; background:-moz-linear-gradient(bottom, black, white);"></div>

View File

@ -0,0 +1,2 @@
<!DOCTYPE HTML>
<div style="height:100px; background:-moz-linear-gradient(top, black, white); transform:scale(1,-1);"></div>

View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<style>
div {
margin-top: 21px;
height: 30px;
background-image: -moz-linear-gradient(center top, black, white);
}
</style>
</head>
<body>
<div></div>
</body>
</html>

View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<style>
div {
margin-top: 20.7px;
height: 30px;
background-image: -moz-linear-gradient(center top, black, white);
}
</style>
</head>
<body>
<div></div>
</body>
</html>

View File

@ -21,6 +21,7 @@ fuzzy-if(!contentSameGfxBackendAsCanvas,1,92400) fails-if(Android) == linear-mix
== linear-diagonal-7a.html linear-diagonal-7-ref.html
== linear-diagonal-8a.html linear-diagonal-8-ref.html
== linear-diagonal-9a.html linear-diagonal-9-ref.html
fuzzy(1,800000) == linear-flipped-1.html linear-flipped-1-ref.html
== linear-position-1a.html linear-position-1-ref.html
== linear-repeat-1a.html linear-repeat-1-ref.html
fails-if(d2d) == linear-repeat-1b.html linear-repeat-1-ref.html # bug 582236
@ -41,6 +42,7 @@ fuzzy-if(!contentSameGfxBackendAsCanvas,1,88500) fails-if(Android) == linear-ver
fuzzy-if(!contentSameGfxBackendAsCanvas,1,88500) fails-if(Android) == linear-vertical-1c.html linear-vertical-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,1,88500) fails-if(Android) == linear-vertical-1d.html linear-vertical-1-ref.html
fuzzy-if(!contentSameGfxBackendAsCanvas,1,88500) fails-if(Android) == linear-vertical-1e.html linear-vertical-1-ref.html
== linear-vertical-subpixel-1.html linear-vertical-subpixel-1-ref.html
== linear-viewport.html linear-viewport-ref.html
== linear-zero-length-1a.html linear-zero-length-1-ref.html
== linear-zero-length-1b.html linear-zero-length-1-ref.html

View File

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<script>
function tweak() {
document.body.offsetTop;
var feImage = document.getElementsByTagName("feImage")[0];
feImage.setAttribute('filter', 'url(#f1)')
document.body.offsetTop;
var child = document.createElementNS('http://www.w3.org/2000/svg', 'g')
feImage.appendChild(child);
}
</script>
</head>
<body onload="tweak()">
<svg xmlns="http://www.w3.org/2000/svg">
<filter filterUnits="userSpaceOnUse" id="f1">
<feImage/>
</filter>
<rect height="100" width="100"/>
</svg>
</body>
</html>

View File

@ -131,5 +131,6 @@ load 740627-2.svg
load 757704-1.svg
load 757718-1.svg
load 768351.svg
load 780963-1.html
load 757751-1.svg

View File

@ -86,8 +86,8 @@ class GeckoInputConnection
private static final Timer mIMETimer = new Timer("GeckoInputConnection Timer");
private static int mIMEState;
private static String mIMETypeHint;
private static String mIMEActionHint;
private static String mIMETypeHint = "";
private static String mIMEActionHint = "";
private String mCurrentInputMethod;
@ -112,8 +112,6 @@ class GeckoInputConnection
mEditable = Editable.Factory.getInstance().newEditable("");
spanAndSelectEditable();
mIMEState = IME_STATE_DISABLED;
mIMETypeHint = "";
mIMEActionHint = "";
}
@Override
@ -819,8 +817,11 @@ class GeckoInputConnection
outAttrs.imeOptions = EditorInfo.IME_ACTION_SEARCH;
else if (mIMEActionHint.equalsIgnoreCase("send"))
outAttrs.imeOptions = EditorInfo.IME_ACTION_SEND;
else if (mIMEActionHint != null && mIMEActionHint.length() != 0)
else if (mIMEActionHint.length() > 0) {
if (DEBUG)
Log.w(LOGTAG, "Unexpected mIMEActionHint=\"" + mIMEActionHint + "\"");
outAttrs.actionLabel = mIMEActionHint;
}
GeckoApp app = GeckoApp.mAppContext;
DisplayMetrics metrics = app.getResources().getDisplayMetrics();
@ -1032,6 +1033,12 @@ class GeckoInputConnection
if (DEBUG) Log.d(LOGTAG, ". . . notifyIME: focus");
IMEStateUpdater.resetIME();
break;
case NOTIFY_IME_SETOPENSTATE:
default:
if (DEBUG)
throw new IllegalArgumentException("Unexpected NOTIFY_IME=" + type);
break;
}
}
});
@ -1047,8 +1054,8 @@ class GeckoInputConnection
/* When IME is 'disabled', IME processing is disabled.
In addition, the IME UI is hidden */
mIMEState = state;
mIMETypeHint = typeHint;
mIMEActionHint = actionHint;
mIMETypeHint = (typeHint == null) ? "" : typeHint;
mIMEActionHint = (actionHint == null) ? "" : actionHint;
IMEStateUpdater.enableIME();
}
});
@ -1442,10 +1449,20 @@ private static final class DebugGeckoInputConnection extends GeckoInputConnectio
@Override
public void notifyIME(int type, int state) {
Log.d(LOGTAG, String.format("IME: >notifyIME(type=%d, state=%d)", type, state));
Log.d(LOGTAG, "IME: >notifyIME(type=" + type + ", state=" + state + ")");
GeckoApp.assertOnGeckoThread();
super.notifyIME(type, state);
}
@Override
public void notifyIMEEnabled(int state, String typeHint, String actionHint) {
Log.d(LOGTAG, "IME: >notifyIMEEnabled(state=" + state + ", typeHint=\"" + typeHint
+ "\", actionHint=\"" + actionHint + "\"");
GeckoApp.assertOnGeckoThread();
if (state < IME_STATE_DISABLED || state > IME_STATE_PLUGIN)
throw new IllegalArgumentException("Unexpected IMEState=" + state);
super.notifyIMEEnabled(state, typeHint, actionHint);
}
}
}

View File

@ -413,6 +413,14 @@ public class SyncAccounts {
ContentResolver.setSyncAutomatically(account, authority, syncAutomatically);
}
public static void backgroundSetSyncAutomatically(final Account account, final boolean syncAutomatically) {
ThreadPool.run(new Runnable() {
@Override
public void run() {
setSyncAutomatically(account, syncAutomatically);
}
});
}
/**
* Bug 721760: try to start a vendor-specific Accounts & Sync activity on Moto
* Blur devices.

View File

@ -88,6 +88,7 @@ public class SyncAdapter extends AbstractThreadedSyncAdapter implements GlobalSe
/**
* Handle an exception: update stats, invalidate auth token, log errors, etc.
* Wakes up sleeping threads by calling notifyMonitor().
*
* @param globalSession
* current global session, or null.
@ -164,10 +165,18 @@ public class SyncAdapter extends AbstractThreadedSyncAdapter implements GlobalSe
return;
}
// Bug 755638 - Uncaught SecurityException when attempting to sync multiple Fennecs
// to the same Sync account.
// Uncheck Sync checkbox because we cannot sync this instance.
if (e instanceof SecurityException) {
Logger.error(LOG_TAG, "SecurityException, multiple Fennecs. Disabling this instance.", e);
SyncAccounts.backgroundSetSyncAutomatically(localAccount, false);
return;
}
// Generic exception.
Logger.error(LOG_TAG, "Unknown exception. Aborting sync.", e);
} catch (Exception ex) {
Logger.error(LOG_TAG, "Unknown exception. Aborting sync.", e);
} finally {
notifyMonitor();
}
}
@ -345,7 +354,6 @@ public class SyncAdapter extends AbstractThreadedSyncAdapter implements GlobalSe
username, password, prefsPath, serverURL, syncKey);
} catch (Exception e) {
self.processException(null, e);
notifyMonitor();
return;
}
}
@ -479,7 +487,6 @@ public class SyncAdapter extends AbstractThreadedSyncAdapter implements GlobalSe
public void handleError(GlobalSession globalSession, Exception ex) {
Logger.info(LOG_TAG, "GlobalSession indicated error.");
this.processException(globalSession, ex);
notifyMonitor();
}
@Override

View File

@ -89,6 +89,7 @@ nsHttpTransaction::nsHttpTransaction()
, mCaps(0)
, mClassification(CLASS_GENERAL)
, mPipelinePosition(0)
, mHttpVersion(NS_HTTP_VERSION_UNKNOWN)
, mClosed(false)
, mConnected(false)
, mHaveStatusLine(false)
@ -1178,6 +1179,10 @@ nsHttpTransaction::HandleContentStart()
LOG3(("]\n"));
}
#endif
// Save http version, mResponseHead isn't available anymore after
// TakeResponseHead() is called
mHttpVersion = mResponseHead->Version();
// notify the connection, give it a chance to cause a reset.
bool reset = false;
if (!mRestartInProgressVerifier.IsSetup())
@ -1301,7 +1306,8 @@ nsHttpTransaction::HandleContent(char *buf,
// headers. So, unless the connection is persistent, we must make
// allowances for a possibly invalid Content-Length header. Thus, if
// NOT persistent, we simply accept everything in |buf|.
if (mConnection->IsPersistent() || mPreserveStream) {
if (mConnection->IsPersistent() || mPreserveStream ||
mHttpVersion >= NS_HTTP_VERSION_1_1) {
PRInt64 remaining = mContentLength - mContentRead;
*contentRead = PRUint32(NS_MIN<PRInt64>(count, remaining));
*contentRemaining = count - *contentRead;

View File

@ -177,6 +177,8 @@ private:
PRInt32 mPipelinePosition;
PRInt64 mMaxPipelineObjectSize;
nsHttpVersion mHttpVersion;
// state flags, all logically boolean, but not packed together into a
// bitfield so as to avoid bitfield-induced races. See bug 560579.
bool mClosed;

View File

@ -587,7 +587,7 @@ nsHtml5Parser::IsScriptCreated()
void
nsHtml5Parser::ParseUntilBlocked()
{
if (mBlocked || mExecutor->IsComplete() || mExecutor->IsBroken()) {
if (mBlocked || mExecutor->IsComplete() || NS_FAILED(mExecutor->IsBroken())) {
return;
}
NS_ASSERTION(mExecutor->HasStarted(), "Bad life cycle.");

View File

@ -1412,7 +1412,7 @@ nsHtml5StreamParser::ContinueAfterScripts(nsHtml5Tokenizer* aTokenizer,
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
NS_ASSERTION(!(mMode == VIEW_SOURCE_HTML || mMode == VIEW_SOURCE_XML),
"ContinueAfterScripts called in view source mode!");
if (mExecutor->IsBroken()) {
if (NS_FAILED(mExecutor->IsBroken())) {
return;
}
#ifdef DEBUG

View File

@ -146,7 +146,7 @@ nsHtml5TreeOpExecutor::DidBuildModel(bool aTerminated)
// This comes from nsXMLContentSink and nsHTMLContentSink
// If this parser has been marked as broken, treat the end of parse as
// forced termination.
DidBuildModelImpl(aTerminated || IsBroken());
DidBuildModelImpl(aTerminated || NS_FAILED(IsBroken()));
if (!mLayoutStarted) {
// We never saw the body, and layout never got started. Force
@ -480,7 +480,7 @@ nsHtml5TreeOpExecutor::RunFlushLoop()
return;
}
if (IsBroken()) {
if (NS_FAILED(IsBroken())) {
return;
}
@ -936,7 +936,7 @@ nsHtml5TreeOpExecutor::Reset()
mFlushState = eNotFlushing;
mRunFlushLoopOnStack = false;
MOZ_ASSERT(!mReadingFromStage);
MOZ_ASSERT(!mBroken);
MOZ_ASSERT(NS_SUCCEEDED(mBroken));
}
void

View File

@ -286,6 +286,7 @@ class Emulator(object):
def _save_logcat_proc(self, filename, cmd):
self.logcat_proc = LogcatProc(filename, cmd)
self.logcat_proc.run()
self.logcat_proc.processOutput()
self.logcat_proc.waitForFinish()
self.logcat_proc = None

View File

@ -14,7 +14,6 @@ import socket
import sys
import time
import platform
import datazilla
import xml.dom.minidom as dom
try:
@ -107,7 +106,8 @@ class MarionetteTextTestRunner(unittest.TextTestRunner):
timeTaken = stopTime - startTime
result.printErrors()
result.printLogs(test)
result.getPerfData(test)
if options.perf:
result.getPerfData(test)
if hasattr(result, 'separator2'):
self.stream.writeln(result.separator2)
run = result.testsRun
@ -359,6 +359,7 @@ class MarionetteTestRunner(object):
manifest = TestManifest()
manifest.read(filepath)
if options.perf:
if options.perfserv is None:
options.perfserv = manifest.get("perfserv")[0]
@ -604,6 +605,9 @@ if __name__ == "__main__":
if options.emulator and not options.logcat_dir:
options.logcat_dir = 'logcat'
if options.perf:
import datazilla
# check for valid resolution string, strip whitespaces
try:
dims = options.emulator_res.split('x')

View File

@ -11,7 +11,8 @@ except (OSError, IOError):
description = ''
# dependencies
deps = ['manifestdestiny', 'mozhttpd >= 0.3', 'mozrunner', 'datazilla == 0.2.1']
deps = ['manifestdestiny', 'mozhttpd >= 0.3',
'mozprocess == 0.5', 'mozrunner == 5.10', 'datazilla == 0.2.1']
setup(name='marionette',
version=version,

View File

@ -27,6 +27,7 @@ const TELEMETRY_DELAY = 60000;
const PR_WRONLY = 0x2;
const PR_CREATE_FILE = 0x8;
const PR_TRUNCATE = 0x20;
const PR_EXCL = 0x80;
const RW_OWNER = 0600;
const RWX_OWNER = 0700;
@ -811,24 +812,31 @@ TelemetryPing.prototype = {
},
finishTelemetrySave: function finishTelemetrySave(ok, stream) {
stream.QueryInterface(Ci.nsISafeOutputStream).finish();
stream.close();
if (this._doLoadSaveNotifications && ok) {
Services.obs.notifyObservers(null, "telemetry-test-save-complete", null);
}
},
savePingToFile: function savePingToFile(ping, file, sync) {
savePingToFile: function savePingToFile(ping, file, sync, overwrite) {
let pingString = JSON.stringify(ping);
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
.createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
let ostream = Cc["@mozilla.org/network/safe-file-output-stream;1"]
let ostream = Cc["@mozilla.org/network/file-output-stream;1"]
.createInstance(Ci.nsIFileOutputStream);
ostream.init(file, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE,
RW_OWNER, ostream.DEFER_OPEN);
let initFlags = PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE;
if (!overwrite) {
initFlags |= PR_EXCL;
}
try {
ostream.init(file, initFlags, RW_OWNER, ostream.DEFER_OPEN);
} catch (e) {
// Probably due to PR_EXCL.
return;
}
if (sync) {
let utf8String = converter.ConvertFromUnicode(pingString);
@ -886,19 +894,22 @@ TelemetryPing.prototype = {
return file;
},
savePing: function savePing(ping) {
this.savePingToFile(ping, this.saveFileForPing(ping), true);
savePing: function savePing(ping, overwrite) {
this.savePingToFile(ping, this.saveFileForPing(ping), true, overwrite);
},
savePendingPings: function savePendingPings() {
this._pendingPings.push(this.getCurrentSessionPayloadAndSlug("saved-session"));
this._pendingPings.forEach(function sppcb(e, i, a) { this.savePing(e); }, this);
let sessionPing = this.getCurrentSessionPayloadAndSlug("saved-session");
this.savePing(sessionPing, true);
this._pendingPings.forEach(function sppcb(e, i, a) {
this.savePing(e, false);
}, this);
this._pendingPings = [];
},
saveHistograms: function saveHistograms(file, sync) {
this.savePingToFile(this.getCurrentSessionPayloadAndSlug("saved-session"),
file, sync);
file, sync, true);
},
/**

View File

@ -16,23 +16,8 @@ function end_test() {
add_test(function() {
info("Testing compatibility checking warning");
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
var version = "nightly";
}
else {
version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1");
}
var pref = "extensions.checkCompatibility." + version;
info("Setting " + pref + " pref to false")
Services.prefs.setBoolPref(pref, false);
info("Setting checkCompatibility to false");
AddonManager.checkCompatibility = false;
open_manager("addons://list/extension", function(aWindow) {
var hbox = aWindow.document.querySelector("#list-view hbox.global-warning-checkcompatibility");
@ -42,7 +27,7 @@ add_test(function() {
info("Clicking 'Enable' button");
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
is(Services.prefs.prefHasUserValue(pref), false, "Check Compatibility pref should be cleared");
is(AddonManager.checkCompatibility, true, "Check Compatibility pref should be cleared");
is_element_hidden(hbox, "Check Compatibility warning hbox should be hidden");
is_element_hidden(button, "Check Compatibility warning button should be hidden");

View File

@ -19,22 +19,6 @@ var gProvider;
var gServer;
var gAddonInstalled = false;
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
var version = "nightly";
}
else {
version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1");
}
const COMPATIBILITY_PREF = "extensions.checkCompatibility." + version;
function test() {
requestLongerTimeout(2);
// Turn on searching for this test
@ -603,16 +587,16 @@ add_test(function() {
// Tests that incompatible add-ons are shown with a warning if compatibility checking is disabled
add_test(function() {
Services.prefs.setBoolPref(COMPATIBILITY_PREF, false);
AddonManager.checkCompatibility = false;
search("incompatible", false, function() {
var item = get_addon_item("remote5");
is_element_visible(item, "Incompatible addon should be visible");
is(item.getAttribute("notification"), "warning", "Compatibility warning should be shown");
var item = get_addon_item("remote6");
item = get_addon_item("remote6");
is(item, null, "Addon incompatible with the product should not be visible");
Services.prefs.clearUserPref(COMPATIBILITY_PREF);
AddonManager.checkCompatibility = true;
run_next_test();
});
});

View File

@ -26,6 +26,16 @@ var gAddonsList;
var TEST_UNPACKED = false;
function isNightlyChannel() {
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
return channel != "aurora" && channel != "beta" && channel != "release" && channel != "esr";
}
function createAppInfo(id, name, version, platformVersion) {
gAppInfo = {
// nsIXULAppInfo

View File

@ -15,19 +15,6 @@ function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
} catch (e) { }
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
var version = "nightly";
} else {
version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1");
}
COMPATIBILITY_PREF = "extensions.checkCompatibility." + version;
// Create and configure the HTTP server.
gServer = new HttpServer();
gServer.registerDirectory("/data/", do_get_file("data"));
@ -84,7 +71,7 @@ function run_test_2() {
// Compatibility checking disabled.
function run_test_3() {
do_print("Testing with all compatibility checking disabled");
Services.prefs.setBoolPref(COMPATIBILITY_PREF, false);
AddonManager.checkCompatibility = false;
AddonRepository.searchAddons("test", 6, {
searchSucceeded: function(aAddons) {

View File

@ -5,21 +5,8 @@
// Disables security checking our updates which haven't been signed
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
// Disables compatibility checking
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", false);
}
else {
Services.prefs.setBoolPref("extensions.checkCompatibility.2", false);
}
AddonManager.checkCompatibility = false;
var ADDONS = [
"test_bug470377_1",

View File

@ -69,21 +69,8 @@ function run_test_1() {
}
function run_test_2() {
// Disable compatibility checks
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
AddonManager.checkCompatibility = false;
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", false);
}
else {
Services.prefs.setBoolPref("extensions.checkCompatibility.2.2", false);
}
restartManager();
AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",

View File

@ -68,21 +68,8 @@ function run_test_1() {
}
function run_test_2() {
// Disable compatibility checks
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
AddonManager.checkCompatibility = false;
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", false);
}
else {
Services.prefs.setBoolPref("extensions.checkCompatibility.2.2", false);
}
restartManager();
AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",

View File

@ -3,21 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
var checkCompatPref = "extensions.checkCompatibility.nightly";
}
else {
checkCompatPref = "extensions.checkCompatibility.2.1a";
}
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2.1a4", "2");
@ -55,8 +40,8 @@ function run_test() {
}
function run_test_1() {
// Disable compatibility checks
Services.prefs.setBoolPref(checkCompatPref, false);
AddonManager.checkCompatibility = false;
startupManager();
AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",
@ -81,8 +66,8 @@ function run_test_1() {
}
function run_test_2() {
// Enable compatibility checks
Services.prefs.setBoolPref(checkCompatPref, true);
AddonManager.checkCompatibility = true;
restartManager();
AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",

View File

@ -8,21 +8,12 @@ const ID = "bug521905@tests.mozilla.org";
// Disables security checking our updates which haven't been signed
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
// Disables compatibility checking
Services.prefs.setBoolPref("extensions.checkCompatibility.2.0pre", false);
AddonManager.checkCompatibility = false;
function run_test() {
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
// This test is only relevant on builds where the version is included in the
// checkCompatibility preference name
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
if (isNightlyChannel()) {
return;
}

View File

@ -69,15 +69,7 @@ function run_test() {
writeInstallRDFForExtension(a, profileDir);
});
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
}
catch (e) { }
gIsNightly = channel != "aurora" &&
channel != "beta" &&
channel != "release";
gIsNightly = isNightlyChannel();
startupManager();

View File

@ -128,13 +128,7 @@ function run_test() {
// AddonManager.checkCompatibility
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
} catch (e) { }
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
if (isNightlyChannel()) {
var version = "nightly";
} else {
version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1");

View File

@ -14,25 +14,10 @@ var testserver;
const profileDir = gProfD.clone();
profileDir.append("extensions");
var COMPATIBILITY_PREF;
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
} catch (e) { }
if (channel != "aurora" &&
channel != "beta" &&
channel != "release") {
var version = "nightly";
} else {
version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1");
}
COMPATIBILITY_PREF = "extensions.checkCompatibility." + version;
// Create and configure the HTTP server.
testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));
@ -174,7 +159,7 @@ function run_test_3() {
// Compatibility checking disabled.
function run_test_4() {
do_print("Testing with all compatibility checking disabled");
Services.prefs.setBoolPref(COMPATIBILITY_PREF, false);
AddonManager.checkCompatibility = false;
AddonManager.getAddonByID("compatmode-ignore@tests.mozilla.org", function(addon) {
do_check_neq(addon, null);
addon.findUpdates({

View File

@ -6,24 +6,12 @@
Components.utils.import("resource://gre/modules/AddonUpdateChecker.jsm");
var COMPATIBILITY_PREF;
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
var channel = "default";
try {
channel = Services.prefs.getCharPref("app.update.channel");
} catch (e) { }
if (channel != "aurora" && channel != "beta" && channel != "release")
var version = "nightly";
else
version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1");
COMPATIBILITY_PREF = "extensions.checkCompatibility." + version;
// Create and configure the HTTP server.
testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));

View File

@ -54,6 +54,7 @@ CPPSRCS += \
nsPrintSettingsQt.cpp \
nsPrintDialogQt.cpp \
nsDeviceContextSpecQt.cpp \
mozqglwidgetwrapper.cpp \
$(NULL)
EXPORTS = \

View File

@ -21,10 +21,20 @@ EXTRA_DSO_LDOPTS = \
$(MOZ_QT_LIBS) \
$(NULL)
LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/build
LOCAL_INCLUDES += \
-I$(topsrcdir)/xpcom/build \
-I$(topsrcdir)/widget/qt \
$(NULL)
GARBAGE += moziqwidget.h nsQAppInstance.h nsQAppInstance.cpp
export:: $(topsrcdir)/widget/qt/moziqwidget.h $(topsrcdir)/toolkit/xre/nsQAppInstance.h $(topsrcdir)/toolkit/xre/nsQAppInstance.cpp
EXPORT_SOURCES = \
$(topsrcdir)/widget/qt/moziqwidget.h \
$(topsrcdir)/toolkit/xre/nsQAppInstance.h \
$(topsrcdir)/toolkit/xre/nsQAppInstance.cpp \
$(topsrcdir)/widget/qt/mozqglwidgetwrapper.h \
$(topsrcdir)/widget/qt/mozqglwidgetwrapper.cpp
GARBAGE += $(EXPORT_SOURCES)
export:: $(EXPORT_SOURCES)
$(INSTALL) $^ .
MOCSRCS = \

View File

@ -10,7 +10,7 @@
#include <QApplication>
#include <QGraphicsWidget>
#include <QGraphicsView>
#include <QtOpenGL/QGLWidget>
#include "mozqglwidgetwrapper.h"
#include "nsCOMPtr.h"
@ -134,8 +134,8 @@ public:
void setGLWidgetEnabled(bool aEnabled)
{
if (aEnabled) {
mGLWidget = new QGLWidget();
setViewport(mGLWidget);
mGLWidget = new MozQGLWidgetWrapper();
mGLWidget->setViewport(this);
} else {
delete mGLWidget;
mGLWidget = 0;
@ -174,7 +174,7 @@ protected:
private:
MozQGraphicsViewEvents mEventHandler;
IMozQWidget* mTopLevelWidget;
QGLWidget* mGLWidget;
MozQGLWidgetWrapper* mGLWidget;
};
#ifdef MOZ_ENABLE_MEEGOTOUCH

View File

@ -0,0 +1,41 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=4 et sw=4 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozqglwidgetwrapper.h"
#include <QGraphicsView>
#include <QtOpenGL/QGLWidget>
#include <QtOpenGL/QGLContext>
MozQGLWidgetWrapper::MozQGLWidgetWrapper()
: mWidget(new QGLWidget())
{
}
MozQGLWidgetWrapper::~MozQGLWidgetWrapper()
{
delete mWidget;
}
void MozQGLWidgetWrapper::makeCurrent()
{
mWidget->makeCurrent();
}
void MozQGLWidgetWrapper::setViewport(QGraphicsView* aView)
{
aView->setViewport(mWidget);
}
bool MozQGLWidgetWrapper::hasGLContext(QGraphicsView* aView)
{
return aView && qobject_cast<QGLWidget*>(aView->viewport());
}
bool MozQGLWidgetWrapper::isRGBAContext()
{
QGLContext* context = const_cast<QGLContext*>(QGLContext::currentContext());
return context && context->format().alpha();
}

View File

@ -0,0 +1,30 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=4 et sw=4 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZQGLWIDGETWRAPPER_H
#define MOZQGLWIDGETWRAPPER_H
/*
* qgl.h and GLDefs.h has conflicts in type defines
* QGLWidget wrapper class helps to avoid including qgl.h with mozilla gl includes
*/
class QGLWidget;
class QGraphicsView;
class MozQGLWidgetWrapper
{
public:
MozQGLWidgetWrapper();
~MozQGLWidgetWrapper();
void makeCurrent();
void setViewport(QGraphicsView*);
static bool hasGLContext(QGraphicsView*);
static bool isRGBAContext();
private:
QGLWidget* mWidget;
};
#endif

View File

@ -6,12 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Util.h"
#include "BasicLayers.h"
#include <QtOpenGL/QGLWidget>
#include <QtOpenGL/QGLContext>
// Solve conflict of qgl.h and GLDefs.h
#define GLdouble_defined 1
#include <QApplication>
#include <QDesktopWidget>
#include <QtGui/QCursor>
@ -27,6 +22,7 @@
#include <QStyleOptionGraphicsItem>
#include <QPaintEngine>
#include <QMimeData>
#include "mozqglwidgetwrapper.h"
#include <QtCore/QDebug>
#include <QtCore/QEvent>
@ -106,6 +102,7 @@ static Atom sPluginIMEAtom = nullptr;
#endif //MOZ_X11
#include "Layers.h"
#include "BasicLayers.h"
#include "LayerManagerOGL.h"
#include "nsFastStartupQt.h"
@ -2581,8 +2578,7 @@ nsPopupWindow::~nsPopupWindow()
NS_IMETHODIMP_(bool)
nsWindow::HasGLContext()
{
QGraphicsView *view = qobject_cast<QGraphicsView*>(GetViewWidget());
return view && qobject_cast<QGLWidget*>(view->viewport());
return MozQGLWidgetWrapper::hasGLContext(qobject_cast<QGraphicsView*>(GetViewWidget()));
}
MozQWidget*
@ -3272,12 +3268,7 @@ nsWindow::GetGLFrameBufferFormat()
{
if (mLayerManager &&
mLayerManager->GetBackendType() == mozilla::layers::LAYERS_OPENGL) {
// On maemo the hardware fb has RGB format.
#ifdef MOZ_PLATFORM_MAEMO
return LOCAL_GL_RGB;
#else
return LOCAL_GL_RGBA;
#endif
return MozQGLWidgetWrapper::isRGBAContext() ? LOCAL_GL_RGBA : LOCAL_GL_RGB;
}
return LOCAL_GL_NONE;
}

View File

@ -1,6 +1,6 @@
skip-if(!cocoaWidget) != 507947.html about:blank
== progressbar-fallback-default-style.html progressbar-fallback-default-style-ref.html
== meter-native-style.html meter-native-style-ref.html
skip-if(!cocoaWidget) == meter-vertical-native-style.html meter-vertical-native-style-ref.html
fuzzy-if(Android,17,1120) == meter-native-style.html meter-native-style-ref.html
skip-if(!cocoaWidget) == meter-vertical-native-style.html meter-vertical-native-style-ref.html # dithering
== meter-fallback-default-style.html meter-fallback-default-style-ref.html
load 664925.xhtml