Merge last PGO-green changeset of mozilla-inbound to mozilla-central

This commit is contained in:
Ed Morley 2012-10-18 18:12:33 +01:00
commit 2663bfd658
101 changed files with 2671 additions and 443 deletions

View File

@ -1,6 +1,9 @@
"use strict";
// runapp.js:
// Provide a --runapp APPNAME command-line option.
let runAppObj;
window.addEventListener('load', function() {
// Get the command line arguments that were passed to the b2g client
let args = window.arguments[0].QueryInterface(Ci.nsICommandLine);
@ -13,27 +16,52 @@ window.addEventListener('load', function() {
// it was the last argument or the next argument starts with '-').
// However, someone could still explicitly pass an empty argument!
appname = args.handleFlagWithParam('runapp', false);
}
catch(e) {
} catch(e) {
// treat a missing parameter like an empty parameter (=> show usage)
appname = '';
}
// not specified, bail.
if (appname === null)
if (appname === null) {
return;
}
runAppObj = new AppRunner(appname);
Services.obs.addObserver(runAppObj, 'webapps-registry-ready', false);
});
window.addEventListener('unload', function() {
Services.obs.removeObserver(runAppObj, 'webapps-registry-ready');
});
function AppRunner(aName) {
this._req = null;
this._appName = aName;
}
AppRunner.prototype = {
observe: function(aSubject, aTopic, aData) {
if (aTopic == 'webapps-registry-ready') {
this.doRunApp();
}
},
doRunApp: function() {
// - Get the list of apps since the parameter was specified
this._req = navigator.mozApps.mgmt.getAll();
this._req.onsuccess = this.getAllSuccess.bind(this);
this._req.onerror = this.getAllError.bind(this);
},
getAllSuccess: function() {
let apps = this._req.result;
// - Get the list of apps since the parameter was specified
let appsReq = navigator.mozApps.mgmt.getAll();
appsReq.onsuccess = function() {
let apps = appsReq.result;
function findAppWithName(name) {
let normalizedSearchName = name.replace(/[- ]+/g, '').toLowerCase();
for (let i = 0; i < apps.length; i++) {
let app = apps[i];
let normalizedAppName =
app.manifest.name.replace(/[- ]+/g, '').toLowerCase();
app.manifest.name.replace(/[- ]+/g, '').toLowerCase();
if (normalizedSearchName === normalizedAppName) {
return app;
}
@ -59,14 +87,14 @@ window.addEventListener('load', function() {
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit);
}
if (appname === '') {
if (this._appName === '') {
usageAndDie();
return;
}
let app = findAppWithName(appname);
let app = findAppWithName(this._appName);
if (!app) {
dump('Could not find app: "' + appname + '". Maybe you meant one of:\n');
dump('Could not find app: "' + this._appName + '". Maybe you meant one of:\n');
usageAndDie(true);
return;
}
@ -74,11 +102,11 @@ window.addEventListener('load', function() {
let setReq =
navigator.mozSettings.createLock().set({'lockscreen.enabled': false});
setReq.onsuccess = function() {
// give the event loop another turn to disable the lock screen
// give the event loop 100ms to disable the lock screen
window.setTimeout(function() {
dump('--runapp launching app: ' + app.manifest.name + '\n');
app.launch();
}, 0);
}, 100);
};
setReq.onerror = function() {
dump('--runapp failed to disable lock-screen. Giving up.\n');
@ -86,8 +114,9 @@ window.addEventListener('load', function() {
dump('--runapp found app: ' + app.manifest.name +
', disabling lock screen...\n');
};
appsReq.onerror = function() {
dump('Problem getting the list of all apps!');
};
});
},
getAllError: function() {
dump('Problem getting the list of all apps!');
}
};

View File

@ -17,7 +17,7 @@
<script type="application/javascript" src="chrome://browser/content/settings.js"/>
<script type="application/javascript" src="chrome://browser/content/shell.js"/>
#ifndef ANDROID
#ifndef MOZ_WIDGET_GONK
<!-- this script handles the screen argument for desktop builds -->
<script type="application/javascript" src="chrome://browser/content/screen.js"/>
<!-- this script handles the "runapp" argument for desktop builds -->

View File

@ -20,6 +20,10 @@ function waitForInactive() {
}
function test() {
registerCleanupFunction(function() {
window.restore();
});
waitForExplicitFinish();
is(gBrowser.docShell.isActive, true, "Docshell should be active");
window.minimize();

View File

@ -50,6 +50,10 @@ if test -z "$MOZ_ARCH"; then
esac
fi
if test "$MOZ_ARCH" = "armv6" -a "$OS_TARGET" = "Android"; then
MOZ_FPU=vfp
fi
MOZ_ARG_WITH_STRING(thumb,
[ --with-thumb[[=yes|no|toolchain-default]]]
[ Use Thumb instruction set (-mthumb)],

View File

@ -1404,24 +1404,24 @@ class _NativeWrapper(_CommandWrapper):
pycommandpath, **kwargs):
_CommandWrapper.__init__(self, cline, ignoreErrors, loc, context,
**kwargs)
# get the module and method to call
parts, badchar = process.clinetoargv(cline, blacklist_gray=False)
if parts is None:
raise DataError("native command '%s': shell metacharacter '%s' in command line" % (cline, badchar), self.loc)
if len(parts) < 2:
raise DataError("native command '%s': no method name specified" % cline, self.loc)
if pycommandpath:
self.pycommandpath = re.split('[%s\s]+' % os.pathsep,
pycommandpath)
else:
self.pycommandpath = None
self.module = parts[0]
self.method = parts[1]
self.cline_list = parts[2:]
def __call__(self, cb):
# get the module and method to call
parts, badchar = process.clinetoargv(self.cline, self.kwargs['cwd'])
if parts is None:
raise DataError("native command '%s': shell metacharacter '%s' in command line" % (cline, badchar), self.loc)
if len(parts) < 2:
raise DataError("native command '%s': no method name specified" % cline, self.loc)
module = parts[0]
method = parts[1]
cline_list = parts[2:]
self.usercb = cb
process.call_native(self.module, self.method, self.cline_list,
process.call_native(module, method, cline_list,
loc=self.loc, cb=self._cb, context=self.context,
pycommandpath=self.pycommandpath, **self.kwargs)

View File

@ -3,7 +3,7 @@ Makefile functions.
"""
import parser, util
import subprocess, os, logging
import subprocess, os, logging, sys
from globrelative import glob
from cStringIO import StringIO
@ -766,16 +766,28 @@ class ShellFunction(Function):
__slots__ = Function.__slots__
def resolve(self, makefile, variables, fd, setting):
#TODO: call this once up-front somewhere and save the result?
shell, msys = util.checkmsyscompat()
from process import prepare_command
cline = self._arguments[0].resolvestr(makefile, variables, setting)
executable, cline = prepare_command(cline, makefile.workdir, self.loc)
# subprocess.Popen doesn't use the PATH set in the env argument for
# finding the executable on some platforms (but strangely it does on
# others!), so set os.environ['PATH'] explicitly.
oldpath = os.environ['PATH']
if makefile.env is not None and 'PATH' in makefile.env:
os.environ['PATH'] = makefile.env['PATH']
log.debug("%s: running command '%s'" % (self.loc, ' '.join(cline)))
try:
p = subprocess.Popen(cline, executable=executable, env=makefile.env, shell=False,
stdout=subprocess.PIPE, cwd=makefile.workdir)
except OSError, e:
print >>sys.stderr, "Error executing command %s" % cline[0], e
return
finally:
os.environ['PATH'] = oldpath
log.debug("%s: running shell command '%s'" % (self.loc, cline))
cline = [shell, "-c", cline]
p = subprocess.Popen(cline, env=makefile.env, shell=False,
stdout=subprocess.PIPE, cwd=makefile.workdir)
stdout, stderr = p.communicate()
stdout = stdout.replace('\r\n', '\n')
if stdout.endswith('\n'):
stdout = stdout[:-1]

View File

@ -15,83 +15,238 @@ if sys.platform=='win32':
_log = logging.getLogger('pymake.process')
_escapednewlines = re.compile(r'\\\n')
# Characters that most likely indicate a shell script and that native commands
# should reject
_blacklist = re.compile(r'[$><;\[~`|&]' +
r'|\${|(?:^|\s){(?:$|\s)') # Blacklist ${foo} and { commands }
# Characters that probably indicate a shell script, but that native commands
# shouldn't just reject
_graylist = re.compile(r'[()]')
# Characters that indicate we need to glob
_needsglob = re.compile(r'[\*\?]')
def clinetoargv(cline, blacklist_gray):
def tokens2re(tokens):
# Create a pattern for non-escaped tokens, in the form:
# (?<!\\)(?:a|b|c...)
# This is meant to match patterns a, b, or c, or ... if they are not
# preceded by a backslash.
# where a, b, c... are in the form
# (?P<name>pattern)
# which matches the pattern and captures it in a named match group.
# The group names and patterns come are given as a dict in the function
# argument.
nonescaped = r'(?<!\\)(?:%s)' % '|'.join('(?P<%s>%s)' % (name, value) for name, value in tokens.iteritems())
# The final pattern matches either the above pattern, or an escaped
# backslash, captured in the "escape" match group.
return re.compile('(?:%s|%s)' % (nonescaped, r'(?P<escape>\\\\)'))
_unquoted_tokens = tokens2re({
'whitespace': r'[\t\r\n ]',
'quote': r'[\'"]',
'comment': '#',
'special': r'[<>&|`~(){}$;]',
'backslashed': r'\\[^\\]',
'glob': r'[\*\?]',
})
_doubly_quoted_tokens = tokens2re({
'quote': '"',
'backslashedquote': r'\\"',
'special': '\$',
'backslashed': r'\\[^\\"]',
})
class MetaCharacterException(Exception):
def __init__(self, char):
self.char = char
class ClineSplitter(list):
"""
Parses a given command line string and creates a list of command
and arguments, with wildcard expansion.
"""
def __init__(self, cline, cwd):
self.cwd = cwd
self.arg = ''
self.cline = cline
self.glob = False
self._parse_unquoted()
def _push(self, str):
"""
Push the given string as part of the current argument
"""
self.arg += str
def _next(self):
"""
Finalize current argument, effectively adding it to the list.
Perform globbing if needed.
"""
if not self.arg:
return
if self.glob:
if os.path.isabs(self.arg):
path = self.arg
else:
path = os.path.join(self.cwd, self.arg)
globbed = glob.glob(path)
if not globbed:
# If globbing doesn't find anything, the literal string is
# used.
self.append(self.arg)
else:
self.extend(f[len(path)-len(self.arg):] for f in globbed)
self.glob = False
else:
self.append(self.arg)
self.arg = ''
def _parse_unquoted(self):
"""
Parse command line remainder in the context of an unquoted string.
"""
while self.cline:
# Find the next token
m = _unquoted_tokens.search(self.cline)
# If we find none, the remainder of the string can be pushed to
# the current argument and the argument finalized
if not m:
self._push(self.cline)
break
# The beginning of the string, up to the found token, is part of
# the current argument
self._push(self.cline[:m.start()])
self.cline = self.cline[m.end():]
match = dict([(name, value) for name, value in m.groupdict().items() if value])
if 'quote' in match:
# " or ' start a quoted string
if match['quote'] == '"':
self._parse_doubly_quoted()
else:
self._parse_quoted()
elif 'comment' in match:
# Comments are ignored. The current argument can be finalized,
# and parsing stopped.
break
elif 'special' in match:
# Unquoted, non-escaped special characters need to be sent to a
# shell.
raise MetaCharacterException, match['special']
elif 'whitespace' in match:
# Whitespaces terminate current argument.
self._next()
elif 'escape' in match:
# Escaped backslashes turn into a single backslash
self._push('\\')
elif 'backslashed' in match:
# Backslashed characters are unbackslashed
# e.g. echo \a -> a
self._push(match['backslashed'][1])
elif 'glob' in match:
# ? or * will need globbing
self.glob = True
self._push(m.group(0))
else:
raise Exception, "Shouldn't reach here"
self._next()
def _parse_quoted(self):
# Single quoted strings are preserved, except for the final quote
index = self.cline.find("'")
if index == -1:
raise Exception, 'Unterminated quoted string in command'
self._push(self.cline[:index])
self.cline = self.cline[index+1:]
def _parse_doubly_quoted(self):
if not self.cline:
raise Exception, 'Unterminated quoted string in command'
while self.cline:
m = _doubly_quoted_tokens.search(self.cline)
if not m:
raise Exception, 'Unterminated quoted string in command'
self._push(self.cline[:m.start()])
self.cline = self.cline[m.end():]
match = dict([(name, value) for name, value in m.groupdict().items() if value])
if 'quote' in match:
# a double quote ends the quoted string, so go back to
# unquoted parsing
return
elif 'special' in match:
# Unquoted, non-escaped special characters in a doubly quoted
# string still have a special meaning and need to be sent to a
# shell.
raise MetaCharacterException, match['special']
elif 'escape' in match:
# Escaped backslashes turn into a single backslash
self._push('\\')
elif 'backslashedquote' in match:
# Backslashed double quotes are un-backslashed
self._push('"')
elif 'backslashed' in match:
# Backslashed characters are kept backslashed
self._push(match['backslashed'])
def clinetoargv(cline, cwd):
"""
If this command line can safely skip the shell, return an argv array.
@returns argv, badchar
"""
str = _escapednewlines.sub('', cline)
m = _blacklist.search(str)
if m is not None:
return None, m.group(0)
if blacklist_gray:
m = _graylist.search(str)
if m is not None:
return None, m.group(0)
args = shlex.split(str, comments=True)
try:
args = ClineSplitter(str, cwd)
except MetaCharacterException, e:
return None, e.char
if len(args) and args[0].find('=') != -1:
return None, '='
return args, None
def doglobbing(args, cwd):
"""
Perform any needed globbing on the argument list passed in
"""
globbedargs = []
for arg in args:
if _needsglob.search(arg):
globbedargs.extend(glob.glob(os.path.join(cwd, arg)))
else:
globbedargs.append(arg)
return globbedargs
# shellwords contains a set of shell builtin commands that need to be
# executed within a shell. It also contains a set of commands that are known
# to be giving problems when run directly instead of through the msys shell.
shellwords = (':', '.', 'break', 'cd', 'continue', 'exec', 'exit', 'export',
'getopts', 'hash', 'pwd', 'readonly', 'return', 'shift',
'test', 'times', 'trap', 'umask', 'unset', 'alias',
'set', 'bind', 'builtin', 'caller', 'command', 'declare',
'echo', 'enable', 'help', 'let', 'local', 'logout',
'printf', 'read', 'shopt', 'source', 'type', 'typeset',
'ulimit', 'unalias', 'set')
'ulimit', 'unalias', 'set', 'find')
def prepare_command(cline, cwd, loc):
"""
Returns a list of command and arguments for the given command line string.
If the command needs to be run through a shell for some reason, the
returned list contains the shell invocation.
"""
def call(cline, env, cwd, loc, cb, context, echo, justprint=False):
#TODO: call this once up-front somewhere and save the result?
shell, msys = util.checkmsyscompat()
shellreason = None
executable = None
if msys and cline.startswith('/'):
shellreason = "command starts with /"
else:
argv, badchar = clinetoargv(cline, blacklist_gray=True)
argv, badchar = clinetoargv(cline, cwd)
if argv is None:
shellreason = "command contains shell-special character '%s'" % (badchar,)
elif len(argv) and argv[0] in shellwords:
shellreason = "command starts with shell primitive '%s'" % (argv[0],)
else:
argv = doglobbing(argv, cwd)
elif argv and (os.sep in argv[0] or os.altsep and os.altsep in argv[0]):
executable = util.normaljoin(cwd, argv[0])
# Avoid "%1 is not a valid Win32 application" errors, assuming
# that if the executable path is to be resolved with PATH, it will
# be a Win32 executable.
if sys.platform == 'win32' and os.path.isfile(executable) and open(executable, 'rb').read(2) == "#!":
shellreason = "command executable starts with a hashbang"
if shellreason is not None:
_log.debug("%s: using shell: %s: '%s'", loc, shellreason, cline)
if msys:
if len(cline) > 3 and cline[1] == ':' and cline[2] == '/':
cline = '/' + cline[0] + cline[2:]
cline = [shell, "-c", cline]
context.call(cline, shell=False, env=env, cwd=cwd, cb=cb, echo=echo,
justprint=justprint)
return
argv = [shell, "-c", cline]
executable = None
return executable, argv
def call(cline, env, cwd, loc, cb, context, echo, justprint=False):
executable, argv = prepare_command(cline, cwd, loc)
if not len(argv):
cb(res=0)
@ -106,17 +261,11 @@ def call(cline, env, cwd, loc, cb, context, echo, justprint=False):
command.main(argv[2:], env, cwd, cb)
return
if argv[0].find('/') != -1:
executable = util.normaljoin(cwd, argv[0])
else:
executable = None
context.call(argv, executable=executable, shell=False, env=env, cwd=cwd, cb=cb,
echo=echo, justprint=justprint)
def call_native(module, method, argv, env, cwd, loc, cb, context, echo, justprint=False,
pycommandpath=None):
argv = doglobbing(argv, cwd)
context.call_native(module, method, argv, env=env, cwd=cwd, cb=cb,
echo=echo, justprint=justprint, pycommandpath=pycommandpath)

View File

@ -1116,8 +1116,8 @@ ifndef NO_SUBMAKEFILES_RULE
ifdef SUBMAKEFILES
# VPATH does not work on some machines in this case, so add $(srcdir)
$(SUBMAKEFILES): % : $(srcdir)/%.in
$(PYTHON) $(DEPTH)$(addprefix /,$(subsrcdir))/config.status -n --file=$@
@$(TOUCH) $@
$(PYTHON) $(DEPTH)$(addprefix /,$(subsrcdir))/config.status -n --file="$@"
@$(TOUCH) "$@"
endif
endif

View File

@ -5845,7 +5845,7 @@ if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
AC_MSG_ERROR([Found the February 2010 DirectX SDK. Need the June 2010 DirectX SDK, or newer. Upgrade your SDK or reconfigure with --disable-webgl.])
else
MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/'`
MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/' | sed 's,\\\\,/,g'`
fi
if test -n "$MOZ_DIRECTX_SDK_PATH" &&
@ -6087,6 +6087,12 @@ if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; th
MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
fi
if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
MOZ_GIO_COMPONENT=1
MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
fi
AC_SUBST(MOZ_GIO_COMPONENT)
if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`

View File

@ -6358,7 +6358,7 @@ public:
{
}
NS_IMETHOD_(void) NoteWeakMapping(void* map, void* key, void* val)
NS_IMETHOD_(void) NoteWeakMapping(void* map, void* key, void* kdelegate, void* val)
{
}

View File

@ -313,11 +313,7 @@ nsHTMLDocument::CreateShell(nsPresContext* aContext,
aInstancePtrResult);
}
// The following Try*Charset will return false only if the charset source
// should be considered (ie. aCharsetSource < thisCharsetSource) but we failed
// to get the charset from this source.
bool
void
nsHTMLDocument::TryHintCharset(nsIMarkupDocumentViewer* aMarkupDV,
int32_t& aCharsetSource, nsACString& aCharset)
{
@ -331,17 +327,17 @@ nsHTMLDocument::TryHintCharset(nsIMarkupDocumentViewer* aMarkupDV,
aMarkupDV->SetHintCharacterSetSource((int32_t)(kCharsetUninitialized));
if(requestCharsetSource <= aCharsetSource)
return true;
return;
if(NS_SUCCEEDED(rv)) {
if(NS_SUCCEEDED(rv) && IsAsciiCompatible(requestCharset)) {
aCharsetSource = requestCharsetSource;
aCharset = requestCharset;
return true;
return;
}
}
}
return false;
return;
}
@ -361,6 +357,8 @@ nsHTMLDocument::TryUserForcedCharset(nsIMarkupDocumentViewer* aMarkupDV,
rv = aMarkupDV->GetForceCharacterSet(forceCharsetFromDocShell);
}
// Not making the IsAsciiCompatible() check here to allow the user to
// force UTF-16 from the menu.
if(NS_SUCCEEDED(rv) && !forceCharsetFromDocShell.IsEmpty()) {
aCharset = forceCharsetFromDocShell;
//TODO: we should define appropriate constant for force charset
@ -392,7 +390,12 @@ nsHTMLDocument::TryCacheCharset(nsICachingChannel* aCachingChannel,
nsCString cachedCharset;
rv = aCachingChannel->GetCacheTokenCachedCharset(cachedCharset);
if (NS_SUCCEEDED(rv) && !cachedCharset.IsEmpty())
// Check IsAsciiCompatible() even in the cache case, because the value
// might be stale and in the case of a stale charset that is not a rough
// ASCII superset, the parser has no way to recover.
if (NS_SUCCEEDED(rv) &&
!cachedCharset.IsEmpty() &&
IsAsciiCompatible(cachedCharset))
{
aCharset = cachedCharset;
aCharsetSource = kCharsetFromCache;
@ -417,69 +420,87 @@ CheckSameOrigin(nsINode* aNode1, nsINode* aNode2)
}
bool
nsHTMLDocument::IsAsciiCompatible(const nsACString& aPreferredName)
{
return !(aPreferredName.LowerCaseEqualsLiteral("utf-16") ||
aPreferredName.LowerCaseEqualsLiteral("utf-16be") ||
aPreferredName.LowerCaseEqualsLiteral("utf-16le") ||
aPreferredName.LowerCaseEqualsLiteral("utf-7") ||
aPreferredName.LowerCaseEqualsLiteral("x-imap4-modified-utf7"));
}
void
nsHTMLDocument::TryParentCharset(nsIDocShell* aDocShell,
nsIDocument* aParentDocument,
int32_t& aCharsetSource,
nsACString& aCharset)
{
if (aDocShell) {
int32_t source;
nsCOMPtr<nsIAtom> csAtom;
int32_t parentSource;
aDocShell->GetParentCharsetSource(&parentSource);
if (kCharsetFromParentForced <= parentSource)
source = kCharsetFromParentForced;
else if (kCharsetFromHintPrevDoc == parentSource) {
// Make sure that's OK
if (!aParentDocument || !CheckSameOrigin(this, aParentDocument)) {
return false;
}
// if parent is posted doc, set this prevent autodections
// I'm not sure this makes much sense... but whatever.
source = kCharsetFromHintPrevDoc;
}
else if (kCharsetFromCache <= parentSource) {
// Make sure that's OK
if (!aParentDocument || !CheckSameOrigin(this, aParentDocument)) {
return false;
}
source = kCharsetFromParentFrame;
}
else
return false;
if (source < aCharsetSource)
return true;
aDocShell->GetParentCharset(getter_AddRefs(csAtom));
if (csAtom) {
csAtom->ToUTF8String(aCharset);
aCharsetSource = source;
return true;
}
if (!aDocShell) {
return;
}
return false;
int32_t source;
nsCOMPtr<nsIAtom> csAtom;
int32_t parentSource;
nsAutoCString parentCharset;
aDocShell->GetParentCharset(getter_AddRefs(csAtom));
if (!csAtom) {
return;
}
aDocShell->GetParentCharsetSource(&parentSource);
csAtom->ToUTF8String(parentCharset);
if (kCharsetFromParentForced <= parentSource) {
source = kCharsetFromParentForced;
} else if (kCharsetFromHintPrevDoc == parentSource) {
// Make sure that's OK
if (!aParentDocument ||
!CheckSameOrigin(this, aParentDocument) ||
!IsAsciiCompatible(parentCharset)) {
return;
}
// if parent is posted doc, set this prevent autodetections
// I'm not sure this makes much sense... but whatever.
source = kCharsetFromHintPrevDoc;
} else if (kCharsetFromCache <= parentSource) {
// Make sure that's OK
if (!aParentDocument ||
!CheckSameOrigin(this, aParentDocument) ||
!IsAsciiCompatible(parentCharset)) {
return;
}
source = kCharsetFromParentFrame;
} else {
return;
}
if (source < aCharsetSource) {
return;
}
aCharset.Assign(parentCharset);
aCharsetSource = source;
}
bool
void
nsHTMLDocument::UseWeakDocTypeDefault(int32_t& aCharsetSource,
nsACString& aCharset)
{
if (kCharsetFromWeakDocTypeDefault <= aCharsetSource)
return true;
// fallback value in case docshell return error
aCharset.AssignLiteral("ISO-8859-1");
return;
const nsAdoptingCString& defCharset =
Preferences::GetLocalizedCString("intl.charset.default");
if (!defCharset.IsEmpty()) {
// Don't let the user break things by setting intl.charset.default to
// not a rough ASCII superset
if (!defCharset.IsEmpty() && IsAsciiCompatible(defCharset)) {
aCharset = defCharset;
aCharsetSource = kCharsetFromWeakDocTypeDefault;
} else {
aCharset.AssignLiteral("ISO-8859-1");
}
return true;
aCharsetSource = kCharsetFromWeakDocTypeDefault;
return;
}
bool
@ -494,6 +515,8 @@ nsHTMLDocument::TryDefaultCharset( nsIMarkupDocumentViewer* aMarkupDV,
if (aMarkupDV) {
nsresult rv =
aMarkupDV->GetDefaultCharacterSet(defaultCharsetFromDocShell);
// Not making the IsAsciiCompatible() check here to allow the user to
// force UTF-16 from the menu.
if(NS_SUCCEEDED(rv)) {
aCharset = defaultCharsetFromDocShell;

View File

@ -218,7 +218,9 @@ protected:
static uint32_t gWyciwygSessionCnt;
static bool TryHintCharset(nsIMarkupDocumentViewer* aMarkupDV,
static bool IsAsciiCompatible(const nsACString& aPreferredName);
static void TryHintCharset(nsIMarkupDocumentViewer* aMarkupDV,
int32_t& aCharsetSource,
nsACString& aCharset);
static bool TryUserForcedCharset(nsIMarkupDocumentViewer* aMarkupDV,
@ -229,10 +231,10 @@ protected:
int32_t& aCharsetSource,
nsACString& aCharset);
// aParentDocument could be null.
bool TryParentCharset(nsIDocShell* aDocShell,
void TryParentCharset(nsIDocShell* aDocShell,
nsIDocument* aParentDocument,
int32_t& charsetSource, nsACString& aCharset);
static bool UseWeakDocTypeDefault(int32_t& aCharsetSource,
static void UseWeakDocTypeDefault(int32_t& aCharsetSource,
nsACString& aCharset);
static bool TryDefaultCharset(nsIMarkupDocumentViewer* aMarkupDV,
int32_t& aCharsetSource,

View File

@ -6425,11 +6425,14 @@ nsDocShell::OnRedirectStateChange(nsIChannel* aOldChannel,
nsCOMPtr<nsIApplicationCacheChannel> appCacheChannel =
do_QueryInterface(aNewChannel);
if (appCacheChannel) {
// Permission will be checked in the parent process.
if (GeckoProcessType_Default != XRE_GetProcessType())
if (GeckoProcessType_Default != XRE_GetProcessType()) {
// Permission will be checked in the parent process.
appCacheChannel->SetChooseApplicationCache(true);
else
appCacheChannel->SetChooseApplicationCache(ShouldCheckAppCache(newURI));
} else {
appCacheChannel->SetChooseApplicationCache(
NS_ShouldCheckAppCache(newURI,
mInPrivateBrowsing));
}
}
if (!(aRedirectFlags & nsIChannelEventSink::REDIRECT_INTERNAL) &&
@ -9169,26 +9172,6 @@ nsDocShell::GetInheritedPrincipal(bool aConsiderCurrentDocument)
return nullptr;
}
bool
nsDocShell::ShouldCheckAppCache(nsIURI *aURI)
{
if (mInPrivateBrowsing) {
return false;
}
nsCOMPtr<nsIOfflineCacheUpdateService> offlineService =
do_GetService(NS_OFFLINECACHEUPDATESERVICE_CONTRACTID);
if (!offlineService) {
return false;
}
bool allowed;
nsresult rv = offlineService->OfflineAppAllowedForURI(aURI,
nullptr,
&allowed);
return NS_SUCCEEDED(rv) && allowed;
}
nsresult
nsDocShell::DoURILoad(nsIURI * aURI,
nsIURI * aReferrerURI,
@ -9276,12 +9259,13 @@ nsDocShell::DoURILoad(nsIURI * aURI,
// Loads with the correct permissions should check for a matching
// application cache.
// Permission will be checked in the parent process
if (GeckoProcessType_Default != XRE_GetProcessType())
if (GeckoProcessType_Default != XRE_GetProcessType()) {
// Permission will be checked in the parent process
appCacheChannel->SetChooseApplicationCache(true);
else
} else {
appCacheChannel->SetChooseApplicationCache(
ShouldCheckAppCache(aURI));
NS_ShouldCheckAppCache(aURI, mInPrivateBrowsing));
}
}
// Make sure to give the caller a channel if we managed to create one

View File

@ -282,10 +282,6 @@ protected:
// at the parent.
nsIPrincipal* GetInheritedPrincipal(bool aConsiderCurrentDocument);
// True if when loading aURI into this docshell, the channel should look
// for an appropriate application cache.
bool ShouldCheckAppCache(nsIURI * aURI);
// Actually open a channel and perform a URI load. Note: whatever owner is
// passed to this function will be set on the channel. Callers who wish to
// not have an owner on the channel should just pass null.

View File

@ -751,6 +751,8 @@ let DOMApplicationRegistry = {
checkForUpdate: function(aData, aMm) {
let app = this.getAppByManifestURL(aData.manifestURL);
let installOrigin = app.installOrigin;
if (!app) {
aData.error = "NO_SUCH_APP";
aMm.sendAsyncMessage("Webapps:CheckForUpdate:Return:KO", aData);
@ -850,7 +852,7 @@ let DOMApplicationRegistry = {
if (xhr.status == 200) {
let manifest;
try {
JSON.parse(xhr.responseText, installOrigin);
manifest = JSON.parse(xhr.responseText);
} catch(e) {
sendError("MANIFEST_PARSE_ERROR");
return;

View File

@ -499,6 +499,7 @@ DOMInterfaces = {
####################################
'TestInterface' : {
# Keep this in sync with TestExampleInterface
'headerFile': 'TestBindingHeader.h',
'register': False,
'resultNotAddRefed': [ 'receiveWeakSelf', 'receiveWeakNullableSelf',
@ -587,6 +588,24 @@ DOMInterfaces = {
'register': False,
'binaryNames': { '__stringifier': 'Stringify' }
},
'TestExampleInterface' : {
# Keep this in sync with TestInterface
'headerFile': 'TestExampleInterface-example.h',
'register': False,
'resultNotAddRefed': [ 'receiveWeakSelf', 'receiveWeakNullableSelf',
'receiveWeakOther', 'receiveWeakNullableOther',
'receiveWeakExternal', 'receiveWeakNullableExternal',
'ReceiveWeakCallbackInterface',
'ReceiveWeakNullableCallbackInterface',
'receiveWeakCastableObjectSequence',
'receiveWeakNullableCastableObjectSequence',
'receiveWeakCastableObjectNullableSequence',
'receiveWeakNullableCastableObjectNullableSequence' ],
'binaryNames': { 'methodRenamedFrom': 'methodRenamedTo',
'attributeGetterRenamedFrom': 'attributeGetterRenamedTo',
'attributeRenamedFrom': 'attributeRenamedTo' }
}
}
# These are temporary, until they've been converted to use new DOM bindings

View File

@ -5964,7 +5964,9 @@ class CGExampleMember(CGThing):
if type.nullable():
typeDecl = "%s*"
else:
typeDecl = "%s&"
typeDecl = "%s"
if not optional:
typeDecl += "&"
return (typeDecl % type.name), False, False
if type.isString():
@ -5978,7 +5980,14 @@ class CGExampleMember(CGThing):
return type.inner.identifier.name, False, True
if type.isCallback():
return "JSObject*", False, False
if type.nullable():
declType = "JSObject*"
else:
if optional:
declType = "NonNull<JSObject>"
else:
declType = "JSObject&"
return declType, False, False
if type.isAny():
return "JS::Value", False, False
@ -6097,11 +6106,8 @@ class CGExampleClass(CGThing):
" NS_DECL_CYCLE_COLLECTING_ISUPPORTS\n"
" NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(${ifaceName})\n"
"\n"
" void* GetParentObject() const\n"
" {\n"
" // TODO: return something sensible here, and change the return type\n"
" return somethingSensible;\n"
" }\n"
" // TODO: return something sensible here, and change the return type\n"
" ${ifaceName}* GetParentObject() const;\n"
"\n" +
wrapFunc +
"\n").substitute({ "ifaceName": descriptor.name })),

View File

@ -75,10 +75,14 @@ include $(topsrcdir)/config/rules.mk
$(CPPSRCS): ../%Binding.cpp: $(bindinggen_dependencies) \
../%.webidl \
TestExampleInterface-example \
$(NULL)
$(MAKE) -C .. $*Binding.h
$(MAKE) -C .. $*Binding.cpp
TestExampleInterface-example:
$(MAKE) -C .. TestExampleInterface-example
check::
PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $(topsrcdir)/config/pythonpath.py \
$(PLY_INCLUDE) $(srcdir)/../parser/runtests.py

View File

@ -34,7 +34,7 @@ interface OnlyForUseInConstructor {
[Constructor,
Constructor(DOMString str),
Constructor(unsigned long num, boolean? bool),
Constructor(unsigned long num, boolean? boolArg),
Constructor(TestInterface? iface),
Constructor(TestNonCastableInterface iface)
// , Constructor(long arg1, long arg2, (TestInterface or OnlyForUseInConstructor) arg3)
@ -332,6 +332,8 @@ interface TestInterface {
// Miscellania
[LenientThis] attribute long attrWithLenientThis;
// If you add things here, add them to TestExampleGen as well
};
interface TestNonWrapperCacheInterface {

View File

@ -0,0 +1,308 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
[Constructor,
Constructor(DOMString str),
Constructor(unsigned long num, boolean? boolArg),
Constructor(TestInterface? iface),
Constructor(TestNonCastableInterface iface)
// , Constructor(long arg1, long arg2, (TestInterface or OnlyForUseInConstructor) arg3)
]
interface TestExampleInterface {
// Integer types
// XXXbz add tests for throwing versions of all the integer stuff
readonly attribute byte readonlyByte;
attribute byte writableByte;
void passByte(byte arg);
byte receiveByte();
void passOptionalByte(optional byte arg);
void passOptionalByteWithDefault(optional byte arg = 0);
void passNullableByte(byte? arg);
void passOptionalNullableByte(optional byte? arg);
readonly attribute short readonlyShort;
attribute short writableShort;
void passShort(short arg);
short receiveShort();
void passOptionalShort(optional short arg);
void passOptionalShortWithDefault(optional short arg = 5);
readonly attribute long readonlyLong;
attribute long writableLong;
void passLong(long arg);
long receiveLong();
void passOptionalLong(optional long arg);
void passOptionalLongWithDefault(optional long arg = 7);
readonly attribute long long readonlyLongLong;
attribute long long writableLongLong;
void passLongLong(long long arg);
long long receiveLongLong();
void passOptionalLongLong(optional long long arg);
void passOptionalLongLongWithDefault(optional long long arg = -12);
readonly attribute octet readonlyOctet;
attribute octet writableOctet;
void passOctet(octet arg);
octet receiveOctet();
void passOptionalOctet(optional octet arg);
void passOptionalOctetWithDefault(optional octet arg = 19);
readonly attribute unsigned short readonlyUnsignedShort;
attribute unsigned short writableUnsignedShort;
void passUnsignedShort(unsigned short arg);
unsigned short receiveUnsignedShort();
void passOptionalUnsignedShort(optional unsigned short arg);
void passOptionalUnsignedShortWithDefault(optional unsigned short arg = 2);
readonly attribute unsigned long readonlyUnsignedLong;
attribute unsigned long writableUnsignedLong;
void passUnsignedLong(unsigned long arg);
unsigned long receiveUnsignedLong();
void passOptionalUnsignedLong(optional unsigned long arg);
void passOptionalUnsignedLongWithDefault(optional unsigned long arg = 6);
readonly attribute unsigned long long readonlyUnsignedLongLong;
attribute unsigned long long writableUnsignedLongLong;
void passUnsignedLongLong(unsigned long long arg);
unsigned long long receiveUnsignedLongLong();
void passOptionalUnsignedLongLong(optional unsigned long long arg);
void passOptionalUnsignedLongLongWithDefault(optional unsigned long long arg = 17);
// Castable interface types
// XXXbz add tests for throwing versions of all the castable interface stuff
TestInterface receiveSelf();
TestInterface? receiveNullableSelf();
TestInterface receiveWeakSelf();
TestInterface? receiveWeakNullableSelf();
// A verstion to test for casting to TestInterface&
void passSelf(TestInterface arg);
// A version we can use to test for the exact type passed in
void passSelf2(TestInterface arg);
void passNullableSelf(TestInterface? arg);
attribute TestInterface nonNullSelf;
attribute TestInterface? nullableSelf;
// Optional arguments
void passOptionalSelf(optional TestInterface? arg);
void passOptionalNonNullSelf(optional TestInterface arg);
void passOptionalSelfWithDefault(optional TestInterface? arg = null);
// Non-wrapper-cache interface types
[Creator]
TestNonWrapperCacheInterface receiveNonWrapperCacheInterface();
[Creator]
TestNonWrapperCacheInterface? receiveNullableNonWrapperCacheInterface();
[Creator]
sequence<TestNonWrapperCacheInterface> receiveNonWrapperCacheInterfaceSequence();
[Creator]
sequence<TestNonWrapperCacheInterface?> receiveNullableNonWrapperCacheInterfaceSequence();
[Creator]
sequence<TestNonWrapperCacheInterface>? receiveNonWrapperCacheInterfaceNullableSequence();
[Creator]
sequence<TestNonWrapperCacheInterface?>? receiveNullableNonWrapperCacheInterfaceNullableSequence();
// Non-castable interface types
TestNonCastableInterface receiveOther();
TestNonCastableInterface? receiveNullableOther();
TestNonCastableInterface receiveWeakOther();
TestNonCastableInterface? receiveWeakNullableOther();
// A verstion to test for casting to TestNonCastableInterface&
void passOther(TestNonCastableInterface arg);
// A version we can use to test for the exact type passed in
void passOther2(TestNonCastableInterface arg);
void passNullableOther(TestNonCastableInterface? arg);
attribute TestNonCastableInterface nonNullOther;
attribute TestNonCastableInterface? nullableOther;
// Optional arguments
void passOptionalOther(optional TestNonCastableInterface? arg);
void passOptionalNonNullOther(optional TestNonCastableInterface arg);
void passOptionalOtherWithDefault(optional TestNonCastableInterface? arg = null);
// External interface types
TestExternalInterface receiveExternal();
TestExternalInterface? receiveNullableExternal();
TestExternalInterface receiveWeakExternal();
TestExternalInterface? receiveWeakNullableExternal();
// A verstion to test for casting to TestExternalInterface&
void passExternal(TestExternalInterface arg);
// A version we can use to test for the exact type passed in
void passExternal2(TestExternalInterface arg);
void passNullableExternal(TestExternalInterface? arg);
attribute TestExternalInterface nonNullExternal;
attribute TestExternalInterface? nullableExternal;
// Optional arguments
void passOptionalExternal(optional TestExternalInterface? arg);
void passOptionalNonNullExternal(optional TestExternalInterface arg);
void passOptionalExternalWithDefault(optional TestExternalInterface? arg = null);
// Callback interface types
TestCallbackInterface receiveCallbackInterface();
TestCallbackInterface? receiveNullableCallbackInterface();
TestCallbackInterface receiveWeakCallbackInterface();
TestCallbackInterface? receiveWeakNullableCallbackInterface();
// A verstion to test for casting to TestCallbackInterface&
void passCallbackInterface(TestCallbackInterface arg);
// A version we can use to test for the exact type passed in
void passCallbackInterface2(TestCallbackInterface arg);
void passNullableCallbackInterface(TestCallbackInterface? arg);
attribute TestCallbackInterface nonNullCallbackInterface;
attribute TestCallbackInterface? nullableCallbackInterface;
// Optional arguments
void passOptionalCallbackInterface(optional TestCallbackInterface? arg);
void passOptionalNonNullCallbackInterface(optional TestCallbackInterface arg);
void passOptionalCallbackInterfaceWithDefault(optional TestCallbackInterface? arg = null);
// Miscellaneous interface tests
IndirectlyImplementedInterface receiveConsequentialInterface();
void passConsequentialInterface(IndirectlyImplementedInterface arg);
// Sequence types
sequence<long> receiveSequence();
sequence<long>? receiveNullableSequence();
sequence<long?> receiveSequenceOfNullableInts();
sequence<long?>? receiveNullableSequenceOfNullableInts();
void passSequence(sequence<long> arg);
void passNullableSequence(sequence<long>? arg);
void passSequenceOfNullableInts(sequence<long?> arg);
void passOptionalSequenceOfNullableInts(optional sequence<long?> arg);
void passOptionalNullableSequenceOfNullableInts(optional sequence<long?>? arg);
sequence<TestInterface> receiveCastableObjectSequence();
sequence<TestCallbackInterface> receiveCallbackObjectSequence();
sequence<TestInterface?> receiveNullableCastableObjectSequence();
sequence<TestCallbackInterface?> receiveNullableCallbackObjectSequence();
sequence<TestInterface>? receiveCastableObjectNullableSequence();
sequence<TestInterface?>? receiveNullableCastableObjectNullableSequence();
sequence<TestInterface> receiveWeakCastableObjectSequence();
sequence<TestInterface?> receiveWeakNullableCastableObjectSequence();
sequence<TestInterface>? receiveWeakCastableObjectNullableSequence();
sequence<TestInterface?>? receiveWeakNullableCastableObjectNullableSequence();
void passCastableObjectSequence(sequence<TestInterface> arg);
void passNullableCastableObjectSequence(sequence<TestInterface?> arg);
void passCastableObjectNullableSequence(sequence<TestInterface>? arg);
void passNullableCastableObjectNullableSequence(sequence<TestInterface?>? arg);
void passOptionalSequence(optional sequence<long> arg);
void passOptionalNullableSequence(optional sequence<long>? arg);
void passOptionalNullableSequenceWithDefaultValue(optional sequence<long>? arg = null);
void passOptionalObjectSequence(optional sequence<TestInterface> arg);
sequence<DOMString> receiveStringSequence();
void passStringSequence(sequence<DOMString> arg);
sequence<any> receiveAnySequence();
sequence<any>? receiveNullableAnySequence();
// Typed array types
void passArrayBuffer(ArrayBuffer arg);
void passNullableArrayBuffer(ArrayBuffer? arg);
void passOptionalArrayBuffer(optional ArrayBuffer arg);
void passOptionalNullableArrayBuffer(optional ArrayBuffer? arg);
void passOptionalNullableArrayBufferWithDefaultValue(optional ArrayBuffer? arg= null);
void passArrayBufferView(ArrayBufferView arg);
void passInt8Array(Int8Array arg);
void passInt16Array(Int16Array arg);
void passInt32Array(Int32Array arg);
void passUint8Array(Uint8Array arg);
void passUint16Array(Uint16Array arg);
void passUint32Array(Uint32Array arg);
void passUint8ClampedArray(Uint8ClampedArray arg);
void passFloat32Array(Float32Array arg);
void passFloat64Array(Float64Array arg);
Uint8Array receiveUint8Array();
// String types
void passString(DOMString arg);
void passNullableString(DOMString? arg);
void passOptionalString(optional DOMString arg);
void passOptionalStringWithDefaultValue(optional DOMString arg = "abc");
void passOptionalNullableString(optional DOMString? arg);
void passOptionalNullableStringWithDefaultValue(optional DOMString? arg = null);
// Enumerated types
void passEnum(TestEnum arg);
// No support for nullable enums yet
// void passNullableEnum(TestEnum? arg);
void passOptionalEnum(optional TestEnum arg);
void passEnumWithDefault(optional TestEnum arg = "a");
// void passOptionalNullableEnum(optional TestEnum? arg);
// void passOptionalNullableEnumWithDefaultValue(optional TestEnum? arg = null);
TestEnum receiveEnum();
attribute TestEnum enumAttribute;
readonly attribute TestEnum readonlyEnumAttribute;
// Callback types
void passCallback(TestCallback arg);
void passNullableCallback(TestCallback? arg);
void passOptionalCallback(optional TestCallback arg);
void passOptionalNullableCallback(optional TestCallback? arg);
void passOptionalNullableCallbackWithDefaultValue(optional TestCallback? arg = null);
TestCallback receiveCallback();
TestCallback? receiveNullableCallback();
void passNullableTreatAsNullCallback(TestTreatAsNullCallback? arg);
void passOptionalNullableTreatAsNullCallback(optional TestTreatAsNullCallback? arg);
void passOptionalNullableTreatAsNullCallbackWithDefaultValue(optional TestTreatAsNullCallback? arg = null);
// Any types
void passAny(any arg);
void passOptionalAny(optional any arg);
void passAnyDefaultNull(optional any arg = null);
any receiveAny();
// object types
void passObject(object arg);
void passNullableObject(object? arg);
void passOptionalObject(optional object arg);
void passOptionalNullableObject(optional object? arg);
void passOptionalNullableObjectWithDefaultValue(optional object? arg = null);
object receiveObject();
object? receiveNullableObject();
// Union types
void passUnion((object or long) arg);
void passUnionWithNullable((object? or long) arg);
void passNullableUnion((object or long)? arg);
void passOptionalUnion(optional (object or long) arg);
void passOptionalNullableUnion(optional (object or long)? arg);
void passOptionalNullableUnionWithDefaultValue(optional (object or long)? arg = null);
//void passUnionWithInterfaces((TestInterface or TestExternalInterface) arg);
//void passUnionWithInterfacesAndNullable((TestInterface? or TestExternalInterface) arg);
//void passUnionWithSequence((sequence<object> or long) arg);
void passUnionWithArrayBuffer((ArrayBuffer or long) arg);
void passUnionWithString((DOMString or object) arg);
//void passUnionWithEnum((TestEnum or object) arg);
void passUnionWithCallback((TestCallback or long) arg);
void passUnionWithObject((object or long) arg);
//void passUnionWithDict((Dict or long) arg);
// binaryNames tests
void methodRenamedFrom();
void methodRenamedFrom(byte argument);
readonly attribute byte attributeGetterRenamedFrom;
attribute byte attributeRenamedFrom;
void passDictionary(optional Dict x);
void passOtherDictionary(optional GrandparentDict x);
void passSequenceOfDictionaries(sequence<Dict> x);
void passDictionaryOrLong(optional Dict x);
void passDictionaryOrLong(long x);
void passDictContainingDict(optional DictContainingDict arg);
void passDictContainingSequence(optional DictContainingSequence arg);
// EnforceRange/Clamp tests
void dontEnforceRangeOrClamp(byte arg);
void doEnforceRange([EnforceRange] byte arg);
void doClamp([Clamp] byte arg);
// Typedefs
const myLong myLongConstant = 5;
void exerciseTypedefInterfaces1(AnotherNameForTestInterface arg);
AnotherNameForTestInterface exerciseTypedefInterfaces2(NullableTestInterface arg);
void exerciseTypedefInterfaces3(YetAnotherNameForTestInterface arg);
// Miscellania
[LenientThis] attribute long attrWithLenientThis;
// If you add things here, add them to TestCodeGen as well
};

View File

@ -60,6 +60,13 @@ int get_bdaddr(const char *str, bdaddr_t *ba)
return 0;
}
static
void get_bdaddr_as_string(const bdaddr_t *ba, char *str) {
const uint8_t *b = (const uint8_t *)ba;
sprintf(str, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
b[5], b[4], b[3], b[2], b[1], b[0]);
}
BluetoothUnixSocketConnector::BluetoothUnixSocketConnector(
BluetoothSocketType aType,
int aChannel,
@ -179,3 +186,11 @@ BluetoothUnixSocketConnector::CreateAddr(bool aIsServer,
}
}
void
BluetoothUnixSocketConnector::GetSocketAddr(const sockaddr& aAddr,
nsAString& aAddrStr)
{
char addr[18];
get_bdaddr_as_string((bdaddr_t*)&aAddr, addr);
aAddrStr.AssignASCII(addr);
}

View File

@ -26,6 +26,9 @@ public:
struct sockaddr* aAddr,
const char* aAddress) MOZ_OVERRIDE;
virtual bool SetUp(int aFd) MOZ_OVERRIDE;
virtual void GetSocketAddr(const sockaddr& aAddr,
nsAString& aAddrStr) MOZ_OVERRIDE;
private:
BluetoothSocketType mType;
int mChannel;

View File

@ -210,16 +210,16 @@ interface nsITCPSocketEvent : nsISupports {
/**
* The socket object which produced this event.
*/
readonly attribute nsIDOMTCPSocket socket;
readonly attribute nsIDOMTCPSocket target;
/**
* The type of this event. One of:
*
* onopen
* onerror
* ondata
* ondrain
* onclose
* open
* error
* data
* drain
* close
*/
readonly attribute DOMString type;

View File

@ -49,21 +49,21 @@ function LOG(msg) {
function TCPSocketEvent(type, sock, data) {
this._type = type;
this._socket = sock;
this._target = sock;
this._data = data;
}
TCPSocketEvent.prototype = {
__exposedProps__: {
type: 'r',
socket: 'r',
target: 'r',
data: 'r'
},
get type() {
return this._type;
},
get socket() {
return this._socket;
get target() {
return this._target;
},
get data() {
return this._data;
@ -233,8 +233,8 @@ TCPSocket.prototype = {
self._readyState = kCLOSED;
let err = new Error("Connection closed while writing: " + status);
err.status = status;
self.callListener("onerror", err);
self.callListener("onclose");
self.callListener("error", err);
self.callListener("close");
return;
}
@ -243,12 +243,12 @@ TCPSocket.prototype = {
} else {
if (self._waitingForDrain) {
self._waitingForDrain = false;
self.callListener("ondrain");
self.callListener("drain");
}
if (self._readyState === kCLOSING) {
self._socketOutputStream.close();
self._readyState = kCLOSED;
self.callListener("onclose");
self.callListener("close");
}
}
}
@ -256,10 +256,10 @@ TCPSocket.prototype = {
},
callListener: function ts_callListener(type, data) {
if (!this[type])
if (!this["on" + type])
return;
this[type].call(null, new TCPSocketEvent(type, this, data || ""));
this["on" + type].call(null, new TCPSocketEvent(type, this, data || ""));
},
/* nsITCPSocketInternal methods */
@ -519,7 +519,7 @@ TCPSocket.prototype = {
transport, status, progress, max) {
if (status === Ci.nsISocketTransport.STATUS_CONNECTED_TO) {
this._readyState = kOPEN;
this.callListener("onopen");
this.callListener("open");
this._inputStreamPump = new InputStreamPump(
this._socketInputStream, -1, -1, 0, 0, false
@ -539,7 +539,7 @@ TCPSocket.prototype = {
try {
input.available();
} catch (e) {
this.callListener("onerror", new Error("Connection refused"));
this.callListener("error", new Error("Connection refused"));
}
},
@ -567,10 +567,10 @@ TCPSocket.prototype = {
if (status) {
let err = new Error("Connection closed: " + status);
err.status = status;
this.callListener("onerror", err);
this.callListener("error", err);
}
this.callListener("onclose");
this.callListener("close");
},
// nsIStreamListener (Triggered by _inputStreamPump.asyncRead)
@ -579,9 +579,9 @@ TCPSocket.prototype = {
let ua = this.useWin ? new this.useWin.Uint8Array(count)
: new Uint8Array(count);
ua.set(this._inputStreamBinary.readByteArray(count));
this.callListener("ondata", ua);
this.callListener("data", ua);
} else {
this.callListener("ondata", this._inputStreamScriptable.read(count));
this.callListener("data", this._inputStreamScriptable.read(count));
}
},
@ -617,7 +617,7 @@ function SecurityCallbacks(socket) {
SecurityCallbacks.prototype = {
notifyCertProblem: function sc_notifyCertProblem(socketInfo, status,
targetSite) {
this._socket.callListener("onerror", status);
this._socket.callListener("error", status);
this._socket.close();
return true;
},

View File

@ -26,9 +26,9 @@ TCPSocketParentIntermediary.prototype = {
// Create handlers for every possible callback that attempt to trigger
// corresponding callbacks on the child object.
["onopen", "ondrain", "ondata", "onerror", "onclose"].forEach(
["open", "drain", "data", "error", "close"].forEach(
function(p) {
socket[p] = function(data) {
socket["on" + p] = function(data) {
aParentSide.sendCallback(p, data.data, socket.readyState,
socket.bufferedAmount);
};

View File

@ -31,22 +31,26 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=799299
var b1 = document.getElementById("b1");
var b2 = document.getElementById("b2");
b1.contentWindow.focus();
opener.wrappedJSObject.is(document.activeElement, b1);
opener.wrappedJSObject.is(document.activeElement, b1,
"Focused first iframe");
var didCallDummy = false;
b2.contentWindow.addEventListener("mousedown", function(e) { didCallDummy = true; });
sendClick(b2.contentWindow);
opener.wrappedJSObject.ok(didCallDummy);
opener.wrappedJSObject.is(document.activeElement, b2);
opener.wrappedJSObject.ok(didCallDummy, "dummy mousedown handler should fire");
opener.wrappedJSObject.is(document.activeElement, b2,
"Focus shifted to second iframe");
b1.contentWindow.focus();
opener.wrappedJSObject.is(document.activeElement, b1);
opener.wrappedJSObject.is(document.activeElement, b1,
"Re-focused first iframe for the first time");
var didCallListener = false;
b2.contentWindow.addEventListener("mousedown", function(e) { didCallListener = true; e.preventDefault(); });
sendClick(b2.contentWindow);
opener.wrappedJSObject.ok(didCallListener);
opener.wrappedJSObject.is(document.activeElement, b2);
opener.wrappedJSObject.ok(didCallListener, "mousedown handler should fire");
opener.wrappedJSObject.is(document.activeElement, b2,
"focus should move to the second iframe");
window.close();
opener.wrappedJSObject.SimpleTest.finish();

View File

@ -31,11 +31,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=800817
var b1 = document.getElementById("b1");
var b2 = document.getElementById("b2");
var mozbrowserAttr = opener.wrappedJSObject.testMozBrowser ? "true" : "false";
b1.setAttribute("mozbrowser", mozbrowserAttr);
b2.setAttribute("mozbrowser", mozbrowserAttr);
var testMozBrowser = opener.wrappedJSObject.testMozBrowser;
if (testMozBrowser) {
b1.setAttribute("mozbrowser", "true");
b2.setAttribute("mozbrowser", "true");
}
opener.wrappedJSObject.ok(true, "Testing with mozbrowser="+ mozbrowserAttr);
if (testMozBrowser)
opener.wrappedJSObject.info("Testing with mozbrowser=true");
else
opener.wrappedJSObject.info("Testing without mozbrowser");
b1.contentWindow.focus();
opener.wrappedJSObject.is(document.activeElement, b1,
@ -44,7 +49,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=800817
var didCallDummy = false;
b2.contentWindow.addEventListener("mousedown", function(e) { didCallDummy = true; });
sendClick(b2.contentWindow);
opener.wrappedJSObject.ok(didCallDummy);
opener.wrappedJSObject.ok(didCallDummy, "dummy mousedown handler should fire");
opener.wrappedJSObject.is(document.activeElement, b2,
"Focus shifted to second iframe");
@ -55,7 +60,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=800817
var didCallListener = false;
b2.contentWindow.addEventListener("mousedown", function(e) { didCallListener = true; e.preventDefault(); });
sendClick(b2.contentWindow);
opener.wrappedJSObject.ok(didCallListener);
opener.wrappedJSObject.ok(didCallListener, "mousedown handler should fire");
opener.wrappedJSObject.is(document.activeElement, b1,
"Did not move focus to the second iframe");

View File

@ -71,6 +71,7 @@ ifdef ENABLE_TESTS
test_webidl_files := \
TestCodeGen.webidl \
TestDictionary.webidl \
TestExampleGen.webidl \
TestTypedef.webidl \
$(NULL)
else

View File

@ -763,7 +763,11 @@ nsHTMLEditor::NodeIsBlockStatic(const dom::Element* aElement)
}
bool isBlock;
DebugOnly<nsresult> rv = nsContentUtils::GetParserService()->
#ifdef DEBUG
// XXX we can't use DebugOnly here because VC++ is stupid (bug 802884)
nsresult rv =
#endif
nsContentUtils::GetParserService()->
IsBlock(nsContentUtils::GetParserService()->HTMLAtomTagToId(tagAtom),
isBlock);
MOZ_ASSERT(rv == NS_OK);

View File

@ -14,6 +14,9 @@ MODULE = nkgio
LIBRARY_NAME = nkgio
SHORT_LIBNAME = nkgio
IS_COMPONENT = 1
EXPORT_LIBRARY = 1
MODULE_NAME = nsGIOModule
LIBXUL_LIBRARY = 1
CPPSRCS = \
nsGIOProtocolHandler.cpp \
@ -21,15 +24,4 @@ CPPSRCS = \
LOCAL_INCLUDES = $(MOZ_GIO_CFLAGS)
EXTRA_DSO_LDOPTS = \
$(XPCOM_GLUE_LDOPTS) \
$(MOZ_COMPONENT_LIBS) \
$(MOZ_GIO_LIBS) \
$(NULL)
# make sure this component is never statically linked into the main
# application. this is necessary since we don't want to force users
# to install gio in order to use the rest of mozilla ;-)
FORCE_SHARED_LIB= 1
include $(topsrcdir)/config/rules.mk

View File

@ -312,7 +312,7 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType,
// If we have no buffered data already, then destBuffer will be a fresh buffer
// and we do not need to clear it below.
bool isClear = mBuffer == nullptr;
bool isClear = !HaveBuffer();
if (destBuffer) {
if (HaveBuffer()) {

View File

@ -416,6 +416,8 @@ BasicShadowableCanvasLayer::Paint(gfxContext* aContext, Layer* aMaskLayer)
if (handle) {
mGLContext->MakeCurrent();
mGLContext->UpdateSharedHandle(flags, handle);
// call Painted() to reset our dirty 'bit'
Painted();
FireDidTransactionCallback();
BasicManager()->PaintedCanvas(BasicManager()->Hold(this),
mNeedsYFlip,

View File

@ -218,15 +218,25 @@ ReusableTileStoreOGL::DrawTiles(TiledThebesLayerOGL* aLayer,
if (parentMetrics.IsScrollable())
scrollableLayer = parent;
if (!parentMetrics.mDisplayPort.IsEmpty() && scrollableLayer) {
displayPort = parent->GetEffectiveTransform().
TransformBounds(gfxRect(
parentMetrics.mDisplayPort.x, parentMetrics.mDisplayPort.y,
parentMetrics.mDisplayPort.width, parentMetrics.mDisplayPort.height));
// Get the display-port bounds in screen-space.
displayPort = gfxRect(parentMetrics.mDisplayPort.x,
parentMetrics.mDisplayPort.y,
parentMetrics.mDisplayPort.width,
parentMetrics.mDisplayPort.height);
// Calculate the scale transform applied to the root layer to determine
// the content resolution.
Layer* rootLayer = aLayer->Manager()->GetRoot();
const gfx3DMatrix& rootTransform = rootLayer->GetTransform();
float scaleX = rootTransform.GetXScale();
float scaleY = rootTransform.GetYScale();
// Get the content document bounds, in screen-space.
const FrameMetrics& metrics = scrollableLayer->GetFrameMetrics();
const nsIntSize& contentSize = metrics.mContentRect.Size();
gfx::Point scrollOffset =
gfx::Point(metrics.mScrollOffset.x * metrics.LayersPixelsPerCSSPixel().width,
metrics.mScrollOffset.y * metrics.LayersPixelsPerCSSPixel().height);
gfx::Point((metrics.mScrollOffset.x * metrics.LayersPixelsPerCSSPixel().width) / scaleX,
(metrics.mScrollOffset.y * metrics.LayersPixelsPerCSSPixel().height) / scaleY);
const nsIntPoint& contentOrigin = metrics.mContentRect.TopLeft() -
nsIntPoint(NS_lround(scrollOffset.x), NS_lround(scrollOffset.y));
gfxRect contentRect = gfxRect(contentOrigin.x, contentOrigin.y,
@ -259,6 +269,7 @@ ReusableTileStoreOGL::DrawTiles(TiledThebesLayerOGL* aLayer,
// Subtract the display-port from the tile region.
if (!displayPort.IsEmpty()) {
// Transform the display-port from screen space to layer space.
gfxRect transformedRenderBounds = transform.Inverse().TransformBounds(displayPort);
tileRegion.Sub(tileRegion, nsIntRect(transformedRenderBounds.x,
transformedRenderBounds.y,
@ -268,6 +279,7 @@ ReusableTileStoreOGL::DrawTiles(TiledThebesLayerOGL* aLayer,
// Intersect the tile region with the content area.
if (!contentBounds.IsEmpty()) {
// Transform the content bounds from screen space to layer space.
gfxRect transformedRenderBounds = transform.Inverse().TransformBounds(contentBounds);
tileRegion.And(tileRegion, nsIntRect(transformedRenderBounds.x,
transformedRenderBounds.y,

View File

@ -226,6 +226,7 @@ nsDeviceContext::nsDeviceContext()
mPixelScale(1.0f), mPrintingScale(1.0f),
mFontCache(nullptr)
{
MOZ_ASSERT(NS_IsMainThread(), "nsDeviceContext created off main thread");
}
// Note: we use a bare pointer for mFontCache so that nsFontCache

View File

@ -583,6 +583,8 @@ nsPNGDecoder::info_callback(png_structp png_ptr, png_infop info_ptr)
/* copy PNG info into imagelib structs (formerly png_set_dims()) */
/*---------------------------------------------------------------*/
// This code is currently unused, but it will be needed for bug 517713.
#if 0
int32_t alpha_bits = 1;
if (channels == 2 || channels == 4) {
@ -601,6 +603,7 @@ nsPNGDecoder::info_callback(png_structp png_ptr, png_infop info_ptr)
alpha_bits = 8;
}
}
#endif
if (channels == 1 || channels == 3)
decoder->format = gfxASurface::ImageFormatRGB24;

View File

@ -151,6 +151,17 @@ public:
*/
bool SetNonblockFlags();
void GetSocketAddr(nsAString& aAddrStr)
{
if (!mConnector)
{
NS_WARNING("No connector to get socket address from!");
aAddrStr = nsString();
return;
}
mConnector->GetSocketAddr(mAddr, aAddrStr);
}
/**
* Consumer pointer. Non-thread safe RefPtr, so should only be manipulated
* directly from main thread. All non-main-thread accesses should happen with
@ -227,6 +238,17 @@ private:
* Address we are connecting to, assuming we are creating a client connection.
*/
nsCString mAddress;
/**
* Size of the socket address struct
*/
socklen_t mAddrSize;
/**
* Address struct of the socket currently in use
*/
sockaddr mAddr;
};
static void
@ -404,8 +426,6 @@ void SocketConnectTask::Run() {
void
UnixSocketImpl::Accept()
{
socklen_t addr_sz;
struct sockaddr addr;
if (!mConnector) {
NS_WARNING("No connector object available!");
@ -414,7 +434,7 @@ UnixSocketImpl::Accept()
// This will set things we don't particularly care about, but it will hand
// back the correct structure size which is what we do care about.
mConnector->CreateAddr(true, addr_sz, &addr, nullptr);
mConnector->CreateAddr(true, mAddrSize, &mAddr, nullptr);
if(mFd.get() < 0)
{
@ -427,7 +447,7 @@ UnixSocketImpl::Accept()
return;
}
if (bind(mFd.get(), &addr, addr_sz)) {
if (bind(mFd.get(), &mAddr, mAddrSize)) {
#ifdef DEBUG
LOG("...bind(%d) gave errno %d", mFd.get(), errno);
#endif
@ -444,7 +464,7 @@ UnixSocketImpl::Accept()
}
int client_fd;
client_fd = accept(mFd.get(), &addr, &addr_sz);
client_fd = accept(mFd.get(), &mAddr, &mAddrSize);
if (client_fd < 0) {
EnqueueTask(SOCKET_RETRY_TIME_MS, new SocketAcceptTask(this));
return;
@ -479,12 +499,10 @@ UnixSocketImpl::Connect()
}
int ret;
socklen_t addr_sz;
struct sockaddr addr;
mConnector->CreateAddr(false, addr_sz, &addr, mAddress.get());
mConnector->CreateAddr(false, mAddrSize, &mAddr, mAddress.get());
ret = connect(mFd.get(), &addr, addr_sz);
ret = connect(mFd.get(), &mAddr, mAddrSize);
if (ret) {
#if DEBUG
@ -693,6 +711,17 @@ UnixSocketImpl::OnFileCanWriteWithoutBlocking(int aFd)
}
}
void
UnixSocketConsumer::GetSocketAddr(nsAString& aAddrStr)
{
if (!mImpl || mConnectionStatus != SOCKET_CONNECTED) {
NS_WARNING("No socket currently open!");
aAddrStr = nsString();
return;
}
mImpl->GetSocketAddr(aAddrStr);
}
void
UnixSocketConsumer::NotifySuccess()
{

View File

@ -101,6 +101,17 @@ public:
* @return true is successful, false otherwise
*/
virtual bool SetUp(int aFd) = 0;
/**
* Get address of socket we're currently connected to. Return null string if
* not connected.
*
* @param aAddr Address struct
* @param aAddrStr String to store address to
*/
virtual void GetSocketAddr(const sockaddr& aAddr,
nsAString& aAddrStr) = 0;
};
enum SocketConnectionStatus {
@ -212,6 +223,12 @@ public:
* Called by implementation to notify consumer of disconnect.
*/
void NotifyDisconnect();
/**
* Get the current sockaddr for the socket
*/
void GetSocketAddr(nsAString& aAddrStr);
private:
UnixSocketImpl* mImpl;
SocketConnectionStatus mConnectionStatus;

View File

@ -50,6 +50,10 @@ if test -z "$MOZ_ARCH"; then
esac
fi
if test "$MOZ_ARCH" = "armv6" -a "$OS_TARGET" = "Android"; then
MOZ_FPU=vfp
fi
MOZ_ARG_WITH_STRING(thumb,
[ --with-thumb[[=yes|no|toolchain-default]]]
[ Use Thumb instruction set (-mthumb)],

View File

@ -167,8 +167,8 @@ GC(JSContext *cx, unsigned argc, jsval *vp)
/*
* If the first argument is 'compartment', we collect any compartments
* previously scheduled for GC via schedulegc. If the first argument is an
* object, we collect the object's compartment (any any other compartments
* scheduled for GC). Otherwise, we collect call compartments.
* object, we collect the object's compartment (and any other compartments
* scheduled for GC). Otherwise, we collect all compartments.
*/
JSBool compartment = false;
if (argc == 1) {

View File

@ -1116,8 +1116,8 @@ ifndef NO_SUBMAKEFILES_RULE
ifdef SUBMAKEFILES
# VPATH does not work on some machines in this case, so add $(srcdir)
$(SUBMAKEFILES): % : $(srcdir)/%.in
$(PYTHON) $(DEPTH)$(addprefix /,$(subsrcdir))/config.status -n --file=$@
@$(TOUCH) $@
$(PYTHON) $(DEPTH)$(addprefix /,$(subsrcdir))/config.status -n --file="$@"
@$(TOUCH) "$@"
endif
endif

View File

@ -204,9 +204,9 @@ UpdateDepth(JSContext *cx, BytecodeEmitter *bce, ptrdiff_t target)
}
/*
* Specially handle any case that would call js_GetIndexFromBytecode since
* it requires a well-formed script. This allows us to safely pass NULL as
* the 'script' parameter.
* Specially handle any case in which StackUses or StackDefs would call
* NumBlockSlots, since that requires a well-formed script. This allows us
* to safely pass NULL as the 'script' parameter to StackUses and StackDefs.
*/
int nuses, ndefs;
if (op == JSOP_ENTERBLOCK) {

View File

@ -0,0 +1,8 @@
var g = newGlobal();
var k = g.eval('var u = new Object(); u');
var m = new WeakMap();
m.set(k, {});
k = null;
gc();
k = g.eval('u');
assertEq(m.has(k), true);

View File

@ -1883,6 +1883,9 @@ typedef void
typedef JSBool
(* JSEqualityOp)(JSContext *cx, JSHandleObject obj, JSHandleValue v, JSBool *bp);
typedef JSRawObject
(* JSWeakmapKeyDelegateOp)(JSRawObject obj);
/*
* Typedef for native functions called by the JS VM.
*

View File

@ -255,9 +255,22 @@ struct ClassExtension
* WeakMaps use this to override the wrapper disposal optimization.
*/
bool isWrappedNative;
/*
* If an object is used as a key in a weakmap, it may be desirable for the
* garbage collector to keep that object around longer than it otherwise
* would. A common case is when the key is a wrapper around an object in
* another compartment, and we want to avoid collecting the wrapper (and
* removing the weakmap entry) as long as the wrapped object is alive. In
* that case, the wrapped object is returned by the wrapper's
* weakmapKeyDelegateOp hook. As long as the wrapper is used as a weakmap
* key, it will not be collected (and remain in the weakmap) until the
* wrapped object is collected.
*/
JSWeakmapKeyDelegateOp weakmapKeyDelegateOp;
};
#define JS_NULL_CLASS_EXT {NULL,NULL,NULL,NULL,NULL,false}
#define JS_NULL_CLASS_EXT {NULL,NULL,NULL,NULL,NULL,false,NULL}
struct ObjectOps
{

View File

@ -532,6 +532,14 @@ js::VisitGrayWrapperTargets(JSCompartment *comp, GCThingCallback *callback, void
}
}
JS_FRIEND_API(JSObject *)
js::GetWeakmapKeyDelegate(JSObject *key)
{
if (JSWeakmapKeyDelegateOp op = key->getClass()->ext.weakmapKeyDelegateOp)
return op(key);
return NULL;
}
JS_FRIEND_API(void)
JS_SetAccumulateTelemetryCallback(JSRuntime *rt, JSAccumulateTelemetryDataCallback callback)
{

View File

@ -265,6 +265,9 @@ typedef void
extern JS_FRIEND_API(void)
VisitGrayWrapperTargets(JSCompartment *comp, GCThingCallback *callback, void *closure);
extern JS_FRIEND_API(JSObject *)
GetWeakmapKeyDelegate(JSObject *key);
/*
* Shadow declarations of JS internal structures, for access by inline access
* functions below. Do not use these structures in any other way. When adding

View File

@ -353,6 +353,12 @@ BaseProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy)
{
}
JSObject *
BaseProxyHandler::weakmapKeyDelegate(JSObject *proxy)
{
return NULL;
}
bool
BaseProxyHandler::getPrototypeOf(JSContext *cx, JSObject *proxy, JSObject **proto)
{
@ -549,6 +555,12 @@ IndirectProxyHandler::iteratorNext(JSContext *cx, JSObject *proxy, Value *vp)
return true;
}
JSObject *
IndirectProxyHandler::weakmapKeyDelegate(JSObject *proxy)
{
return UnwrapObject(proxy);
}
DirectProxyHandler::DirectProxyHandler(void *family)
: IndirectProxyHandler(family)
{
@ -2857,6 +2869,13 @@ proxy_TraceFunction(JSTracer *trc, RawObject obj)
proxy_TraceObject(trc, obj);
}
static JSObject *
proxy_WeakmapKeyDelegate(RawObject obj)
{
JS_ASSERT(obj->isProxy());
return GetProxyHandler(obj)->weakmapKeyDelegate(obj);
}
static JSBool
proxy_Convert(JSContext *cx, HandleObject proxy, JSType hint, MutableHandleValue vp)
{
@ -2868,8 +2887,7 @@ static void
proxy_Finalize(FreeOp *fop, RawObject obj)
{
JS_ASSERT(obj->isProxy());
if (!obj->getSlot(JSSLOT_PROXY_HANDLER).isUndefined())
GetProxyHandler(obj)->finalize(fop, obj);
GetProxyHandler(obj)->finalize(fop, obj);
}
static JSBool
@ -2889,6 +2907,17 @@ proxy_TypeOf(JSContext *cx, HandleObject proxy)
return Proxy::typeOf(cx, proxy);
}
#define PROXY_CLASS_EXT \
{ \
NULL, /* equality */ \
NULL, /* outerObject */ \
NULL, /* innerObject */ \
NULL, /* iteratorObject */ \
NULL, /* unused */ \
false, /* isWrappedNative */ \
proxy_WeakmapKeyDelegate \
}
JS_FRIEND_DATA(Class) js::ObjectProxyClass = {
"Proxy",
Class::NON_NATIVE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(4),
@ -2905,7 +2934,7 @@ JS_FRIEND_DATA(Class) js::ObjectProxyClass = {
proxy_HasInstance, /* hasInstance */
NULL, /* construct */
proxy_TraceObject, /* trace */
JS_NULL_CLASS_EXT,
PROXY_CLASS_EXT,
{
proxy_LookupGeneric,
proxy_LookupProperty,
@ -2961,7 +2990,10 @@ JS_FRIEND_DATA(Class) js::OuterWindowProxyClass = {
NULL, /* equality */
NULL, /* outerObject */
proxy_innerObject,
NULL /* unused */
NULL, /* iteratorObject */
NULL, /* unused */
false, /* isWrappedNative */
proxy_WeakmapKeyDelegate
},
{
proxy_LookupGeneric,
@ -3031,7 +3063,7 @@ JS_FRIEND_DATA(Class) js::FunctionProxyClass = {
FunctionClass.hasInstance,
proxy_Construct,
proxy_TraceFunction, /* trace */
JS_NULL_CLASS_EXT,
PROXY_CLASS_EXT,
{
proxy_LookupGeneric,
proxy_LookupProperty,

View File

@ -124,6 +124,9 @@ class JS_FRIEND_API(BaseProxyHandler) {
virtual bool getElementIfPresent(JSContext *cx, JSObject *obj, JSObject *receiver,
uint32_t index, Value *vp, bool *present);
virtual bool getPrototypeOf(JSContext *cx, JSObject *proxy, JSObject **protop);
/* See comment for weakmapKeyDelegateOp in jsclass.h. */
virtual JSObject *weakmapKeyDelegate(JSObject *proxy);
};
/*
@ -176,6 +179,7 @@ class JS_PUBLIC_API(IndirectProxyHandler) : public BaseProxyHandler {
Value *vp) MOZ_OVERRIDE;
virtual bool iteratorNext(JSContext *cx, JSObject *proxy,
Value *vp) MOZ_OVERRIDE;
virtual JSObject *weakmapKeyDelegate(JSObject *proxy);
};
/*

View File

@ -108,14 +108,7 @@ GetKeyArg(JSContext *cx, CallArgs &args)
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NOT_NONNULL_OBJECT);
return NULL;
}
JSObject &key = vp->toObject();
// If the key is from another compartment, and we store the wrapper as the key
// the wrapper might be GC-ed since it is not strong referenced (Bug 673468).
// To avoid this we always use the unwrapped object as the key instead of its
// security wrapper. This also means that if the keys are ever exposed they must
// be re-wrapped (see: JS_NondeterministicGetWeakMapKeys).
return JS_UnwrapObject(&key);
return &vp->toObject();
}
JS_ALWAYS_INLINE bool
@ -251,7 +244,7 @@ WeakMap_set_impl(JSContext *cx, CallArgs args)
// Preserve wrapped native keys to prevent wrapper optimization.
if (key->getClass()->ext.isWrappedNative) {
MOZ_ASSERT(cx->runtime->preserveWrapperCallback, "wrapped native weak map key needs preserveWrapperCallback");
JS_ASSERT(cx->runtime->preserveWrapperCallback);
if (!cx->runtime->preserveWrapperCallback(cx, key)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_WEAKMAP_KEY);
return false;
@ -278,6 +271,7 @@ WeakMap_set(JSContext *cx, unsigned argc, Value *vp)
JS_FRIEND_API(JSBool)
JS_NondeterministicGetWeakMapKeys(JSContext *cx, JSObject *obj, JSObject **ret)
{
obj = UnwrapObject(obj);
if (!obj || !obj->isWeakMap()) {
*ret = NULL;
return true;
@ -289,10 +283,8 @@ JS_NondeterministicGetWeakMapKeys(JSContext *cx, JSObject *obj, JSObject **ret)
if (map) {
for (ObjectValueMap::Base::Range r = map->all(); !r.empty(); r.popFront()) {
RootedObject key(cx, r.front().key);
// Re-wrapping the key (see comment of GetKeyArg)
if (!JS_WrapObject(cx, key.address()))
return false;
if (!js_NewbornArrayPush(cx, arr, ObjectValue(*key)))
return false;
}

View File

@ -27,42 +27,10 @@ namespace js {
// is collected. If an entry is not collected, it remains in the WeakMap and it has a
// strong reference to the value.
//
// You must call this table's 'mark' method when the object of which it is a part is
// You must call this table's 'trace' method when the object of which it is a part is
// reached by the garbage collection tracer. Once a table is known to be live, the
// implementation takes care of the iterative marking needed for weak tables and removing
// table entries when collection is complete.
//
// You may provide your own MarkPolicy class to specify how keys and values are marked; a
// policy template provides default definitions for some common key/value type
// combinations.
//
// Details:
//
// The interface is as for a js::HashMap, with the following additions:
//
// - You must call the WeakMap's 'trace' member function when you discover that the map is
// part of a live object. (You'll typically call this from the containing type's 'trace'
// function.)
//
// - There is no AllocPolicy parameter; these are used with our garbage collector, so
// RuntimeAllocPolicy is hard-wired.
//
// - Optional fourth and fifth parameters are the MarkPolicies for the key and value type.
// A MarkPolicy has the constructor:
//
// MarkPolicy(JSTracer *)
//
// and the following member functions:
//
// bool isMarked(const Type &x)
// Return true if x has been marked as live by the garbage collector.
//
// bool mark(Type &x)
// Return false if x is already marked. Otherwise, mark x and return true.
//
// If omitted, the MarkPolicy parameter defaults to js::DefaultMarkPolicy<Type>,
// a policy template with the obvious definitions for some typical
// SpiderMonkey type combinations.
// The value for the next pointer for maps not in the map list.
static WeakMapBase * const WeakMapNotInList = reinterpret_cast<WeakMapBase *>(1);
@ -170,6 +138,23 @@ class WeakMap : public HashMap<Key, Value, HashPolicy, RuntimeAllocPolicy>, publ
markValue(trc, &r.front().value);
}
bool keyNeedsMark(JSObject *key) {
if (JSWeakmapKeyDelegateOp op = key->getClass()->ext.weakmapKeyDelegateOp) {
JSObject *delegate = op(key);
/*
* Check if the delegate is marked with any color to properly handle
* gray marking when the key's delegate is black and the map is
* gray.
*/
return delegate && gc::IsObjectMarked(&delegate);
}
return false;
}
bool keyNeedsMark(gc::Cell *cell) {
return false;
}
bool markIteratively(JSTracer *trc) {
bool markedAny = false;
for (Enum e(*this); !e.empty(); e.popFront()) {
@ -180,6 +165,12 @@ class WeakMap : public HashMap<Key, Value, HashPolicy, RuntimeAllocPolicy>, publ
markedAny = true;
if (prior != e.front().key)
e.rekeyFront(e.front().key);
} else if (keyNeedsMark(e.front().key)) {
gc::Mark(trc, const_cast<Key *>(&e.front().key), "proxy-preserved WeakMap key");
if (prior != e.front().key)
e.rekeyFront(e.front().key);
gc::Mark(trc, &e.front().value, "WeakMap entry");
markedAny = true;
}
}
return markedAny;

View File

@ -2523,6 +2523,13 @@ EvalInFrame(JSContext *cx, unsigned argc, jsval *vp)
JS_ASSERT(cx->hasfp());
/* This is a copy of CheckDebugMode. */
if (!JS_GetDebugMode(cx)) {
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage,
NULL, JSMSG_NEED_DEBUG_MODE);
return false;
}
/* Debug-mode currently disables Ion compilation. */
ScriptFrameIter fi(cx);
for (uint32_t i = 0; i < upCount; ++i, ++fi) {

View File

@ -398,6 +398,7 @@ struct NoteWeakMapChildrenTracer : public JSTracer
nsCycleCollectionTraversalCallback &mCb;
JSObject *mMap;
void *mKey;
void *mKeyDelegate;
};
static void
@ -412,7 +413,7 @@ TraceWeakMappingChild(JSTracer *trc, void **thingp, JSGCTraceKind kind)
if (!xpc_IsGrayGCThing(thing) && !tracer->mCb.WantAllTraces())
return;
if (AddToCCKind(kind)) {
tracer->mCb.NoteWeakMapping(tracer->mMap, tracer->mKey, thing);
tracer->mCb.NoteWeakMapping(tracer->mMap, tracer->mKey, tracer->mKeyDelegate, thing);
} else {
JS_TraceChildren(trc, thing, kind);
}
@ -455,11 +456,16 @@ TraceWeakMapping(js::WeakMapTracer *trc, JSObject *m,
if (!AddToCCKind(kkind))
k = nullptr;
JSObject *kdelegate = NULL;
if (kkind == JSTRACE_OBJECT)
kdelegate = js::GetWeakmapKeyDelegate((JSObject *)k);
if (AddToCCKind(vkind)) {
tracer->mCb.NoteWeakMapping(m, k, v);
tracer->mCb.NoteWeakMapping(m, k, kdelegate, v);
} else {
tracer->mChildTracer.mMap = m;
tracer->mChildTracer.mKey = k;
tracer->mChildTracer.mKeyDelegate = kdelegate;
JS_TraceChildren(&tracer->mChildTracer, v, vkind);
}
}

View File

@ -62,6 +62,8 @@ MOCHITEST_CHROME_FILES = \
test_precisegc.xul \
test_sandboxImport.xul \
test_weakmaps.xul \
test_weakmap_keys_preserved.xul \
test_weakmap_keys_preserved2.xul \
test_weakref.xul \
test_wrappers.xul \
$(NULL)

View File

@ -0,0 +1,37 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=673468
-->
<window title="Mozilla Bug "
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<!-- test results are displayed in the html:body -->
<body xmlns="http://www.w3.org/1999/xhtml">
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id="
target="_blank">Mozilla Bug 673468</a>
</body>
<!-- test code goes here -->
<script type="application/javascript">
<![CDATA[
/** Test for Bug 673468 **/
let Cc = Components.classes;
let Cu = Components.utils;
let Ci = Components.interfaces;
let system = Cc["@mozilla.org/systemprincipal;1"].createInstance();
let sandbox = Cu.Sandbox(system);
let map = sandbox.WeakMap();
let obj = {};
map.set(obj, {});
Cu.forceGC();
ok(map.has(obj), "Weakmap still contains our wrapper!");
]]>
</script>
</window>

View File

@ -0,0 +1,84 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=673468
-->
<window title="Mozilla Bug "
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<!-- test results are displayed in the html:body -->
<body xmlns="http://www.w3.org/1999/xhtml">
<a id="testelem" href="https://bugzilla.mozilla.org/show_bug.cgi?id="
target="_blank">Mozilla Bug 673468</a>
</body>
<!-- test code goes here -->
<script type="application/javascript">
<![CDATA[
/** Test for Bug 673468 **/
let Cc = Components.classes;
let Cu = Components.utils;
let Ci = Components.interfaces;
SpecialPowers.DOMWindowUtils.garbageCollect();
let get_live_dom = function () {
return document.getElementById("testelem");
};
let wrappers_as_keys_test = function () {
let e = document.createEvent("MessageEvent");
e.initMessageEvent("foo", false, false, { dummy: document.createElement("foo") }, null, null, null);
window.eeeevent = e;
let live_dom = e.data.dummy;
let dead_dom = document.createElement("div");
let dead_child = document.createElement("div");
dead_dom.appendChild(dead_child);
is(dead_dom.children.length, 1, "children have wrong length");
let wrappee = new Object();
dead_dom.abcxyz = wrappee;
let system = Cc["@mozilla.org/systemprincipal;1"].createInstance();
let sandbox = Cu.Sandbox(system);
sandbox.wrapper = wrappee;
sandbox.value = dead_dom;
let map = Cu.evalInSandbox("wm = new WeakMap(); wm.set(wrapper, value); wm", sandbox);
sandbox.wrapper = null;
sandbox.value = null;
live_dom.xyzabc = {wrappee: wrappee, m: map, sb: sandbox};
let key = Cu.nondeterministicGetWeakMapKeys(map)[0];
let value = map.get(key);
is(value.children.length, 1, "children have wrong length");
}
wrappers_as_keys_test();
let check_wrappers_as_keys = function () {
let live_dom = window.eeeevent.data.dummy;
let live_map = live_dom.xyzabc.m;
let sandbox = live_dom.xyzabc.sb;
is(Cu.nondeterministicGetWeakMapKeys(live_map).length, 1,
"Map should not be empty.");
let key = Cu.nondeterministicGetWeakMapKeys(live_map)[0];
let value = live_map.get(key);
is(value.children.length, 1, "children have wrong length");
}
Cu.schedulePreciseGC(function () {
SpecialPowers.DOMWindowUtils.cycleCollect();
SpecialPowers.DOMWindowUtils.garbageCollect();
check_wrappers_as_keys();
});
]]>
</script>
</window>

View File

@ -448,7 +448,8 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
mHasDisplayPort(false),
mHasFixedItems(false),
mIsInFixedPosition(false),
mIsCompositingCheap(false)
mIsCompositingCheap(false),
mContainsPluginItem(false)
{
MOZ_COUNT_CTOR(nsDisplayListBuilder);
PL_InitArenaPool(&mPool, "displayListArena", 1024,

View File

@ -582,6 +582,9 @@ public:
return aItem == mGlassDisplayItem;
}
void SetContainsPluginItem() { mContainsPluginItem = true; }
bool ContainsPluginItem() { return mContainsPluginItem; }
private:
void MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, nsIFrame* aFrame,
const nsRect& aDirtyRect);
@ -635,6 +638,7 @@ private:
bool mHasFixedItems;
bool mIsInFixedPosition;
bool mIsCompositingCheap;
bool mContainsPluginItem;
};
class nsDisplayItem;

View File

@ -1302,7 +1302,11 @@ gfx3DMatrix
nsLayoutUtils::GetTransformToAncestor(nsIFrame *aFrame, const nsIFrame *aAncestor)
{
nsIFrame* parent;
gfx3DMatrix ctm = aFrame->GetTransformMatrix(aAncestor, &parent);
gfx3DMatrix ctm;
if (aFrame == aAncestor) {
return ctm;
}
ctm = aFrame->GetTransformMatrix(aAncestor, &parent);
while (parent && parent != aAncestor) {
if (!parent->Preserves3DChildren()) {
ctm.ProjectTo2D();

View File

@ -2544,20 +2544,19 @@ nsRootPresContext::ComputePluginGeometryUpdates(nsIFrame* aFrame,
mRegisteredPlugins.EnumerateEntries(SetPluginHidden, aFrame);
nsIFrame* rootFrame = FrameManager()->GetRootFrame();
if (!rootFrame) {
return;
}
aBuilder->SetForPluginGeometry();
aBuilder->SetAccurateVisibleRegions();
// Merging and flattening has already been done and we should not do it
// again. nsDisplayScroll(Info)Layer doesn't support trying to flatten
// again.
aBuilder->SetAllowMergingAndFlattening(false);
nsRegion region = rootFrame->GetVisualOverflowRectRelativeToSelf();
// nsDisplayPlugin::ComputeVisibility will automatically set a non-hidden
// widget configuration for the plugin, if it's visible.
aList->ComputeVisibilityForRoot(aBuilder, &region);
if (rootFrame && aBuilder->ContainsPluginItem()) {
aBuilder->SetForPluginGeometry();
aBuilder->SetAccurateVisibleRegions();
// Merging and flattening has already been done and we should not do it
// again. nsDisplayScroll(Info)Layer doesn't support trying to flatten
// again.
aBuilder->SetAllowMergingAndFlattening(false);
nsRegion region = rootFrame->GetVisualOverflowRectRelativeToSelf();
// nsDisplayPlugin::ComputeVisibility will automatically set a non-hidden
// widget configuration for the plugin, if it's visible.
aList->ComputeVisibilityForRoot(aBuilder, &region);
}
InitApplyPluginGeometryTimer();
}

View File

@ -2998,26 +2998,25 @@ AccumulateFrameBounds(nsIFrame* aContainerFrame,
nsAutoLineIterator& aLines,
int32_t& aCurLine)
{
nsRect frameBounds = aFrame->GetRect() +
aFrame->GetParent()->GetOffsetTo(aContainerFrame);
nsIFrame* frame = aFrame;
nsRect frameBounds = nsRect(nsPoint(0, 0), aFrame->GetSize());
// If this is an inline frame and either the bounds height is 0 (quirks
// layout model) or aUseWholeLineHeightForInlines is set, we need to
// change the top of the bounds to include the whole line.
if (frameBounds.height == 0 || aUseWholeLineHeightForInlines) {
nsIAtom* frameType = NULL;
nsIFrame *prevFrame = aFrame;
nsIFrame *f = aFrame;
while (f &&
(frameType = f->GetType()) == nsGkAtoms::inlineFrame) {
while (f && f->IsFrameOfType(nsIFrame::eLineParticipant) &&
!f->IsTransformed() && !f->IsPositioned()) {
prevFrame = f;
f = prevFrame->GetParent();
}
if (f != aFrame &&
f &&
frameType == nsGkAtoms::blockFrame) {
f->GetType() == nsGkAtoms::blockFrame) {
// find the line containing aFrame and increase the top of |offset|.
if (f != aPrevBlock) {
aLines = f->GetLineIterator();
@ -3035,7 +3034,8 @@ AccumulateFrameBounds(nsIFrame* aContainerFrame,
if (NS_SUCCEEDED(aLines->GetLine(index, &trash1, &trash2,
lineBounds, &trash3))) {
lineBounds += f->GetOffsetTo(aContainerFrame);
frameBounds += frame->GetOffsetTo(f);
frame = f;
if (lineBounds.y < frameBounds.y) {
frameBounds.height = frameBounds.YMost() - lineBounds.y;
frameBounds.y = lineBounds.y;
@ -3046,14 +3046,17 @@ AccumulateFrameBounds(nsIFrame* aContainerFrame,
}
}
nsRect transformedBounds = nsLayoutUtils::TransformFrameRectToAncestor(frame,
frameBounds, aContainerFrame);
if (aHaveRect) {
// We can't use nsRect::UnionRect since it drops empty rects on
// the floor, and we need to include them. (Thus we need
// aHaveRect to know when to drop the initial value on the floor.)
aRect.UnionRectEdges(aRect, frameBounds);
aRect.UnionRectEdges(aRect, transformedBounds);
} else {
aHaveRect = true;
aRect = frameBounds;
aRect = transformedBounds;
}
}
@ -3276,8 +3279,10 @@ PresShell::DoScrollContentIntoView()
return;
}
// Make sure we skip 'frame' ... if it's scrollable, we should use its
// scrollable ancestor as the container.
nsIFrame* container =
nsLayoutUtils::GetClosestFrameOfType(frame, nsGkAtoms::scrollFrame);
nsLayoutUtils::GetClosestFrameOfType(frame->GetParent(), nsGkAtoms::scrollFrame);
if (!container) {
// nothing can be scrolled
return;
@ -3354,8 +3359,14 @@ PresShell::ScrollFrameRectIntoView(nsIFrame* aFrame,
break;
}
}
rect += container->GetPosition();
nsIFrame* parent = container->GetParent();
nsIFrame* parent;
if (container->IsTransformed()) {
container->GetTransformMatrix(nullptr, &parent);
rect = nsLayoutUtils::TransformFrameRectToAncestor(container, rect, parent);
} else {
rect += container->GetPosition();
parent = container->GetParent();
}
if (!parent && !(aFlags & nsIPresShell::SCROLL_NO_PARENT_FRAMES)) {
nsPoint extraOffset(0,0);
parent = nsLayoutUtils::GetCrossDocParentFrame(container, &extraOffset);

View File

@ -40,6 +40,29 @@
<div style='height:400px;'></div>">
</iframe>
</div>
<div id="c5" style="overflow-y:scroll; width:200px; height:200px; position:absolute; top:400px; left:0;">
<div style="-moz-transform:translateY(400px); transform:translateY(400px)">
<span id="target5" style="display:inline-block; vertical-align:top; height:20px;">target</span>
</div>
<div style="height:800px;"></div>
</div>
<div id="c6" style="overflow-y:scroll; width:200px; height:200px; position:absolute; top:400px; left:200px;">
<div style="height:200px"></div>
<div style="height:100px; -moz-transform:scale(2); transform:scale(2)">
<span id="target6" style="display:inline-block; vertical-align:top; height:20px;">target</span>
</div>
<div style="height:800px;"></div>
</div>
<div id="c7" style="overflow-y:scroll; width:200px; height:200px; position:absolute; top:400px; left:400px;">
<div style="overflow:auto; height:200px; -moz-transform:translateY(400px); transform:translateY(400px)">
<div style="height:200px;"></div>
<div>
<span id="target7" style="display:inline-block; vertical-align:top; height:20px;">target</span>
</div>
<div style="height:800px;"></div>
</div>
<div style="height:800px;"></div>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
@ -101,6 +124,18 @@ function doTest() {
// visible.
testCollapsed("4", -1, 1000, 400);
// Test that scrolling a translated element into view takes
// account of the transform.
testCollapsed("5", 0, 0, 400);
// Test that scrolling a scaled element into view takes
// account of the transform.
testCollapsed("6", 0, 0, 150);
// Test that scrolling an element with a translated, scrolling container
// into view takes account of the transform.
testCollapsed("7", 0, 0, 400);
SimpleTest.finish();
}

View File

@ -2052,7 +2052,11 @@ public:
* @param aStopAtAncestor don't look further than aStopAtAncestor. If null,
* all ancestors (including across documents) will be traversed.
* @param aOutAncestor [out] The ancestor frame the frame has chosen. If
* this frame has no ancestor, *aOutAncestor will be set to null.
* this frame has no ancestor, *aOutAncestor will be set to null. If
* this frame is not a root frame, then *aOutAncestor will be in the same
* document as this frame. If this frame IsTransformed(), then *aOutAncestor
* will be the parent frame (if not preserve-3d) or the nearest non-transformed
* ancestor (if preserve-3d).
* @return A gfxMatrix that converts points in this frame's coordinate space
* into points in aOutAncestor's coordinate space.
*/

View File

@ -120,6 +120,14 @@ public:
void GetWidgetConfiguration(nsTArray<nsIWidget::Configuration>* aConfigurations)
{
if (mWidget) {
if (!mWidget->GetParent()) {
// Plugin widgets should not be toplevel except when they're out of the
// document, in which case the plugin should not be registered for
// geometry updates and this should not be called. But apparently we
// have bugs where mWidget sometimes is toplevel here. Bail out.
NS_ERROR("Plugin widgets registered for geometry updates should not be toplevel");
return;
}
nsIWidget::Configuration* configuration = aConfigurations->AppendElement();
configuration->mChild = mWidget;
configuration->mBounds = mNextConfigurationBounds;
@ -299,6 +307,7 @@ public:
: nsDisplayItem(aBuilder, aFrame)
{
MOZ_COUNT_CTOR(nsDisplayPlugin);
aBuilder->SetContainsPluginItem();
}
#ifdef NS_BUILD_REFCNT_LOGGING
virtual ~nsDisplayPlugin() {

View File

@ -35,7 +35,9 @@ t.scrollTop = 0;
var targetY = target.getBoundingClientRect().top;
SimpleTest.waitForFocus(function() {
is(target.getBoundingClientRect().top, targetY, "Target should not have scrolled due to waitForFocus");
t.focus();
is(target.getBoundingClientRect().top, targetY, "Target should not have scrolled due to focus change");
// Move the caret to scroll it into view
sel.collapse(target.firstChild, 2);

View File

@ -130,7 +130,7 @@ public class Tabs implements GeckoEventListener {
final Tab tab = mTabs.get(id);
// This avoids a NPE below, but callers need to be careful to
// handle this case
if (tab == null)
if (tab == null || oldTab == tab)
return null;
mSelectedTab = tab;

View File

@ -8,6 +8,7 @@ package org.mozilla.gecko.gfx;
import org.mozilla.gecko.mozglue.DirectBufferAllocator;
import android.graphics.Bitmap;
import android.util.Log;
import java.nio.ByteBuffer;
@ -17,6 +18,8 @@ public class BufferedCairoImage extends CairoImage {
private IntSize mSize;
private int mFormat;
private static String LOGTAG = "GeckoBufferedCairoImage";
/** Creates a buffered Cairo image from a byte buffer. */
public BufferedCairoImage(ByteBuffer inBuffer, int inWidth, int inHeight, int inFormat) {
setBuffer(inBuffer, inWidth, inHeight, inFormat);
@ -40,6 +43,15 @@ public class BufferedCairoImage extends CairoImage {
}
}
@Override
public void destroy() {
try {
freeBuffer();
} catch (Exception ex) {
Log.e(LOGTAG, "error clearing buffer: ", ex);
}
}
@Override
public ByteBuffer getBuffer() { return mBuffer; }
@Override

View File

@ -13,6 +13,8 @@ import java.nio.ByteBuffer;
public abstract class CairoImage {
public abstract ByteBuffer getBuffer();
public abstract void destroy();
public abstract IntSize getSize();
public abstract int getFormat();

View File

@ -8,6 +8,7 @@ package org.mozilla.gecko.gfx;
import org.mozilla.gecko.mozglue.DirectBufferAllocator;
import android.graphics.Color;
import android.util.Log;
import java.nio.ByteBuffer;
import java.nio.ShortBuffer;
@ -24,6 +25,8 @@ public class CheckerboardImage extends CairoImage {
// The amount to mix in.
private static final float TINT_OPACITY = 0.4f;
private static String LOGTAG = "GeckoCheckerboardImage";
private ByteBuffer mBuffer;
private int mMainColor;
private boolean mShowChecks;
@ -121,6 +124,16 @@ public class CheckerboardImage extends CairoImage {
}
}
@Override
public void destroy() {
try {
DirectBufferAllocator.free(mBuffer);
mBuffer = null;
} catch (Exception ex) {
Log.e(LOGTAG, "error clearing buffer: ", ex);
}
}
@Override
public ByteBuffer getBuffer() {
return mBuffer;

View File

@ -497,6 +497,12 @@ public class GeckoLayerClient
// a full viewport update, which is fine because if browser.js has somehow moved to
// be out of sync with this first-paint viewport, then we force them back in sync.
abortPanZoomAnimation();
// Indicate that the document is about to be composited so the
// LayerView background can be removed.
if (mView.getPaintState() == LayerView.PAINT_START) {
mView.setPaintState(LayerView.PAINT_BEFORE_FIRST);
}
}
DisplayPortCalculator.resetPageState();
mDrawTimingQueue.reset();

View File

@ -6,6 +6,8 @@
package org.mozilla.gecko.gfx;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.gfx.Layer.RenderContext;
import org.mozilla.gecko.mozglue.DirectBufferAllocator;
@ -32,7 +34,7 @@ import javax.microedition.khronos.egl.EGLConfig;
/**
* The layer renderer implements the rendering logic for a layer view.
*/
public class LayerRenderer {
public class LayerRenderer implements Tabs.OnTabsChangedListener {
private static final String LOGTAG = "GeckoLayerRenderer";
private static final String PROFTAG = "GeckoLayerRendererProf";
@ -166,6 +168,8 @@ public class LayerRenderer {
mCoordByteBuffer = DirectBufferAllocator.allocate(COORD_BUFFER_SIZE * 4);
mCoordByteBuffer.order(ByteOrder.nativeOrder());
mCoordBuffer = mCoordByteBuffer.asFloatBuffer();
Tabs.registerOnTabsChangedListener(this);
}
@Override
@ -179,6 +183,20 @@ public class LayerRenderer {
}
}
public void destroy() {
DirectBufferAllocator.free(mCoordByteBuffer);
mCoordByteBuffer = null;
mCoordBuffer = null;
mScreenshotLayer.destroy();
mBackgroundLayer.destroy();
mShadowLayer.destroy();
mHorizScrollLayer.destroy();
mVertScrollLayer.destroy();
if (mFrameRateLayer != null) {
mFrameRateLayer.destroy();
}
}
void onSurfaceCreated(EGLConfig config) {
checkMonitoringEnabled();
createDefaultProgram();
@ -669,7 +687,9 @@ public class LayerRenderer {
}
}
// Remove white screen once we've painted
// Remove background color once we've painted. GeckoLayerClient is
// responsible for setting this flag before current document is
// composited.
if (mView.getPaintState() == LayerView.PAINT_BEFORE_FIRST) {
mView.post(new Runnable() {
public void run() {
@ -680,4 +700,16 @@ public class LayerRenderer {
}
}
}
@Override
public void onTabChanged(final Tab tab, Tabs.TabEvents msg, Object data) {
// Sets the background of the newly selected tab. This background color
// gets cleared in endDrawing(). This function runs on the UI thread,
// but other code that touches the paint state is run on the compositor
// thread, so this may need to be changed if any problems appear.
if (msg == Tabs.TabEvents.SELECTED) {
mView.getChildAt(0).setBackgroundColor(tab.getCheckerboardColor());
mView.setPaintState(LayerView.PAINT_START);
}
}
}

View File

@ -60,8 +60,9 @@ public class LayerView extends FrameLayout {
private Listener mListener;
/* Flags used to determine when to show the painted surface. */
public static final int PAINT_BEFORE_FIRST = 0;
public static final int PAINT_AFTER_FIRST = 1;
public static final int PAINT_START = 0;
public static final int PAINT_BEFORE_FIRST = 1;
public static final int PAINT_AFTER_FIRST = 2;
public boolean shouldUseTextureView() {
// Disable TextureView support for now as it causes panning/zooming
@ -90,7 +91,7 @@ public class LayerView extends FrameLayout {
super(context, attrs);
mGLController = new GLController(this);
mPaintState = PAINT_BEFORE_FIRST;
mPaintState = PAINT_START;
mCheckerboardColor = Color.WHITE;
mCheckerboardShouldShowChecks = true;
}
@ -112,6 +113,9 @@ public class LayerView extends FrameLayout {
if (mLayerClient != null) {
mLayerClient.destroy();
}
if (mRenderer != null) {
mRenderer.destroy();
}
}
@Override

View File

@ -115,6 +115,16 @@ public class ScreenshotLayer extends SingleTileLayer {
}
}
@Override
public void destroy() {
try {
DirectBufferAllocator.free(mBuffer);
mBuffer = null;
} catch (Exception ex) {
Log.e(LOGTAG, "error clearing buffers: ", ex);
}
}
void copyBuffer(ByteBuffer src, ByteBuffer dst, Rect rect, int stride) {
int start = (rect.top * stride) + (rect.left * BYTES_FOR_16BPP);
int end = ((rect.bottom - 1) * stride) + (rect.right * BYTES_FOR_16BPP);

View File

@ -7,6 +7,7 @@ package org.mozilla.gecko.gfx;
import android.graphics.Rect;
import android.opengl.GLES20;
import android.util.Log;
import java.nio.ByteBuffer;
@ -50,6 +51,16 @@ public abstract class TileLayer extends Layer {
}
}
public void destroy() {
try {
if (mImage != null) {
mImage.destroy();
}
} catch (Exception ex) {
Log.e(LOGTAG, "error clearing buffers: ", ex);
}
}
public void setPaintMode(PaintMode mode) {
mPaintMode = mode;
}

View File

@ -2800,12 +2800,9 @@ Tab.prototype = {
// event fires; it's not clear that doing so is worth the effort.
var backgroundColor = null;
try {
let browser = BrowserApp.selectedBrowser;
if (browser) {
let { contentDocument, contentWindow } = browser;
let computedStyle = contentWindow.getComputedStyle(contentDocument.body);
backgroundColor = computedStyle.backgroundColor;
}
let { contentDocument, contentWindow } = this.browser;
let computedStyle = contentWindow.getComputedStyle(contentDocument.body);
backgroundColor = computedStyle.backgroundColor;
} catch (e) {
// Ignore. Catching and ignoring exceptions here ensures that Talos succeeds.
}

View File

@ -78,6 +78,7 @@
#include "mozilla/Services.h"
#include "nsIPrivateBrowsingChannel.h"
#include "mozIApplicationClearPrivateDataParams.h"
#include "nsIOfflineCacheUpdate.h"
#include <limits>
@ -1375,6 +1376,29 @@ NS_GetAppInfoFromClearDataNotification(nsISupports *aSubject,
return NS_OK;
}
/**
* Determines whether appcache should be checked for a given URI.
*/
inline bool
NS_ShouldCheckAppCache(nsIURI *aURI, bool usePrivateBrowsing)
{
if (usePrivateBrowsing) {
return false;
}
nsCOMPtr<nsIOfflineCacheUpdateService> offlineService =
do_GetService("@mozilla.org/offlinecacheupdate-service;1");
if (!offlineService) {
return false;
}
bool allowed;
nsresult rv = offlineService->OfflineAppAllowedForURI(aURI,
nullptr,
&allowed);
return NS_SUCCEEDED(rv) && allowed;
}
/**
* Wraps an nsIAuthPrompt so that it can be used as an nsIAuthPrompt2. This
* method is provided mainly for use by other methods in this file.

View File

@ -211,7 +211,7 @@ HttpChannelParent::RecvAsyncOpen(const URIParams& aURI,
bool setChooseApplicationCache = chooseApplicationCache;
if (appCacheChan && appCacheService) {
// We might potentially want to drop this flag (that is TRUE by default)
// after we succefully associate the channel with an application cache
// after we successfully associate the channel with an application cache
// reported by the channel child. Dropping it here may be too early.
appCacheChan->SetInheritApplicationCache(false);
if (!appCacheClientID.IsEmpty()) {
@ -225,16 +225,10 @@ HttpChannelParent::RecvAsyncOpen(const URIParams& aURI,
}
if (setChooseApplicationCache) {
nsCOMPtr<nsIOfflineCacheUpdateService> offlineUpdateService =
do_GetService("@mozilla.org/offlinecacheupdate-service;1", &rv);
if (NS_SUCCEEDED(rv)) {
rv = offlineUpdateService->OfflineAppAllowedForURI(uri,
nullptr,
&setChooseApplicationCache);
if (setChooseApplicationCache && NS_SUCCEEDED(rv))
appCacheChan->SetChooseApplicationCache(true);
}
// This works because we've already called SetNotificationCallbacks and
// done mPBOverride logic by this point.
appCacheChan->SetChooseApplicationCache(
NS_ShouldCheckAppCache(uri, NS_UsePrivateBrowsing(mChannel)));
}
}

View File

@ -56,10 +56,7 @@ nsHtml5MetaScanner::tryCharset(nsString* charset)
preferred.LowerCaseEqualsLiteral("utf-16be") ||
preferred.LowerCaseEqualsLiteral("utf-16le") ||
preferred.LowerCaseEqualsLiteral("utf-7") ||
preferred.LowerCaseEqualsLiteral("jis_x0212-1990") ||
preferred.LowerCaseEqualsLiteral("x-jis0208") ||
preferred.LowerCaseEqualsLiteral("x-imap4-modified-utf7") ||
preferred.LowerCaseEqualsLiteral("x-user-defined")) {
preferred.LowerCaseEqualsLiteral("x-imap4-modified-utf7")) {
return false;
}
res = convManager->GetUnicodeDecoderRaw(preferred.get(), getter_AddRefs(mUnicodeDecoder));

View File

@ -1213,10 +1213,7 @@ nsHtml5StreamParser::PreferredForInternalEncodingDecl(nsACString& aEncoding)
preferred.LowerCaseEqualsLiteral("utf-16be") ||
preferred.LowerCaseEqualsLiteral("utf-16le") ||
preferred.LowerCaseEqualsLiteral("utf-7") ||
preferred.LowerCaseEqualsLiteral("jis_x0212-1990") ||
preferred.LowerCaseEqualsLiteral("x-jis0208") ||
preferred.LowerCaseEqualsLiteral("x-imap4-modified-utf7") ||
preferred.LowerCaseEqualsLiteral("x-user-defined")) {
preferred.LowerCaseEqualsLiteral("x-imap4-modified-utf7")) {
// Not a rough ASCII superset
mTreeBuilder->MaybeComplainAboutCharset("EncMetaNonRoughSuperset",
true,

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8>
<meta content="width=device-width, initial-scale=1" name="viewport">
<title>UTF-16 doc</title>
</head>
<body>
<h1>UTF-16 doc</h1>
<p>Euro sign: €</p>
<p>iframe:</p>
<iframe src=frame599320-1-ref.html width=300 height=400></iframe>
</body>
</html>

Binary file not shown.

View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8>
<meta content="width=device-width, initial-scale=1" name="viewport">
<title>Non-UTF-16 doc</title>
</head>
<body>
<h1>Non-UTF-16 doc</h1>
<p>Euro sign: €</p>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,7 @@
== bug582788-1.html bug582788-1-ref.html
== bug582940-1.html bug582940-1-ref.html
== bug592656-1.html bug592656-1-ref.html
== bug599320-1.html bug599320-1-ref.html
== bug608373-1.html bug608373-1-ref.html
fails-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)&&!layersGPUAccelerated&&!azureSkia) == view-source:bug482921-1.html bug482921-1-ref.html # bug 703201
== view-source:bug482921-2.xhtml bug482921-2-ref.html

0
testing/marionette/client/marionette/venv_test.sh Normal file → Executable file
View File

0
testing/mozbase/mozdevice/mozdevice/Zeroconf.py Normal file → Executable file
View File

View File

@ -22,6 +22,7 @@ include $(topsrcdir)/config/rules.mk
TEST_HARNESS_FILES := \
runxpcshelltests.py \
remotexpcshelltests.py \
runtestsb2g.py \
head.js \
node-spdy \
moz-spdy \
@ -33,9 +34,10 @@ EXTRA_BUILD_FILES := \
manifestparser.py \
$(NULL)
# And files for running xpcshell remotely from $(topsrcdir)/build/mobile
MOBILE_BUILD_FILES := \
MOZDEVICE_FILES := \
devicemanager.py \
devicemanagerADB.py \
devicemanagerSUT.py \
$(NULL)
# Components / typelibs that don't get packaged with
@ -66,6 +68,6 @@ stage-package:
@(cd $(srcdir) && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_FILES)) | (cd $(PKG_STAGE)/xpcshell && tar -xf -)
@(cd $(topsrcdir)/build && tar $(TAR_CREATE_FLAGS) - $(EXTRA_BUILD_FILES)) | (cd $(PKG_STAGE)/xpcshell && tar -xf -)
@cp $(DEPTH)/mozinfo.json $(PKG_STAGE)/xpcshell
@(cd $(topsrcdir)/build/mobile && tar $(TAR_CREATE_FLAGS) - $(MOBILE_BUILD_FILES)) | (cd $(PKG_STAGE)/xpcshell && tar -xf -)
@(cd $(topsrcdir)/testing/mozbase/mozdevice/mozdevice && tar $(TAR_CREATE_FLAGS) - $(MOZDEVICE_FILES)) | (cd $(PKG_STAGE)/xpcshell && tar -xf -)
(cd $(DEPTH)/_tests/xpcshell/ && tar $(TAR_CREATE_FLAGS_QUIET) - *) | (cd $(PKG_STAGE)/xpcshell/tests && tar -xf -)
@(cd $(DIST)/bin/components && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_COMPONENTS)) | (cd $(PKG_STAGE)/bin/components && tar -xf -)

View File

@ -69,6 +69,7 @@ function FrameWorker(url, name) {
this.ports = {};
this.pendingPorts = [];
this.loaded = false;
this.reloading = false;
this.frame = makeHiddenFrame();
this.load();
@ -81,7 +82,7 @@ FrameWorker.prototype = {
if (!doc.defaultView || doc.defaultView != self.frame.contentWindow) {
return;
}
Services.obs.removeObserver(injectController, "document-element-inserted", false);
Services.obs.removeObserver(injectController, "document-element-inserted");
try {
self.createSandbox();
} catch (e) {
@ -100,8 +101,12 @@ FrameWorker.prototype = {
this.pendingPorts.push(port);
}
this.ports = {};
this.loaded = false;
this.load();
// reset the iframe to about:blank - this will fire the unload event
// but not remove the iframe from the DOM. Our unload handler will
// (a) set this.loaded to false then (b) see this.reloading is true and
// reload for us.
this.reloading = true;
this.frame.setAttribute("src", "about:blank");
},
createSandbox: function createSandbox() {
@ -118,8 +123,12 @@ FrameWorker.prototype = {
'location'];
workerAPI.forEach(function(fn) {
try {
// XXX Need to unwrap for this to work - find out why!
sandbox[fn] = XPCNativeWrapper.unwrap(workerWindow)[fn];
// Bug 798660 - XHR and WebSocket have issues in a sandbox and need
// to be unwrapped to work
if (fn == "XMLHttpRequest" || fn == "WebSocket")
sandbox[fn] = XPCNativeWrapper.unwrap(workerWindow)[fn];
else
sandbox[fn] = workerWindow[fn];
}
catch(e) {
Cu.reportError("FrameWorker: failed to import API "+fn+"\n"+e+"\n");
@ -168,8 +177,9 @@ FrameWorker.prototype = {
workerWindow.addEventListener(t, l, c)
};
this.sandbox = sandbox;
// Note we don't need to stash |sandbox| in |this| as the unload handler
// has a reference in its closure, so it can't die until that handler is
// removed - at which time we've explicitly killed it anyway.
let worker = this;
workerWindow.addEventListener("load", function loadListener() {
@ -219,24 +229,65 @@ FrameWorker.prototype = {
}
}
});
// the 'unload' listener cleans up the worker and the sandbox. This
// will be triggered via either our 'terminate' function or by the
// window unloading as part of shutdown.
workerWindow.addEventListener("unload", function unloadListener() {
workerWindow.removeEventListener("unload", unloadListener);
delete workerCache[worker.url];
// closing the port also removes it from this.ports via port-close
for (let [portid, port] in Iterator(worker.ports)) {
// port may have been closed as a side-effect from closing another port
if (!port)
continue;
try {
port.close();
} catch (ex) {
Cu.reportError("FrameWorker: failed to close port. " + ex);
}
}
// Must reset this to an array incase we are being reloaded.
worker.ports = [];
// The worker window may not have fired a load event yet, so pendingPorts
// might still have items in it - close them too.
worker.loaded = false;
// If the worker is reloading, when we don't actually close the pending
// ports as they are the ports which need to be re-entangled.
if (!worker.reloading) {
for (let port of worker.pendingPorts) {
try {
port.close();
} catch (ex) {
Cu.reportError("FrameWorker: failed to close pending port. " + ex);
}
}
worker.pendingPorts = [];
}
if (sandbox) {
Cu.nukeSandbox(sandbox);
sandbox = null;
}
if (worker.reloading) {
Services.tm.mainThread.dispatch(function doReload() {
worker.reloading = false;
worker.load();
}, Ci.nsIThread.DISPATCH_NORMAL);
}
});
},
terminate: function terminate() {
// closing the port also removes it from this.ports via port-close
for (let [portid, port] in Iterator(this.ports)) {
// port may have been closed as a side-effect from closing another port
if (!port)
continue;
try {
port.close();
} catch (ex) {
Cu.reportError("FrameWorker: failed to close port. " + ex);
}
if (!(this.url in workerCache)) {
// terminating an already terminated worker - ignore it
return;
}
// we want to "forget" about this worker now even though the termination
// may not be complete for a little while...
delete workerCache[this.url];
// let pending events get delivered before actually removing the frame
// let pending events get delivered before actually removing the frame,
// then we perform the actual cleanup in the unload handler.
Services.tm.mainThread.dispatch(function deleteWorkerFrame() {
// now nuke the iframe itself and forget everything about this worker.
this.frame.parentNode.removeChild(this.frame);

View File

@ -44,10 +44,10 @@ AbstractPort.prototype = {
// Further, we allow the workers to override exactly how the JSON parsing
// is done - we try and do such parsing in the client window so things
// like prototype overrides on Array work as expected.
data = this._JSONParse(data);
if (!this._handler) {
this._pendingMessagesIncoming.push(data);
} else {
data = this._JSONParse(data);
try {
this._handler({
data: data,

View File

@ -63,8 +63,7 @@ WorkerAPI.prototype = {
this._provider.setAmbientNotification(data);
},
"social.cookies-get": function(data) {
let document = getFrameWorkerHandle(this._provider.workerURL, null).
_worker.frame.contentDocument;
let document = this._port._window.document;
let cookies = document.cookie.split(";");
let results = [];
cookies.forEach(function(aCookie) {

View File

@ -114,13 +114,20 @@ let tests = {
// the worker was loaded again and ports reconnected
let reloading = false;
let worker = fw.getFrameWorkerHandle(provider.workerURL, undefined, "testWorkerReload");
let win = worker._worker.frame.contentWindow;
let frame = worker._worker.frame;
let win = frame.contentWindow;
let port = provider.getWorkerPort();
win.addEventListener("unload", function workerUnload(e) {
win.removeEventListener("unload", workerUnload);
ok(true, "worker unload event has fired");
reloading = true;
is(port._pendingMessagesOutgoing.length, 0, "port has no pending outgoing message");
});
frame.addEventListener("DOMWindowCreated", function workerLoaded(e) {
frame.removeEventListener("DOMWindowCreated", workerLoaded);
// send a message which should end up pending
port.postMessage({topic: "test-pending-msg"});
ok(port._pendingMessagesOutgoing.length > 0, "port has pending outgoing message");
});
let port = provider.getWorkerPort();
ok(port, "provider has a port");
port.onmessage = function (e) {
let topic = e.data.topic;
@ -129,13 +136,9 @@ let tests = {
// tell the worker to send the reload msg
port.postMessage({topic: "test-reload-init"});
break;
case "worker.connected":
// we'll get this message from the worker on every load of the worker,
// so we need to ignore it unless we have requested the reload.
if (reloading) {
ok(true, "worker reloaded and testPort was reconnected");
next();
}
case "test-pending-response":
ok(true, "worker reloaded and testPort was reconnected");
next();
break;
}
}

View File

@ -10,6 +10,7 @@ onconnect = function(e) {
} else {
port.postMessage({topic: "done", result: "import worked but global is not available"});
}
return;
} catch(e) {
port.postMessage({topic: "done", result: "FAILED to importScripts, " + e.toString() });
return;

View File

@ -25,6 +25,9 @@ onconnect = function(e) {
case "test-profile":
apiPort.postMessage({topic: "social.user-profile", data: data});
break;
case "test-pending-msg":
port.postMessage({topic: "test-pending-response"})
break;
case "test-ambient":
apiPort.postMessage({topic: "social.ambient-notification", data: data});
break;

View File

@ -238,11 +238,17 @@ UrlClassifierUpdateObserverProxy::UpdateUrlRequestedRunnable::Run()
NS_IMETHODIMP
UrlClassifierUpdateObserverProxy::RekeyRequested()
{
nsCOMPtr<nsIRunnable> r =
NS_NewRunnableMethod(mTarget, &nsIUrlClassifierUpdateObserver::RekeyRequested);
nsCOMPtr<nsIRunnable> r = new RekeyRequestedRunnable(mTarget);
return NS_DispatchToMainThread(r);
}
NS_IMETHODIMP
UrlClassifierUpdateObserverProxy::RekeyRequestedRunnable::Run()
{
mTarget->RekeyRequested();
return NS_OK;
}
NS_IMETHODIMP
UrlClassifierUpdateObserverProxy::StreamFinished(nsresult aStatus,
uint32_t aDelay)

View File

@ -7,6 +7,7 @@
#define nsUrlClassifierProxies_h
#include "nsIUrlClassifierDBService.h"
#include "nsProxyRelease.h"
#include "nsThreadUtils.h"
#include "mozilla/Attributes.h"
#include "nsIPrincipal.h"
@ -162,7 +163,7 @@ class UrlClassifierLookupCallbackProxy MOZ_FINAL :
{
public:
UrlClassifierLookupCallbackProxy(nsIUrlClassifierLookupCallback* aTarget)
: mTarget(aTarget)
: mTarget(new nsMainThreadPtrHolder<nsIUrlClassifierLookupCallback>(aTarget))
{ }
NS_DECL_ISUPPORTS
@ -171,7 +172,7 @@ public:
class LookupCompleteRunnable : public nsRunnable
{
public:
LookupCompleteRunnable(nsIUrlClassifierLookupCallback* aTarget,
LookupCompleteRunnable(nsMainThreadPtrHolder<nsIUrlClassifierLookupCallback>* aTarget,
LookupResultArray *aResults)
: mTarget(aTarget)
, mResults(aResults)
@ -180,19 +181,19 @@ public:
NS_DECL_NSIRUNNABLE
private:
nsCOMPtr<nsIUrlClassifierLookupCallback> mTarget;
nsMainThreadPtrHandle<nsIUrlClassifierLookupCallback> mTarget;
LookupResultArray * mResults;
};
private:
nsCOMPtr<nsIUrlClassifierLookupCallback> mTarget;
nsMainThreadPtrHandle<nsIUrlClassifierLookupCallback> mTarget;
};
class UrlClassifierCallbackProxy MOZ_FINAL : public nsIUrlClassifierCallback
{
public:
UrlClassifierCallbackProxy(nsIUrlClassifierCallback* aTarget)
: mTarget(aTarget)
: mTarget(new nsMainThreadPtrHolder<nsIUrlClassifierCallback>(aTarget))
{ }
NS_DECL_ISUPPORTS
@ -201,7 +202,7 @@ public:
class HandleEventRunnable : public nsRunnable
{
public:
HandleEventRunnable(nsIUrlClassifierCallback* aTarget,
HandleEventRunnable(nsMainThreadPtrHolder<nsIUrlClassifierCallback>* aTarget,
const nsACString& aValue)
: mTarget(aTarget)
, mValue(aValue)
@ -210,12 +211,12 @@ public:
NS_DECL_NSIRUNNABLE
private:
nsCOMPtr<nsIUrlClassifierCallback> mTarget;
nsMainThreadPtrHandle<nsIUrlClassifierCallback> mTarget;
nsCString mValue;
};
private:
nsCOMPtr<nsIUrlClassifierCallback> mTarget;
nsMainThreadPtrHandle<nsIUrlClassifierCallback> mTarget;
};
class UrlClassifierUpdateObserverProxy MOZ_FINAL :
@ -223,7 +224,7 @@ class UrlClassifierUpdateObserverProxy MOZ_FINAL :
{
public:
UrlClassifierUpdateObserverProxy(nsIUrlClassifierUpdateObserver* aTarget)
: mTarget(aTarget)
: mTarget(new nsMainThreadPtrHolder<nsIUrlClassifierUpdateObserver>(aTarget))
{ }
NS_DECL_ISUPPORTS
@ -232,7 +233,7 @@ public:
class UpdateUrlRequestedRunnable : public nsRunnable
{
public:
UpdateUrlRequestedRunnable(nsIUrlClassifierUpdateObserver* aTarget,
UpdateUrlRequestedRunnable(nsMainThreadPtrHolder<nsIUrlClassifierUpdateObserver>* aTarget,
const nsACString& aURL,
const nsACString& aTable,
const nsACString& aServerMAC)
@ -245,14 +246,27 @@ public:
NS_DECL_NSIRUNNABLE
private:
nsCOMPtr<nsIUrlClassifierUpdateObserver> mTarget;
nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver> mTarget;
nsCString mURL, mTable, mServerMAC;
};
class RekeyRequestedRunnable : public nsRunnable
{
public:
RekeyRequestedRunnable(nsMainThreadPtrHolder<nsIUrlClassifierUpdateObserver>* aTarget)
: mTarget(aTarget)
{ }
NS_DECL_NSIRUNNABLE
private:
nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver> mTarget;
};
class StreamFinishedRunnable : public nsRunnable
{
public:
StreamFinishedRunnable(nsIUrlClassifierUpdateObserver* aTarget,
StreamFinishedRunnable(nsMainThreadPtrHolder<nsIUrlClassifierUpdateObserver>* aTarget,
nsresult aStatus, uint32_t aDelay)
: mTarget(aTarget)
, mStatus(aStatus)
@ -262,7 +276,7 @@ public:
NS_DECL_NSIRUNNABLE
private:
nsCOMPtr<nsIUrlClassifierUpdateObserver> mTarget;
nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver> mTarget;
nsresult mStatus;
uint32_t mDelay;
};
@ -270,7 +284,7 @@ public:
class UpdateErrorRunnable : public nsRunnable
{
public:
UpdateErrorRunnable(nsIUrlClassifierUpdateObserver* aTarget,
UpdateErrorRunnable(nsMainThreadPtrHolder<nsIUrlClassifierUpdateObserver>* aTarget,
nsresult aError)
: mTarget(aTarget)
, mError(aError)
@ -279,14 +293,14 @@ public:
NS_DECL_NSIRUNNABLE
private:
nsCOMPtr<nsIUrlClassifierUpdateObserver> mTarget;
nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver> mTarget;
nsresult mError;
};
class UpdateSuccessRunnable : public nsRunnable
{
public:
UpdateSuccessRunnable(nsIUrlClassifierUpdateObserver* aTarget,
UpdateSuccessRunnable(nsMainThreadPtrHolder<nsIUrlClassifierUpdateObserver>* aTarget,
uint32_t aRequestedTimeout)
: mTarget(aTarget)
, mRequestedTimeout(aRequestedTimeout)
@ -295,12 +309,12 @@ public:
NS_DECL_NSIRUNNABLE
private:
nsCOMPtr<nsIUrlClassifierUpdateObserver> mTarget;
nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver> mTarget;
uint32_t mRequestedTimeout;
};
private:
nsCOMPtr<nsIUrlClassifierUpdateObserver> mTarget;
nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver> mTarget;
};
#endif // nsUrlClassifierProxies_h

View File

@ -333,6 +333,11 @@ COMPONENT_LIBS += gkdebug
endif
endif
ifdef MOZ_GIO_COMPONENT
DEFINES += -DMOZ_GIO_COMPONENT
COMPONENT_LIBS += nkgio
endif
ifdef MOZ_APP_COMPONENT_LIBS
COMPONENT_LIBS += $(MOZ_APP_COMPONENT_LIBS)
endif

View File

@ -170,6 +170,12 @@
#define PEERCONNECTION_MODULE
#endif
#if defined(MOZ_GIO_COMPONENT)
#define GIO_MODULE MODULE(nsGIOModule)
#else
#define GIO_MODULE
#endif
#define XUL_MODULES \
MODULE(nsUConvModule) \
MODULE(nsI18nModule) \
@ -228,6 +234,7 @@
MODULE(jsinspector) \
MODULE(jsdebugger) \
PEERCONNECTION_MODULE \
GIO_MODULE \
/* end of list */
#define MODULE(_name) \

View File

@ -252,6 +252,10 @@ tier_platform_dirs += js/ductwork/debugger
tier_platform_dirs += other-licenses/snappy
ifdef MOZ_GIO_COMPONENT
tier_platform_dirs += extensions/gio
endif
ifdef APP_LIBXUL_STATICDIRS
# Applications can cheat and ask for code to be
# built before libxul so libxul can be linked against it.

View File

@ -245,7 +245,7 @@ endif
DEFINES += -DAPP_VERSION=$(MOZ_APP_VERSION)
DEFINES += -DAPP_ID=$(MOZ_APP_ID)
DEFINES += -DAPP_ID="$(MOZ_APP_ID)"
$(srcdir)/nsAppRunner.cpp: $(DEPTH)/config/buildid $(milestone_txt)

View File

@ -669,6 +669,7 @@ struct WeakMapping
// map and key will be null if the corresponding objects are GC marked
PtrInfo *mMap;
PtrInfo *mKey;
PtrInfo *mKeyDelegate;
PtrInfo *mVal;
};
@ -1678,7 +1679,7 @@ public:
nsCycleCollectionParticipant *participant);
NS_IMETHOD_(void) NoteNextEdgeName(const char* name);
NS_IMETHOD_(void) NoteWeakMapping(void *map, void *key, void *val);
NS_IMETHOD_(void) NoteWeakMapping(void *map, void *key, void *kdelegate, void *val);
private:
NS_IMETHOD_(void) NoteRoot(void *root,
@ -1968,7 +1969,7 @@ GCGraphBuilder::AddWeakMapNode(void *node)
}
NS_IMETHODIMP_(void)
GCGraphBuilder::NoteWeakMapping(void *map, void *key, void *val)
GCGraphBuilder::NoteWeakMapping(void *map, void *key, void *kdelegate, void *val)
{
PtrInfo *valNode = AddWeakMapNode(val);
@ -1978,6 +1979,7 @@ GCGraphBuilder::NoteWeakMapping(void *map, void *key, void *val)
WeakMapping *mapping = mWeakMaps.AppendElement();
mapping->mMap = map ? AddWeakMapNode(map) : nullptr;
mapping->mKey = key ? AddWeakMapNode(key) : nullptr;
mapping->mKeyDelegate = kdelegate ? AddWeakMapNode(kdelegate) : mapping->mKey;
mapping->mVal = valNode;
}
@ -2021,7 +2023,7 @@ public:
NS_IMETHOD_(void) NoteNativeRoot(void *root,
nsCycleCollectionParticipant *helper) {}
NS_IMETHOD_(void) NoteNextEdgeName(const char* name) {}
NS_IMETHOD_(void) NoteWeakMapping(void *map, void *key, void *val) {}
NS_IMETHOD_(void) NoteWeakMapping(void *map, void *key, void *kdelegate, void *val) {}
bool MayHaveChild() {
return mMayHaveChild;
}
@ -2206,15 +2208,22 @@ nsCycleCollector::ScanWeakMaps()
// If mMap or mKey are null, the original object was marked black.
uint32_t mColor = wm->mMap ? wm->mMap->mColor : black;
uint32_t kColor = wm->mKey ? wm->mKey->mColor : black;
uint32_t kdColor = wm->mKeyDelegate ? wm->mKeyDelegate->mColor : black;
PtrInfo *v = wm->mVal;
// All non-null weak mapping maps, keys and values are
// roots (in the sense of WalkFromRoots) in the cycle
// collector graph, and thus should have been colored
// either black or white in ScanRoots().
NS_ASSERTION(mColor != grey, "Uncolored weak map");
NS_ASSERTION(kColor != grey, "Uncolored weak map key");
NS_ASSERTION(v->mColor != grey, "Uncolored weak map value");
MOZ_ASSERT(mColor != grey, "Uncolored weak map");
MOZ_ASSERT(kColor != grey, "Uncolored weak map key");
MOZ_ASSERT(kdColor != grey, "Uncolored weak map key delegate");
MOZ_ASSERT(v->mColor != grey, "Uncolored weak map value");
if (mColor == black && kColor != black && kdColor == black) {
GraphWalker<ScanBlackVisitor>(ScanBlackVisitor(mWhiteNodeCount)).Walk(wm->mKey);
anyChanged = true;
}
if (mColor == black && kColor == black && v->mColor != black) {
GraphWalker<ScanBlackVisitor>(ScanBlackVisitor(mWhiteNodeCount)).Walk(v);
@ -2471,7 +2480,7 @@ public:
NS_IMETHOD_(void) NoteNativeChild(void *child,
nsCycleCollectionParticipant *participant) {}
NS_IMETHOD_(void) NoteNextEdgeName(const char* name) {}
NS_IMETHOD_(void) NoteWeakMapping(void *map, void *key, void *val) {}
NS_IMETHOD_(void) NoteWeakMapping(void *map, void *key, void *kdelegate, void *val) {}
};
char *Suppressor::sSuppressionList = nullptr;

View File

@ -146,20 +146,19 @@
/**
* @name Standard Error Handling Macros
* @return 0 or 1
* @return 0 or 1 (false/true with bool type for C++)
*/
#ifdef __cplusplus
inline int NS_FAILED(nsresult _nsresult) {
inline uint32_t NS_FAILED_impl(nsresult _nsresult) {
return static_cast<uint32_t>(_nsresult) & 0x80000000;
}
inline int NS_SUCCEEDED(nsresult _nsresult) {
return !(static_cast<uint32_t>(_nsresult) & 0x80000000);
}
#define NS_FAILED(_nsresult) ((bool)NS_UNLIKELY(NS_FAILED_impl(_nsresult)))
#define NS_SUCCEEDED(_nsresult) ((bool)NS_LIKELY(!NS_FAILED_impl(_nsresult)))
#else
#define NS_FAILED(_nsresult) (NS_UNLIKELY((_nsresult) & 0x80000000))
#define NS_SUCCEEDED(_nsresult) (NS_LIKELY(!((_nsresult) & 0x80000000)))
#define NS_FAILED_impl(_nsresult) ((_nsresult) & 0x80000000)
#define NS_FAILED(_nsresult) (NS_UNLIKELY(NS_FAILED_impl(_nsresult)))
#define NS_SUCCEEDED(_nsresult) (NS_LIKELY(!NS_FAILED_impl(_nsresult)))
#endif
/**

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