From 30956334f2013fc66ee6ab4e70bb6e6e571aadcb Mon Sep 17 00:00:00 2001
From: Dirkjan Ochtman
Date: Fri, 15 Feb 2013 08:32:43 +0100
Subject: [PATCH 001/140] Bug 638219 - Move command construction into Test
class method; r=terrence
--HG--
rename : toolkit/modules/Timer.jsm => browser/devtools/shared/Browser.jsm
rename : toolkit/modules/tests/xpcshell/test_timer.js => browser/devtools/shared/test/browser_browser_basic.js
extra : rebase_source : 4a02112413b31457cf855d68a6db6d816172652f
---
js/src/jit-test/jit_test.py | 2 +-
js/src/tests/lib/jittests.py | 33 ++++++++++++++++-----------------
2 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/js/src/jit-test/jit_test.py b/js/src/jit-test/jit_test.py
index c891eec78eb..5d582cc6268 100755
--- a/js/src/jit-test/jit_test.py
+++ b/js/src/jit-test/jit_test.py
@@ -189,7 +189,7 @@ def main(argv):
sys.exit(1)
tc = job_list[0]
- cmd = [ 'gdb', '--args' ] + jittests.get_test_cmd(options.js_shell, tc.path, tc.jitflags, lib_dir, shell_args)
+ cmd = [ 'gdb', '--args' ] + tc.command(options.js_shell, lib_dir, shell_args)
subprocess.call(cmd)
sys.exit()
diff --git a/js/src/tests/lib/jittests.py b/js/src/tests/lib/jittests.py
index af7f69fbb98..c274e6f04f4 100755
--- a/js/src/tests/lib/jittests.py
+++ b/js/src/tests/lib/jittests.py
@@ -123,6 +123,20 @@ class Test:
return test
+ def command(self, js, lib_dir, shell_args):
+ libdir_var = lib_dir
+ if not libdir_var.endswith('/'):
+ libdir_var += '/'
+ scriptdir_var = os.path.dirname(self.path);
+ if not scriptdir_var.endswith('/'):
+ scriptdir_var += '/'
+ expr = ("const platform=%r; const libdir=%r; const scriptdir=%r"
+ % (sys.platform, libdir_var, scriptdir_var))
+ # We may have specified '-a' or '-d' twice: once via --jitflags, once
+ # via the "|jit-test|" line. Remove dups because they are toggles.
+ return ([js] + list(set(self.jitflags)) + shell_args +
+ ['-e', expr, '-f', os.path.join(lib_dir, 'prolog.js'), '-f', self.path])
+
def find_tests(dir, substring = None):
ans = []
for dirpath, dirnames, filenames in os.walk(dir):
@@ -140,20 +154,6 @@ def find_tests(dir, substring = None):
ans.append(test)
return ans
-def get_test_cmd(js, path, jitflags, lib_dir, shell_args):
- libdir_var = lib_dir
- if not libdir_var.endswith('/'):
- libdir_var += '/'
- scriptdir_var = os.path.dirname(path);
- if not scriptdir_var.endswith('/'):
- scriptdir_var += '/'
- expr = ("const platform=%r; const libdir=%r; const scriptdir=%r"
- % (sys.platform, libdir_var, scriptdir_var))
- # We may have specified '-a' or '-d' twice: once via --jitflags, once
- # via the "|jit-test|" line. Remove dups because they are toggles.
- return ([js] + list(set(jitflags)) + shell_args +
- [ '-e', expr, '-f', os.path.join(lib_dir, 'prolog.js'), '-f', path ])
-
def tmppath(token):
fd, path = tempfile.mkstemp(prefix=token)
os.close(fd)
@@ -240,8 +240,7 @@ def run_cmd_avoid_stdio(cmdline, env, timeout):
return read_and_unlink(stdoutPath), read_and_unlink(stderrPath), code
def run_test(test, lib_dir, shell_args, options):
- cmd = get_test_cmd(options.js_shell, test.path, test.jitflags, lib_dir, shell_args)
-
+ cmd = test.command(options.js_shell, lib_dir, shell_args)
if (test.valgrind and
any([os.path.exists(os.path.join(d, 'valgrind'))
for d in os.environ['PATH'].split(os.pathsep)])):
@@ -442,7 +441,7 @@ def print_test_summary(failures, complete, doing, options, lib_dir, shell_args):
def show_test(test):
if options.show_failed:
- print(' ' + subprocess.list2cmdline(get_test_cmd(options.js_shell, test.path, test.jitflags, lib_dir, shell_args)))
+ print(' ' + subprocess.list2cmdline(test.command(options.js_shell, lib_dir, shell_args)))
else:
print(' ' + ' '.join(test.jitflags + [test.path]))
From c877e5877efac518ad7e8da3fea7436bbb37ee00 Mon Sep 17 00:00:00 2001
From: Dirkjan Ochtman
Date: Fri, 15 Feb 2013 08:33:25 +0100
Subject: [PATCH 002/140] Bug 638219 - Extract valgrind setup, prepend in
Test.command(); r=terrence
--HG--
extra : rebase_source : dc17ae04127892f4d5778e5d546d8fba4436766f
---
js/src/tests/lib/jittests.py | 37 ++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/js/src/tests/lib/jittests.py b/js/src/tests/lib/jittests.py
index c274e6f04f4..7f923464e94 100755
--- a/js/src/tests/lib/jittests.py
+++ b/js/src/tests/lib/jittests.py
@@ -45,6 +45,22 @@ def _relpath(path, start=None):
os.path.relpath = _relpath
class Test:
+
+ VALGRIND_CMD = []
+ paths = (d for d in os.environ['PATH'].split(os.pathsep))
+ valgrinds = (os.path.join(d, 'valgrind') for d in paths)
+ if any(os.path.exists(p) for p in valgrinds):
+ VALGRIND_CMD = [
+ 'valgrind', '-q', '--smc-check=all-non-file',
+ '--error-exitcode=1', '--gen-suppressions=all',
+ '--show-possibly-lost=no', '--leak-check=full',
+ ]
+ if os.uname()[0] == 'Darwin':
+ VALGRIND_CMD.append('--dsymutil=yes')
+
+ del paths
+ del valgrinds
+
def __init__(self, path):
self.path = path # path to test file
@@ -134,8 +150,11 @@ class Test:
% (sys.platform, libdir_var, scriptdir_var))
# We may have specified '-a' or '-d' twice: once via --jitflags, once
# via the "|jit-test|" line. Remove dups because they are toggles.
- return ([js] + list(set(self.jitflags)) + shell_args +
- ['-e', expr, '-f', os.path.join(lib_dir, 'prolog.js'), '-f', self.path])
+ cmd = [js] + list(set(self.jitflags)) + shell_args + ['-e', expr]
+ cmd += ['-f', os.path.join(lib_dir, 'prolog.js'), '-f', self.path]
+ if self.valgrind:
+ cmd = self.VALGRIND_CMD + cmd
+ return cmd
def find_tests(dir, substring = None):
ans = []
@@ -241,20 +260,6 @@ def run_cmd_avoid_stdio(cmdline, env, timeout):
def run_test(test, lib_dir, shell_args, options):
cmd = test.command(options.js_shell, lib_dir, shell_args)
- if (test.valgrind and
- any([os.path.exists(os.path.join(d, 'valgrind'))
- for d in os.environ['PATH'].split(os.pathsep)])):
- valgrind_prefix = [ 'valgrind',
- '-q',
- '--smc-check=all-non-file',
- '--error-exitcode=1',
- '--gen-suppressions=all',
- '--show-possibly-lost=no',
- '--leak-check=full']
- if os.uname()[0] == 'Darwin':
- valgrind_prefix += ['--dsymutil=yes']
- cmd = valgrind_prefix + cmd
-
if options.show_cmd:
print(subprocess.list2cmdline(cmd))
From b364cd92d0ad39ca18fc98e53839419782ac8f3d Mon Sep 17 00:00:00 2001
From: Dirkjan Ochtman
Date: Fri, 15 Feb 2013 09:01:19 +0100
Subject: [PATCH 003/140] Bug 638219 - Save static paths in module-level
constants; r=terrence
These paths are a little far away from the script they're referenced in, so
it's a little fragile. However, since (a) these aren't expected to change
that often, and (b) the code should fail conspicuously if there is a change,
I don't think it's a problem.
--HG--
extra : rebase_source : 2e2d278826d4d30c813156553590c24d9056575f
---
js/src/jit-test/jit_test.py | 19 +++++-------
js/src/tests/lib/jittests.py | 58 +++++++++++++++++++-----------------
2 files changed, 37 insertions(+), 40 deletions(-)
diff --git a/js/src/jit-test/jit_test.py b/js/src/jit-test/jit_test.py
index 5d582cc6268..de72df3ad44 100755
--- a/js/src/jit-test/jit_test.py
+++ b/js/src/jit-test/jit_test.py
@@ -18,11 +18,6 @@ import jittests
def main(argv):
- script_path = os.path.abspath(__file__)
- script_dir = os.path.dirname(script_path)
- test_dir = os.path.join(script_dir, 'tests')
- lib_dir = os.path.join(script_dir, 'lib')
-
# If no multiprocessing is available, fallback to serial test execution
max_jobs_default = 1
if jittests.HAVE_MULTIPROCESSING:
@@ -106,14 +101,14 @@ def main(argv):
if test_args:
read_all = False
for arg in test_args:
- test_list += jittests.find_tests(test_dir, arg)
+ test_list += jittests.find_tests(arg)
if options.read_tests:
read_all = False
try:
f = open(options.read_tests)
for line in f:
- test_list.append(os.path.join(test_dir, line.strip('\n')))
+ test_list.append(os.path.join(TEST_DIR, line.strip('\n')))
f.close()
except IOError:
if options.retest:
@@ -125,12 +120,12 @@ def main(argv):
sys.stderr.write('---\n')
if read_all:
- test_list = jittests.find_tests(test_dir)
+ test_list = jittests.find_tests()
if options.exclude:
exclude_list = []
for exclude in options.exclude:
- exclude_list += jittests.find_tests(test_dir, exclude)
+ exclude_list += jittests.find_tests(exclude)
test_list = [ test for test in test_list if test not in set(exclude_list) ]
if not test_list:
@@ -189,16 +184,16 @@ def main(argv):
sys.exit(1)
tc = job_list[0]
- cmd = [ 'gdb', '--args' ] + tc.command(options.js_shell, lib_dir, shell_args)
+ cmd = [ 'gdb', '--args' ] + tc.command(options.js_shell, shell_args)
subprocess.call(cmd)
sys.exit()
try:
ok = None
if options.max_jobs > 1 and jittests.HAVE_MULTIPROCESSING:
- ok = jittests.run_tests_parallel(job_list, test_dir, lib_dir, shell_args, options)
+ ok = jittests.run_tests_parallel(job_list, shell_args, options)
else:
- ok = jittests.run_tests(job_list, test_dir, lib_dir, shell_args, options)
+ ok = jittests.run_tests(job_list, shell_args, options)
if not ok:
sys.exit(2)
except OSError:
diff --git a/js/src/tests/lib/jittests.py b/js/src/tests/lib/jittests.py
index 7f923464e94..878225feb39 100755
--- a/js/src/tests/lib/jittests.py
+++ b/js/src/tests/lib/jittests.py
@@ -21,6 +21,11 @@ except ImportError:
from progressbar import ProgressBar, NullProgressBar
+TESTS_LIB_DIR = os.path.dirname(os.path.abspath(__file__))
+JS_DIR = os.path.dirname(os.path.dirname(TESTS_LIB_DIR))
+TEST_DIR = os.path.join(JS_DIR, 'jit-test', 'tests')
+LIB_DIR = os.path.join(JS_DIR, 'jit-test', 'lib') + os.path.sep
+
# Backported from Python 3.1 posixpath.py
def _relpath(path, start=None):
"""Return a relative version of a path"""
@@ -139,26 +144,23 @@ class Test:
return test
- def command(self, js, lib_dir, shell_args):
- libdir_var = lib_dir
- if not libdir_var.endswith('/'):
- libdir_var += '/'
+ def command(self, js, shell_args):
scriptdir_var = os.path.dirname(self.path);
if not scriptdir_var.endswith('/'):
scriptdir_var += '/'
expr = ("const platform=%r; const libdir=%r; const scriptdir=%r"
- % (sys.platform, libdir_var, scriptdir_var))
+ % (sys.platform, LIB_DIR, scriptdir_var))
# We may have specified '-a' or '-d' twice: once via --jitflags, once
# via the "|jit-test|" line. Remove dups because they are toggles.
cmd = [js] + list(set(self.jitflags)) + shell_args + ['-e', expr]
- cmd += ['-f', os.path.join(lib_dir, 'prolog.js'), '-f', self.path]
+ cmd += ['-f', os.path.join(LIB_DIR, 'prolog.js'), '-f', self.path]
if self.valgrind:
cmd = self.VALGRIND_CMD + cmd
return cmd
-def find_tests(dir, substring = None):
+def find_tests(substring=None):
ans = []
- for dirpath, dirnames, filenames in os.walk(dir):
+ for dirpath, dirnames, filenames in os.walk(TEST_DIR):
dirnames.sort()
filenames.sort()
if dirpath == '.':
@@ -169,7 +171,7 @@ def find_tests(dir, substring = None):
if filename in ('shell.js', 'browser.js', 'jsref.js'):
continue
test = os.path.join(dirpath, filename)
- if substring is None or substring in os.path.relpath(test, dir):
+ if substring is None or substring in os.path.relpath(test, TEST_DIR):
ans.append(test)
return ans
@@ -258,8 +260,8 @@ def run_cmd_avoid_stdio(cmdline, env, timeout):
_, __, code = run_timeout_cmd(cmdline, { 'env': env }, timeout)
return read_and_unlink(stdoutPath), read_and_unlink(stderrPath), code
-def run_test(test, lib_dir, shell_args, options):
- cmd = test.command(options.js_shell, lib_dir, shell_args)
+def run_test(test, shell_args, options):
+ cmd = test.command(options.js_shell, shell_args)
if options.show_cmd:
print(subprocess.list2cmdline(cmd))
@@ -313,14 +315,14 @@ def print_tinderbox(label, test, message=None):
result += ": " + message
print(result)
-def wrap_parallel_run_test(test, lib_dir, shell_args, resultQueue, options):
+def wrap_parallel_run_test(test, shell_args, resultQueue, options):
# Ignore SIGINT in the child
signal.signal(signal.SIGINT, signal.SIG_IGN)
- result = run_test(test, lib_dir, shell_args, options) + (test,)
+ result = run_test(test, shell_args, options) + (test,)
resultQueue.put(result)
return result
-def run_tests_parallel(tests, test_dir, lib_dir, shell_args, options):
+def run_tests_parallel(tests, shell_args, options):
# This queue will contain the results of the various tests run.
# We could make this queue a global variable instead of using
# a manager to share, but this will not work on Windows.
@@ -338,7 +340,7 @@ def run_tests_parallel(tests, test_dir, lib_dir, shell_args, options):
result_process_return_queue = queue_manager.Queue()
result_process = Process(target=process_test_results_parallel,
args=(async_test_result_queue, result_process_return_queue,
- notify_queue, len(tests), options, lib_dir, shell_args))
+ notify_queue, len(tests), options, shell_args))
result_process.start()
# Ensure that a SIGTERM is handled the same way as SIGINT
@@ -368,7 +370,7 @@ def run_tests_parallel(tests, test_dir, lib_dir, shell_args, options):
while notify_queue.get():
if (testcnt < len(tests)):
# Start one new worker
- worker_process = Process(target=wrap_parallel_run_test, args=(tests[testcnt], lib_dir, shell_args, async_test_result_queue, options))
+ worker_process = Process(target=wrap_parallel_run_test, args=(tests[testcnt], shell_args, async_test_result_queue, options))
worker_processes.append(worker_process)
worker_process.start()
testcnt += 1
@@ -417,12 +419,12 @@ def get_parallel_results(async_test_result_queue, notify_queue):
yield async_test_result
-def process_test_results_parallel(async_test_result_queue, return_queue, notify_queue, num_tests, options, lib_dir, shell_args):
+def process_test_results_parallel(async_test_result_queue, return_queue, notify_queue, num_tests, options, shell_args):
gen = get_parallel_results(async_test_result_queue, notify_queue)
- ok = process_test_results(gen, num_tests, options, lib_dir, shell_args)
+ ok = process_test_results(gen, num_tests, options, shell_args)
return_queue.put(ok)
-def print_test_summary(failures, complete, doing, options, lib_dir, shell_args):
+def print_test_summary(failures, complete, doing, options, shell_args):
if failures:
if options.write_failures:
try:
@@ -431,7 +433,7 @@ def print_test_summary(failures, complete, doing, options, lib_dir, shell_args):
written = set()
for test, fout, ferr, fcode, _ in failures:
if test.path not in written:
- out.write(os.path.relpath(test.path, test_dir) + '\n')
+ out.write(os.path.relpath(test.path, TEST_DIR) + '\n')
if options.write_failure_output:
out.write(fout)
out.write(ferr)
@@ -446,7 +448,7 @@ def print_test_summary(failures, complete, doing, options, lib_dir, shell_args):
def show_test(test):
if options.show_failed:
- print(' ' + subprocess.list2cmdline(test.command(options.js_shell, lib_dir, shell_args)))
+ print(' ' + subprocess.list2cmdline(test.command(options.js_shell, shell_args)))
else:
print(' ' + ' '.join(test.jitflags + [test.path]))
@@ -465,7 +467,7 @@ def print_test_summary(failures, complete, doing, options, lib_dir, shell_args):
print('PASSED ALL' + ('' if complete else ' (partial run -- interrupted by user %s)' % doing))
return True
-def process_test_results(results, num_tests, options, lib_dir, shell_args):
+def process_test_results(results, num_tests, options, shell_args):
pb = NullProgressBar()
if not options.hide_progress and not options.show_cmd and ProgressBar.conservative_isatty():
fmt = [
@@ -514,17 +516,17 @@ def process_test_results(results, num_tests, options, lib_dir, shell_args):
print_tinderbox("TEST-UNEXPECTED-FAIL", None, "Test execution interrupted by user");
pb.finish(True)
- return print_test_summary(failures, complete, doing, options, lib_dir, shell_args)
+ return print_test_summary(failures, complete, doing, options, shell_args)
-def get_serial_results(tests, lib_dir, shell_args, options):
+def get_serial_results(tests, shell_args, options):
for test in tests:
- result = run_test(test, lib_dir, shell_args, options)
+ result = run_test(test, shell_args, options)
yield result + (test,)
-def run_tests(tests, test_dir, lib_dir, shell_args, options):
- gen = get_serial_results(tests, lib_dir, shell_args, options)
- ok = process_test_results(gen, len(tests), options, lib_dir, shell_args)
+def run_tests(tests, shell_args, options):
+ gen = get_serial_results(tests, shell_args, options)
+ ok = process_test_results(gen, len(tests), options, shell_args)
return ok
def parse_jitflags(options):
From 4b6bc9c1099c6afd4016eebae1675f9942161744 Mon Sep 17 00:00:00 2001
From: Dirkjan Ochtman
Date: Fri, 15 Feb 2013 17:00:58 +0100
Subject: [PATCH 004/140] Bug 638219 - Use TestOutput class to wrap test
results; r=terrence
--HG--
extra : rebase_source : 446d5f86d11c4d41fc771dde2b6357f6fff63175
---
js/src/tests/lib/jittests.py | 51 ++++++++++++++++++------------------
1 file changed, 26 insertions(+), 25 deletions(-)
diff --git a/js/src/tests/lib/jittests.py b/js/src/tests/lib/jittests.py
index 878225feb39..a6f1911da52 100755
--- a/js/src/tests/lib/jittests.py
+++ b/js/src/tests/lib/jittests.py
@@ -20,6 +20,7 @@ except ImportError:
HAVE_MULTIPROCESSING = False
from progressbar import ProgressBar, NullProgressBar
+from results import TestOutput
TESTS_LIB_DIR = os.path.dirname(os.path.abspath(__file__))
JS_DIR = os.path.dirname(os.path.dirname(TESTS_LIB_DIR))
@@ -282,8 +283,8 @@ def run_test(test, shell_args, options):
sys.stdout.write('Exit code: %s\n' % code)
if test.valgrind:
sys.stdout.write(err)
- return (check_output(out, err, code, test),
- out, err, code, timed_out)
+
+ return TestOutput(test, cmd, out, err, code, None, timed_out)
def check_output(out, err, rc, test):
if test.expect_error:
@@ -318,7 +319,7 @@ def print_tinderbox(label, test, message=None):
def wrap_parallel_run_test(test, shell_args, resultQueue, options):
# Ignore SIGINT in the child
signal.signal(signal.SIGINT, signal.SIG_IGN)
- result = run_test(test, shell_args, options) + (test,)
+ result = run_test(test, shell_args, options)
resultQueue.put(result)
return result
@@ -431,14 +432,14 @@ def print_test_summary(failures, complete, doing, options, shell_args):
out = open(options.write_failures, 'w')
# Don't write duplicate entries when we are doing multiple failures per job.
written = set()
- for test, fout, ferr, fcode, _ in failures:
- if test.path not in written:
- out.write(os.path.relpath(test.path, TEST_DIR) + '\n')
+ for res in failures:
+ if res.test.path not in written:
+ out.write(os.path.relpath(res.test.path, TEST_DIR) + '\n')
if options.write_failure_output:
- out.write(fout)
- out.write(ferr)
- out.write('Exit code: ' + str(fcode) + "\n")
- written.add(test.path)
+ out.write(res.out)
+ out.write(res.err)
+ out.write('Exit code: ' + str(res.rc) + "\n")
+ written.add(res.test.path)
out.close()
except IOError:
sys.stderr.write("Exception thrown trying to write failure file '%s'\n"%
@@ -453,14 +454,14 @@ def print_test_summary(failures, complete, doing, options, shell_args):
print(' ' + ' '.join(test.jitflags + [test.path]))
print('FAILURES:')
- for test, _, __, ___, timed_out in failures:
- if not timed_out:
- show_test(test)
+ for res in failures:
+ if not res.timed_out:
+ show_test(res.test)
print('TIMEOUTS:')
- for test, _, __, ___, timed_out in failures:
- if timed_out:
- show_test(test)
+ for res in failures:
+ if res.timed_out:
+ show_test(res.test)
return False
else:
@@ -483,18 +484,19 @@ def process_test_results(results, num_tests, options, shell_args):
complete = False
doing = 'before starting'
try:
- for i, (ok, out, err, code, timed_out, test) in enumerate(results):
- doing = 'after %s'%test.path
+ for i, res in enumerate(results):
+ ok = check_output(res.out, res.err, res.rc, res.test)
+ doing = 'after %s' % res.test.path
if not ok:
- failures.append([ test, out, err, code, timed_out ])
- pb.message("FAIL - %s" % test.path)
- if timed_out:
+ failures.append(res)
+ pb.message("FAIL - %s" % res.test.path)
+ if res.timed_out:
timeouts += 1
if options.tinderbox:
if ok:
- print_tinderbox("TEST-PASS", test);
+ print_tinderbox("TEST-PASS", res.test);
else:
lines = [ _ for _ in out.split('\n') + err.split('\n')
if _ != '' ]
@@ -502,7 +504,7 @@ def process_test_results(results, num_tests, options, shell_args):
msg = lines[-1]
else:
msg = ''
- print_tinderbox("TEST-UNEXPECTED-FAIL", test, msg);
+ print_tinderbox("TEST-UNEXPECTED-FAIL", res.test, msg);
n = i + 1
pb.update(n, {
@@ -521,8 +523,7 @@ def process_test_results(results, num_tests, options, shell_args):
def get_serial_results(tests, shell_args, options):
for test in tests:
- result = run_test(test, shell_args, options)
- yield result + (test,)
+ yield run_test(test, shell_args, options)
def run_tests(tests, shell_args, options):
gen = get_serial_results(tests, shell_args, options)
From d60cf242a46f4318db654ab1573e399b2321f284 Mon Sep 17 00:00:00 2001
From: Dirkjan Ochtman
Date: Fri, 15 Feb 2013 17:44:24 +0100
Subject: [PATCH 005/140] Bug 638219 - Reuse cmd saved in results object rather
than rebuilding it; r=terrence
--HG--
extra : rebase_source : 4b955e7793c966db184f67cc1a90ab8c24bbfcd7
---
js/src/tests/lib/jittests.py | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/js/src/tests/lib/jittests.py b/js/src/tests/lib/jittests.py
index a6f1911da52..5c64d296be7 100755
--- a/js/src/tests/lib/jittests.py
+++ b/js/src/tests/lib/jittests.py
@@ -341,7 +341,7 @@ def run_tests_parallel(tests, shell_args, options):
result_process_return_queue = queue_manager.Queue()
result_process = Process(target=process_test_results_parallel,
args=(async_test_result_queue, result_process_return_queue,
- notify_queue, len(tests), options, shell_args))
+ notify_queue, len(tests), options))
result_process.start()
# Ensure that a SIGTERM is handled the same way as SIGINT
@@ -420,12 +420,12 @@ def get_parallel_results(async_test_result_queue, notify_queue):
yield async_test_result
-def process_test_results_parallel(async_test_result_queue, return_queue, notify_queue, num_tests, options, shell_args):
+def process_test_results_parallel(async_test_result_queue, return_queue, notify_queue, num_tests, options):
gen = get_parallel_results(async_test_result_queue, notify_queue)
- ok = process_test_results(gen, num_tests, options, shell_args)
+ ok = process_test_results(gen, num_tests, options)
return_queue.put(ok)
-def print_test_summary(failures, complete, doing, options, shell_args):
+def print_test_summary(failures, complete, doing, options):
if failures:
if options.write_failures:
try:
@@ -447,28 +447,28 @@ def print_test_summary(failures, complete, doing, options, shell_args):
traceback.print_exc()
sys.stderr.write('---\n')
- def show_test(test):
+ def show_test(res):
if options.show_failed:
- print(' ' + subprocess.list2cmdline(test.command(options.js_shell, shell_args)))
+ print(' ' + subprocess.list2cmdline(res.cmd))
else:
- print(' ' + ' '.join(test.jitflags + [test.path]))
+ print(' ' + ' '.join(res.test.jitflags + [res.test.path]))
print('FAILURES:')
for res in failures:
if not res.timed_out:
- show_test(res.test)
+ show_test(res)
print('TIMEOUTS:')
for res in failures:
if res.timed_out:
- show_test(res.test)
+ show_test(res)
return False
else:
print('PASSED ALL' + ('' if complete else ' (partial run -- interrupted by user %s)' % doing))
return True
-def process_test_results(results, num_tests, options, shell_args):
+def process_test_results(results, num_tests, options):
pb = NullProgressBar()
if not options.hide_progress and not options.show_cmd and ProgressBar.conservative_isatty():
fmt = [
@@ -518,7 +518,7 @@ def process_test_results(results, num_tests, options, shell_args):
print_tinderbox("TEST-UNEXPECTED-FAIL", None, "Test execution interrupted by user");
pb.finish(True)
- return print_test_summary(failures, complete, doing, options, shell_args)
+ return print_test_summary(failures, complete, doing, options)
def get_serial_results(tests, shell_args, options):
@@ -527,7 +527,7 @@ def get_serial_results(tests, shell_args, options):
def run_tests(tests, shell_args, options):
gen = get_serial_results(tests, shell_args, options)
- ok = process_test_results(gen, len(tests), options, shell_args)
+ ok = process_test_results(gen, len(tests), options)
return ok
def parse_jitflags(options):
From ad98786482fb3ea66690ef44f72af260d31b3b1b Mon Sep 17 00:00:00 2001
From: Dirkjan Ochtman
Date: Fri, 15 Feb 2013 17:09:33 +0100
Subject: [PATCH 006/140] Bug 638219 - Move test result output into result
processing function; r=terrence
--HG--
extra : rebase_source : c72b28460c2e4b52aa3e4bfa903d5ee1563c1e39
---
js/src/tests/lib/jittests.py | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/js/src/tests/lib/jittests.py b/js/src/tests/lib/jittests.py
index 5c64d296be7..74185cee087 100755
--- a/js/src/tests/lib/jittests.py
+++ b/js/src/tests/lib/jittests.py
@@ -276,14 +276,6 @@ def run_test(test, shell_args, options):
env['TZ'] = 'PST8PDT'
out, err, code, timed_out = run(cmd, env, options.timeout)
-
- if options.show_output:
- sys.stdout.write(out)
- sys.stdout.write(err)
- sys.stdout.write('Exit code: %s\n' % code)
- if test.valgrind:
- sys.stdout.write(err)
-
return TestOutput(test, cmd, out, err, code, None, timed_out)
def check_output(out, err, rc, test):
@@ -486,6 +478,13 @@ def process_test_results(results, num_tests, options):
try:
for i, res in enumerate(results):
+ if options.show_output:
+ sys.stdout.write(res.out)
+ sys.stdout.write(res.err)
+ sys.stdout.write('Exit code: %s\n' % res.rc)
+ if res.test.valgrind:
+ sys.stdout.write(res.err)
+
ok = check_output(res.out, res.err, res.rc, res.test)
doing = 'after %s' % res.test.path
if not ok:
From 301f3895ff68bc318ad002600a57a48f6de6df1b Mon Sep 17 00:00:00 2001
From: Dirkjan Ochtman
Date: Fri, 15 Feb 2013 17:58:45 +0100
Subject: [PATCH 007/140] Bug 638219 - Set all test-independent command-line
bits up once, pass in; r=terrence
This will help integration with the jstests framework, which also uses
a single prefix argument to its Test command construction method.
Note that the order of js arguments is changed, from:
cmd = [js] + list(set(self.jitflags)) + shell_args + ['-e', expr]
cmd += ['-f', os.path.join(LIB_DIR, 'prolog.js'), '-f', self.path]
to:
prefix = [os.path.abspath(args[0])] + shlex.split(options.shell_args)
prefix += ['-f', os.path.join(jittests.LIB_DIR, 'prolog.js')]
cmd = prefix + list(set(self.jitflags)) + ['-e', expr, '-f', self.path]
The assumption here is that only the order of -f options matters.
--HG--
extra : rebase_source : 9655d6efc62006aa840d72f6b31d764bd870cc7d
---
js/src/jit-test/jit_test.py | 16 ++++++++--------
js/src/tests/lib/jittests.py | 26 ++++++++++++--------------
2 files changed, 20 insertions(+), 22 deletions(-)
diff --git a/js/src/jit-test/jit_test.py b/js/src/jit-test/jit_test.py
index de72df3ad44..0e226811fd1 100755
--- a/js/src/jit-test/jit_test.py
+++ b/js/src/jit-test/jit_test.py
@@ -79,7 +79,7 @@ def main(argv):
if len(args) < 1:
op.error('missing JS_SHELL argument')
# We need to make sure we are using backslashes on Windows.
- options.js_shell, test_args = os.path.abspath(args[0]), args[1:]
+ test_args = args[:1]
if jittests.stdio_might_be_broken():
# Prefer erring on the side of caution and not using stdio if
@@ -174,8 +174,8 @@ def main(argv):
new_test.jitflags.extend(jitflags)
job_list.append(new_test)
- shell_args = shlex.split(options.shell_args)
-
+ prefix = [os.path.abspath(args[0])] + shlex.split(options.shell_args)
+ prefix += ['-f', os.path.join(jittests.LIB_DIR, 'prolog.js')]
if options.debug:
if len(job_list) > 1:
print 'Multiple tests match command line arguments, debugger can only run one'
@@ -184,21 +184,21 @@ def main(argv):
sys.exit(1)
tc = job_list[0]
- cmd = [ 'gdb', '--args' ] + tc.command(options.js_shell, shell_args)
+ cmd = ['gdb', '--args'] + tc.command(prefix)
subprocess.call(cmd)
sys.exit()
try:
ok = None
if options.max_jobs > 1 and jittests.HAVE_MULTIPROCESSING:
- ok = jittests.run_tests_parallel(job_list, shell_args, options)
+ ok = jittests.run_tests_parallel(job_list, prefix, options)
else:
- ok = jittests.run_tests(job_list, shell_args, options)
+ ok = jittests.run_tests(job_list, prefix, options)
if not ok:
sys.exit(2)
except OSError:
- if not os.path.exists(options.js_shell):
- print >> sys.stderr, "JS shell argument: file does not exist: '%s'" % options.js_shell
+ if not os.path.exists(prefix[0]):
+ print >> sys.stderr, "JS shell argument: file does not exist: '%s'" % prefix[0]
sys.exit(1)
else:
raise
diff --git a/js/src/tests/lib/jittests.py b/js/src/tests/lib/jittests.py
index 74185cee087..267a29e891c 100755
--- a/js/src/tests/lib/jittests.py
+++ b/js/src/tests/lib/jittests.py
@@ -145,7 +145,7 @@ class Test:
return test
- def command(self, js, shell_args):
+ def command(self, prefix):
scriptdir_var = os.path.dirname(self.path);
if not scriptdir_var.endswith('/'):
scriptdir_var += '/'
@@ -153,8 +153,7 @@ class Test:
% (sys.platform, LIB_DIR, scriptdir_var))
# We may have specified '-a' or '-d' twice: once via --jitflags, once
# via the "|jit-test|" line. Remove dups because they are toggles.
- cmd = [js] + list(set(self.jitflags)) + shell_args + ['-e', expr]
- cmd += ['-f', os.path.join(LIB_DIR, 'prolog.js'), '-f', self.path]
+ cmd = prefix + list(set(self.jitflags)) + ['-e', expr, '-f', self.path]
if self.valgrind:
cmd = self.VALGRIND_CMD + cmd
return cmd
@@ -261,8 +260,8 @@ def run_cmd_avoid_stdio(cmdline, env, timeout):
_, __, code = run_timeout_cmd(cmdline, { 'env': env }, timeout)
return read_and_unlink(stdoutPath), read_and_unlink(stderrPath), code
-def run_test(test, shell_args, options):
- cmd = test.command(options.js_shell, shell_args)
+def run_test(test, prefix, options):
+ cmd = test.command(prefix)
if options.show_cmd:
print(subprocess.list2cmdline(cmd))
@@ -308,14 +307,14 @@ def print_tinderbox(label, test, message=None):
result += ": " + message
print(result)
-def wrap_parallel_run_test(test, shell_args, resultQueue, options):
+def wrap_parallel_run_test(test, prefix, resultQueue, options):
# Ignore SIGINT in the child
signal.signal(signal.SIGINT, signal.SIG_IGN)
- result = run_test(test, shell_args, options)
+ result = run_test(test, prefix, options)
resultQueue.put(result)
return result
-def run_tests_parallel(tests, shell_args, options):
+def run_tests_parallel(tests, prefix, options):
# This queue will contain the results of the various tests run.
# We could make this queue a global variable instead of using
# a manager to share, but this will not work on Windows.
@@ -363,7 +362,7 @@ def run_tests_parallel(tests, shell_args, options):
while notify_queue.get():
if (testcnt < len(tests)):
# Start one new worker
- worker_process = Process(target=wrap_parallel_run_test, args=(tests[testcnt], shell_args, async_test_result_queue, options))
+ worker_process = Process(target=wrap_parallel_run_test, args=(tests[testcnt], prefix, async_test_result_queue, options))
worker_processes.append(worker_process)
worker_process.start()
testcnt += 1
@@ -519,13 +518,12 @@ def process_test_results(results, num_tests, options):
pb.finish(True)
return print_test_summary(failures, complete, doing, options)
-
-def get_serial_results(tests, shell_args, options):
+def get_serial_results(tests, prefix, options):
for test in tests:
- yield run_test(test, shell_args, options)
+ yield run_test(test, prefix, options)
-def run_tests(tests, shell_args, options):
- gen = get_serial_results(tests, shell_args, options)
+def run_tests(tests, prefix, options):
+ gen = get_serial_results(tests, prefix, options)
ok = process_test_results(gen, len(tests), options)
return ok
From 9fbf61c89143220ff9a939547a9f1d3658a94303 Mon Sep 17 00:00:00 2001
From: Jim Mathies
Date: Fri, 1 Mar 2013 16:16:13 -0600
Subject: [PATCH 008/140] Bug 846679 - Export WinUtils so we can use its handy
dandy routines in other places besides widget. r=masayuki
---
widget/windows/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/widget/windows/Makefile.in b/widget/windows/Makefile.in
index a5770701a33..70ca933ba61 100644
--- a/widget/windows/Makefile.in
+++ b/widget/windows/Makefile.in
@@ -93,7 +93,7 @@ SHARED_LIBRARY_LIBS = \
../xpwidgets/$(LIB_PREFIX)xpwidgets_s.$(LIB_SUFFIX) \
$(NULL)
-EXPORTS = nsdefs.h WindowHook.h
+EXPORTS = nsdefs.h WindowHook.h WinUtils.h
EXPORTS_NAMESPACES = mozilla/widget
EXPORTS_mozilla/widget = AudioSession.h
From 24581defe93eb6848b570fba60b5e15805d90806 Mon Sep 17 00:00:00 2001
From: Jim Mathies
Date: Fri, 1 Mar 2013 16:16:11 -0600
Subject: [PATCH 009/140] Bug 843014 - 'Search for' context menu item should
quote selected text. r=fryn
---
browser/metro/base/content/ContextCommands.js | 19 ++++++++++++++++---
browser/metro/base/content/browser.xul | 6 ++++--
browser/metro/base/content/helperui/MenuUI.js | 4 ++++
.../locales/en-US/chrome/browser.properties | 4 ++--
4 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/browser/metro/base/content/ContextCommands.js b/browser/metro/base/content/ContextCommands.js
index a18fcd81c36..e18de84c4c5 100644
--- a/browser/metro/base/content/ContextCommands.js
+++ b/browser/metro/base/content/ContextCommands.js
@@ -10,6 +10,15 @@
var ContextCommands = {
_picker: null,
+ get _ellipsis() {
+ delete this._ellipsis;
+ this._ellipsis = "\u2026";
+ try {
+ this._ellipsis = Services.prefs.getComplexValue("intl.ellipsis", Ci.nsIPrefLocalizedString).data;
+ } catch (ex) { }
+ return this._ellipsis;
+ },
+
get clipboard() {
return Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper);
@@ -98,6 +107,7 @@ var ContextCommands = {
searchTextSetup: function cc_searchTextSetup(aRichListItem, aSearchString) {
let defaultURI;
let defaultName;
+ aSearchString = aSearchString.trim();
try {
let defaultPB = Services.prefs.getDefaultBranch(null);
const nsIPLS = Ci.nsIPrefLocalizedString;
@@ -108,11 +118,15 @@ var ContextCommands = {
Cu.reportError(ex);
return false;
}
+ let displayString = aSearchString;
+ if (displayString.length > 15) {
+ displayString = displayString.substring(0, 15) + this._ellipsis;
+ }
// label child node
let label = Services.strings
.createBundle("chrome://browser/locale/browser.properties")
- .formatStringFromName("browser.search.contextTextSearchLabel",
- [defaultName], 1);
+ .formatStringFromName("browser.search.contextTextSearchLabel2",
+ [defaultName, displayString], 2);
aRichListItem.childNodes[0].setAttribute("value", label);
aRichListItem.setAttribute("searchString", defaultURI);
return true;
@@ -355,7 +369,6 @@ var ContextCommands = {
var newDir = file.parent.QueryInterface(Ci.nsILocalFile);
Services.prefs.setComplexValue("browser.download.lastDir", Ci.nsILocalFile, newDir);
},
-
};
function AutoChosen(aFileAutoChosen, aUriAutoChosen) {
diff --git a/browser/metro/base/content/browser.xul b/browser/metro/base/content/browser.xul
index 593f6f58e64..e8db2dbbd92 100644
--- a/browser/metro/base/content/browser.xul
+++ b/browser/metro/base/content/browser.xul
@@ -572,6 +572,8 @@
+
@@ -585,8 +587,8 @@
-
-
+
+
diff --git a/browser/metro/base/content/helperui/MenuUI.js b/browser/metro/base/content/helperui/MenuUI.js
index 3e439edfabd..e6e4de19064 100644
--- a/browser/metro/base/content/helperui/MenuUI.js
+++ b/browser/metro/base/content/helperui/MenuUI.js
@@ -161,6 +161,10 @@ var ContextMenuUI = {
continue;
for (let i = 0; i < types.length; i++) {
+ // If one of the item's types has '!' before it, treat it as an exclusion rule.
+ if (types[i].charAt(0) == '!' && contentTypes.indexOf(types[i].substring(1)) != -1) {
+ break;
+ }
if (contentTypes.indexOf(types[i]) != -1) {
// If this is the special search text item, we need to set its label dynamically.
if (searchTextItem && !ContextCommands.searchTextSetup(command, this._popupState.string)) {
diff --git a/browser/metro/locales/en-US/chrome/browser.properties b/browser/metro/locales/en-US/chrome/browser.properties
index e971a0468ca..e856861de74 100644
--- a/browser/metro/locales/en-US/chrome/browser.properties
+++ b/browser/metro/locales/en-US/chrome/browser.properties
@@ -10,8 +10,8 @@ browser.search.order.1=Bing
browser.search.order.2=Google
browser.search.order.3=Yahoo
-# l10n: search context menu item text will be: |Search (browser.search.defaultenginename) for ".."
-browser.search.contextTextSearchLabel=Search %S for ".."
+# l10n: search context menu item text will be: |Search (browser.search.defaultenginename) for "(string).."
+browser.search.contextTextSearchLabel2=Search %S for "%S"
# Settings Charms
aboutCharm1=About
From ede5196c398a5121c6d59e5f86e7940e0f5251ca Mon Sep 17 00:00:00 2001
From: Matt Brubeck
Date: Fri, 1 Mar 2013 15:50:53 -0800
Subject: [PATCH 010/140] Bug 840588 - add topsrcdir and mozconfig to
mozinfo.json [r=ted]
--HG--
extra : rebase_source : 281c7272576af2f23be7becd7845a5f78da3eb17
---
config/writemozinfo.py | 7 +++++++
configure.in | 1 +
2 files changed, 8 insertions(+)
diff --git a/config/writemozinfo.py b/config/writemozinfo.py
index e207a48c32b..f4feb979bd9 100755
--- a/config/writemozinfo.py
+++ b/config/writemozinfo.py
@@ -28,6 +28,13 @@ def build_dict(env=os.environ):
if missing:
raise Exception("Missing required environment variables: %s" %
', '.join(missing))
+
+ if 'MOZCONFIG' in env:
+ d["mozconfig"] = env["MOZCONFIG"]
+
+ if 'TOPSRCDIR' in env:
+ d["topsrcdir"] = env["TOPSRCDIR"]
+
# os
o = env["OS_TARGET"]
known_os = {"Linux": "linux",
diff --git a/configure.in b/configure.in
index 5d412f11325..5a7e9b806d2 100644
--- a/configure.in
+++ b/configure.in
@@ -9118,6 +9118,7 @@ MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} \
UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
MOZ_CRASHREPORTER=${MOZ_CRASHREPORTER} \
MOZ_APP_NAME=${MOZ_APP_NAME} \
+TOPSRCDIR=${_topsrcdir} \
$PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
rm ./mozinfo.json.tmp
From 247d600febff62be12d77c2a138aec433e66fed6 Mon Sep 17 00:00:00 2001
From: Matt Brubeck
Date: Fri, 1 Mar 2013 15:51:11 -0800
Subject: [PATCH 011/140] Bug 840588 - Create a mach wrapper that searches up
from $CWD for a topsrcdir [r=gps]
--HG--
rename : mach => build/mach_bootstrap.py
extra : rebase_source : df914d42e46aac1326e50735a5d8e66cb4243a25
---
build/mach_bootstrap.py | 60 ++++++++++++++++++++++++++++
mach | 87 +++++++++++++++++------------------------
2 files changed, 96 insertions(+), 51 deletions(-)
create mode 100755 build/mach_bootstrap.py
diff --git a/build/mach_bootstrap.py b/build/mach_bootstrap.py
new file mode 100755
index 00000000000..5cd52e24ea4
--- /dev/null
+++ b/build/mach_bootstrap.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+# 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/.
+
+from __future__ import print_function, unicode_literals
+
+import os
+import platform
+import sys
+
+# TODO Bug 794506 Integrate with the in-tree virtualenv configuration.
+SEARCH_PATHS = [
+ 'python/mach',
+ 'python/mozboot',
+ 'python/mozbuild',
+ 'build/pymake',
+ 'python/blessings',
+ 'python/psutil',
+ 'python/which',
+ 'other-licenses/ply',
+ 'xpcom/idl-parser',
+ 'testing',
+ 'testing/xpcshell',
+ 'testing/mozbase/mozprocess',
+ 'testing/mozbase/mozfile',
+ 'testing/mozbase/mozinfo',
+]
+
+# Individual files providing mach commands.
+MACH_MODULES = [
+ 'addon-sdk/mach_commands.py',
+ 'layout/tools/reftest/mach_commands.py',
+ 'python/mozboot/mozboot/mach_commands.py',
+ 'python/mozbuild/mozbuild/config.py',
+ 'python/mozbuild/mozbuild/mach_commands.py',
+ 'python/mozbuild/mozbuild/frontend/mach_commands.py',
+ 'testing/mochitest/mach_commands.py',
+ 'testing/xpcshell/mach_commands.py',
+]
+
+def bootstrap(topsrcdir):
+ # Ensure we are running Python 2.7+. We put this check here so we generate a
+ # user-friendly error message rather than a cryptic stack trace on module
+ # import.
+ if sys.version_info[0] != 2 or sys.version_info[1] < 7:
+ print('Python 2.7 or above (but not Python 3) is required to run mach.')
+ print('You are running Python', platform.python_version())
+ sys.exit(1)
+
+ try:
+ import mach.main
+ except ImportError:
+ sys.path[0:0] = [os.path.join(topsrcdir, path) for path in SEARCH_PATHS]
+ import mach.main
+
+ mach = mach.main.Mach(topsrcdir)
+ for path in MACH_MODULES:
+ mach.load_commands_from_file(os.path.join(topsrcdir, path))
+ return mach
diff --git a/mach b/mach
index a4242f09745..9aba2825387 100755
--- a/mach
+++ b/mach
@@ -6,61 +6,46 @@
from __future__ import print_function, unicode_literals
import os
-import platform
import sys
-# Ensure we are running Python 2.7+. We put this check here so we generate a
-# user-friendly error message rather than a cryptic stack trace on module
-# import.
-if sys.version_info[0] != 2 or sys.version_info[1] < 7:
- print('Python 2.7 or above (but not Python 3) is required to run mach.')
- print('You are running Python', platform.python_version())
- sys.exit(1)
+def ancestors(path):
+ while path:
+ yield path
+ (path, child) = os.path.split(path)
+ if child == "":
+ break
-# TODO Bug 794506 Integrate with the in-tree virtualenv configuration.
-SEARCH_PATHS = [
- 'python/mach',
- 'python/mozboot',
- 'python/mozbuild',
- 'build',
- 'build/pymake',
- 'python/blessings',
- 'python/psutil',
- 'python/which',
- 'other-licenses/ply',
- 'xpcom/idl-parser',
- 'testing',
- 'testing/xpcshell',
- 'testing/mozbase/mozprocess',
- 'testing/mozbase/mozfile',
- 'testing/mozbase/mozinfo',
-]
+def load_mach(topsrcdir):
+ sys.path[0:0] = [os.path.join(topsrcdir, "build")]
+ import mach_bootstrap
+ return mach_bootstrap.bootstrap(topsrcdir)
-# Individual files providing mach commands.
-MACH_MODULES = [
- 'addon-sdk/mach_commands.py',
- 'layout/tools/reftest/mach_commands.py',
- 'python/mozboot/mozboot/mach_commands.py',
- 'python/mozbuild/mozbuild/config.py',
- 'python/mozbuild/mozbuild/mach_commands.py',
- 'python/mozbuild/mozbuild/frontend/mach_commands.py',
- 'testing/mochitest/mach_commands.py',
- 'testing/xpcshell/mach_commands.py',
-]
+# Check whether the current directory is within a mach src or obj dir.
+for dir_path in ancestors(os.getcwd()):
+ # If we find a "mozinfo.json" file, we are in the objdir.
+ mozinfo_path = os.path.join(dir_path, "mozinfo.json")
+ if os.path.isfile(mozinfo_path):
+ import json
+ info = json.load(open(mozinfo_path))
+ if "mozconfig" in info and "MOZCONFIG" not in os.environ:
+ # If the MOZCONFIG environment variable is not already set, set it
+ # to the value from mozinfo.json. This will tell the build system
+ # to look for a config file at the path in $MOZCONFIG rather than
+ # its default locations.
+ #
+ # Note: subprocess requires native strings in os.environ Python
+ # 2.7.2 and earlier on Windows.
+ os.environ[b"MOZCONFIG"] = str(info["mozconfig"])
-our_dir = os.path.dirname(os.path.abspath(__file__))
+ if "topsrcdir" in info:
+ # Continue searching for mach_bootstrap in the source directory.
+ dir_path = info["topsrcdir"]
-try:
- import mach.main
-except ImportError:
- sys.path[0:0] = [os.path.join(our_dir, path) for path in SEARCH_PATHS]
+ # If we find the mach bootstrap module, we are in the srcdir.
+ mach_path = os.path.join(dir_path, "build/mach_bootstrap.py")
+ if os.path.isfile(mach_path):
+ mach = load_mach(dir_path)
+ sys.exit(mach.run(sys.argv[1:]))
- import mach.main
-
-# All of the code is in a module because EVERYTHING IS A LIBRARY.
-mach = mach.main.Mach(our_dir)
-
-for path in MACH_MODULES:
- mach.load_commands_from_file(os.path.join(our_dir, path))
-
-sys.exit(mach.run(sys.argv[1:]))
+print("Could not run mach: No mach source directory found")
+sys.exit(1)
From f76b987b207645803a4e3af8819fe71b2b2ec78d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabrice=20Desr=C3=A9?=
Date: Fri, 1 Mar 2013 11:42:49 -0800
Subject: [PATCH 012/140] Backout e0be1d5500f2 (bug 833795) for causing bug
846816
---
dom/ipc/TabParent.cpp | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp
index 1804d98f68e..e5a81a75ba1 100644
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -619,18 +619,6 @@ bool TabParent::SendRealTouchEvent(nsTouchEvent& event)
}
MaybeForwardEventToRenderFrame(event, &e);
-
- // Adjust the widget coordinates to be relative to our frame.
- nsRefPtr frameLoader = GetFrameLoader();
-
- if (!frameLoader) {
- // No frame anymore?
- sEventCapturer = nullptr;
- return false;
- }
-
- nsEventStateManager::MapEventCoordinatesForChildProcess(frameLoader, &event);
-
return (e.message == NS_TOUCH_MOVE) ?
PBrowserParent::SendRealTouchMoveEvent(e) :
PBrowserParent::SendRealTouchEvent(e);
@@ -667,6 +655,17 @@ TabParent::TryCapture(const nsGUIEvent& aEvent)
return false;
}
+ // Adjust the widget coordinates to be relative to our frame.
+ nsRefPtr frameLoader = GetFrameLoader();
+
+ if (!frameLoader) {
+ // No frame anymore?
+ sEventCapturer = nullptr;
+ return false;
+ }
+
+ nsEventStateManager::MapEventCoordinatesForChildProcess(frameLoader, &event);
+
SendRealTouchEvent(event);
return true;
}
From db65a38a152cacd067894b255f7bd258bdcdaebd Mon Sep 17 00:00:00 2001
From: Wes Johnston
Date: Fri, 1 Mar 2013 15:57:36 -0800
Subject: [PATCH 013/140] Bug 828400 - Set an explicit minHeight on context
menu items. r=sriram
---
mobile/android/base/PromptService.java | 3 +++
mobile/android/base/resources/values/dimens.xml | 1 +
2 files changed, 4 insertions(+)
diff --git a/mobile/android/base/PromptService.java b/mobile/android/base/PromptService.java
index bdc64d8a9c4..5916381739c 100644
--- a/mobile/android/base/PromptService.java
+++ b/mobile/android/base/PromptService.java
@@ -67,6 +67,7 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
private final int mIconTextPadding;
private final int mIconSize;
private final int mInputPaddingSize;
+ private final int mMinRowSize;
PromptService() {
sInflater = LayoutInflater.from(GeckoApp.mAppContext);
@@ -78,6 +79,7 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
mIconTextPadding = (int) (res.getDimension(R.dimen.prompt_service_icon_text_padding));
mIconSize = (int) (res.getDimension(R.dimen.prompt_service_icon_size));
mInputPaddingSize = (int) (res.getDimension(R.dimen.prompt_service_inputs_padding));
+ mMinRowSize = (int) (res.getDimension(R.dimen.prompt_service_min_list_item_height));
GeckoAppShell.getEventDispatcher().registerEventListener("Prompt:Show", this);
}
@@ -692,6 +694,7 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
}
convertView = sInflater.inflate(resourceId, null);
+ convertView.setMinimumHeight(mMinRowSize);
TextView tv = (TextView) convertView.findViewById(android.R.id.text1);
viewHolder = new ViewHolder(tv, tv.getPaddingLeft(), tv.getPaddingRight(),
diff --git a/mobile/android/base/resources/values/dimens.xml b/mobile/android/base/resources/values/dimens.xml
index 3af15f3552d..d0bc7b88d4a 100644
--- a/mobile/android/base/resources/values/dimens.xml
+++ b/mobile/android/base/resources/values/dimens.xml
@@ -44,6 +44,7 @@
16dp
10dp
8dp
+ 48dp
64dp
26dp
400dp
From b96ab263878e47415886e45bfe718059a189ee90 Mon Sep 17 00:00:00 2001
From: Wes Johnston
Date: Fri, 1 Mar 2013 15:57:38 -0800
Subject: [PATCH 014/140] Bug 844834 - Use system colors for dialog titles.
r=sriram
---
mobile/android/base/Makefile.in | 6 +++++-
.../base/resources/layout/site_setting_title.xml | 11 ++++-------
mobile/android/base/resources/values-v14/styles.xml | 13 +++++++++++++
mobile/android/base/resources/values/styles.xml | 6 ++++++
4 files changed, 28 insertions(+), 8 deletions(-)
create mode 100644 mobile/android/base/resources/values-v14/styles.xml
diff --git a/mobile/android/base/Makefile.in b/mobile/android/base/Makefile.in
index 33322a4ebee..771a5835b74 100644
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -505,6 +505,10 @@ RES_VALUES_LAND_V14 = \
res/values-land-v14/dimens.xml \
$(NULL)
+RES_VALUES_V14 = \
+ res/values-v14/styles.xml \
+ $(NULL)
+
RES_XML = \
res/xml/gecko_appwidget_info.xml \
$(SYNC_RES_XML) \
@@ -1003,7 +1007,7 @@ MOZ_BRANDING_DRAWABLE_MDPI = $(shell if test -e $(topsrcdir)/$(MOZ_BRANDING_DIRE
MOZ_BRANDING_DRAWABLE_HDPI = $(shell if test -e $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources-hdpi.mn; then cat $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources-hdpi.mn | tr '\n' ' '; fi)
MOZ_BRANDING_DRAWABLE_XHDPI = $(shell if test -e $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources-xhdpi.mn; then cat $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources-xhdpi.mn | tr '\n' ' '; fi)
-RESOURCES=$(RES_LAYOUT) $(RES_LAYOUT_LARGE_LAND_V11) $(RES_LAYOUT_LARGE_V11) $(RES_LAYOUT_XLARGE_V11) $(RES_VALUES) $(RES_VALUES_LAND) $(RES_VALUES_V11) $(RES_VALUES_LARGE_V11) $(RES_VALUES_LARGE_LAND_V11) $(RES_VALUES_XLARGE_V11) $(RES_VALUES_LAND_V14) $(RES_XML) $(RES_ANIM) $(RES_DRAWABLE_MDPI) $(RES_DRAWABLE_LDPI) $(RES_DRAWABLE_HDPI) $(RES_DRAWABLE_XHDPI) $(RES_DRAWABLE_MDPI_V11) $(RES_DRAWABLE_HDPI_V11) $(RES_DRAWABLE_XHDPI_V11) $(RES_DRAWABLE_LAND_MDPI_V14) $(RES_DRAWABLE_LAND_HDPI_V14) $(RES_DRAWABLE_LAND_XHDPI_V14) $(RES_DRAWABLE_LARGE_LAND_V11) $(RES_DRAWABLE_LARGE_MDPI_V11) $(RES_DRAWABLE_LARGE_HDPI_V11) $(RES_DRAWABLE_LARGE_XHDPI_V11) $(RES_DRAWABLE_XLARGE_MDPI_V11) $(RES_DRAWABLE_XLARGE_HDPI_V11) $(RES_DRAWABLE_XLARGE_XHDPI_V11) $(RES_COLOR) $(RES_MENU)
+RESOURCES=$(RES_LAYOUT) $(RES_LAYOUT_LARGE_LAND_V11) $(RES_LAYOUT_LARGE_V11) $(RES_LAYOUT_XLARGE_V11) $(RES_VALUES) $(RES_VALUES_LAND) $(RES_VALUES_V11) $(RES_VALUES_LARGE_V11) $(RES_VALUES_LARGE_LAND_V11) $(RES_VALUES_XLARGE_V11) $(RES_VALUES_LAND_V14) $(RES_VALUES_V14) $(RES_XML) $(RES_ANIM) $(RES_DRAWABLE_MDPI) $(RES_DRAWABLE_LDPI) $(RES_DRAWABLE_HDPI) $(RES_DRAWABLE_XHDPI) $(RES_DRAWABLE_MDPI_V11) $(RES_DRAWABLE_HDPI_V11) $(RES_DRAWABLE_XHDPI_V11) $(RES_DRAWABLE_LAND_MDPI_V14) $(RES_DRAWABLE_LAND_HDPI_V14) $(RES_DRAWABLE_LAND_XHDPI_V14) $(RES_DRAWABLE_LARGE_LAND_V11) $(RES_DRAWABLE_LARGE_MDPI_V11) $(RES_DRAWABLE_LARGE_HDPI_V11) $(RES_DRAWABLE_LARGE_XHDPI_V11) $(RES_DRAWABLE_XLARGE_MDPI_V11) $(RES_DRAWABLE_XLARGE_HDPI_V11) $(RES_DRAWABLE_XLARGE_XHDPI_V11) $(RES_COLOR) $(RES_MENU)
RES_DIRS= \
res/layout \
diff --git a/mobile/android/base/resources/layout/site_setting_title.xml b/mobile/android/base/resources/layout/site_setting_title.xml
index 41dec76fdb5..4fdfd6d61af 100644
--- a/mobile/android/base/resources/layout/site_setting_title.xml
+++ b/mobile/android/base/resources/layout/site_setting_title.xml
@@ -10,8 +10,7 @@
android:gravity="center_vertical">
+ android:textSize="14sp"/>
diff --git a/mobile/android/base/resources/values-v14/styles.xml b/mobile/android/base/resources/values-v14/styles.xml
new file mode 100644
index 00000000000..39e18421752
--- /dev/null
+++ b/mobile/android/base/resources/values-v14/styles.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
diff --git a/mobile/android/base/resources/values/styles.xml b/mobile/android/base/resources/values/styles.xml
index ffd7e6ac30c..14a83d06edf 100644
--- a/mobile/android/base/resources/values/styles.xml
+++ b/mobile/android/base/resources/values/styles.xml
@@ -284,4 +284,10 @@
- @color/abouthome_section_subtitle
+
+
+
+
From 52d847cd8516df35476cfc83b41dd980383e5783 Mon Sep 17 00:00:00 2001
From: Mark Capella
Date: Fri, 1 Mar 2013 19:01:11 -0500
Subject: [PATCH 015/140] Bug 784331 - No indication if a page is in reader
mode, r=lucasr
---
mobile/android/base/BrowserToolbar.java | 22 ++++++++++++++----
mobile/android/base/Makefile.in | 3 +++
.../resources/drawable-hdpi/reader_active.png | Bin 0 -> 482 bytes
.../resources/drawable-mdpi/reader_active.png | Bin 0 -> 295 bytes
.../drawable-xhdpi/reader_active.png | Bin 0 -> 554 bytes
5 files changed, 21 insertions(+), 4 deletions(-)
create mode 100644 mobile/android/base/resources/drawable-hdpi/reader_active.png
create mode 100644 mobile/android/base/resources/drawable-mdpi/reader_active.png
create mode 100644 mobile/android/base/resources/drawable-xhdpi/reader_active.png
diff --git a/mobile/android/base/BrowserToolbar.java b/mobile/android/base/BrowserToolbar.java
index 76150024848..583483cd152 100644
--- a/mobile/android/base/BrowserToolbar.java
+++ b/mobile/android/base/BrowserToolbar.java
@@ -282,8 +282,13 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
@Override
public void onClick(View view) {
Tab tab = Tabs.getInstance().getSelectedTab();
- if (tab != null)
- tab.readerMode();
+ if (tab != null) {
+ if (ReaderModeUtils.isAboutReader(tab.getURL())) {
+ tab.doBack();
+ } else {
+ tab.readerMode();
+ }
+ }
}
});
@@ -938,12 +943,21 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
// Handle the viewing mode page actions
setSiteSecurityVisibility(mShowSiteSecurity && !isLoading);
- mReader.setVisibility(mShowReader && !isLoading ? View.VISIBLE : View.GONE);
+
+ // Handle the readerMode image and visibility: We show the reader mode button if 1) you can
+ // enter reader mode for current page or 2) if you're already in reader mode and can exit back,
+ // in which case we show the reader mode "close" (reader_active) icon.
+ boolean exitableReaderMode = false;
+ Tab tab = Tabs.getInstance().getSelectedTab();
+ if (tab != null)
+ exitableReaderMode = ReaderModeUtils.isAboutReader(tab.getURL()) && tab.canDoBack();
+ mReader.setImageResource(exitableReaderMode ? R.drawable.reader_active : R.drawable.reader);
+ mReader.setVisibility(!isLoading && (mShowReader || exitableReaderMode) ? View.VISIBLE : View.GONE);
// We want title to fill the whole space available for it when there are icons
// being shown on the right side of the toolbar as the icons already have some
// padding in them. This is just to avoid wasting space when icons are shown.
- mTitle.setPadding(0, 0, (!mShowReader && !isLoading ? mTitlePadding : 0), 0);
+ mTitle.setPadding(0, 0, (!isLoading && !(mShowReader || exitableReaderMode) ? mTitlePadding : 0), 0);
updateFocusOrder();
}
diff --git a/mobile/android/base/Makefile.in b/mobile/android/base/Makefile.in
index 771a5835b74..045a24d69ed 100644
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -614,6 +614,7 @@ RES_DRAWABLE_MDPI = \
res/drawable-mdpi/tabs_synced.png \
res/drawable-mdpi/urlbar_stop.png \
res/drawable-mdpi/reader.png \
+ res/drawable-mdpi/reader_active.png \
res/drawable-mdpi/reading_list.png \
res/drawable-mdpi/validation_arrow.png \
res/drawable-mdpi/validation_arrow_inverted.png \
@@ -713,6 +714,7 @@ RES_DRAWABLE_HDPI = \
res/drawable-hdpi/tabs_synced.png \
res/drawable-hdpi/urlbar_stop.png \
res/drawable-hdpi/reader.png \
+ res/drawable-hdpi/reader_active.png \
res/drawable-hdpi/reading_list.png \
res/drawable-hdpi/validation_arrow.png \
res/drawable-hdpi/validation_arrow_inverted.png \
@@ -781,6 +783,7 @@ RES_DRAWABLE_XHDPI = \
res/drawable-xhdpi/find_prev.png \
res/drawable-xhdpi/urlbar_stop.png \
res/drawable-xhdpi/reader.png \
+ res/drawable-xhdpi/reader_active.png \
res/drawable-xhdpi/reading_list.png \
res/drawable-xhdpi/larry_blue.png \
res/drawable-xhdpi/larry_green.png \
diff --git a/mobile/android/base/resources/drawable-hdpi/reader_active.png b/mobile/android/base/resources/drawable-hdpi/reader_active.png
new file mode 100644
index 0000000000000000000000000000000000000000..811168736a3ab00f5c629475c705aa1ab88f0db7
GIT binary patch
literal 482
zcmV<80UiE{P)1^ZjH6{1sV!k8XBUZPf!s=AE33lu`!xlf|kgX%o?JM
zAjBjW%if;h4bI@zbLDD5cldGe$i)ZGt6m)u`BTE6FenTPgO*p<&LEcFaf(?u=)ek+
zc!e}@W)mb$C}R=_5I5
zLlII#QJ;6PjbS(zL3s#XnhA38ghCB@Bd8OOR}kwKG8n}Kc96gT&aoNXk*NkjHxOM%
zb#D+U2r}&sisK%FET)W@JGiz-7DuVh7h~Ke=w}{{s4rb}aQzLncTfp2t02YW8Hgbf
z{Kww@9U8(l#E?U@?LiuohTs+n+?mH_ePlt*5bK38&{5rUHAax~Gt}ieKdNJvL7PY;
ziU{V>uTdFnwDrhL8X(B}{k89FAmSb3eO;?>KOV5I5hFOlTadROACM+2;S%CQ)h1{U
z1xue0m4g^67S|s(3^G{^buU)%3{l6JMwc5`x&LcHYR==HDEy-s2L11#
YZ}&7dlE~uz)&Kwi07*qoM6N<$f?M{DvxcY)Mh^u}D
zT;j@$06pI7{1N2w4mF6ShB@T*T+__HUOxhwJwzFz%6iOL{0vYJ@BWP^JyjIK^Cx&v=V{JjooO--x8xg6YsX1Pv4uhHpS{(CvU~hJX^pjsyD17ahRhId&)+mIB$G6W<<*u%RAe8qK&4W|HIHc9t{&r8T2-d6NA
zAo14*OK}lCJ_p{|!?(C6=3N4+U3v~2#tokk@z=X0gr_*ge2dR0;Rug?3y8a30pHb>
z{l51B)_%M`Z~@)eQeG#hL(~m^W6|2c4B6yfjn5D)@FKnUoMdv&?D+49_Gq5uE@07*qoM6N<$g124q?f?J)
literal 0
HcmV?d00001
From 34dcb1feede61a7a1d309124e9f04c1d5a4f2999 Mon Sep 17 00:00:00 2001
From: Daniel Holbert
Date: Fri, 1 Mar 2013 16:02:21 -0800
Subject: [PATCH 016/140] Bug 845868: Reorder js.cpp's #include list so that
GCC doesn't spam Wattributes warnings about attributes being ignored on class
decl-after-definition. r=Waldo
---
js/src/shell/js.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp
index b8b3b5cb430..0c5d98d79b2 100644
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -22,7 +22,6 @@
#include "jstypes.h"
#include "jsutil.h"
#include "jsprf.h"
-#include "jswrapper.h"
#include "jsapi.h"
#include "jsarray.h"
#include "jsatom.h"
@@ -41,6 +40,7 @@
#include "jstypedarray.h"
#include "jstypedarrayinlines.h"
#include "jsworkers.h"
+#include "jswrapper.h"
#include "jsperf.h"
#include "builtin/TestingFunctions.h"
From 41c74a99aaa05d7a1e478755d096c26d15cec301 Mon Sep 17 00:00:00 2001
From: Geoff Brown
Date: Fri, 1 Mar 2013 17:02:52 -0700
Subject: [PATCH 017/140] Bug 769919: Allow retry when getting awesomebar
ListView in robocop tests; r=jmaher
---
mobile/android/base/tests/BaseTest.java.in | 86 ++++++++++++-------
mobile/android/base/tests/robocop.ini | 2 +-
.../base/tests/testAllPagesTab.java.in | 5 +-
.../android/base/tests/testBookmark.java.in | 10 +--
.../base/tests/testBookmarklets.java.in | 6 +-
.../base/tests/testBookmarksTab.java.in | 25 ++----
.../base/tests/testClearPrivateData.java.in | 8 +-
.../android/base/tests/testHistoryTab.java.in | 20 +----
.../android/base/tests/testShareLink.java.in | 6 +-
9 files changed, 79 insertions(+), 89 deletions(-)
diff --git a/mobile/android/base/tests/BaseTest.java.in b/mobile/android/base/tests/BaseTest.java.in
index 71829f65bb4..172fcd66ea9 100755
--- a/mobile/android/base/tests/BaseTest.java.in
+++ b/mobile/android/base/tests/BaseTest.java.in
@@ -37,6 +37,7 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2 {
private static final String TARGET_PACKAGE_ID = "org.mozilla.gecko";
private static final String LAUNCH_ACTIVITY_FULL_CLASSNAME="@ANDROID_PACKAGE_NAME@.App";
private static final int VERIFY_URL_TIMEOUT = 2000;
+ private static final int MAX_LIST_ATTEMPTS = 3;
public static final int MAX_WAIT_MS = 3000;
private static Class mLauncherActivityClass;
@@ -406,55 +407,74 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2 {
mAsserter.is(tabCountInt, expectedTabCount, "The correct number of tabs are opened");
}
- /**
- * Click on the awesome bar, and return the ListView for the
- * All Pages ("Top Sites") tab.
- */
- protected ListView getAllPagesList(String waitText) {
- Activity awesomeBarActivity = clickOnAwesomeBar();
- waitForText(waitText);
-
- ArrayList views = mSolo.getCurrentListViews();
- for (ListView view : views) {
- if (view.getTag() == "allPages") {
- return view;
+ private ListView getAwesomeList(String waitText, int expectedChildCount,
+ String clickText, String tagName, String callerName) {
+ ArrayList views;
+ ListView tabView = null;
+ int childCount = 0;
+ for (int i = 0; i < MAX_LIST_ATTEMPTS; i++) {
+ tabView = null;
+ childCount = 0;
+ Activity awesomeBarActivity = clickOnAwesomeBar();
+ mSolo.clickOnText(clickText);
+ if (waitForText(waitText)) {
+ views = mSolo.getCurrentListViews();
+ for (ListView view : views) {
+ if (view.getTag().equals(tagName)) {
+ tabView = view;
+ childCount = view.getAdapter().getCount();
+ if (expectedChildCount < 0 || expectedChildCount == childCount) {
+ return view;
+ }
+ }
+ }
}
}
+ if (tabView == null) {
+ mAsserter.dumpLog(callerName+" did not find ListView");
+ } else if (expectedChildCount >= 0) {
+ mAsserter.dumpLog(callerName+" found ListView with "+childCount+" children");
+ }
return null;
}
+ /**
+ * Click on the awesome bar, click on the Top Sites tab, and return
+ * the ListView for the All Pages ("Top Sites") tab.
+ */
+ protected ListView getAllPagesList(String waitText, int expectedChildCount) {
+ return getAwesomeList(waitText, expectedChildCount,
+ "Top Sites", "allPages", "getAllPagesList");
+ }
+
+ protected ListView getAllPagesList(String waitText) {
+ return getAllPagesList(waitText, -1);
+ }
+
/**
* Click on the awesome bar, click on the Bookmarks tab, and return
* the ListView for the Bookmarks tab.
*/
- protected ListView getBookmarksList() {
- Activity awesomeBarActivity = clickOnAwesomeBar();
- mSolo.clickOnText("Bookmarks");
+ protected ListView getBookmarksList(String waitText, int expectedChildCount) {
+ return getAwesomeList(waitText, expectedChildCount,
+ "Bookmarks", "bookmarks", "getBookmarksList");
+ }
- ArrayList views = mSolo.getCurrentListViews();
- for (ListView view : views) {
- if (view.getTag().equals("bookmarks")) {
- return view;
- }
- }
- return null;
+ protected ListView getBookmarksList(String waitText) {
+ return getBookmarksList(waitText, -1);
}
/**
* Click on the awesome bar, click on the History tab, and return
* the ListView for the History tab.
*/
- protected ListView getHistoryList() {
- Activity awesomeBarActivity = clickOnAwesomeBar();
- mSolo.clickOnText("History");
- waitForText("Today|Yesterday");
- ArrayList views = mSolo.getCurrentListViews();
- for (ListView view : views) {
- if (view.getTag().equals("history")) {
- return view;
- }
- }
- return null;
+ protected ListView getHistoryList(String waitText, int expectedChildCount) {
+ return getAwesomeList(waitText, expectedChildCount,
+ "History", "history", "getHistoryList");
+ }
+
+ protected ListView getHistoryList(String waitText) {
+ return getHistoryList(waitText, -1);
}
public long addOrUpdateBookmark(String title, String url, boolean bookmarklet) {
diff --git a/mobile/android/base/tests/robocop.ini b/mobile/android/base/tests/robocop.ini
index a9492e06322..79bac88a418 100644
--- a/mobile/android/base/tests/robocop.ini
+++ b/mobile/android/base/tests/robocop.ini
@@ -1,4 +1,4 @@
-# [testAllPagesTab] # see bug 825152
+[testAllPagesTab]
[testHistoryTab]
[testBookmarksTab]
[testAwesomebar]
diff --git a/mobile/android/base/tests/testAllPagesTab.java.in b/mobile/android/base/tests/testAllPagesTab.java.in
index 226d8b5e6d5..b3a29aca515 100644
--- a/mobile/android/base/tests/testAllPagesTab.java.in
+++ b/mobile/android/base/tests/testAllPagesTab.java.in
@@ -56,7 +56,7 @@ public class testAllPagesTab extends BaseTest {
}
private void testList(String url) {
- final ListView list = getAllPagesList(bookmarks[0]);
+ final ListView list = getAllPagesList(bookmarks[0], 5);
// some basic checks for the tab strip
TabWidget tabwidget = (TabWidget)mSolo.getView(TabWidget.class, 0);
@@ -68,9 +68,8 @@ public class testAllPagesTab extends BaseTest {
// This test fails, only when we're running tests
// mAsserter.is(host.getCurrentTab(), 0, "All pages tab is selected in tab strip");
- mAsserter.isnot(list, null, "checking that all pages list exists");
+ mAsserter.isnot(list, null, "checking that all pages list exists and has 5 children (the default bookmarks)");
final int count = list.getAdapter().getCount();
- mAsserter.is(count, 5, "all pages list has 5 children (the default bookmarks)");
String loadUrl = "";
for (int i = count - 1; i >= 0; i--) {
diff --git a/mobile/android/base/tests/testBookmark.java.in b/mobile/android/base/tests/testBookmark.java.in
index 7995647d064..0063abda6b6 100644
--- a/mobile/android/base/tests/testBookmark.java.in
+++ b/mobile/android/base/tests/testBookmark.java.in
@@ -76,18 +76,12 @@ public class testBookmark extends PixelTest {
blockForGeckoReady();
// Open the bookmark list and check the root folder view
- ListView bookmarksList = getBookmarksList();
+ ListView bookmarksList = getBookmarksList(ABOUT_HOME_URL, 4);
- // Wait for bookmark to appear in list
- waitForText(ABOUT_HOME_URL);
-
- mAsserter.ok(bookmarksList != null, "checking that bookmarks list exists", "bookmarks list exists");
+ mAsserter.ok(bookmarksList != null, "checking that bookmarks list exists", "bookmarks list exists and has 4 children (the default bookmarks)");
// No folders should be visible if no desktop bookmarks exist
int count = bookmarksList.getAdapter().getCount();
- mAsserter.is(count, 4,
- "bookmarks list has 4 children (the default bookmarks)");
-
for (int i = 0; i < count; i++) {
Cursor c = (Cursor)bookmarksList.getItemAtPosition(i);
String url = c.getString(c.getColumnIndexOrThrow("url"));
diff --git a/mobile/android/base/tests/testBookmarklets.java.in b/mobile/android/base/tests/testBookmarklets.java.in
index fdbbb80d31f..6a336514f28 100644
--- a/mobile/android/base/tests/testBookmarklets.java.in
+++ b/mobile/android/base/tests/testBookmarklets.java.in
@@ -43,12 +43,12 @@ public class testBookmarklets extends PixelTest {
addOrUpdateBookmark(title, js, true);
// verify that bookmarklets clicked in awesomescreen work
- ListView bookmarks = getBookmarksList();
+ ListView bookmarks = getBookmarksList(title);
Boolean found = false;
if (bookmarks == null) {
mAsserter.is(true, true, "Did not find the bookmarks section in the awesomebar");
- } else if (mSolo.waitForText(title)) {
+ } else {
for (int i = 0; i < bookmarks.getAdapter().getCount(); i++) {
Cursor c = (Cursor)bookmarks.getItemAtPosition(i);
String turl = c.getString(c.getColumnIndexOrThrow("url"));
@@ -58,8 +58,6 @@ public class testBookmarklets extends PixelTest {
mSolo.clickOnView(bookmarks.getChildAt(i));
}
}
- } else {
- mAsserter.is(true, true, "Did not find the title '" + title + "' of the bookmark in the list");
}
if (!found) {
mAsserter.is(found, true, "Found the bookmark: " + js + " and clicked on it");
diff --git a/mobile/android/base/tests/testBookmarksTab.java.in b/mobile/android/base/tests/testBookmarksTab.java.in
index bbe616a29d9..bf725dd9153 100644
--- a/mobile/android/base/tests/testBookmarksTab.java.in
+++ b/mobile/android/base/tests/testBookmarksTab.java.in
@@ -18,7 +18,7 @@ import java.util.ArrayList;
import java.io.File;
/**
- * Tests the Bookamrks Tab
+ * Tests the Bookmarks Tab
* - opening the bookmarks tab
* - items look correct
* - clicking on an item
@@ -26,7 +26,6 @@ import java.io.File;
* - editing the name, url and keyword of a bookmark from the context menu
* - removing a bookmark
*/
-
public class testBookmarksTab extends BaseTest {
private View mFirstChild;
private ListView list;
@@ -49,14 +48,10 @@ public class testBookmarksTab extends BaseTest {
private void testList(String url) {
View child;
- ListView list = getBookmarksList();
-
- waitForText("Desktop Bookmarks");
- mAsserter.isnot(list, null, "checking that bookmarks list exists");
+ ListView list = getBookmarksList("about:firefox", 5);
+ mAsserter.isnot(list, null, "checking that bookmarks list exists and has 5 children (defaults + a folder)");
int count = list.getAdapter().getCount();
- mAsserter.is(count, 5, "bookmarks list has 5 children (defaults + a folder)");
-
for (int i = count - 1; i >= 0; i--) {
child = list.getChildAt(i);
compareRow(child, i == 0 ? 1 : 2, 1);
@@ -95,9 +90,7 @@ public class testBookmarksTab extends BaseTest {
}
private void testContextMenu(String url) {
- list = getBookmarksList();
- waitForText(url);
-
+ list = getBookmarksList(url);
// wait for the bookmarks list to be populated
View child;
mFirstChild = null;
@@ -150,7 +143,7 @@ public class testBookmarksTab extends BaseTest {
mAsserter.ok(false, "waiting for bookmark item", "bookmark item available");
}
- list = getBookmarksList();
+ list = getBookmarksList(url);
// Test edit bookmark name
editBookmark(1,0," Bookmark Name ");
@@ -191,7 +184,7 @@ public class testBookmarksTab extends BaseTest {
View child;
mSolo.clickOnText("Bookmarks");
child = list.getChildAt(bookmarkIndex);
- waitForText("Desktop Bookmarks");
+ waitForText("about:firefox");
mSolo.clickLongOnView(child);
waitForText("Open in New Tab");
mSolo.clickOnText("Edit");
@@ -214,7 +207,7 @@ public class testBookmarksTab extends BaseTest {
View child;
mSolo.clickOnText("Bookmarks");
child = list.getChildAt(bookmarkIndex);
- waitForText("Desktop Bookmarks");
+ waitForText("about:firefox");
mSolo.clickLongOnView(child);
waitForText("Open in New Tab");
mSolo.clickOnText("Edit");
@@ -228,12 +221,12 @@ public class testBookmarksTab extends BaseTest {
// Check if the new text was added
if (mSolo.searchText(addedText)) {
mSolo.clickOnText("Cancel");
- waitForText("Desktop Bookmarks");
+ waitForText("about:firefox");
mActions.sendSpecialKey(Actions.SpecialKey.BACK); // close the VKB
return true;
} else {
mSolo.clickOnText("Cancel");
- waitForText("Desktop Bookmarks");
+ waitForText("about:firefox");
mActions.sendSpecialKey(Actions.SpecialKey.BACK); // close the VKB
return false;
}
diff --git a/mobile/android/base/tests/testClearPrivateData.java.in b/mobile/android/base/tests/testClearPrivateData.java.in
index 1d2fc6d3772..01cc1bb8790 100644
--- a/mobile/android/base/tests/testClearPrivateData.java.in
+++ b/mobile/android/base/tests/testClearPrivateData.java.in
@@ -28,8 +28,8 @@ public class testClearPrivateData extends PixelTest {
String url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
loadAndPaint(url);
- // Checking that the history list in not empty
- ListView hList = getHistoryList();
+ // Checking that the history list is not empty
+ ListView hList = getHistoryList("Today|Yesterday");
mAsserter.ok(hList.getAdapter().getCount() > 0,"checking history exists","history exists");
// Quit the awesomescreen
@@ -46,7 +46,7 @@ public class testClearPrivateData extends PixelTest {
mAsserter.is(mSolo.waitForText("Private data cleared"),true,"private data cleared successfully");
// Checking that history list is empty
- hList = getHistoryList();
- mAsserter.ok(hList.getAdapter().getCount() == 0,"checking history is cleared ","history is cleared");
+ hList = getHistoryList("History", 0);
+ mAsserter.ok(hList != null,"checking history is cleared ","history is cleared");
}
}
diff --git a/mobile/android/base/tests/testHistoryTab.java.in b/mobile/android/base/tests/testHistoryTab.java.in
index b3148f8f8db..6837f67e714 100644
--- a/mobile/android/base/tests/testHistoryTab.java.in
+++ b/mobile/android/base/tests/testHistoryTab.java.in
@@ -98,25 +98,14 @@ public class testHistoryTab extends PixelTest {
}
private void testList(String url) {
- listview = getHistoryList();
-
- // Around midnight we will switch from Today -> Yesterday, account for both
- if (!mSolo.waitForText("Today")) {
- waitForText("Yesterday");
- }
-
- mAsserter.isnot(listview, null, "checking that history list exists");
-
+ listview = getHistoryList("Today|Yesterday", 3);
+ mAsserter.isnot(listview, null, "checking that history list exists and has 3 children");
final int count = listview.getAdapter().getCount();
- mAsserter.is(count, 3, "history list has 3 children");
-
String loadUrl = "";
for (int i = count - 1; i >= 0; i--) {
View child = listview.getChildAt(i);
-
ArrayList views = mSolo.getViews(child);
ArrayList imageViews = new ArrayList();
-
int expectedImages = 1;
for (int j = 0; j < views.size(); j++) {
View v = views.get(j);
@@ -160,7 +149,7 @@ public class testHistoryTab extends PixelTest {
}
private void testContextMenu(String url) {
- listview = getHistoryList();
+ listview = getHistoryList("Today|Yesterday");
waitForText(url);
// wait for the history list to be populated
@@ -213,8 +202,7 @@ public class testHistoryTab extends PixelTest {
}
private void testClick(String url) {
- listview = getHistoryList();
-
+ listview = getHistoryList("Today|Yesterday");
waitForText(url);
View child = listview.getChildAt(0);
diff --git a/mobile/android/base/tests/testShareLink.java.in b/mobile/android/base/tests/testShareLink.java.in
index 03fcd3b3b83..d8b6a86a277 100644
--- a/mobile/android/base/tests/testShareLink.java.in
+++ b/mobile/android/base/tests/testShareLink.java.in
@@ -79,15 +79,13 @@ public class testShareLink extends BaseTest {
}
// Test the share popup in the Bookmarks tab
- ListView blist = getBookmarksList();
- mSolo.clickOnText("Bookmarks");
+ ListView blist = getBookmarksList("about:firefox");
View bookmark = blist.getChildAt(1); // Getting child at 1 because 0 might be the Desktop folder
mSolo.clickLongOnView(bookmark);
verifySharePopup(shareOptions,"bookmarks");
// Test the share popup in the History tab
- ListView hlist = getHistoryList();
- mSolo.clickOnText("History");
+ ListView hlist = getHistoryList("Today|Yesterday");
View history = hlist.getChildAt(1); // Getting child at 1 because 0 might be the "Today" label
mSolo.clickLongOnView(history);
verifySharePopup(shareOptions,"history");
From 1a40cdb6ee5cc2b457ceb9d961bd3b3397598d87 Mon Sep 17 00:00:00 2001
From: Brian Hackett
Date: Fri, 1 Mar 2013 17:08:18 -0700
Subject: [PATCH 018/140] Bug 834240 - Add missing setPendingNukeTypes,
r=dvander.
---
js/src/jsinfer.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp
index 5f9088bd568..7fb2443c67e 100644
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -5253,6 +5253,7 @@ CheckNewScriptProperties(JSContext *cx, HandleTypeObject type, HandleFunction fu
if (!state.baseobj) {
if (type->newScript)
type->clearNewScript(cx);
+ cx->compartment->types.setPendingNukeTypes(cx);
return;
}
From 480a461986ec4221bf57acb099f7256c6a7156a8 Mon Sep 17 00:00:00 2001
From: Wes Johnston
Date: Fri, 1 Mar 2013 16:09:31 -0800
Subject: [PATCH 019/140] backout 24dd58c6390c to fix commit message
---
mobile/android/base/PromptService.java | 3 ---
mobile/android/base/resources/values/dimens.xml | 1 -
2 files changed, 4 deletions(-)
diff --git a/mobile/android/base/PromptService.java b/mobile/android/base/PromptService.java
index 5916381739c..bdc64d8a9c4 100644
--- a/mobile/android/base/PromptService.java
+++ b/mobile/android/base/PromptService.java
@@ -67,7 +67,6 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
private final int mIconTextPadding;
private final int mIconSize;
private final int mInputPaddingSize;
- private final int mMinRowSize;
PromptService() {
sInflater = LayoutInflater.from(GeckoApp.mAppContext);
@@ -79,7 +78,6 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
mIconTextPadding = (int) (res.getDimension(R.dimen.prompt_service_icon_text_padding));
mIconSize = (int) (res.getDimension(R.dimen.prompt_service_icon_size));
mInputPaddingSize = (int) (res.getDimension(R.dimen.prompt_service_inputs_padding));
- mMinRowSize = (int) (res.getDimension(R.dimen.prompt_service_min_list_item_height));
GeckoAppShell.getEventDispatcher().registerEventListener("Prompt:Show", this);
}
@@ -694,7 +692,6 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
}
convertView = sInflater.inflate(resourceId, null);
- convertView.setMinimumHeight(mMinRowSize);
TextView tv = (TextView) convertView.findViewById(android.R.id.text1);
viewHolder = new ViewHolder(tv, tv.getPaddingLeft(), tv.getPaddingRight(),
diff --git a/mobile/android/base/resources/values/dimens.xml b/mobile/android/base/resources/values/dimens.xml
index d0bc7b88d4a..3af15f3552d 100644
--- a/mobile/android/base/resources/values/dimens.xml
+++ b/mobile/android/base/resources/values/dimens.xml
@@ -44,7 +44,6 @@
16dp
10dp
8dp
- 48dp
64dp
26dp
400dp
From c8f9c1d3c90d56b7962ead025ab0956005cbb198 Mon Sep 17 00:00:00 2001
From: Wes Johnston
Date: Fri, 1 Mar 2013 16:09:33 -0800
Subject: [PATCH 020/140] Bug 838400 - Set an explicit minHeight on context
menu items. r=sriram DONTBUILD
---
mobile/android/base/PromptService.java | 3 +++
mobile/android/base/resources/values/dimens.xml | 1 +
2 files changed, 4 insertions(+)
diff --git a/mobile/android/base/PromptService.java b/mobile/android/base/PromptService.java
index bdc64d8a9c4..5916381739c 100644
--- a/mobile/android/base/PromptService.java
+++ b/mobile/android/base/PromptService.java
@@ -67,6 +67,7 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
private final int mIconTextPadding;
private final int mIconSize;
private final int mInputPaddingSize;
+ private final int mMinRowSize;
PromptService() {
sInflater = LayoutInflater.from(GeckoApp.mAppContext);
@@ -78,6 +79,7 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
mIconTextPadding = (int) (res.getDimension(R.dimen.prompt_service_icon_text_padding));
mIconSize = (int) (res.getDimension(R.dimen.prompt_service_icon_size));
mInputPaddingSize = (int) (res.getDimension(R.dimen.prompt_service_inputs_padding));
+ mMinRowSize = (int) (res.getDimension(R.dimen.prompt_service_min_list_item_height));
GeckoAppShell.getEventDispatcher().registerEventListener("Prompt:Show", this);
}
@@ -692,6 +694,7 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
}
convertView = sInflater.inflate(resourceId, null);
+ convertView.setMinimumHeight(mMinRowSize);
TextView tv = (TextView) convertView.findViewById(android.R.id.text1);
viewHolder = new ViewHolder(tv, tv.getPaddingLeft(), tv.getPaddingRight(),
diff --git a/mobile/android/base/resources/values/dimens.xml b/mobile/android/base/resources/values/dimens.xml
index 3af15f3552d..d0bc7b88d4a 100644
--- a/mobile/android/base/resources/values/dimens.xml
+++ b/mobile/android/base/resources/values/dimens.xml
@@ -44,6 +44,7 @@
16dp
10dp
8dp
+ 48dp
64dp
26dp
400dp
From bf391b7462882ced9cfa9e13d9515b36880ec9cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?=
Date: Fri, 1 Mar 2013 19:39:29 -0500
Subject: [PATCH 021/140] Bug 846922 - Read late write stacks on windows.
r=BenWa.
---
build/unix/stdc++compat/stdc++compat.cpp | 1 +
toolkit/components/telemetry/Telemetry.cpp | 4 ----
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/build/unix/stdc++compat/stdc++compat.cpp b/build/unix/stdc++compat/stdc++compat.cpp
index 57947864f12..5b01cf1eccc 100644
--- a/build/unix/stdc++compat/stdc++compat.cpp
+++ b/build/unix/stdc++compat/stdc++compat.cpp
@@ -33,6 +33,7 @@ namespace std {
template istream& istream::_M_extract(float&);
template istream& istream::_M_extract(unsigned int&);
template istream& istream::_M_extract(unsigned long&);
+ template istream& istream::_M_extract(unsigned short&);
#endif
#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)
/* Instantiate these templates to avoid GLIBCXX_3.4.14 symbol versions
diff --git a/toolkit/components/telemetry/Telemetry.cpp b/toolkit/components/telemetry/Telemetry.cpp
index 9527e58c1da..82ad969e75b 100644
--- a/toolkit/components/telemetry/Telemetry.cpp
+++ b/toolkit/components/telemetry/Telemetry.cpp
@@ -5,9 +5,7 @@
#include
-#ifdef XP_MACOSX
#include
-#endif
#include
@@ -1639,7 +1637,6 @@ IsValidBreakpadId(const std::string &breakpadId) {
static void
ReadStack(const char *aFileName, Telemetry::ProcessedStack &aStack)
{
-#ifdef XP_MACOSX
std::ifstream file(aFileName);
size_t numModules;
@@ -1707,7 +1704,6 @@ ReadStack(const char *aFileName, Telemetry::ProcessedStack &aStack)
}
aStack = stack;
-#endif
}
void
From 1a20d1b3c3438d15fcec0e7c63408b265d2a9122 Mon Sep 17 00:00:00 2001
From: Trevor Saunders
Date: Fri, 15 Feb 2013 15:09:28 -0500
Subject: [PATCH 022/140] bug 845562 - remove GetFrameSelection() from
nsISelectionPrivate r=smaug
---
content/base/public/nsISelectionPrivate.idl | 9 +--------
editor/libeditor/base/nsEditor.cpp | 9 +--------
editor/libeditor/text/nsTextEditRulesBidi.cpp | 12 +++++-------
layout/base/nsCaret.cpp | 12 ++++++------
layout/base/nsCaret.h | 2 +-
layout/base/nsPresShell.cpp | 3 +--
layout/forms/nsTextControlFrame.cpp | 14 +++-----------
layout/generic/Selection.h | 1 +
layout/generic/nsSelection.cpp | 8 --------
9 files changed, 19 insertions(+), 51 deletions(-)
diff --git a/content/base/public/nsISelectionPrivate.idl b/content/base/public/nsISelectionPrivate.idl
index 319f350c855..12603b7ee9c 100644
--- a/content/base/public/nsISelectionPrivate.idl
+++ b/content/base/public/nsISelectionPrivate.idl
@@ -14,7 +14,6 @@ interface nsIContent;
interface nsINode;
%{C++
-class nsFrameSelection;
struct nsTextRangeStyle;
struct nsPoint;
struct ScrollAxis;
@@ -22,7 +21,6 @@ struct ScrollAxis;
#include "nsIFrame.h"
%}
-[ptr] native nsFrameSelection(nsFrameSelection);
[ptr] native nsIFrame(nsIFrame);
[ptr] native RangeArray(nsTArray);
[ref] native constTextRangeStyleRef(const nsTextRangeStyle);
@@ -30,7 +28,7 @@ struct ScrollAxis;
native nsDirection(nsDirection);
native ScrollAxis(nsIPresShell::ScrollAxis);
-[scriptable, builtinclass, uuid(a6d2cedd-afbc-4d25-bffb-e725b9881e30)]
+[scriptable, builtinclass, uuid(3ede44eb-2df8-41de-ab79-6f3dbd10090b)]
interface nsISelectionPrivate : nsISelection
{
const short ENDOFPRECEDINGLINE=0;
@@ -83,11 +81,6 @@ interface nsISelectionPrivate : nsISelection
*/
[noscript] void getCachedFrameOffset(in nsIFrame aFrame, in int32_t inOffset, in nsPointRef aPoint);
- /* getFrameSelection
- * Returnes a reference to the frame selection associated with this selection
- */
- [noscript] nsFrameSelection getFrameSelection();
-
[noscript] void setAncestorLimiter(in nsIContent aContent);
/**
diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp
index 7542fb497e4..cff3f927499 100644
--- a/editor/libeditor/base/nsEditor.cpp
+++ b/editor/libeditor/base/nsEditor.cpp
@@ -629,14 +629,7 @@ nsEditor::GetSelection()
nsresult res = GetSelection(getter_AddRefs(sel));
NS_ENSURE_SUCCESS(res, nullptr);
- nsCOMPtr selPrivate = do_QueryInterface(sel);
- NS_ENSURE_TRUE(selPrivate, nullptr);
-
- nsRefPtr frameSel;
- res = selPrivate->GetFrameSelection(getter_AddRefs(frameSel));
- NS_ENSURE_SUCCESS(res, nullptr);
-
- return frameSel->GetSelection(nsISelectionController::SELECTION_NORMAL);
+ return static_cast(sel.get());
}
NS_IMETHODIMP
diff --git a/editor/libeditor/text/nsTextEditRulesBidi.cpp b/editor/libeditor/text/nsTextEditRulesBidi.cpp
index 15af76f635d..9740fed80d1 100644
--- a/editor/libeditor/text/nsTextEditRulesBidi.cpp
+++ b/editor/libeditor/text/nsTextEditRulesBidi.cpp
@@ -12,7 +12,7 @@
#include "nsIDOMNode.h"
#include "nsIEditor.h"
#include "nsIPresShell.h"
-#include "nsISelection.h"
+#include "mozilla/Selection.h"
#include "nsISelectionPrivate.h"
#include "nsISupportsImpl.h"
#include "nsPlaintextEditor.h"
@@ -20,6 +20,8 @@
#include "nsTextEditRules.h"
#include "nscore.h"
+using namespace mozilla;
+
// Test for distance between caret and text that will be deleted
nsresult
nsTextEditRules::CheckBidiLevelForDeletion(nsISelection *aSelection,
@@ -45,12 +47,8 @@ nsTextEditRules::CheckBidiLevelForDeletion(nsISelection *aSelection,
uint8_t levelBefore;
uint8_t levelAfter;
-
- nsCOMPtr privateSelection(do_QueryInterface(aSelection));
- NS_ENSURE_TRUE(privateSelection, NS_ERROR_NULL_POINTER);
-
- nsRefPtr frameSelection;
- privateSelection->GetFrameSelection(getter_AddRefs(frameSelection));
+ nsRefPtr frameSelection =
+ static_cast(aSelection)->GetFrameSelection();
NS_ENSURE_TRUE(frameSelection, NS_ERROR_NULL_POINTER);
nsPrevNextBidiLevels levels = frameSelection->
diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp
index e050e7aaaf1..bdb01ff32ed 100644
--- a/layout/base/nsCaret.cpp
+++ b/layout/base/nsCaret.cpp
@@ -35,6 +35,7 @@
#include "nsThemeConstants.h"
#include "mozilla/Preferences.h"
#include "mozilla/LookAndFeel.h"
+#include "mozilla/Selection.h"
#include
// The bidi indicator hangs off the caret to one side, to show which
@@ -1127,15 +1128,14 @@ void nsCaret::CaretBlinkCallback(nsITimer *aTimer, void *aClosure)
//-----------------------------------------------------------------------------
-already_AddRefed
+nsFrameSelection*
nsCaret::GetFrameSelection()
{
- nsCOMPtr privateSelection(do_QueryReferent(mDomSelectionWeak));
- if (!privateSelection)
+ nsCOMPtr sel = do_QueryReferent(mDomSelectionWeak);
+ if (!sel)
return nullptr;
- nsFrameSelection* frameSelection = nullptr;
- privateSelection->GetFrameSelection(&frameSelection);
- return frameSelection;
+
+ return static_cast(sel.get())->GetFrameSelection();
}
void
diff --git a/layout/base/nsCaret.h b/layout/base/nsCaret.h
index 2ac70982ae7..d8fd8ad9264 100644
--- a/layout/base/nsCaret.h
+++ b/layout/base/nsCaret.h
@@ -209,7 +209,7 @@ protected:
}
void ToggleDrawnStatus() { mDrawn = !mDrawn; }
- already_AddRefed GetFrameSelection();
+ nsFrameSelection* GetFrameSelection();
// Returns true if we should not draw the caret because of XUL menu popups.
// The caret should be hidden if:
diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp
index 95f0062fe8b..2b754747692 100644
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -4763,8 +4763,7 @@ PresShell::PaintRangePaintInfo(nsTArray >* aItems,
// selection.
nsRefPtr frameSelection;
if (aSelection) {
- nsCOMPtr selpriv = do_QueryInterface(aSelection);
- selpriv->GetFrameSelection(getter_AddRefs(frameSelection));
+ frameSelection = static_cast(aSelection)->GetFrameSelection();
}
else {
frameSelection = FrameSelection();
diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp
index df30bc2b13a..813111c5182 100644
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -1074,18 +1074,10 @@ nsTextControlFrame::GetSelectionRange(int32_t* aSelectionStart,
rv = selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(selection));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
- nsCOMPtr selPriv = do_QueryInterface(selection);
- NS_ENSURE_TRUE(selPriv, NS_ERROR_FAILURE);
- nsRefPtr frameSel;
- rv = selPriv->GetFrameSelection(getter_AddRefs(frameSel));
- NS_ENSURE_SUCCESS(rv, rv);
- NS_ENSURE_TRUE(frameSel, NS_ERROR_FAILURE);
- nsRefPtr typedSel =
- frameSel->GetSelection(nsISelectionController::SELECTION_NORMAL);
- NS_ENSURE_TRUE(typedSel, NS_ERROR_FAILURE);
+ Selection* sel = static_cast(selection.get());
if (aDirection) {
- nsDirection direction = typedSel->GetSelectionDirection();
+ nsDirection direction = sel->GetSelectionDirection();
if (direction == eDirNext) {
*aDirection = eForward;
} else if (direction == eDirPrevious) {
@@ -1101,7 +1093,7 @@ nsTextControlFrame::GetSelectionRange(int32_t* aSelectionStart,
mozilla::dom::Element* root = GetRootNodeAndInitializeEditor();
NS_ENSURE_STATE(root);
- nsContentUtils::GetSelectionInTextControl(typedSel, root,
+ nsContentUtils::GetSelectionInTextControl(sel, root,
*aSelectionStart, *aSelectionEnd);
return NS_OK;
diff --git a/layout/generic/Selection.h b/layout/generic/Selection.h
index d5da100ed20..b837763d55b 100644
--- a/layout/generic/Selection.h
+++ b/layout/generic/Selection.h
@@ -53,6 +53,7 @@ public:
// utility methods for scrolling the selection into view
nsPresContext* GetPresContext() const;
nsIPresShell* GetPresShell() const;
+ nsFrameSelection* GetFrameSelection() const { return mFrameSelection; }
// Returns a rect containing the selection region, and frame that that
// position is relative to. For SELECTION_ANCHOR_REGION or
// SELECTION_FOCUS_REGION the rect is a zero-width rectangle. For
diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp
index def52646716..561ce759899 100644
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -4117,14 +4117,6 @@ Selection::GetCachedFrameOffset(nsIFrame* aFrame, int32_t inOffset,
return rv;
}
-NS_IMETHODIMP
-Selection::GetFrameSelection(nsFrameSelection** aFrameSelection) {
- NS_ENSURE_ARG_POINTER(aFrameSelection);
- *aFrameSelection = mFrameSelection;
- NS_IF_ADDREF(*aFrameSelection);
- return NS_OK;
-}
-
NS_IMETHODIMP
Selection::SetAncestorLimiter(nsIContent* aContent)
{
From fb135090eb1e56415428cee37d414dcd714dbccd Mon Sep 17 00:00:00 2001
From: Trevor Saunders
Date: Fri, 15 Feb 2013 16:32:19 -0500
Subject: [PATCH 023/140] bug 845562 - nsFrameSelection doesn't need to inherit
from nsISupports r=smaug
---
layout/generic/nsFrameSelection.h | 7 ++++---
layout/generic/nsSelection.cpp | 7 ++-----
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/layout/generic/nsFrameSelection.h b/layout/generic/nsFrameSelection.h
index f97c96e1330..d79f38e20ac 100644
--- a/layout/generic/nsFrameSelection.h
+++ b/layout/generic/nsFrameSelection.h
@@ -7,6 +7,7 @@
#include "mozilla/Attributes.h"
+#include "mozilla/Selection.h"
#include "nsIFrame.h"
#include "nsIContent.h"
#include "nsISelectionController.h"
@@ -185,13 +186,13 @@ class nsIScrollableFrame;
* or they may cause other objects to be deleted.
*/
-class nsFrameSelection MOZ_FINAL : public nsISupports {
+class nsFrameSelection MOZ_FINAL {
public:
enum HINT { HINTLEFT = 0, HINTRIGHT = 1}; //end of this line or beginning of next
/*interfaces for addref and release and queryinterface*/
- NS_DECL_CYCLE_COLLECTING_ISUPPORTS
- NS_DECL_CYCLE_COLLECTION_CLASS(nsFrameSelection)
+ NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsFrameSelection)
+ NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsFrameSelection)
/** Init will initialize the frame selector with the necessary pres shell to
* be used by most of the methods
diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp
index 561ce759899..363dd534e01 100644
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -415,11 +415,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsFrameSelection)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAncestorLimiter)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsFrameSelection)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFrameSelection)
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameSelection)
- NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
+NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsFrameSelection, AddRef)
+NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsFrameSelection, Release)
nsresult
From 9fe46afd099472891f64a165e64447c03826a54a Mon Sep 17 00:00:00 2001
From: Margaret Leibovic
Date: Thu, 28 Feb 2013 18:31:55 -0800
Subject: [PATCH 024/140] Bug 846013 - Get rid of about:blank subframe entries
in session restore. r=bnicholson
---
mobile/android/components/SessionStore.js | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/mobile/android/components/SessionStore.js b/mobile/android/components/SessionStore.js
index 4324aa25489..ae766a46f05 100644
--- a/mobile/android/components/SessionStore.js
+++ b/mobile/android/components/SessionStore.js
@@ -655,19 +655,21 @@ SessionStore.prototype = {
return entry;
if (aEntry.childCount > 0) {
- entry.children = [];
+ let children = [];
for (let i = 0; i < aEntry.childCount; i++) {
let child = aEntry.GetChildAt(i);
- if (child)
- entry.children.push(this._serializeHistoryEntry(child));
- else // to maintain the correct frame order, insert a dummy entry
- entry.children.push({ url: "about:blank" });
- // don't try to restore framesets containing wyciwyg URLs (cf. bug 424689 and bug 450595)
- if (/^wyciwyg:\/\//.test(entry.children[i].url)) {
- delete entry.children;
- break;
+ if (child) {
+ // don't try to restore framesets containing wyciwyg URLs (cf. bug 424689 and bug 450595)
+ if (child.URI.schemeIs("wyciwyg")) {
+ children = [];
+ break;
+ }
+ children.push(this._serializeHistoryEntry(child));
}
+
+ if (children.length)
+ entry.children = children;
}
}
From 0d7910eddb01f94b2b42cec74e815f8dbeac5849 Mon Sep 17 00:00:00 2001
From: Nicholas Nethercote
Date: Thu, 28 Feb 2013 18:22:15 -0800
Subject: [PATCH 025/140] Bug 845609 (part 1) - Add a script to diff JSON
memory report dumps. r=kats.
--HG--
extra : rebase_source : 2c549d1f9f495811e0d0ecad9210145747a0725d
---
.../aboutmemory/tools/diff-memory-reports.js | 341 ++++++++++++++++++
1 file changed, 341 insertions(+)
create mode 100644 toolkit/components/aboutmemory/tools/diff-memory-reports.js
diff --git a/toolkit/components/aboutmemory/tools/diff-memory-reports.js b/toolkit/components/aboutmemory/tools/diff-memory-reports.js
new file mode 100644
index 00000000000..108e703f7d5
--- /dev/null
+++ b/toolkit/components/aboutmemory/tools/diff-memory-reports.js
@@ -0,0 +1,341 @@
+/* -*- Mode: js2; tab-width: 8; indent-tabs-mode: nil; js2-basic-offset: 2 -*-*/
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+//---------------------------------------------------------------------------
+// This script diffs two memory report dumps produced by about:memory. Run it
+// using a JS shell. View the result in about:memory using its diff mode, e.g.
+// visit "about:memory?diff" or "about:memory?verbose&diff".
+//
+// A simple test can be performed by running:
+//
+// js diff-memory-reports.js --test
+//
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+// The incoming JSON report objects have the following fields: process, path,
+// kind, units, amount, description.
+//
+// Internally, we use a Report type with the following fields: _kind, _units,
+// _amount, _description, _nMerged. Each Report object represents one or more
+// JSON report objects -- in the "or more" case, all the JSON report objects
+// must have the same process and path.
+//
+// The main data structure is a "reportMap" which is conceptually like this:
+//
+// map(processPath, Report)
+//
+// The process path is a string of the form |process + kSep + path|.
+//
+// The two JSON report arrays are first converted to a reportMap. The two
+// reportMaps are then diff'd, producing a third reportMap, which is converted
+// back to JSON form.
+//---------------------------------------------------------------------------
+
+"use strict";
+
+function assert(aCond, aFailMsg)
+{
+ if (!aCond) {
+ throw aFailMsg;
+ }
+}
+
+let kSep = "^:^:^"; // Something unlikely to appear in a process.
+
+function Report(aKind, aUnits, aAmount, aDescription, aNMerged)
+{
+ this._kind = aKind;
+ this._units = aUnits;
+ this._amount = aAmount;
+ this._description = aDescription;
+ this._nMerged = aNMerged;
+}
+
+Report.prototype = {
+ assertCompatible: function(aKind, aUnits)
+ {
+ assert(this._kind == aKind, "Mismatched kinds");
+ assert(this._units == aUnits, "Mismatched units");
+
+ // We don't check that the "description" properties match. This is because
+ // on Linux we can get cases where the paths are the same but the
+ // descriptions differ, like this:
+ //
+ // "path": "size/other-files/icon-theme.cache/[r--p]",
+ // "description": "/usr/share/icons/gnome/icon-theme.cache (read-only, not executable, private)"
+ //
+ // "path": "size/other-files/icon-theme.cache/[r--p]"
+ // "description": "/usr/share/icons/hicolor/icon-theme.cache (read-only, not executable, private)"
+ //
+ // In those cases, we just use the description from the first-encountered
+ // one, which is what about:memory also does.
+ },
+
+ merge: function(aJr) {
+ this.assertCompatible(aJr.kind, aJr.units);
+ this._amount += aJr.amount;
+ this._nMerged++;
+ },
+
+ toJSON: function(aProcess, aPath, aAmount) {
+ return {
+ process: aProcess,
+ path: aPath,
+ kind: this._kind,
+ units: this._units,
+ amount: aAmount,
+ description: this._description
+ };
+ }
+};
+
+// Make a reportMap from the |reports| field of a JSON object.
+function makeReportMap(aJSONReports)
+{
+ let reportMap = {};
+ for (let i = 0; i < aJSONReports.length; i++) {
+ let jr = aJSONReports[i];
+
+ assert(jr.process !== undefined, "Missing process");
+ assert(jr.path !== undefined, "Missing path");
+ assert(jr.kind !== undefined, "Missing kind");
+ assert(jr.units !== undefined, "Missing units");
+ assert(jr.amount !== undefined, "Missing amount");
+ assert(jr.description !== undefined, "Missing description");
+
+ // Strip out some non-deterministic stuff that prevents clean diffs --
+ // e.g. PIDs, addresses.
+ let strippedProcess = jr.process.replace(/pid \d+/, "pid NNN");
+ let strippedPath = jr.path.replace(/0x[0-9A-Fa-f]+/, "0xNNN");
+ let processPath = strippedProcess + kSep + strippedPath;
+
+ let rOld = reportMap[processPath];
+ if (rOld === undefined) {
+ reportMap[processPath] =
+ new Report(jr.kind, jr.units, jr.amount, jr.description, 1);
+ } else {
+ rOld.merge(jr);
+ }
+ }
+ return reportMap;
+}
+
+// Return a new reportMap which is the diff of two reportMaps. Empties
+// aReportMap2 along the way.
+function diffReportMaps(aReportMap1, aReportMap2)
+{
+ let result = {};
+
+ for (let processPath in aReportMap1) {
+ let r1 = aReportMap1[processPath];
+ let r2 = aReportMap2[processPath];
+ let r2_amount, r2_nMerged;
+ if (r2 !== undefined) {
+ r1.assertCompatible(r2._kind, r2._units);
+ r2_amount = r2._amount;
+ r2_nMerged = r2._nMerged;
+ delete aReportMap2[processPath];
+ } else {
+ r2_amount = 0;
+ r2_nMerged = 0;
+ }
+ result[processPath] =
+ new Report(r1._kind, r1._units, r2_amount - r1._amount, r1._description,
+ Math.max(r1._nMerged, r2_nMerged));
+ }
+
+ for (let processPath in aReportMap2) {
+ let r2 = aReportMap2[processPath];
+ result[processPath] = new Report(r2._kind, r2._units, r2._amount,
+ r2._description, r2._nMerged);
+ }
+
+ return result;
+}
+
+function makeJSONReports(aReportMap)
+{
+ let reports = [];
+ for (let processPath in aReportMap) {
+ let r = aReportMap[processPath];
+ if (r._amount !== 0) {
+ // If _nMerged > 1, we give the full (aggregated) amount in the first
+ // copy, and then use amount=0 in the remainder. When viewed in
+ // about:memory, this shows up as an entry with a "[2]"-style suffix
+ // and the correct amount.
+ let split = processPath.split(kSep);
+ assert(split.length >= 2);
+ let process = split.shift();
+ let path = split.join();
+ reports.push(r.toJSON(process, path, r._amount));
+ for (let i = 1; i < r._nMerged; i++) {
+ reports.push(r.toJSON(process, path, 0));
+ }
+ }
+ }
+
+ // The sorting makes the output deterministic, which is only done so that
+ // the test is reliable.
+ reports.sort(function(a, b) {
+ if (a.process < b.process) return -1;
+ else if (a.process > b.process) return 1;
+ else if (a.path < b.path) return -1;
+ else if (a.path > b.path) return 1;
+ else if (a.amount < b.amount) return -1;
+ else if (a.amount > b.amount) return 1;
+ else return 0;
+ });
+
+ return reports;
+}
+
+
+// Diff two JSON objects holding memory reports.
+function diff(aJson1, aJson2)
+{
+ function simpleProp(aProp)
+ {
+ assert(aJson1[aProp] !== undefined && aJson1[aProp] === aJson2[aProp],
+ aProp + " properties don't match");
+ return aJson1[aProp];
+ }
+
+ return {
+ version: simpleProp("version"),
+
+ hasMozMallocUsableSize: simpleProp("hasMozMallocUsableSize"),
+
+ reports: makeJSONReports(diffReportMaps(makeReportMap(aJson1.reports),
+ makeReportMap(aJson2.reports)))
+ };
+}
+
+//---------------------------------------------------------------------------
+
+
+let kTestInput1 =
+{
+ "version": 1,
+ "hasMozMallocUsableSize": true,
+ "reports": [
+ // Simple cases.
+ {"process": "P", "path": "explicit/xpcom/category-manager", "kind": 1, "units": 0, "amount": 56848, "description": "Desc."},
+ {"process": "P", "path": "explicit/storage/prefixset/goog-phish-shavar", "kind": 1, "units": 0, "amount": 680000, "description": "Desc."},
+
+ // Multiple occurrences of the same path; occurs once in kTestInput2.
+ {"process": "P", "path": "explicit/spell-check", "kind": 1, "units": 0, "amount": 4, "description": "Desc."},
+ {"process": "P", "path": "explicit/spell-check", "kind": 1, "units": 0, "amount": 5, "description": "Desc."},
+
+ // Doesn't appear in the output because the diff is zero.
+ {"process": "P", "path": "page-faults-soft", "kind": 2, "units": 2, "amount": 61013, "description": "Desc."},
+
+ {"process": "P", "path": "foobar", "kind": 2, "units": 0, "amount": 100, "description": "Desc."},
+ {"process": "P", "path": "zero1", "kind": 2, "units": 0, "amount": 0, "description": "Desc."},
+
+ // The PID and address need to be stripped to match.
+ {"process": "P2 (pid 22)", "path": "z 0x1234", "kind": 2, "units": 0, "amount": 33, "description": "Desc."},
+
+ // Case with no corresponding entry in kTestInput2.
+ {"process": "P3", "path": "p3", "kind": 2, "units": 0, "amount": 55, "description": "Desc."},
+
+ // Doesn't appear in the output because it's zero and there's no
+ // corresponding entry in kTestInput2.
+ {"process": "P5", "path": "p5", "kind": 2, "units": 0, "amount": 0, "description": "Desc."}
+ ]
+}
+
+let kTestInput2 =
+{
+ "version": 1,
+ "hasMozMallocUsableSize": true,
+ "reports": [
+ {"process": "P", "path": "explicit/xpcom/category-manager", "kind": 1, "units": 0, "amount": 56849, "description": "Desc."},
+ {"process": "P", "path": "explicit/storage/prefixset/goog-phish-shavar", "kind": 1, "units": 0, "amount": 670000, "description": "Desc."},
+
+ {"process": "P", "path": "explicit/spell-check", "kind": 1, "units": 0, "amount": 3, "description": "Desc."},
+
+ {"process": "P", "path": "page-faults-soft", "kind": 2, "units": 2, "amount": 61013, "description": "Desc."},
+
+ // Multiple occurrences of the same path; doesn't occur in kTestInput1.
+ {"process": "P", "path": "canvas-2d-pixel-bytes", "kind": 2, "units": 0, "amount": 1000, "description": "Desc."},
+ {"process": "P", "path": "canvas-2d-pixel-bytes", "kind": 2, "units": 0, "amount": 2000, "description": "Desc."},
+
+ {"process": "P", "path": "foobaz", "kind": 2, "units": 0, "amount": 0, "description": "Desc."},
+
+ {"process": "P2 (pid 33)", "path": "z 0x5678", "kind": 2, "units": 0, "amount": 44, "description": "Desc."},
+
+ // Case with no corresponding entry in kTestInput1.
+ {"process": "P4", "path": "p4", "kind": 2, "units": 0, "amount": 66, "description": "Desc."},
+
+ // Doesn't appear in the output because it's zero and there's no
+ // corresponding entry in kTestInput1.
+ {"process": "P6", "path": "p6", "kind": 2, "units": 0, "amount": 0, "description": "Desc."}
+ ]
+}
+
+let kTestExpectedOutput =
+{
+ "version": 1,
+ "hasMozMallocUsableSize": true,
+ "reports": [
+ {"process":"P","path":"canvas-2d-pixel-bytes","kind":2,"units":0,"amount":0,"description":"Desc."},
+ {"process":"P","path":"canvas-2d-pixel-bytes","kind":2,"units":0,"amount":3000,"description":"Desc."},
+ {"process":"P","path":"explicit/spell-check","kind":1,"units":0,"amount":-6,"description":"Desc."},
+ {"process":"P","path":"explicit/spell-check","kind":1,"units":0,"amount":0,"description":"Desc."},
+ {"process":"P","path":"explicit/storage/prefixset/goog-phish-shavar","kind":1,"units":0,"amount":-10000,"description":"Desc."},
+ {"process":"P","path":"explicit/xpcom/category-manager","kind":1,"units":0,"amount":1,"description":"Desc."},
+ {"process":"P","path":"foobar","kind":2,"units":0,"amount":-100,"description":"Desc."},
+ {"process":"P2 (pid NNN)","path":"z 0xNNN","kind":2,"units":0,"amount":11,"description":"Desc."},
+ {"process":"P3","path":"p3","kind":2,"units":0,"amount":-55,"description":"Desc."},{"process":"P4","path":"p4","kind":2,"units":0,"amount":66,"description":"Desc."}]}
+
+function matches(aA, aB)
+{
+ return JSON.stringify(aA) === JSON.stringify(aB);
+}
+
+//---------------------------------------------------------------------------
+
+// XXX: note that read() looks for files relative to the path of the script,
+// not the path the script was invoked from. Bug 835552 is open to fix this.
+
+let kUsageMsg =
+"Usage:\n\
+\n\
+ diff-memory-reports.js \n\
+\n\
+or:\n\
+\n\
+ diff-memory-reports.js --test\n\
+"
+
+if (arguments.length === 1 && arguments[0] === "--test") {
+ let expected = JSON.stringify(kTestExpectedOutput);
+ let actual = JSON.stringify(diff(kTestInput1, kTestInput2));
+ if (expected === actual) {
+ print("test PASSED");
+ } else {
+ print("test FAILED");
+ print();
+ print("expected:");
+ print(expected);
+ print();
+ print("actual:");
+ print(actual);
+ }
+
+} else if (arguments.length === 2) {
+ let json1 = JSON.parse(read(arguments[0]));
+ let json2 = JSON.parse(read(arguments[1]));
+
+ print(JSON.stringify(diff(json1, json2)));
+
+} else {
+ print(kUsageMsg);
+ quit(1);
+}
+
+
From 320ee2e66e5aa4dfe5a1a34eef7b66a1abe068a7 Mon Sep 17 00:00:00 2001
From: Nicholas Nethercote
Date: Thu, 28 Feb 2013 18:22:25 -0800
Subject: [PATCH 026/140] Bug 845609 (part 2) - Add a diff mode to
about:memory. r=jlebar.
--HG--
extra : rebase_source : 2819dd753dd7804c40ca20ac5fcee14e822307a0
---
.../aboutmemory/content/aboutMemory.js | 44 ++++++++++++-------
1 file changed, 28 insertions(+), 16 deletions(-)
diff --git a/toolkit/components/aboutmemory/content/aboutMemory.js b/toolkit/components/aboutmemory/content/aboutMemory.js
index b69625aedf6..96840c6f9dc 100644
--- a/toolkit/components/aboutmemory/content/aboutMemory.js
+++ b/toolkit/components/aboutmemory/content/aboutMemory.js
@@ -1,11 +1,11 @@
-/* -*- Mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil; -*- */
+/* -*- Mode: js2; tab-width: 8; indent-tabs-mode: nil; js2-basic-offset: 2 -*-*/
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This file is used for both about:memory and about:compartments.
-//
-//
+
// about:memory will by default show information about the browser's current
// memory usage, but you can direct it to load information from a file by
// providing a file= query string. For example,
@@ -48,18 +48,21 @@ let gUnnamedProcessStr = "Main Process";
// Because about:memory and about:compartments are non-standard URLs,
// location.search is undefined, so we have to use location.href here.
// The toLowerCase() calls ensure that addresses like "ABOUT:MEMORY" work.
-let gVerbose;
+let gVerbose = false;
+let gIsDiff = false;
{
let split = document.location.href.split('?');
document.title = split[0].toLowerCase();
- gVerbose = false;
- if (split.length == 2) {
+ if (split.length === 2) {
let searchSplit = split[1].split('&');
for (let i = 0; i < searchSplit.length; i++) {
- if (searchSplit[i].toLowerCase() == 'verbose') {
+ if (searchSplit[i].toLowerCase() === 'verbose') {
gVerbose = true;
}
+ if (searchSplit[i].toLowerCase() === 'diff') {
+ gIsDiff = true;
+ }
}
}
}
@@ -886,19 +889,27 @@ TreeNode.prototype = {
// Sort TreeNodes first by size, then by name. This is particularly important
// for the about:memory tests, which need a predictable ordering of reporters
// which have the same amount.
-TreeNode.compareAmounts = function(a, b) {
- if (a._amount > b._amount) {
+TreeNode.compareAmounts = function(aA, aB) {
+ let a, b;
+ if (gIsDiff) {
+ a = Math.abs(aA._amount);
+ b = Math.abs(aB._amount);
+ } else {
+ a = aA._amount;
+ b = aB._amount;
+ }
+ if (a > b) {
return -1;
}
- if (a._amount < b._amount) {
+ if (a < b) {
return 1;
}
- return TreeNode.compareUnsafeNames(a, b);
+ return TreeNode.compareUnsafeNames(aA, aB);
};
-TreeNode.compareUnsafeNames = function(a, b) {
- return a._unsafeName < b._unsafeName ? -1 :
- a._unsafeName > b._unsafeName ? 1 :
+TreeNode.compareUnsafeNames = function(aA, aB) {
+ return aA._unsafeName < aB._unsafeName ? -1 :
+ aA._unsafeName > aB._unsafeName ? 1 :
0;
};
@@ -1516,11 +1527,12 @@ function appendTreeElements(aP, aRoot, aProcess, aPadText)
let treelineText = aTreelineText1 + aTreelineText2a;
appendElementWithText(aP, "span", "treeline", treelineText);
- // Detect and record invalid values.
+ // Detect and record invalid values. But not if gIsDiff is true, because
+ // we expect negative values in that case.
assertInput(aRoot._units === aT._units,
"units within a tree are inconsistent");
let tIsInvalid = false;
- if (!(0 <= aT._amount && aT._amount <= aRoot._amount)) {
+ if (!gIsDiff && !(0 <= aT._amount && aT._amount <= aRoot._amount)) {
tIsInvalid = true;
let unsafePath = aUnsafeNames.join("/");
gUnsafePathsWithInvalidValuesForThisProcess.push(unsafePath);
From f950b5da5b47d2cae370757ab943238e9f9b536f Mon Sep 17 00:00:00 2001
From: Mark Hammond
Date: Fri, 1 Mar 2013 14:04:29 +1100
Subject: [PATCH 027/140] Bug 821208 - don't reference chatbox.iframe until the
XBL bindings have been created. r=gavin
---
browser/base/content/socialchat.xml | 83 +++++++++++++----------------
1 file changed, 37 insertions(+), 46 deletions(-)
diff --git a/browser/base/content/socialchat.xml b/browser/base/content/socialchat.xml
index 6ca1d44be29..c485ee20200 100644
--- a/browser/base/content/socialchat.xml
+++ b/browser/base/content/socialchat.xml
@@ -20,6 +20,37 @@
+
+
document.getAnonymousElementByAttribute(this, "anonid", "iframe");
@@ -381,51 +412,6 @@
]]>
This is a test social chat window.
+
+
+
+
This is a test social sidebar.
+