This commit is contained in:
Gregory Szorc 2012-02-21 15:04:45 -08:00
Родитель f44380666b 35176b3c55
Коммит 2224cef968
82 изменённых файлов: 1024 добавлений и 812 удалений

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

@ -851,7 +851,9 @@ nsAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
// Get accessible for the node with the point or the first accessible in
// the DOM parent chain.
nsAccessible* accessible = accDocument->GetAccessibleOrContainer(content);
nsDocAccessible* contentDocAcc = GetAccService()->
GetDocAccessible(content->OwnerDoc());
nsAccessible* accessible = contentDocAcc->GetAccessibleOrContainer(content);
if (!accessible)
return fallbackAnswer;

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

@ -49,6 +49,7 @@ DIRS = \
elm \
events \
focus \
hittest \
hyperlink \
hypertext \
name \
@ -96,8 +97,6 @@ _TEST_FILES =\
test_aria_roles.xul \
test_aria_token_attrs.html \
test_bug420863.html \
test_childAtPoint.html \
test_childAtPoint.xul \
test_descr.html \
test_nsIAccessibleDocument.html \
test_nsIAccessibleImage.html \

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

@ -0,0 +1,55 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2012
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Hubert Figuière <hub@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = accessible/hittest
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES = \
test_general.html \
test_general.xul \
test_browser.html \
$(NULL)
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)

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

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html>
<head>
<title>nsIAccessible::childAtPoint() from browser tests</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../layout.js"></script>
<script type="application/javascript">
function doTest()
{
// Hit testing. See bug #726097
var nodeObj = { value: null };
var hititem = getAccessible("hititem", null, nodeObj);
var [deltaX, deltaY] = getScreenCoords(nodeObj.value);
var hittest = getAccessible("hittest");
var hitX = {}, hitY = {}, hitWidth = {}, hitHeight = {};
hititem.getBounds(hitX, hitY, hitWidth, hitHeight);
var tgtX = deltaX + (hitWidth.value / 2);
var tgtY = deltaY + (hitHeight.value / 2);
var rootAcc = getRootAccessible();
var docAcc = getAccessible(document);
var outerDocAcc = docAcc.parent;
var hitAcc = rootAcc.getDeepestChildAtPoint(tgtX, tgtY);
is(hitAcc, hititem, "Hit match at " + tgtX + "," + tgtY +
". Found: " + prettyName(hitAcc));
var hitAcc2 = docAcc.getDeepestChildAtPoint(tgtX, tgtY);
is(hitAcc, hitAcc2, "Hit match at " + tgtX + "," + tgtY +
". Found: " + prettyName(hitAcc2));
hitAcc = outerDocAcc.getChildAtPoint(tgtX, tgtY);
is(hitAcc, docAcc, "Hit match at " + tgtX + "," + tgtY +
". Found: " + prettyName(hitAcc));
hitAcc = docAcc.getChildAtPoint(tgtX, tgtY);
is(hitAcc, hittest, "Hit match at " + tgtX + "," + tgtY +
". Found: " + prettyName(hitAcc));
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=726097"
title="nsIAccessible::childAtPoint() from browser tests">Mozilla Bug 726097</a>
<div id="hittest">
<div id="hititem"><span role="image">img</span>item</div>
</div>
</body>
</html>

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

@ -8,9 +8,9 @@
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="common.js"></script>
src="../common.js"></script>
<script type="application/javascript"
src="layout.js"></script>
src="../layout.js"></script>
<script type="application/javascript">
function doTest()
@ -85,6 +85,5 @@
<div id="outofflow" style="width: 10px; height: 10px; position: absolute; left: 0px; top: 0px; background-color: yellow;">
</div>
<div id="area" style="width: 100px; height: 100px; background-color: blue;"></div>
</body>
</html>

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

@ -10,12 +10,12 @@
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="treeview.js" />
src="../treeview.js" />
<script type="application/javascript"
src="common.js" />
src="../common.js" />
<script type="application/javascript"
src="layout.js" />
src="../layout.js" />
<script type="application/javascript">
<![CDATA[

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

@ -562,7 +562,7 @@ HistoryMenu.prototype = {
undoMenu.removeAttribute("disabled");
// populate menu
var undoItems = eval("(" + this._ss.getClosedTabData(window) + ")");
var undoItems = JSON.parse(this._ss.getClosedTabData(window));
for (var i = 0; i < undoItems.length; i++) {
var m = document.createElement("menuitem");
m.setAttribute("label", undoItems[i].title);

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

@ -1055,11 +1055,7 @@
<svg:svg height="0">
<svg:mask id="winstripe-keyhole-forward-mask" maskContentUnits="objectBoundingBox">
<svg:rect x="0" y="0" width="1" height="1" fill="white"/>
<svg:circle cx="-0.46" cy="0.5" r="0.63"/>
</svg:mask>
<svg:mask id="winstripe-keyhole-forward-mask-hover" maskContentUnits="objectBoundingBox">
<svg:rect x="0" y="0" width="1" height="1" fill="white"/>
<svg:circle cx="-0.35" cy="0.5" r="0.58"/>
<svg:circle cx="-0.34" cy="0.5" r="0.61"/>
</svg:mask>
<svg:mask id="winstripe-urlbar-back-button-mask" maskContentUnits="userSpaceOnUse">
<svg:rect x="0" y="0" width="10000" height="50" fill="white"/>

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

@ -64,7 +64,7 @@ function test() {
let testState = {
windows: [
{ tabs: [{ entries: [{ url: "http://example.com/" }] }], selected: 1 },
{ tabs: [{ entries: [{ url: "about:robots" }] }], selected: 1 },
{ tabs: [{ entries: [{ url: "about:mozilla" }] }], selected: 1 },
],
// make sure the first window is focused, otherwise when restoring the
// old state, the first window is closed and the test harness gets unloaded

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

@ -686,17 +686,22 @@ menuitem.bookmark-item {
@navbarLargeIcons@ .toolbarbutton-1 {
-moz-appearance: none;
padding: 1px 5px;
background: rgba(151,152,153,.05)
-moz-linear-gradient(rgba(251,252,253,.95), rgba(246,247,248,.47) 49%,
rgba(231,232,233,.45) 51%, rgba(225,226,229,.3));
background-clip: padding-box;
background: hsla(210,48%,90%,.1)
-moz-linear-gradient(rgba(255,255,255,.8), rgba(255,255,255,.45) 49%,
rgba(255,255,255,.35) 51%, rgba(255,255,255,.1))
padding-box;
border-radius: 2.5px;
border: 1px solid;
border-color: rgba(0,0,0,.12) rgba(0,0,0,.19) rgba(0,0,0,.38);
box-shadow: 0 0 0 1px rgba(255,255,255,.3) inset,
0 0 0 2px rgba(255,255,255,.1) inset;
border-color: hsla(210,54%,20%,.13) hsla(210,54%,20%,.16) hsla(210,54%,20%,.2);
box-shadow: 0 1px 0 rgba(255,255,255,.3) inset,
0 0 0 1px rgba(255,255,255,.3) inset,
0 1px 0 hsla(210,54%,20%,.02),
/* allows winstripe-keyhole-forward-mask to be used for non-hover as well as hover: */
0 0 2px hsla(210,54%,20%,0);
color: black;
text-shadow: 0 0 2px white;
-moz-transition-property: background-color, border-color, box-shadow;
-moz-transition-duration: 250ms;
}
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
@ -755,16 +760,13 @@ menuitem.bookmark-item {
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled="true"]):not(:active):hover,
@navbarLargeIcons@ .toolbarbutton-1:not([open="true"]):not(:active):hover > .toolbarbutton-menubutton-dropmarker:not([disabled="true"]),
@navbarLargeIcons@ .toolbarbutton-1:not([type="menu-button"]):not([disabled="true"]):not([checked="true"]):not([open="true"]):not(:active):hover,
@navbarLargeIcons@ #back-button:not([disabled="true"]):not([open]):not(:active):hover > .toolbarbutton-icon {
background-color: hsla(190,60%,70%,.5);
border-color: hsla(190,50%,65%,.8) hsla(190,50%,50%,.8) hsla(190,50%,40%,.8);
box-shadow: 0 0 0 1px rgba(255,255,255,.3) inset,
0 0 0 1.5px rgba(255,255,255,.1) inset,
0 0 3.5px hsl(190,90%,80%);
-moz-transition: background-color .4s ease-in,
border-color .3s ease-in,
box-shadow .3s ease-in;
@navbarLargeIcons@ .toolbarbutton-1:not([type="menu-button"]):not([disabled="true"]):not([checked="true"]):not([open="true"]):not(:active):hover {
background-color: hsla(210,48%,96%,.75);
border-color: hsla(210,54%,20%,.3) hsla(210,54%,20%,.35) hsla(210,54%,20%,.4);
box-shadow: 0 1px 0 rgba(255,255,255,.3) inset,
0 0 0 1px rgba(255,255,255,.3) inset,
0 1px 0 hsla(210,54%,20%,.03),
0 0 2px hsla(210,54%,20%,.1);
}
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled="true"]):hover:active,
@ -773,12 +775,15 @@ menuitem.bookmark-item {
@navbarLargeIcons@ .toolbarbutton-1:not([type="menu-button"]):not([disabled="true"]):hover:active,
@navbarLargeIcons@ .toolbarbutton-1:not([type="menu-button"])[checked="true"],
@navbarLargeIcons@ .toolbarbutton-1[open="true"] {
background-color: transparent;
border-color: rgba(0,0,0,.65) rgba(0,0,0,.55) rgba(0,0,0,.5);
box-shadow: 0 0 6.5px rgba(0,0,0,.4) inset,
0 0 2px rgba(0,0,0,.4) inset,
0 1px 0 rgba(255,255,255,.4);
background-color: hsla(210,54%,20%,.2);
border-color: hsla(210,54%,20%,.3) hsla(210,54%,20%,.35) hsla(210,54%,20%,.4);
box-shadow: 0 1px 1px rgba(0,0,0,.1) inset,
0 0 2px rgba(0,0,0,.3) inset,
/* allows winstripe-keyhole-forward-mask to be used for non-hover as well as hover: */
0 1px 0 hsla(210,54%,20%,0),
0 0 2px hsla(210,54%,20%,0);
text-shadow: none;
-moz-transition: none;
}
@navbarLargeIcons@ .toolbarbutton-1[checked="true"]:not(:active):hover {
@ -904,28 +909,33 @@ toolbar[mode="full"] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
border-radius: 10000px;
padding: 5px;
border: none;
background-image: -moz-linear-gradient(rgba(251,252,253,.97), rgba(246,247,248,.5) 49%,
rgba(231,232,233,.45) 51%, rgba(225,226,229,.2));
box-shadow: 0 0 0 1px rgba(255,255,255,.3) inset,
0 0 0 2px rgba(255,255,255,.1) inset,
0 0 0 1px rgba(0,0,0,.15),
0 1px 0 rgba(0,0,0,.4);
background: hsla(210,48%,90%,.1)
-moz-linear-gradient(rgba(255,255,255,.88), rgba(255,255,255,.45) 49%,
rgba(255,255,255,.35) 51%, rgba(255,255,255,.67));
box-shadow: 0 1px 0 rgba(255,255,255,.3) inset,
0 0 0 1px rgba(255,255,255,.3) inset,
0 1px 0 hsla(210,54%,20%,.02),
0 0 0 1px rgba(0,0,0,.15);
-moz-transition-property: background-color, box-shadow;
-moz-transition-duration: 250ms;
}
@navbarLargeIcons@ #back-button:not([disabled="true"]):not([open="true"]):not(:active):hover > .toolbarbutton-icon {
box-shadow: 0 0 0 1px rgba(255,255,255,.3) inset,
0 0 0 2px rgba(255,255,255,.1) inset,
0 0 0 1px hsla(190,50%,40%,.3),
0 1px 0 rgba(0,0,0,.4),
0 0 5px 1px hsl(190,90%,80%);
background-color: hsla(210,48%,96%,.75);
box-shadow: 0 1px 0 rgba(255,255,255,.3) inset,
0 0 0 1px rgba(255,255,255,.1) inset,
0 1px 0 hsla(210,54%,20%,.03),
0 0 0 1px rgba(0,0,0,.2),
0 0 2px 1px hsla(210,54%,20%,.2);
}
@navbarLargeIcons@ #back-button:not([disabled="true"]):hover:active > .toolbarbutton-icon,
@navbarLargeIcons@ #back-button[open="true"] > .toolbarbutton-icon {
box-shadow: 0 0 6.5px rgba(0,0,0,.4) inset,
0 0 2px rgba(0,0,0,.4) inset,
0 0 0 1px rgba(0,0,0,.65),
0 2px 0 rgba(255,255,255,.4);
background-color: hsla(210,54%,20%,.2);
box-shadow: 0 1px 1px rgba(0,0,0,.1) inset,
0 0 2px rgba(0,0,0,.3) inset,
0 0 0 1px rgba(0,0,0,.2);
-moz-transition: none;
}
@navbarLargeIcons@[currentset*="unified-back-forward-button"],
@ -947,13 +957,6 @@ toolbar[mode="full"] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
padding-right: 3px;
}
@navbarLargeIcons@ #forward-button:not([disabled="true"]):not(:active):hover {
/*mask: url(keyhole-forward-mask.svg#mask-hover);*/
mask: url(chrome://browser/content/browser.xul#winstripe-keyhole-forward-mask-hover);
/* Don't animate the box shadow, as the blur and spread radii affect the mask. */
-moz-transition: background-color .4s ease-in;
}
.unified-nav-back[_moz-menuactive]:-moz-locale-dir(ltr),
.unified-nav-forward[_moz-menuactive]:-moz-locale-dir(rtl) {
list-style-image: url("chrome://browser/skin/menu-back.png") !important;

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

@ -33,7 +33,7 @@ class DeviceManagerADB(DeviceManager):
self.verifyRunAs(packageName)
except:
self.useRunAs = False
self.packageName = None
self.packageName = packageName
try:
self.verifyZip()
except:
@ -684,7 +684,13 @@ class DeviceManagerADB(DeviceManager):
if (packageName and self.isCpAvailable() and devroot):
tmpDir = self.getTempDir()
self.checkCmd(["shell", "run-as", packageName, "mkdir", devroot + "/sanity"])
# The problem here is that run-as doesn't cause a non-zero exit code
# when failing because of a non-existent or non-debuggable package :(
runAsOut = self.runCmd(["shell", "run-as", packageName, "mkdir", devroot + "/sanity"]).communicate()[0]
if runAsOut.startswith("run-as:") and ("not debuggable" in runAsOut[0] or
"is unknown" in runAsOut[0]):
raise DMError("run-as failed sanity check")
self.checkCmd(["push", os.path.abspath(sys.argv[0]), tmpDir + "/tmpfile"])
if self.useDDCopy:
self.checkCmd(["shell", "run-as", packageName, "dd", "if=" + tmpDir + "/tmpfile", "of=" + devroot + "/sanity/tmpfile"])

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

@ -209,17 +209,18 @@ class DeviceManagerSUT(DeviceManager):
self._sock = None
return None
# If something goes wrong in the agent it will send back a string that
# starts with '##AGENT-ERROR##'
if (self.agentErrorRE.match(temp)):
data = temp
break
data += temp
# If something goes wrong in the agent it will send back a string that
# starts with '##AGENT-ERROR##'
if self.agentErrorRE.match(data):
break
for line in data.splitlines():
if (promptre.match(line)):
if promptre.match(line):
found = True
data = self._stripPrompt(data)
break
# If we violently lose the connection to the device, this loop tends to spin,
# this guard prevents that
@ -238,7 +239,7 @@ class DeviceManagerSUT(DeviceManager):
# internal function
# take a data blob and strip instances of the prompt '$>\x00'
def stripPrompt(self, data):
def _stripPrompt(self, data):
promptre = re.compile(self.prompt_regex + '.*')
retVal = []
lines = data.split('\n')
@ -293,7 +294,7 @@ class DeviceManagerSUT(DeviceManager):
validated = False
if (retVal):
retline = self.stripPrompt(retVal).strip()
retline = retVal.strip()
if (retline == None):
# Then we failed to get back a hash from agent, try manual validation
validated = self.validateFile(destname, localname)
@ -379,11 +380,9 @@ class DeviceManagerSUT(DeviceManager):
except(DMError):
return False
retVal = self.stripPrompt(data)
data = retVal.split('\n')
found = False
for d in data:
if (dirre.match(d)):
for d in data.splitlines():
if (dirre.match(d)):
found = True
return found
@ -417,8 +416,7 @@ class DeviceManagerSUT(DeviceManager):
except(DMError):
return []
retVal = self.stripPrompt(data)
files = filter(lambda x: x, retVal.split('\n'))
files = filter(lambda x: x, data.splitlines())
if len(files) == 1 and files[0] == '<empty>':
# special case on the agent: empty directories return just the string "<empty>"
return []
@ -460,11 +458,9 @@ class DeviceManagerSUT(DeviceManager):
except DMError:
return []
retVal = self.stripPrompt(data)
lines = retVal.split('\n')
files = []
for line in lines:
if (line.strip() != ''):
for line in data.splitlines():
if line:
pidproc = line.strip().split()
if (len(pidproc) == 2):
files += [[pidproc[0], pidproc[1]]]
@ -552,7 +548,7 @@ class DeviceManagerSUT(DeviceManager):
except(DMError):
return None
return self.stripPrompt(data).strip('\n')
return data.strip()
# external function
# returns:
@ -564,7 +560,7 @@ class DeviceManagerSUT(DeviceManager):
except(DMError):
return None
return self.stripPrompt(data)
return data
# external function
# returns:
@ -754,7 +750,8 @@ class DeviceManagerSUT(DeviceManager):
# return the string "<filename>: No such file or directory".
# However, I've seen AGENT-WARNING returned before.
return False
retVal = self.stripPrompt(data).strip()
retVal = data.strip()
if not retVal:
raise FileError('isdir returned null')
return retVal == 'TRUE'
@ -787,9 +784,9 @@ class DeviceManagerSUT(DeviceManager):
except(DMError):
return None
retVal = self.stripPrompt(data)
if (retVal != None):
retVal = retVal.strip('\n')
retVal = None
if data:
retVal = data.strip()
if (self.debug >= 3): print "remote hash returned: '" + retVal + "'"
return retVal
@ -815,8 +812,8 @@ class DeviceManagerSUT(DeviceManager):
data = self.verifySendCMD(['testroot'])
except:
return None
deviceRoot = self.stripPrompt(data).strip('\n') + '/tests'
deviceRoot = data.strip() + '/tests'
if (not self.dirExists(deviceRoot)):
if (self.mkDir(deviceRoot) == None):
@ -829,9 +826,8 @@ class DeviceManagerSUT(DeviceManager):
data = self.verifySendCMD(['getapproot '+packageName])
except:
return None
appRoot = self.stripPrompt(data).strip('\n')
return appRoot
return data.strip()
# external function
# returns:
@ -925,7 +921,6 @@ class DeviceManagerSUT(DeviceManager):
data = self.verifySendCMD(['info ' + d])
if (data is None):
continue
data = self.stripPrompt(data)
data = collapseSpaces.sub(' ', data)
result[d] = data.split('\n')
@ -1055,7 +1050,7 @@ class DeviceManagerSUT(DeviceManager):
except(DMError):
return None
return self.stripPrompt(data).strip('\n')
return data.strip()
"""
Connect the ipaddress and port for a callback ping. Defaults to current IP address

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

@ -80,10 +80,16 @@ def build_glibc_aux(stage_dir, inst_dir):
["--disable-profile",
"--enable-add-ons=nptl",
"--without-selinux",
"--enable-kernel=2.6.18",
"--enable-kernel=%s" % linux_version,
"--libdir=%s/lib64" % inst_dir,
"--prefix=%s" % inst_dir])
def build_linux_headers(inst_dir):
run_in(linux_source_dir, [old_make, "headers_check"])
run_in(linux_source_dir, [old_make, "INSTALL_HDR_PATH=dest",
"headers_install"])
shutil.move(linux_source_dir + "/dest", inst_dir)
def build_one_stage(env, stage_dir, is_stage_one):
def f():
build_one_stage_aux(stage_dir, is_stage_one)
@ -108,6 +114,7 @@ def build_one_stage_aux(stage_dir, is_stage_one):
"--with-mpfr=%s" % lib_inst_dir])
tool_inst_dir = stage_dir + '/inst'
build_linux_headers(tool_inst_dir)
binutils_build_dir = stage_dir + '/binutils'
build_package(binutils_source_dir, binutils_build_dir,
@ -119,17 +126,15 @@ def build_one_stage_aux(stage_dir, is_stage_one):
"--with-gmp=%s" % lib_inst_dir,
"--with-mpfr=%s" % lib_inst_dir,
"--with-mpc=%s" % lib_inst_dir,
"--enable-languages=c,c++",
"--disable-multilib",
"--disable-bootstrap"]
if is_stage_one:
gcc_configure_args.append("--enable-languages=c")
gcc_configure_args.append("--disable-multilib")
# We build the stage1 gcc without shared libraries. Otherwise its
# libgcc.so would depend on the system libc.so, which causes problems
# when it tries to use that libgcc.so and the libc we are about to
# build.
gcc_configure_args.append("--disable-shared")
else:
gcc_configure_args.append("--enable-languages=c,c++")
build_package(gcc_source_dir, gcc_build_dir, gcc_configure_args)
@ -155,6 +160,7 @@ def build_source_dir(prefix, version):
binutils_version = "2.21.1"
glibc_version = "2.5.1"
linux_version = "2.6.18"
tar_version = "1.26"
make_version = "3.81"
gcc_version = "4.5.2"
@ -166,6 +172,8 @@ binutils_source_uri = "http://ftp.gnu.org/gnu/binutils/binutils-%sa.tar.bz2" % \
binutils_version
glibc_source_uri = "http://ftp.gnu.org/gnu/glibc/glibc-%s.tar.bz2" % \
glibc_version
linux_source_uri = "http://www.kernel.org/pub/linux/kernel/v2.6/linux-%s.tar.bz2" % \
linux_version
tar_source_uri = "http://ftp.gnu.org/gnu/tar/tar-%s.tar.bz2" % \
tar_version
make_source_uri = "http://ftp.gnu.org/gnu/make/make-%s.tar.bz2" % \
@ -180,6 +188,7 @@ mpc_source_uri = "http://www.multiprecision.org/mpc/download/mpc-%s.tar.gz" % \
binutils_source_tar = download_uri(binutils_source_uri)
glibc_source_tar = download_uri(glibc_source_uri)
linux_source_tar = download_uri(linux_source_uri)
tar_source_tar = download_uri(tar_source_uri)
make_source_tar = download_uri(make_source_uri)
mpc_source_tar = download_uri(mpc_source_uri)
@ -189,6 +198,7 @@ gcc_source_tar = download_uri(gcc_source_uri)
binutils_source_dir = build_source_dir('binutils-', binutils_version)
glibc_source_dir = build_source_dir('glibc-', glibc_version)
linux_source_dir = build_source_dir('linux-', linux_version)
tar_source_dir = build_source_dir('tar-', tar_version)
make_source_dir = build_source_dir('make-', make_version)
mpc_source_dir = build_source_dir('mpc-', mpc_version)
@ -201,6 +211,7 @@ if not os.path.exists(source_dir):
extract(binutils_source_tar, source_dir)
patch('binutils-deterministic.patch', 1, binutils_source_dir)
extract(glibc_source_tar, source_dir)
extract(linux_source_tar, source_dir)
patch('glibc-deterministic.patch', 1, glibc_source_dir)
run_in(glibc_source_dir, ["autoconf"])
extract(tar_source_tar, source_dir)

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

@ -95,7 +95,7 @@ test$(DLL_SUFFIX): test.$(OBJ_SUFFIX) elfhack $(CSRCS:.c=.$(OBJ_SUFFIX))
@echo === --disable-elf-hack until this is fixed.
@echo ===
@rm -f $@.bak
$(CURDIR)/elfhack -b $@
$(CURDIR)/elfhack -b -f $@
# Fail if the backup file doesn't exist
[ -f "$@.bak" ]
# Fail if the new library doesn't contain less relocations

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

@ -265,6 +265,15 @@ Elf::Elf(std::ifstream &file)
file.seekg(ehdr->e_phoff);
for (int i = 0; i < ehdr->e_phnum; i++) {
Elf_Phdr phdr(file, e_ident[EI_CLASS], e_ident[EI_DATA]);
if (phdr.p_type == PT_LOAD) {
// Default alignment for PT_LOAD on x86-64 prevents elfhack from
// doing anything useful. However, the system doesn't actually
// require such a big alignment, so in order for elfhack to work
// efficiently, reduce alignment when it's originally the default
// one.
if ((ehdr->e_machine == EM_X86_64) && (phdr.p_align == 0x200000))
phdr.p_align = 0x1000;
}
ElfSegment *segment = new ElfSegment(&phdr);
// Some segments aren't entirely filled (if at all) by sections
// For those, we use fake sections
@ -503,12 +512,17 @@ unsigned int ElfSection::getOffset()
if (previous->getType() != SHT_NOBITS)
offset += previous->getSize();
Elf32_Word align = 0x1000;
for (std::vector<ElfSegment *>::iterator seg = segments.begin(); seg != segments.end(); seg++)
align = std::max(align, (*seg)->getAlign());
Elf32_Word mask = align - 1;
// SHF_TLS is used for .tbss which is some kind of special case.
if (((getType() != SHT_NOBITS) || (getFlags() & SHF_TLS)) && (getFlags() & SHF_ALLOC)) {
if ((getAddr() & 4095) < (offset & 4095))
offset = (offset | 4095) + (getAddr() & 4095) + 1;
if ((getAddr() & mask) < (offset & mask))
offset = (offset | mask) + (getAddr() & mask) + 1;
else
offset = (offset & ~4095) + (getAddr() & 4095);
offset = (offset & ~mask) + (getAddr() & mask);
}
if ((getType() != SHT_NOBITS) && (offset & (getAddrAlign() - 1)))
offset = (offset | (getAddrAlign() - 1)) + 1;
@ -632,7 +646,7 @@ ElfSegment *ElfSegment::splitBefore(ElfSection *section)
phdr.p_vaddr = 0;
phdr.p_paddr = phdr.p_vaddr + v_p_diff;
phdr.p_flags = flags;
phdr.p_align = 0x1000;
phdr.p_align = getAlign();
phdr.p_filesz = (unsigned int)-1;
phdr.p_memsz = (unsigned int)-1;
ElfSegment *segment = new ElfSegment(&phdr);

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

@ -501,7 +501,7 @@ static inline int backup_file(const char *name)
return rename(name, fname.c_str());
}
void do_file(const char *name, bool backup = false)
void do_file(const char *name, bool backup = false, bool force = false)
{
std::ifstream file(name, std::ios::in|std::ios::binary);
Elf *elf = new Elf(file);
@ -531,7 +531,7 @@ void do_file(const char *name, bool backup = false)
break;
}
if (exit == 0) {
if (elf->getSize() >= size) {
if (!force && (elf->getSize() >= size)) {
fprintf(stderr, "No gain. Skipping\n");
} else if (backup && backup_file(name) != 0) {
fprintf(stderr, "Couln't create backup file\n");
@ -548,14 +548,17 @@ int main(int argc, char *argv[])
{
int arg;
bool backup = false;
bool force = false;
char *lastSlash = rindex(argv[0], '/');
if (lastSlash != NULL)
rundir = strndup(argv[0], lastSlash - argv[0]);
for (arg = 1; arg < argc; arg++) {
if (strcmp(argv[arg], "-b") == 0)
if (strcmp(argv[arg], "-f") == 0)
force = true;
else if (strcmp(argv[arg], "-b") == 0)
backup = true;
else
do_file(argv[arg], backup);
do_file(argv[arg], backup, force);
}
free(rundir);

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

@ -444,7 +444,7 @@ public:
unsigned int getType() { return type; }
unsigned int getFlags() { return flags; }
unsigned int getAlign() { return type == PT_LOAD ? 0x1000 : align; /* TODO: remove this gross hack */ }
unsigned int getAlign() { return align; }
ElfSection *getFirstSection() { return sections.empty() ? NULL : sections.front(); }
int getVPDiff() { return v_p_diff; }

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

@ -897,10 +897,10 @@ ifdef MOZ_PROFILE_GENERATE
endif
else # !WINNT || GNU_CC
ifeq ($(CPP_PROG_LINK),1)
$(EXPAND_CCC) -o $@ $(CXXFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
$(EXPAND_CCC) -o $@ $(CXXFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(LIBS_DIR) $(LIBS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
@$(call CHECK_STDCXX,$@)
else # ! CPP_PROG_LINK
$(EXPAND_CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(WRAP_LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
$(EXPAND_CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(LIBS_DIR) $(LIBS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
endif # CPP_PROG_LINK
endif # WINNT && !GNU_CC
@ -913,7 +913,7 @@ endif
$(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
$(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
$(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
ifdef MSMANIFEST_TOOL
@if test -f $@.manifest; then \
if test -f "$(srcdir)/$@.manifest"; then \
@ -1071,10 +1071,10 @@ ifdef DTRACE_LIB_DEPENDENT
ifndef XP_MACOSX
dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(shell $(EXPAND_LIBS) $(MOZILLA_PROBE_LIBS))
endif
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(MOZILLA_PROBE_LIBS) $(RESFILE) $(LDFLAGS) $(MOZ_GLUE_LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(MOZILLA_PROBE_LIBS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
@$(RM) $(DTRACE_PROBE_OBJ)
else # ! DTRACE_LIB_DEPENDENT
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(MOZ_GLUE_LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
endif # DTRACE_LIB_DEPENDENT
@$(call CHECK_STDCXX,$@)

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

@ -201,6 +201,11 @@ case "$target" in
esac
fi
if test -z "$MIDL"; then MIDL=midl; fi
# need override this flag since we don't use $(LDFLAGS) for this.
if test -z "$HOST_LDFLAGS" ; then
HOST_LDFLAGS=" "
fi
;;
*-darwin*)
# we prefer gcc-4.2 over gcc on older darwin, so
@ -2203,7 +2208,15 @@ case "$host" in
esac
case "${host_cpu}" in
i*86)
if test -n "$_WIN32_MSVC"; then
HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
fi
;;
x86_64)
if test -n "$_WIN32_MSVC"; then
HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
fi
HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
;;
esac
@ -2684,12 +2697,16 @@ ia64*-hpux*)
CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
else
AC_DEFINE(HAVE_STDCALL)
DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
fi
MOZ_CHECK_HEADERS(mmintrin.h)
AC_DEFINE(_X86_)
;;
x86_64-*)
if test -n "$_WIN32_MSVC"; then
DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
fi
AC_DEFINE(_AMD64_)
;;
*)

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

@ -194,7 +194,7 @@ JSClass nsXBLDocGlobalObject::gSharedGlobalClass = {
nsXBLDocGlobalObject_getProperty, nsXBLDocGlobalObject_setProperty,
JS_EnumerateStub, nsXBLDocGlobalObject_resolve,
JS_ConvertStub, nsXBLDocGlobalObject_finalize,
NULL, nsXBLDocGlobalObject_checkAccess, NULL, NULL, NULL, NULL,
nsXBLDocGlobalObject_checkAccess, NULL, NULL, NULL,
TraceXPCGlobal
};

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

@ -146,7 +146,7 @@ JSClass nsXULPDGlobalObject::gSharedGlobalClass = {
XPCONNECT_GLOBAL_FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, nsXULPDGlobalObject_resolve, JS_ConvertStub,
nsXULPDGlobalObject_finalize, NULL, NULL, NULL, NULL, NULL, NULL,
nsXULPDGlobalObject_finalize, NULL, NULL, NULL, NULL,
TraceXPCGlobal
};

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

@ -184,8 +184,8 @@ static JSClass sNPObjectJSWrapperClass =
NPObjWrapper_GetProperty, NPObjWrapper_SetProperty,
(JSEnumerateOp)NPObjWrapper_newEnumerate,
(JSResolveOp)NPObjWrapper_NewResolve, NPObjWrapper_Convert,
NPObjWrapper_Finalize, nsnull, nsnull, NPObjWrapper_Call,
NPObjWrapper_Construct, nsnull, nsnull
NPObjWrapper_Finalize, nsnull, NPObjWrapper_Call,
NPObjWrapper_Construct
};
typedef struct NPObjectMemberPrivate {
@ -213,8 +213,8 @@ static JSClass sNPObjectMemberClass =
JS_PropertyStub, JS_PropertyStub,
JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub,
JS_ResolveStub, NPObjectMember_Convert,
NPObjectMember_Finalize, nsnull, nsnull, NPObjectMember_Call,
nsnull, nsnull, nsnull, NPObjectMember_Trace, nsnull
NPObjectMember_Finalize, nsnull, NPObjectMember_Call,
nsnull, nsnull, NPObjectMember_Trace
};
static void

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

@ -50,7 +50,7 @@
#include "WorkerPrivate.h"
#define PROPERTY_FLAGS \
JSPROP_ENUMERATE | JSPROP_SHARED
(JSPROP_ENUMERATE | JSPROP_SHARED)
#define FUNCTION_FLAGS \
JSPROP_ENUMERATE

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

@ -50,7 +50,7 @@
#include "WorkerInlines.h"
#define PROPERTY_FLAGS \
JSPROP_ENUMERATE | JSPROP_SHARED
(JSPROP_ENUMERATE | JSPROP_SHARED)
#define CONSTANT_FLAGS \
JSPROP_ENUMERATE | JSPROP_SHARED | JSPROP_PERMANENT | JSPROP_READONLY

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

@ -53,7 +53,7 @@
#include "WorkerPrivate.h"
#define PROPERTY_FLAGS \
JSPROP_ENUMERATE | JSPROP_SHARED
(JSPROP_ENUMERATE | JSPROP_SHARED)
USING_WORKERS_NAMESPACE

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

@ -44,7 +44,7 @@
#include "nsTraceRefcnt.h"
#define PROPERTY_FLAGS \
JSPROP_ENUMERATE | JSPROP_SHARED
(JSPROP_ENUMERATE | JSPROP_SHARED)
USING_WORKERS_NAMESPACE

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

@ -46,7 +46,7 @@
#include "RuntimeService.h"
#define PROPERTY_FLAGS \
JSPROP_ENUMERATE | JSPROP_SHARED
(JSPROP_ENUMERATE | JSPROP_SHARED)
USING_WORKERS_NAMESPACE

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

@ -48,7 +48,7 @@
#include "WorkerInlines.h"
#define PROPERTY_FLAGS \
JSPROP_ENUMERATE | JSPROP_SHARED
(JSPROP_ENUMERATE | JSPROP_SHARED)
#define FUNCTION_FLAGS \
JSPROP_ENUMERATE
@ -302,8 +302,8 @@ JSClass Worker::sClass = {
"Worker",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize, NULL, NULL, NULL,
NULL, NULL, NULL, Trace, NULL
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
NULL, NULL, NULL, NULL, Trace,
};
JSPropertySpec Worker::sProperties[] = {
@ -417,8 +417,8 @@ JSClass ChromeWorker::sClass = {
"ChromeWorker",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize, NULL, NULL, NULL,
NULL, NULL, NULL, Trace, NULL
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
NULL, NULL, NULL, NULL, Trace
};
WorkerPrivate*

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

@ -68,7 +68,7 @@
#include "WorkerInlines.h"
#define PROPERTY_FLAGS \
JSPROP_ENUMERATE | JSPROP_SHARED
(JSPROP_ENUMERATE | JSPROP_SHARED)
#define FUNCTION_FLAGS \
JSPROP_ENUMERATE
@ -802,7 +802,7 @@ JSClass DedicatedWorkerGlobalScope::sClass = {
JSCLASS_GLOBAL_FLAGS | JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_NEW_RESOLVE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, reinterpret_cast<JSResolveOp>(Resolve), JS_ConvertStub,
Finalize, NULL, NULL, NULL, NULL, NULL, NULL, Trace, NULL
Finalize, NULL, NULL, NULL, NULL, Trace
};
JSPropertySpec DedicatedWorkerGlobalScope::sProperties[] = {

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

@ -48,13 +48,13 @@
#include "WorkerInlines.h"
#define PROPERTY_FLAGS \
JSPROP_ENUMERATE | JSPROP_SHARED
(JSPROP_ENUMERATE | JSPROP_SHARED)
#define FUNCTION_FLAGS \
JSPROP_ENUMERATE
#define CONSTANT_FLAGS \
JSPROP_ENUMERATE | JSPROP_SHARED | JSPROP_PERMANENT | JSPROP_READONLY
(JSPROP_ENUMERATE | JSPROP_SHARED | JSPROP_PERMANENT | JSPROP_READONLY)
USING_WORKERS_NAMESPACE
@ -223,7 +223,7 @@ JSClass XMLHttpRequestUpload::sClass = {
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
NULL, NULL, NULL, NULL, NULL, NULL, Trace, NULL
NULL, NULL, NULL, NULL, Trace
};
JSPropertySpec XMLHttpRequestUpload::sProperties[] = {
@ -772,7 +772,7 @@ JSClass XMLHttpRequest::sClass = {
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
NULL, NULL, NULL, NULL, NULL, NULL, Trace, NULL
NULL, NULL, NULL, NULL, Trace
};
JSPropertySpec XMLHttpRequest::sProperties[] = {

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

@ -172,13 +172,11 @@ const js::Class ObjectWrapperParent::sCPOW_JSClass = {
(JSResolveOp) ObjectWrapperParent::CPOW_NewResolve,
ObjectWrapperParent::CPOW_Convert,
ObjectWrapperParent::CPOW_Finalize,
nsnull, // reserved1
nsnull, // checkAccess
ObjectWrapperParent::CPOW_Call,
ObjectWrapperParent::CPOW_Construct,
nsnull, // xdrObject
ObjectWrapperParent::CPOW_HasInstance,
nsnull, // mark
nsnull, // trace
{
ObjectWrapperParent::CPOW_Equality,
nsnull, // outerObject

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

@ -157,11 +157,9 @@ Class MapObject::class_ = {
JS_ResolveStub,
JS_ConvertStub,
finalize,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
mark
};
@ -308,11 +306,9 @@ Class SetObject::class_ = {
JS_ResolveStub,
JS_ConvertStub,
finalize,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
mark
};

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

@ -897,10 +897,10 @@ ifdef MOZ_PROFILE_GENERATE
endif
else # !WINNT || GNU_CC
ifeq ($(CPP_PROG_LINK),1)
$(EXPAND_CCC) -o $@ $(CXXFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
$(EXPAND_CCC) -o $@ $(CXXFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(LIBS_DIR) $(LIBS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
@$(call CHECK_STDCXX,$@)
else # ! CPP_PROG_LINK
$(EXPAND_CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(WRAP_LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
$(EXPAND_CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(LIBS_DIR) $(LIBS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
endif # CPP_PROG_LINK
endif # WINNT && !GNU_CC
@ -913,7 +913,7 @@ endif
$(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
$(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
$(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
ifdef MSMANIFEST_TOOL
@if test -f $@.manifest; then \
if test -f "$(srcdir)/$@.manifest"; then \
@ -1071,10 +1071,10 @@ ifdef DTRACE_LIB_DEPENDENT
ifndef XP_MACOSX
dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(shell $(EXPAND_LIBS) $(MOZILLA_PROBE_LIBS))
endif
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(MOZILLA_PROBE_LIBS) $(RESFILE) $(LDFLAGS) $(MOZ_GLUE_LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(MOZILLA_PROBE_LIBS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
@$(RM) $(DTRACE_PROBE_OBJ)
else # ! DTRACE_LIB_DEPENDENT
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(MOZ_GLUE_LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
endif # DTRACE_LIB_DEPENDENT
@$(call CHECK_STDCXX,$@)

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

@ -194,6 +194,11 @@ case "$target" in
esac
fi
if test -z "$MIDL"; then MIDL=midl; fi
# need override this flag since we don't use $(LDFLAGS) for this.
if test -z "$HOST_LDFLAGS" ; then
HOST_LDFLAGS=" "
fi
;;
*-darwin*)
# prefer gcc-4.2 to default cc on older xcode
@ -2044,7 +2049,15 @@ case "$host" in
esac
case "${host_cpu}" in
i*86)
if test -n "$_WIN32_MSVC"; then
HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
fi
;;
x86_64)
if test -n "$_WIN32_MSVC"; then
HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
fi
HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
;;
esac
@ -2491,12 +2504,17 @@ ia64*-hpux*)
if test -n "$GNU_CC"; then
CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
else
DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
fi
MOZ_CHECK_HEADERS(mmintrin.h)
AC_DEFINE(_X86_)
;;
x86_64-*)
if test -n "$_WIN32_MSVC"; then
DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
fi
AC_DEFINE(_AMD64_)
;;
*)

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

@ -240,7 +240,7 @@ static JSClass sCTypeProtoClass = {
JSCLASS_HAS_RESERVED_SLOTS(CTYPEPROTO_SLOTS),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CType::FinalizeProtoClass,
NULL, NULL, ConstructAbstract, ConstructAbstract, NULL, NULL, NULL, NULL
NULL, ConstructAbstract, ConstructAbstract
};
// Class representing ctypes.CData.prototype and the 'prototype' properties
@ -258,8 +258,8 @@ static JSClass sCTypeClass = {
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(CTYPE_SLOTS),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CType::Finalize,
NULL, NULL, CType::ConstructData, CType::ConstructData, NULL,
CType::HasInstance, CType::Trace, NULL
NULL, CType::ConstructData, CType::ConstructData,
CType::HasInstance, CType::Trace
};
static JSClass sCDataClass = {
@ -267,7 +267,7 @@ static JSClass sCDataClass = {
JSCLASS_HAS_RESERVED_SLOTS(CDATA_SLOTS),
JS_PropertyStub, JS_PropertyStub, ArrayType::Getter, ArrayType::Setter,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CData::Finalize,
NULL, NULL, FunctionType::Call, FunctionType::Call, NULL, NULL, NULL, NULL
NULL, FunctionType::Call, FunctionType::Call
};
static JSClass sCClosureClass = {
@ -275,7 +275,7 @@ static JSClass sCClosureClass = {
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(CCLOSURE_SLOTS),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CClosure::Finalize,
NULL, NULL, NULL, NULL, NULL, NULL, CClosure::Trace, NULL
NULL, NULL, NULL, NULL, CClosure::Trace
};
#define CTYPESFN_FLAGS \

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

@ -329,6 +329,7 @@ class HeapValue
bool isFalse() const { return value.isFalse(); }
bool isNumber() const { return value.isNumber(); }
bool isInt32() const { return value.isInt32(); }
bool isDouble() const { return value.isDouble(); }
bool isString() const { return value.isString(); }
bool isObject() const { return value.isObject(); }
bool isMagic(JSWhyMagic why) const { return value.isMagic(why); }

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

@ -124,7 +124,7 @@ MSG_DEF(JSMSG_COMPILE_EXECED_SCRIPT, 37, 0, JSEXN_TYPEERR, "can't compile over
MSG_DEF(JSMSG_CANT_CONVERT_TO, 38, 2, JSEXN_TYPEERR, "can't convert {0} to {1}")
MSG_DEF(JSMSG_NO_PROPERTIES, 39, 1, JSEXN_TYPEERR, "{0} has no properties")
MSG_DEF(JSMSG_CANT_FIND_CLASS, 40, 1, JSEXN_TYPEERR, "can't find class id {0}")
MSG_DEF(JSMSG_CANT_XDR_CLASS, 41, 1, JSEXN_TYPEERR, "can't XDR class {0}")
MSG_DEF(JSMSG_UNUSED41 , 41, 0, JSEXN_NONE, "")
MSG_DEF(JSMSG_BYTECODE_TOO_BIG, 42, 2, JSEXN_INTERNALERR, "bytecode {0} too large (limit {1})")
MSG_DEF(JSMSG_UNKNOWN_FORMAT, 43, 1, JSEXN_INTERNALERR, "unknown bytecode format {0}")
MSG_DEF(JSMSG_TOO_MANY_CON_ARGS, 44, 0, JSEXN_SYNTAXERR, "too many constructor arguments")

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

@ -35,11 +35,9 @@ js::Class HasCustomIterClass = {
JS_ResolveStub,
JS_ConvertStub,
NULL,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
NULL, /* mark */
{

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

@ -26,11 +26,9 @@ js::Class TestExtendedEq_JSClass = {
JS_ResolveStub,
NULL, /* convert */
NULL, /* finalize */
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
NULL, /* mark */
{

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

@ -86,7 +86,7 @@ BEGIN_TEST(testNewObject_1)
0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL,
NULL, NULL, NULL, constructHook, NULL, NULL, NULL, NULL
NULL, NULL, constructHook
};
JSObject *ctor = JS_NewObject(cx, &cls, NULL, NULL);
CHECK(ctor);

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

@ -4291,11 +4291,9 @@ static Class prop_iter_class = {
JS_ResolveStub,
JS_ConvertStub,
prop_iter_finalize,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
prop_iter_trace
};

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

@ -1350,13 +1350,6 @@ typedef JSBool
(* JSCheckAccessOp)(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
jsval *vp);
/*
* Encode or decode an object, given an XDR state record representing external
* data. See jsxdrapi.h.
*/
typedef JSBool
(* JSXDRObjectOp)(JSXDRState *xdr, JSObject **objp);
/*
* Check whether v is an instance of obj. Return false on error or exception,
* true on success with JS_TRUE in *bp if v is an instance of obj, JS_FALSE in
@ -3397,15 +3390,12 @@ struct JSClass {
JSFinalizeOp finalize;
/* Optionally non-null members start here. */
JSClassInternal reserved0;
JSCheckAccessOp checkAccess;
JSNative call;
JSNative construct;
JSXDRObjectOp xdrObject;
JSHasInstanceOp hasInstance;
JSTraceOp trace;
JSClassInternal reserved1;
void *reserved[40];
};
@ -3489,8 +3479,8 @@ struct JSClass {
& JSCLASS_CACHED_PROTO_MASK))
/* Initializer for unused members of statically initialized JSClass structs. */
#define JSCLASS_NO_INTERNAL_MEMBERS 0,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
#define JSCLASS_NO_OPTIONAL_MEMBERS 0,0,0,0,0,0,0,JSCLASS_NO_INTERNAL_MEMBERS
#define JSCLASS_NO_INTERNAL_MEMBERS {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
#define JSCLASS_NO_OPTIONAL_MEMBERS 0,0,0,0,0,JSCLASS_NO_INTERNAL_MEMBERS
extern JS_PUBLIC_API(jsint)
JS_IdArrayLength(JSContext *cx, JSIdArray *ida);

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

@ -1225,11 +1225,9 @@ Class js::ArrayClass = {
JS_ResolveStub,
JS_ConvertStub,
NULL,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
array_trace, /* trace */
{
@ -1289,11 +1287,9 @@ Class js::SlowArrayClass = {
JS_ResolveStub,
JS_ConvertStub,
NULL,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
NULL, /* trace */
{

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

@ -265,11 +265,9 @@ typedef void
JSFinalizeOp finalize; \
\
/* Optionally non-null members start here. */ \
JSClassInternal reserved0; \
JSCheckAccessOp checkAccess; \
JSNative call; \
JSNative construct; \
JSXDRObjectOp xdrObject; \
JSHasInstanceOp hasInstance; \
JSTraceOp trace
@ -372,11 +370,9 @@ JS_STATIC_ASSERT(offsetof(JSClass, enumerate) == offsetof(Class, enumerate));
JS_STATIC_ASSERT(offsetof(JSClass, resolve) == offsetof(Class, resolve));
JS_STATIC_ASSERT(offsetof(JSClass, convert) == offsetof(Class, convert));
JS_STATIC_ASSERT(offsetof(JSClass, finalize) == offsetof(Class, finalize));
JS_STATIC_ASSERT(offsetof(JSClass, reserved0) == offsetof(Class, reserved0));
JS_STATIC_ASSERT(offsetof(JSClass, checkAccess) == offsetof(Class, checkAccess));
JS_STATIC_ASSERT(offsetof(JSClass, call) == offsetof(Class, call));
JS_STATIC_ASSERT(offsetof(JSClass, construct) == offsetof(Class, construct));
JS_STATIC_ASSERT(offsetof(JSClass, xdrObject) == offsetof(Class, xdrObject));
JS_STATIC_ASSERT(offsetof(JSClass, hasInstance) == offsetof(Class, hasInstance));
JS_STATIC_ASSERT(offsetof(JSClass, trace) == offsetof(Class, trace));
JS_STATIC_ASSERT(sizeof(JSClass) == sizeof(Class));

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

@ -104,11 +104,9 @@ Class js::ErrorClass = {
(JSResolveOp)exn_resolve,
JS_ConvertStub,
exn_finalize,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
exn_trace
};

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

@ -564,11 +564,9 @@ Class js::NormalArgumentsObjectClass = {
reinterpret_cast<JSResolveOp>(args_resolve),
JS_ConvertStub,
args_finalize, /* finalize */
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
args_trace,
{
@ -600,11 +598,9 @@ Class js::StrictArgumentsObjectClass = {
reinterpret_cast<JSResolveOp>(strictargs_resolve),
JS_ConvertStub,
args_finalize, /* finalize */
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
args_trace,
{
@ -954,11 +950,9 @@ JS_PUBLIC_DATA(Class) js::CallClass = {
(JSResolveOp)call_resolve,
NULL, /* convert: Leave it NULL so we notice if calls ever escape */
NULL, /* finalize */
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
call_trace
};
@ -1350,7 +1344,7 @@ fun_resolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
/* XXX store parent and proto, if defined */
JSBool
js_XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
js::XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
{
JSContext *cx;
JSFunction *fun;
@ -1393,7 +1387,7 @@ js_XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
if (!JS_XDRUint32(xdr, &flagsword))
return false;
if (!js_XDRScript(xdr, &script))
if (!XDRScript(xdr, &script))
return false;
if (xdr->mode == JSXDR_DECODE) {
@ -1411,11 +1405,7 @@ js_XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
return true;
}
#else /* !JS_HAS_XDR */
#define js_XDRFunctionObject NULL
#endif /* !JS_HAS_XDR */
#endif /* JS_HAS_XDR */
/*
* [[HasInstance]] internal method for Function objects: fetch the .prototype
@ -1510,11 +1500,9 @@ JS_FRIEND_DATA(Class) js::FunctionClass = {
(JSResolveOp)fun_resolve,
JS_ConvertStub,
fun_finalize,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL,
fun_hasInstance,
fun_trace
};
@ -2232,7 +2220,7 @@ js_CloneFunctionObject(JSContext *cx, JSFunction *fun, JSObject *parent,
JS_ASSERT(script->compartment() != cx->compartment);
clone->script().init(NULL);
JSScript *cscript = js_CloneScript(cx, script);
JSScript *cscript = CloneScript(cx, script);
if (!cscript)
return NULL;

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

@ -437,8 +437,12 @@ js_PutArgsObject(js::StackFrame *fp);
inline bool
js_IsNamedLambda(JSFunction *fun) { return (fun->flags & JSFUN_LAMBDA) && fun->atom; }
namespace js {
extern JSBool
js_XDRFunctionObject(JSXDRState *xdr, JSObject **objp);
XDRFunctionObject(JSXDRState *xdr, JSObject **objp);
} /* namespace js */
extern JSBool
js_fun_apply(JSContext *cx, uintN argc, js::Value *vp);

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

@ -4547,12 +4547,7 @@ JS_IterateCompartments(JSContext *cx, void *data,
AutoLockGC lock(rt);
AutoHeapSession session(cx);
#ifdef JS_THREADSAFE
rt->gcHelperThread.waitBackgroundSweepEnd();
#endif
AutoUnlockGC unlock(rt);
AutoCopyFreeListToArenas copy(rt);
for (CompartmentsIter c(rt); !c.done(); c.next())
(*compartmentCallback)(cx, data, c);
}

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

@ -100,11 +100,9 @@ Class js::IteratorClass = {
JS_ResolveStub,
JS_ConvertStub,
iterator_finalize,
NULL, /* reserved */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
iterator_trace,
{
@ -127,11 +125,9 @@ Class js::ElementIteratorClass = {
JS_ResolveStub,
JS_ConvertStub,
NULL, /* finalize */
NULL, /* reserved */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
NULL, /* trace */
{
@ -1340,11 +1336,9 @@ Class js::StopIterationClass = {
JS_ResolveStub,
JS_ConvertStub,
NULL, /* finalize */
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
stopiter_hasInstance
};
@ -1429,11 +1423,9 @@ Class js::GeneratorClass = {
JS_ResolveStub,
JS_ConvertStub,
generator_finalize,
NULL, /* reserved */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
generator_trace,
{

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

@ -6179,88 +6179,6 @@ js_ValueToNonNullObject(JSContext *cx, const Value &v)
return obj;
}
#if JS_HAS_XDR
JSBool
js_XDRObject(JSXDRState *xdr, JSObject **objp)
{
JSContext *cx;
JSAtom *atom;
Class *clasp;
uint32_t classId, classDef;
JSProtoKey protoKey;
JSObject *proto;
cx = xdr->cx;
atom = NULL;
if (xdr->mode == JSXDR_ENCODE) {
clasp = (*objp)->getClass();
classId = JS_XDRFindClassIdByName(xdr, clasp->name);
classDef = !classId;
if (classDef) {
if (!JS_XDRRegisterClass(xdr, Jsvalify(clasp), &classId))
return JS_FALSE;
protoKey = JSCLASS_CACHED_PROTO_KEY(clasp);
if (protoKey != JSProto_Null) {
classDef |= (protoKey << 1);
} else {
atom = js_Atomize(cx, clasp->name, strlen(clasp->name));
if (!atom)
return JS_FALSE;
}
}
} else {
clasp = NULL; /* quell GCC overwarning */
classDef = 0;
}
/*
* XDR a flag word, which could be 0 for a class use, in which case no
* name follows, only the id in xdr's class registry; 1 for a class def,
* in which case the flag word is followed by the class name transferred
* from or to atom; or a value greater than 1, an odd number that when
* divided by two yields the JSProtoKey for class. In the last case, as
* in the 0 classDef case, no name is transferred via atom.
*/
if (!JS_XDRUint32(xdr, &classDef))
return JS_FALSE;
if (classDef == 1 && !js_XDRAtom(xdr, &atom))
return JS_FALSE;
if (!JS_XDRUint32(xdr, &classId))
return JS_FALSE;
if (xdr->mode == JSXDR_DECODE) {
if (classDef) {
/* NB: we know that JSProto_Null is 0 here, for backward compat. */
protoKey = (JSProtoKey) (classDef >> 1);
if (!js_GetClassPrototype(cx, NULL, protoKey, &proto, clasp))
return JS_FALSE;
clasp = proto->getClass();
if (!JS_XDRRegisterClass(xdr, Jsvalify(clasp), &classId))
return JS_FALSE;
} else {
clasp = Valueify(JS_XDRFindClassById(xdr, classId));
if (!clasp) {
char numBuf[12];
JS_snprintf(numBuf, sizeof numBuf, "%ld", (long)classId);
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
JSMSG_CANT_FIND_CLASS, numBuf);
return JS_FALSE;
}
}
}
if (!clasp->xdrObject) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
JSMSG_CANT_XDR_CLASS, clasp->name);
return JS_FALSE;
}
return clasp->xdrObject(xdr, objp);
}
#endif /* JS_HAS_XDR */
#ifdef DEBUG
void
js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)

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

@ -1960,9 +1960,6 @@ ValueToObject(JSContext *cx, const Value &v)
} /* namespace js */
extern JSBool
js_XDRObject(JSXDRState *xdr, JSObject **objp);
extern void
js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize);

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

@ -1322,11 +1322,9 @@ JS_FRIEND_DATA(Class) js::ObjectProxyClass = {
JS_ResolveStub,
proxy_Convert,
proxy_Finalize, /* finalize */
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
proxy_HasInstance, /* hasInstance */
proxy_TraceObject, /* trace */
JS_NULL_CLASS_EXT,
@ -1378,11 +1376,9 @@ JS_FRIEND_DATA(Class) js::OuterWindowProxyClass = {
JS_ResolveStub,
JS_ConvertStub,
proxy_Finalize, /* finalize */
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
proxy_TraceObject, /* trace */
{
@ -1456,11 +1452,9 @@ JS_FRIEND_DATA(Class) js::FunctionProxyClass = {
JS_ResolveStub,
JS_ConvertStub,
NULL, /* finalize */
NULL, /* reserved0 */
NULL, /* checkAccess */
proxy_Call,
proxy_Construct,
NULL, /* xdrObject */
FunctionClass.hasInstance,
proxy_TraceFunction, /* trace */
JS_NULL_CLASS_EXT,
@ -1734,7 +1728,6 @@ Class js::CallableObjectClass = {
JS_ResolveStub,
JS_ConvertStub,
NULL, /* finalize */
NULL, /* reserved0 */
NULL, /* checkAccess */
callable_Call,
callable_Construct,

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

@ -336,26 +336,114 @@ CheckScript(JSScript *script, JSScript *prev)
#endif /* JS_CRASH_DIAGNOSTICS */
} /* namespace js */
#if JS_HAS_XDR
enum ScriptBits {
NoScriptRval,
SavedCallerFun,
StrictModeCode,
UsesEval,
UsesArguments
};
static bool
XDRScriptConst(JSXDRState *xdr, HeapValue *vp)
{
/*
* A script constant can be an arbitrary primitive value as they are used
* to implement JSOP_LOOKUPSWITCH. But they cannot be objects, see
* bug 407186.
*/
enum ConstTag {
SCRIPT_INT = 0,
SCRIPT_DOUBLE = 1,
SCRIPT_STRING = 2,
SCRIPT_TRUE = 3,
SCRIPT_FALSE = 4,
SCRIPT_NULL = 5,
SCRIPT_VOID = 6
};
uint32_t tag;
if (xdr->mode == JSXDR_ENCODE) {
if (vp->isInt32()) {
tag = SCRIPT_INT;
} else if (vp->isDouble()) {
tag = SCRIPT_DOUBLE;
} else if (vp->isString()) {
tag = SCRIPT_STRING;
} else if (vp->isTrue()) {
tag = SCRIPT_TRUE;
} else if (vp->isFalse()) {
tag = SCRIPT_FALSE;
} else if (vp->isNull()) {
tag = SCRIPT_NULL;
} else {
JS_ASSERT(vp->isUndefined());
tag = SCRIPT_VOID;
}
}
if (!JS_XDRUint32(xdr, &tag))
return false;
switch (tag) {
case SCRIPT_INT: {
uint32_t i;
if (xdr->mode == JSXDR_ENCODE)
i = uint32_t(vp->toInt32());
if (!JS_XDRUint32(xdr, &i))
return JS_FALSE;
if (xdr->mode == JSXDR_DECODE)
vp->init(Int32Value(int32_t(i)));
break;
}
case SCRIPT_DOUBLE: {
double d;
if (xdr->mode == JSXDR_ENCODE)
d = vp->toDouble();
if (!JS_XDRDouble(xdr, &d))
return false;
if (xdr->mode == JSXDR_DECODE)
vp->init(DoubleValue(d));
break;
}
case SCRIPT_STRING: {
JSString *str;
if (xdr->mode == JSXDR_ENCODE)
str = vp->toString();
if (!JS_XDRString(xdr, &str))
return false;
if (xdr->mode == JSXDR_DECODE)
vp->init(StringValue(str));
break;
}
case SCRIPT_TRUE:
if (xdr->mode == JSXDR_DECODE)
vp->init(BooleanValue(true));
break;
case SCRIPT_FALSE:
if (xdr->mode == JSXDR_DECODE)
vp->init(BooleanValue(false));
break;
case SCRIPT_NULL:
if (xdr->mode == JSXDR_DECODE)
vp->init(NullValue());
break;
case SCRIPT_VOID:
if (xdr->mode == JSXDR_DECODE)
vp->init(UndefinedValue());
break;
}
return true;
}
static const char *
SaveScriptFilename(JSContext *cx, const char *filename);
JSBool
js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
XDRScript(JSXDRState *xdr, JSScript **scriptp)
{
JSScript *oldscript;
JSBool ok;
enum ScriptBits {
NoScriptRval,
SavedCallerFun,
StrictModeCode,
UsesEval,
UsesArguments
};
uint32_t length, lineno, nslots;
uint32_t natoms, nsrcnotes, ntrynotes, nobjects, nregexps, nconsts, i;
uint32_t prologLength, version, encodedClosedCount;
@ -366,23 +454,26 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
uint32_t scriptBits = 0;
JSContext *cx = xdr->cx;
JSScript *script = *scriptp;
JSScript *script;
nsrcnotes = ntrynotes = natoms = nobjects = nregexps = nconsts = 0;
jssrcnote *notes = NULL;
XDRScriptState *state = xdr->state;
JS_ASSERT(state);
/* Should not XDR scripts optimized for a single global object. */
JS_ASSERT_IF(script, !JSScript::isValidOffset(script->globalsOffset));
/* XDR arguments, local vars, and upvars. */
uint16_t nargs, nvars, nupvars;
#if defined(DEBUG) || defined(__GNUC__) /* quell GCC overwarning */
script = NULL;
nargs = nvars = nupvars = Bindings::BINDING_COUNT_LIMIT;
#endif
uint32_t argsVars, paddingUpvars;
if (xdr->mode == JSXDR_ENCODE) {
script = *scriptp;
/* Should not XDR scripts optimized for a single global object. */
JS_ASSERT(!JSScript::isValidOffset(script->globalsOffset));
nargs = script->bindings.countArgs();
nvars = script->bindings.countVars();
nupvars = script->bindings.countUpvars();
@ -586,22 +677,13 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
script->usesArguments = true;
}
/*
* Control hereafter must goto error on failure, in order for the
* DECODE case to destroy script.
*/
oldscript = xdr->script;
xdr->script = script;
ok = JS_XDRBytes(xdr, (char *)script->code, length * sizeof(jsbytecode));
if (!ok)
goto error;
if (!JS_XDRBytes(xdr, (char *)script->code, length * sizeof(jsbytecode)))
return false;
if (!JS_XDRBytes(xdr, (char *)notes, nsrcnotes * sizeof(jssrcnote)) ||
!JS_XDRUint32(xdr, &lineno) ||
!JS_XDRUint32(xdr, &nslots)) {
goto error;
return false;
}
if (xdr->mode == JSXDR_DECODE && state->filename) {
@ -612,7 +694,7 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
state->filename = filename;
state->filenameSaved = true;
if (!filename)
goto error;
return false;
}
script->filename = state->filename;
}
@ -624,23 +706,23 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
encodeable = script->principals && callbacks && callbacks->principalsTranscoder;
if (!JS_XDRUint32(xdr, &encodeable))
goto error;
return false;
if (encodeable) {
if (!callbacks || !callbacks->principalsTranscoder) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
JSMSG_CANT_DECODE_PRINCIPALS);
goto error;
return false;
}
if (!callbacks->principalsTranscoder(xdr, &script->principals))
goto error;
return false;
if (xdr->mode == JSXDR_ENCODE)
sameOriginPrincipals = script->principals == script->originPrincipals;
if (!JS_XDRUint32(xdr, &sameOriginPrincipals))
goto error;
return false;
if (sameOriginPrincipals) {
if (xdr->mode == JSXDR_DECODE) {
@ -649,7 +731,7 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
}
} else {
if (!callbacks->principalsTranscoder(xdr, &script->originPrincipals))
goto error;
return false;
}
}
@ -661,7 +743,7 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
for (i = 0; i != natoms; ++i) {
if (!js_XDRAtom(xdr, &script->atoms[i]))
goto error;
return false;
}
/*
@ -679,37 +761,35 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
isBlock = obj->isBlock() ? 1 : 0;
}
if (!JS_XDRUint32(xdr, &isBlock))
goto error;
return false;
if (isBlock == 0) {
JSObject *tmp = *objp;
if (!js_XDRFunctionObject(xdr, &tmp))
goto error;
if (!XDRFunctionObject(xdr, &tmp))
return false;
*objp = tmp;
} else {
JS_ASSERT(isBlock == 1);
StaticBlockObject *tmp = static_cast<StaticBlockObject *>(objp->get());
if (!js_XDRStaticBlockObject(xdr, &tmp))
goto error;
if (!XDRStaticBlockObject(xdr, script, &tmp))
return false;
*objp = tmp;
}
}
for (i = 0; i != nupvars; ++i) {
if (!JS_XDRUint32(xdr, reinterpret_cast<uint32_t *>(&script->upvars()->vector[i])))
goto error;
return false;
}
for (i = 0; i != nregexps; ++i) {
JSObject *tmp = script->regexps()->vector[i];
if (!js_XDRRegExpObject(xdr, &tmp))
goto error;
script->regexps()->vector[i] = tmp;
if (!XDRScriptRegExpObject(xdr, &script->regexps()->vector[i]))
return false;
}
for (i = 0; i != nClosedArgs; ++i) {
if (!JS_XDRUint32(xdr, &script->closedSlots[i]))
goto error;
return false;
}
for (i = 0; i != nClosedVars; ++i) {
if (!JS_XDRUint32(xdr, &script->closedSlots[nClosedArgs + i]))
goto error;
return false;
}
if (ntrynotes != 0) {
@ -734,7 +814,7 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
if (!JS_XDRUint32(xdr, &kindAndDepth) ||
!JS_XDRUint32(xdr, &tn->start) ||
!JS_XDRUint32(xdr, &tn->length)) {
goto error;
return false;
}
if (xdr->mode == JSXDR_DECODE) {
tn->kind = uint8_t(kindAndDepth >> 16);
@ -743,28 +823,27 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
} while (tn != tnfirst);
}
for (i = 0; i != nconsts; ++i) {
Value tmp = script->consts()->vector[i];
if (!JS_XDRValue(xdr, &tmp))
goto error;
script->consts()->vector[i] = tmp;
if (nconsts) {
HeapValue *vector = script->consts()->vector;
for (i = 0; i != nconsts; ++i) {
if (!XDRScriptConst(xdr, &vector[i]))
return false;
}
}
if (xdr->mode == JSXDR_DECODE && cx->hasRunOption(JSOPTION_PCCOUNT))
(void) script->initCounts(cx);
if (xdr->mode == JSXDR_DECODE) {
if (cx->hasRunOption(JSOPTION_PCCOUNT))
(void) script->initCounts(cx);
*scriptp = script;
}
xdr->script = oldscript;
return JS_TRUE;
error:
if (xdr->mode == JSXDR_DECODE)
*scriptp = NULL;
xdr->script = oldscript;
return JS_FALSE;
return true;
}
#endif /* JS_HAS_XDR */
} /* namespace js */
bool
JSScript::initCounts(JSContext *cx)
{
@ -817,6 +896,7 @@ JSScript::destroyCounts(JSContext *cx)
}
}
namespace js {
/*
* Shared script filename management.
@ -846,6 +926,8 @@ SaveScriptFilename(JSContext *cx, const char *filename)
return (*p)->filename;
}
} /* namespace js */
/*
* Back up from a saved filename by its offset within its hash table entry.
*/
@ -1623,8 +1705,6 @@ CurrentScriptFileLineOriginSlow(JSContext *cx, const char **file, uintN *linenop
*origin = script->originPrincipals;
}
} /* namespace js */
class DisablePrincipalsTranscoding {
JSSecurityCallbacks *callbacks;
JSPrincipalsTranscoder temp;
@ -1670,7 +1750,7 @@ private:
};
JSScript *
js_CloneScript(JSContext *cx, JSScript *script)
CloneScript(JSContext *cx, JSScript *script)
{
JS_ASSERT(cx->compartment != script->compartment());
@ -1686,7 +1766,7 @@ js_CloneScript(JSContext *cx, JSScript *script)
#ifdef DEBUG
wstate.filename = script->filename;
#endif
if (!js_XDRScript(w, &script))
if (!XDRScript(w, &script))
return NULL;
uint32_t nbytes;
@ -1709,7 +1789,7 @@ js_CloneScript(JSContext *cx, JSScript *script)
rstate.filenameSaved = true;
JSScript *newScript = NULL;
if (!js_XDRScript(r, &newScript))
if (!XDRScript(r, &newScript))
return NULL;
// set the proper principals for the script's new compartment
@ -1726,6 +1806,8 @@ js_CloneScript(JSContext *cx, JSScript *script)
return newScript;
}
} /* namespace js */
void
JSScript::copyClosedSlotsTo(JSScript *other)
{

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

@ -848,8 +848,8 @@ js_SweepScriptFilenames(JSCompartment *comp);
/*
* New-script-hook calling is factored from NewScriptFromEmitter so that it
* and callers of js_XDRScript can share this code. In the case of callers
* of js_XDRScript, the hook should be invoked only after successful decode
* and callers of XDRScript can share this code. In the case of callers
* of XDRScript, the hook should be invoked only after successful decode
* of any owning function (the fun parameter) or script object (null fun).
*/
extern JS_FRIEND_API(void)
@ -928,10 +928,8 @@ enum LineOption {
inline void
CurrentScriptFileLineOrigin(JSContext *cx, uintN *linenop, LineOption = NOT_CALLED_FROM_JSOP_EVAL);
}
extern JSScript *
js_CloneScript(JSContext *cx, JSScript *script);
CloneScript(JSContext *cx, JSScript *script);
/*
* NB: after a successful JSXDR_DECODE, js_XDRScript callers must do any
@ -939,6 +937,8 @@ js_CloneScript(JSContext *cx, JSScript *script);
* js_CallNewScriptHook.
*/
extern JSBool
js_XDRScript(JSXDRState *xdr, JSScript **scriptp);
XDRScript(JSXDRState *xdr, JSScript **scriptp);
}
#endif /* jsscript_h___ */

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

@ -2194,11 +2194,9 @@ Class js::ArrayBufferClass = {
JS_ResolveStub,
JS_ConvertStub,
NULL, /* finalize */
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
ArrayBuffer::obj_trace,
JS_NULL_CLASS_EXT,
@ -2312,11 +2310,9 @@ JSFunctionSpec _typedArray::jsfuncs[] = { \
JS_ResolveStub, \
JS_ConvertStub, \
NULL, /* finalize */ \
NULL, /* reserved0 */ \
NULL, /* checkAccess */ \
NULL, /* call */ \
NULL, /* construct */ \
NULL, /* xdrObject */ \
NULL, /* hasInstance */ \
_typedArray::obj_trace, /* trace */ \
{ \

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

@ -349,12 +349,10 @@ Class js::WeakMapClass = {
JS_ResolveStub,
JS_ConvertStub,
WeakMap_finalize,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
WeakMap_mark
};

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

@ -51,7 +51,6 @@
#include "jsapi.h"
#include "jscntxt.h"
#include "jsnum.h"
#include "jsobj.h" /* js_XDRObject */
#include "jsscript.h" /* js_XDRScript */
#include "jsstr.h"
#include "jsxdrapi.h"
@ -237,11 +236,7 @@ JS_XDRInitBase(JSXDRState *xdr, JSXDRMode mode, JSContext *cx)
{
xdr->mode = mode;
xdr->cx = cx;
xdr->registry = NULL;
xdr->numclasses = xdr->maxclasses = 0;
xdr->reghash = NULL;
xdr->userdata = NULL;
xdr->script = NULL;
xdr->state = NULL;
}
@ -307,11 +302,6 @@ JS_XDRDestroy(JSXDRState *xdr)
{
JSContext *cx = xdr->cx;
xdr->ops->finalize(xdr);
if (xdr->registry) {
cx->free_(xdr->registry);
if (xdr->reghash)
JS_DHashTableDestroy((JSDHashTable *) xdr->reghash);
}
cx->free_(xdr);
}
@ -493,131 +483,17 @@ JS_XDRStringOrNull(JSXDRState *xdr, JSString **strp)
return JS_XDRString(xdr, strp);
}
static JSBool
XDRDoubleValue(JSXDRState *xdr, jsdouble *dp)
JS_PUBLIC_API(JSBool)
JS_XDRDouble(JSXDRState *xdr, jsdouble *dp)
{
jsdpun u;
u.d = (xdr->mode == JSXDR_ENCODE) ? *dp : 0.0;
if (!JS_XDRUint32(xdr, &u.s.lo) || !JS_XDRUint32(xdr, &u.s.hi))
return JS_FALSE;
return false;
if (xdr->mode == JSXDR_DECODE)
*dp = u.d;
return JS_TRUE;
}
JS_PUBLIC_API(JSBool)
JS_XDRDouble(JSXDRState *xdr, jsdouble *dp)
{
jsdouble d = (xdr->mode == JSXDR_ENCODE) ? *dp : 0.0;
if (!XDRDoubleValue(xdr, &d))
return JS_FALSE;
if (xdr->mode == JSXDR_DECODE)
*dp = d;
return JS_TRUE;
}
enum XDRValueTag {
XDRTAG_OBJECT = 0,
XDRTAG_INT = 1,
XDRTAG_DOUBLE = 2,
XDRTAG_STRING = 3,
XDRTAG_SPECIAL = 4,
XDRTAG_XDRNULL = 5,
XDRTAG_XDRVOID = 6
};
static XDRValueTag
GetXDRTag(jsval v)
{
if (JSVAL_IS_NULL(v))
return XDRTAG_XDRNULL;
if (JSVAL_IS_VOID(v))
return XDRTAG_XDRVOID;
if (JSVAL_IS_OBJECT(v))
return XDRTAG_OBJECT;
if (JSVAL_IS_INT(v))
return XDRTAG_INT;
if (JSVAL_IS_DOUBLE(v))
return XDRTAG_DOUBLE;
if (JSVAL_IS_STRING(v))
return XDRTAG_STRING;
JS_ASSERT(JSVAL_IS_BOOLEAN(v));
return XDRTAG_SPECIAL;
}
static JSBool
XDRValueBody(JSXDRState *xdr, uint32_t type, jsval *vp)
{
switch (type) {
case XDRTAG_XDRNULL:
*vp = JSVAL_NULL;
break;
case XDRTAG_XDRVOID:
*vp = JSVAL_VOID;
break;
case XDRTAG_STRING: {
JSString *str;
if (xdr->mode == JSXDR_ENCODE)
str = JSVAL_TO_STRING(*vp);
if (!JS_XDRString(xdr, &str))
return JS_FALSE;
if (xdr->mode == JSXDR_DECODE)
*vp = STRING_TO_JSVAL(str);
break;
}
case XDRTAG_DOUBLE: {
double d = xdr->mode == JSXDR_ENCODE ? JSVAL_TO_DOUBLE(*vp) : 0;
if (!JS_XDRDouble(xdr, &d))
return JS_FALSE;
if (xdr->mode == JSXDR_DECODE)
*vp = DOUBLE_TO_JSVAL(d);
break;
}
case XDRTAG_OBJECT: {
JSObject *obj;
if (xdr->mode == JSXDR_ENCODE)
obj = JSVAL_TO_OBJECT(*vp);
if (!js_XDRObject(xdr, &obj))
return JS_FALSE;
if (xdr->mode == JSXDR_DECODE)
*vp = OBJECT_TO_JSVAL(obj);
break;
}
case XDRTAG_SPECIAL: {
uint32_t b;
if (xdr->mode == JSXDR_ENCODE)
b = (uint32_t) JSVAL_TO_BOOLEAN(*vp);
if (!JS_XDRUint32(xdr, &b))
return JS_FALSE;
if (xdr->mode == JSXDR_DECODE)
*vp = BOOLEAN_TO_JSVAL(!!b);
break;
}
default: {
uint32_t i;
JS_ASSERT(type == XDRTAG_INT);
if (xdr->mode == JSXDR_ENCODE)
i = (uint32_t) JSVAL_TO_INT(*vp);
if (!JS_XDRUint32(xdr, &i))
return JS_FALSE;
if (xdr->mode == JSXDR_DECODE)
*vp = INT_TO_JSVAL((int32_t) i);
break;
}
}
return JS_TRUE;
}
JS_PUBLIC_API(JSBool)
JS_XDRValue(JSXDRState *xdr, jsval *vp)
{
uint32_t type;
if (xdr->mode == JSXDR_ENCODE)
type = GetXDRTag(*vp);
return JS_XDRUint32(xdr, &type) && XDRValueBody(xdr, type, vp);
return true;
}
extern JSBool
@ -697,7 +573,7 @@ JS_XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
if (!JS_XDRCStringOrNull(xdr, (char **) &fstate.filename))
return false;
return js_XDRFunctionObject(xdr, objp);
return XDRFunctionObject(xdr, objp);
}
JS_PUBLIC_API(JSBool)
@ -738,7 +614,7 @@ JS_XDRScript(JSXDRState *xdr, JSScript **scriptp)
if (!JS_XDRCStringOrNull(xdr, (char **) &state.filename))
return false;
if (!js_XDRScript(xdr, &script))
if (!XDRScript(xdr, &script))
return false;
if (xdr->mode == JSXDR_DECODE) {
@ -752,107 +628,4 @@ JS_XDRScript(JSXDRState *xdr, JSScript **scriptp)
return true;
}
#define CLASS_REGISTRY_MIN 8
#define CLASS_INDEX_TO_ID(i) ((i)+1)
#define CLASS_ID_TO_INDEX(id) ((id)-1)
typedef struct JSRegHashEntry {
JSDHashEntryHdr hdr;
const char *name;
uint32_t index;
} JSRegHashEntry;
JS_PUBLIC_API(JSBool)
JS_XDRRegisterClass(JSXDRState *xdr, JSClass *clasp, uint32_t *idp)
{
uintN numclasses, maxclasses;
JSClass **registry;
numclasses = xdr->numclasses;
maxclasses = xdr->maxclasses;
if (numclasses == maxclasses) {
maxclasses = (maxclasses == 0) ? CLASS_REGISTRY_MIN : maxclasses << 1;
registry = (JSClass **)
xdr->cx->realloc_(xdr->registry, maxclasses * sizeof(JSClass *));
if (!registry)
return JS_FALSE;
xdr->registry = registry;
xdr->maxclasses = maxclasses;
} else {
JS_ASSERT(numclasses && numclasses < maxclasses);
registry = xdr->registry;
}
registry[numclasses] = clasp;
if (xdr->reghash) {
JSRegHashEntry *entry = (JSRegHashEntry *)
JS_DHashTableOperate((JSDHashTable *) xdr->reghash,
clasp->name, JS_DHASH_ADD);
if (!entry) {
JS_ReportOutOfMemory(xdr->cx);
return JS_FALSE;
}
entry->name = clasp->name;
entry->index = numclasses;
}
*idp = CLASS_INDEX_TO_ID(numclasses);
xdr->numclasses = ++numclasses;
return JS_TRUE;
}
JS_PUBLIC_API(uint32_t)
JS_XDRFindClassIdByName(JSXDRState *xdr, const char *name)
{
uintN i, numclasses;
numclasses = xdr->numclasses;
if (numclasses >= 10) {
JSRegHashEntry *entry;
/* Bootstrap reghash from registry on first overpopulated Find. */
if (!xdr->reghash) {
xdr->reghash =
JS_NewDHashTable(JS_DHashGetStubOps(), NULL,
sizeof(JSRegHashEntry),
JS_DHASH_DEFAULT_CAPACITY(numclasses));
if (xdr->reghash) {
for (i = 0; i < numclasses; i++) {
JSClass *clasp = xdr->registry[i];
entry = (JSRegHashEntry *)
JS_DHashTableOperate((JSDHashTable *) xdr->reghash,
clasp->name, JS_DHASH_ADD);
entry->name = clasp->name;
entry->index = i;
}
}
}
/* If we managed to create reghash, use it for O(1) Find. */
if (xdr->reghash) {
entry = (JSRegHashEntry *)
JS_DHashTableOperate((JSDHashTable *) xdr->reghash,
name, JS_DHASH_LOOKUP);
if (JS_DHASH_ENTRY_IS_BUSY(&entry->hdr))
return CLASS_INDEX_TO_ID(entry->index);
}
}
/* Only a few classes, or we couldn't malloc reghash: use linear search. */
for (i = 0; i < numclasses; i++) {
if (!strcmp(name, xdr->registry[i]->name))
return CLASS_INDEX_TO_ID(i);
}
return 0;
}
JS_PUBLIC_API(JSClass *)
JS_XDRFindClassById(JSXDRState *xdr, uint32_t id)
{
uintN i = CLASS_ID_TO_INDEX(id);
if (i >= xdr->numclasses)
return NULL;
return xdr->registry[i];
}
#endif /* JS_HAS_XDR */

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

@ -125,12 +125,7 @@ struct JSXDRState {
JSXDRMode mode;
JSXDROps *ops;
JSContext *cx;
JSClass **registry;
uintN numclasses;
uintN maxclasses;
void *reghash;
void *userdata;
JSScript *script;
js::XDRScriptState *state;
};
@ -182,24 +177,12 @@ JS_XDRStringOrNull(JSXDRState *xdr, JSString **strp);
extern JS_PUBLIC_API(JSBool)
JS_XDRDouble(JSXDRState *xdr, jsdouble *dp);
extern JS_PUBLIC_API(JSBool)
JS_XDRValue(JSXDRState *xdr, jsval *vp);
extern JS_PUBLIC_API(JSBool)
JS_XDRFunctionObject(JSXDRState *xdr, JSObject **objp);
extern JS_PUBLIC_API(JSBool)
JS_XDRScript(JSXDRState *xdr, JSScript **scriptp);
extern JS_PUBLIC_API(JSBool)
JS_XDRRegisterClass(JSXDRState *xdr, JSClass *clasp, uint32_t *lp);
extern JS_PUBLIC_API(uint32_t)
JS_XDRFindClassIdByName(JSXDRState *xdr, const char *name);
extern JS_PUBLIC_API(JSClass *)
JS_XDRFindClassById(JSXDRState *xdr, uint32_t id);
/*
* Magic numbers.
*/

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

@ -233,11 +233,9 @@ JS_FRIEND_DATA(Class) js::NamespaceClass = {
JS_ResolveStub,
JS_ConvertStub,
JS_FinalizeStub,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
NULL, /* mark */
{
@ -349,11 +347,9 @@ JS_FRIEND_DATA(Class) js::QNameClass = {
JS_ResolveStub,
JS_ConvertStub,
JS_FinalizeStub,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
NULL, /* mark */
{
@ -5380,11 +5376,9 @@ JS_FRIEND_DATA(Class) js::XMLClass = {
JS_ResolveStub,
xml_convert,
xml_finalize,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
xml_hasInstance,
xml_trace,
JS_NULL_CLASS_EXT,
@ -7932,11 +7926,9 @@ Class js_XMLFilterClass = {
JS_ResolveStub,
JS_ConvertStub,
xmlfilter_finalize,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
xmlfilter_trace
};

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

@ -1760,28 +1760,35 @@ class BindNameCompiler : public PICStubCompiler
BindNameLabels &labels = pic.bindNameLabels();
if (!IsCacheableNonGlobalScope(scopeChain))
return disable("non-cacheable obj at start of scope chain");
/* Guard on the shape of the scope chain. */
masm.loadPtr(Address(JSFrameReg, StackFrame::offsetOfScopeChain()), pic.objReg);
masm.loadShape(pic.objReg, pic.shapeReg);
Jump firstShape = masm.branchPtr(Assembler::NotEqual, pic.shapeReg,
ImmPtr(scopeChain->lastProperty()));
/* Walk up the scope chain. */
JSObject *tobj = scopeChain;
Address parent(pic.objReg, ScopeObject::offsetOfEnclosingScope());
while (tobj && tobj != obj) {
if (!IsCacheableNonGlobalScope(tobj))
return disable("non-cacheable obj in scope chain");
masm.loadPayload(parent, pic.objReg);
masm.loadShape(pic.objReg, pic.shapeReg);
Jump shapeTest = masm.branchPtr(Assembler::NotEqual, pic.shapeReg,
ImmPtr(tobj->lastProperty()));
if (!fails.append(shapeTest))
return error();
tobj = &tobj->asScope().enclosingScope();
if (scopeChain != obj) {
/* Walk up the scope chain. */
JSObject *tobj = &scopeChain->asScope().enclosingScope();
Address parent(pic.objReg, ScopeObject::offsetOfEnclosingScope());
while (tobj) {
if (!IsCacheableNonGlobalScope(tobj))
return disable("non-cacheable obj in scope chain");
masm.loadPayload(parent, pic.objReg);
masm.loadShape(pic.objReg, pic.shapeReg);
Jump shapeTest = masm.branchPtr(Assembler::NotEqual, pic.shapeReg,
ImmPtr(tobj->lastProperty()));
if (!fails.append(shapeTest))
return error();
if (tobj == obj)
break;
tobj = &tobj->asScope().enclosingScope();
}
if (tobj != obj)
return disable("indirect hit");
}
if (tobj != obj)
return disable("indirect hit");
Jump done = masm.jump();

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

@ -1270,16 +1270,14 @@ JSClass ThreadPool::jsClass = {
"ThreadPool", JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, jsFinalize,
NULL, NULL, NULL, NULL,
NULL, NULL, jsTraceThreadPool, NULL
NULL, NULL, NULL, NULL, jsTraceThreadPool
};
JSClass Worker::jsWorkerClass = {
"Worker", JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, jsFinalize,
NULL, NULL, NULL, NULL,
NULL, NULL, jsTraceWorker, NULL
NULL, NULL, NULL, NULL, jsTraceWorker
};
JSFunctionSpec Worker::jsMethods[3] = {

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

@ -1328,11 +1328,9 @@ Class Debugger::jsclass = {
JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUG_COUNT),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Debugger::finalize,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
Debugger::traceObject
};
@ -1861,11 +1859,9 @@ Class DebuggerScript_class = {
JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUGSCRIPT_COUNT),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
DebuggerScript_trace
};
@ -2965,11 +2961,9 @@ Class DebuggerObject_class = {
JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUGOBJECT_COUNT),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
DebuggerObject_trace
};
@ -3609,11 +3603,9 @@ Class DebuggerEnv_class = {
JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUGENV_COUNT),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
DebuggerEnv_trace
};

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

@ -352,15 +352,9 @@ Class js::RegExpClass = {
JS_ResolveStub,
JS_ConvertStub,
NULL, /* finalize */
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
#if JS_HAS_XDR
js_XDRRegExpObject,
#else
NULL
#endif
NULL, /* hasInstance */
regexp_trace
};
@ -746,8 +740,8 @@ js::ParseRegExpFlags(JSContext *cx, JSString *flagStr, RegExpFlag *flagsOut)
#if JS_HAS_XDR
# include "jsxdrapi.h"
JSBool
js_XDRRegExpObject(JSXDRState *xdr, JSObject **objp)
bool
js::XDRScriptRegExpObject(JSXDRState *xdr, HeapPtrObject *objp)
{
JSAtom *source = 0;
uint32_t flagsword = 0;
@ -770,7 +764,7 @@ js_XDRRegExpObject(JSXDRState *xdr, JSObject **objp)
return false;
if (!reobj->clearType(xdr->cx))
return false;
*objp = reobj;
objp->init(reobj);
}
return true;
}

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

@ -464,9 +464,9 @@ ParseRegExpFlags(JSContext *cx, JSString *flagStr, RegExpFlag *flagsOut);
inline RegExpShared *
RegExpToShared(JSContext *cx, JSObject &obj);
bool
XDRScriptRegExpObject(JSXDRState *xdr, HeapPtrObject *objp);
} /* namespace js */
JSBool
js_XDRRegExpObject(JSXDRState *xdr, JSObject **objp);
#endif

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

@ -80,11 +80,9 @@ Class js::RegExpStaticsClass = {
JS_ResolveStub,
JS_ConvertStub,
resc_finalize,
NULL, /* reserved0 */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
resc_trace
};

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

@ -382,11 +382,9 @@ Class js::WithClass = {
JS_ResolveStub,
JS_ConvertStub,
NULL, /* finalize */
NULL, /* reserved */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
NULL, /* trace */
JS_NULL_CLASS_EXT,
@ -617,7 +615,7 @@ FindObjectIndex(JSObjectArray *array, JSObject *obj)
}
bool
js_XDRStaticBlockObject(JSXDRState *xdr, StaticBlockObject **objp)
js::XDRStaticBlockObject(JSXDRState *xdr, JSScript *script, StaticBlockObject **objp)
{
JSContext *cx = xdr->cx;
@ -627,8 +625,8 @@ js_XDRStaticBlockObject(JSXDRState *xdr, StaticBlockObject **objp)
uint32_t depthAndCount = 0;
if (xdr->mode == JSXDR_ENCODE) {
obj = *objp;
parentId = JSScript::isValidOffset(xdr->script->objectsOffset)
? FindObjectIndex(xdr->script->objects(), obj->enclosingBlock())
parentId = JSScript::isValidOffset(script->objectsOffset)
? FindObjectIndex(script->objects(), obj->enclosingBlock())
: NO_PARENT_INDEX;
uint32_t depth = obj->stackDepth();
JS_ASSERT(depth <= UINT16_MAX);
@ -654,7 +652,7 @@ js_XDRStaticBlockObject(JSXDRState *xdr, StaticBlockObject **objp)
*/
obj->setEnclosingBlock(parentId == NO_PARENT_INDEX
? NULL
: &xdr->script->getObject(parentId)->asStaticBlock());
: &script->getObject(parentId)->asStaticBlock());
}
AutoObjectRooter tvr(cx, obj);

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

@ -256,9 +256,9 @@ class ClonedBlockObject : public BlockObject
const Value &closedSlot(unsigned i);
};
extern bool
XDRStaticBlockObject(JSXDRState *xdr, JSScript *script, StaticBlockObject **objp);
} /* namespace js */
extern bool
js_XDRStaticBlockObject(JSXDRState *xdr, js::StaticBlockObject **objp);
#endif /* ScopeObject_h___ */

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

@ -2907,7 +2907,7 @@ static JSClass SandboxClass = {
XPCONNECT_GLOBAL_FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
sandbox_enumerate, sandbox_resolve, sandbox_convert, sandbox_finalize,
NULL, NULL, NULL, NULL, NULL, NULL, TraceXPCGlobal
NULL, NULL, NULL, NULL, TraceXPCGlobal
};
static JSFunctionSpec SandboxFunctions[] = {

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

@ -177,7 +177,7 @@ static JSClass global_class = {
XPCONNECT_GLOBAL_FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, SafeGlobalResolve, JS_ConvertStub, SafeFinalize,
NULL, NULL, NULL, NULL, NULL, NULL, TraceXPCGlobal
NULL, NULL, NULL, NULL, TraceXPCGlobal
};
// We just use the same reporter as the component loader

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

@ -832,11 +832,9 @@ XPCWrappedNativeJSClass XPC_WN_NoHelper_JSClass = {
XPC_WN_NoHelper_Finalize, // finalize
/* Optionally non-null members start here. */
nsnull, // reserved0
nsnull, // checkAccess
nsnull, // call
nsnull, // construct
nsnull, // xdrObject;
nsnull, // hasInstance
XPC_WN_NoHelper_Trace, // trace
@ -1697,11 +1695,9 @@ js::Class XPC_WN_ModsAllowed_WithCall_Proto_JSClass = {
XPC_WN_Shared_Proto_Finalize, // finalize;
/* Optionally non-null members start here. */
nsnull, // reserved0;
nsnull, // checkAccess;
nsnull, // call;
nsnull, // construct;
nsnull, // xdrObject;
nsnull, // hasInstance;
XPC_WN_Shared_Proto_Trace, // trace;
@ -1724,11 +1720,9 @@ js::Class XPC_WN_ModsAllowed_NoCall_Proto_JSClass = {
XPC_WN_Shared_Proto_Finalize, // finalize;
/* Optionally non-null members start here. */
nsnull, // reserved0;
nsnull, // checkAccess;
nsnull, // call;
nsnull, // construct;
nsnull, // xdrObject;
nsnull, // hasInstance;
XPC_WN_Shared_Proto_Trace, // trace;
@ -1814,11 +1808,9 @@ js::Class XPC_WN_NoMods_WithCall_Proto_JSClass = {
XPC_WN_Shared_Proto_Finalize, // finalize;
/* Optionally non-null members start here. */
nsnull, // reserved0;
nsnull, // checkAccess;
nsnull, // call;
nsnull, // construct;
nsnull, // xdrObject;
nsnull, // hasInstance;
XPC_WN_Shared_Proto_Trace, // trace;
@ -1841,11 +1833,9 @@ js::Class XPC_WN_NoMods_NoCall_Proto_JSClass = {
XPC_WN_Shared_Proto_Finalize, // finalize;
/* Optionally non-null members start here. */
nsnull, // reserved0;
nsnull, // checkAccess;
nsnull, // call;
nsnull, // construct;
nsnull, // xdrObject;
nsnull, // hasInstance;
XPC_WN_Shared_Proto_Trace, // trace;

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

@ -214,11 +214,9 @@ js::Class XPC_WN_NoHelper_Proto_JSClass = {
nsnull, // finalize;
/* Optionally non-null members start here. */
nsnull, // reserved0;
nsnull, // checkAccess;
nsnull, // call;
nsnull, // construct;
nsnull, // xdrObject;
nsnull, // hasInstance;
nsnull, // trace;

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

@ -444,11 +444,9 @@ listTemplate = (
" JS_ResolveStub,\n"
" JS_ConvertStub,\n"
" JS_FinalizeStub,\n"
" NULL, /* reserved0 */\n"
" NULL, /* checkAccess */\n"
" NULL, /* call */\n"
" NULL, /* construct */\n"
" NULL, /* xdrObject */\n"
" interface_hasInstance\n"
"};\n"
"\n")

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

@ -1434,8 +1434,8 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList,
NS_ASSERTION(ownLayer->Manager() == mManager, "Wrong manager");
NS_ASSERTION(!ownLayer->HasUserData(&gLayerManagerUserData),
"We shouldn't have a FrameLayerBuilder-managed layer here!");
NS_ASSERTION(aClip.mHaveClipRect ||
aClip.mRoundedClipRects.IsEmpty(),
NS_ASSERTION(aClip.mHaveClipRect ||
aClip.mRoundedClipRects.IsEmpty(),
"If we have rounded rects, we must have a clip rect");
// It has its own layer. Update that layer's clip and visible rects.
if (aClip.mHaveClipRect) {

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

@ -5347,6 +5347,12 @@ static nsIView* FindViewContaining(nsIView* aView, nsPoint aPt)
void
PresShell::ProcessSynthMouseMoveEvent(bool aFromScroll)
{
// If drag session has started, we shouldn't synthesize mousemove event.
nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
if (dragSession) {
return;
}
// allow new event to be posted while handling this one only if the
// source of the event is a scroll (to prevent infinite reflow loops)
if (aFromScroll) {

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

@ -573,6 +573,9 @@ abstract public class GeckoApp
}
public void run() {
if (mSoftwareLayerClient == null)
return;
synchronized (mSoftwareLayerClient) {
if (!Tabs.getInstance().isSelectedTab(mThumbnailTab))
return;

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

@ -37,32 +37,45 @@
package org.mozilla.gecko;
import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.db.BrowserContract.Bookmarks;
import org.mozilla.gecko.db.BrowserContract.History;
import org.mozilla.gecko.db.BrowserContract.ImageColumns;
import org.mozilla.gecko.db.BrowserContract.Images;
import org.mozilla.gecko.db.BrowserContract.URLColumns;
import org.mozilla.gecko.db.BrowserContract.SyncColumns;
import org.mozilla.gecko.db.BrowserDB;
import org.mozilla.gecko.sqlite.ByteBufferInputStream;
import org.mozilla.gecko.sqlite.SQLiteBridge;
import org.mozilla.gecko.sqlite.SQLiteBridgeException;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.SQLException;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.provider.Browser;
import android.util.Log;
import android.net.Uri;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.File;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Map;
import java.util.HashMap;
import java.util.Date;
import java.util.List;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class ProfileMigrator {
private static final String LOGTAG = "ProfMigr";
@ -73,40 +86,90 @@ public class ProfileMigrator {
These queries are derived from the low-level Places schema
https://developer.mozilla.org/en/The_Places_database
*/
private final String bookmarkQuery = "SELECT places.url AS a_url, "
+ "places.title AS a_title FROM "
+ "(moz_places as places JOIN moz_bookmarks as bookmarks ON "
+ "places.id = bookmarks.fk) WHERE places.hidden <> 1 "
+ "ORDER BY bookmarks.dateAdded";
private final String kRootQuery =
"SELECT root_name, folder_id FROM moz_bookmarks_roots";
private final String kRootName = "root_name";
private final String kRootFolderId = "folder_id";
private final String kBookmarkQuery =
"SELECT places.url AS p_url," +
" bookmark.guid AS b_guid," +
" bookmark.id AS b_id," +
" bookmark.title AS b_title," +
" bookmark.type AS b_type," +
" bookmark.parent AS b_parent," +
" bookmark.dateAdded AS b_added," +
" bookmark.lastModified AS b_modified," +
" bookmark.position AS b_position," +
" favicon.data AS f_data," +
" favicon.mime_type AS f_mime_type," +
" favicon.url AS f_url," +
" favicon.guid AS f_guid " +
"FROM ((moz_bookmarks AS bookmark " +
" LEFT OUTER JOIN moz_places AS places " +
" ON places.id = bookmark.fk) " +
" LEFT OUTER JOIN moz_favicons AS favicon " +
" ON places.favicon_id = favicon.id) " +
// Bookmark folders don't have a places entry.
"WHERE (places.hidden IS NULL " +
" OR places.hidden <> 1) " +
// This gives us a better chance of adding a folder before
// adding its contents and hence avoiding extra iterations below.
"ORDER BY bookmark.id";
// Result column of relevant data
private final String bookmarkUrl = "a_url";
private final String bookmarkTitle = "a_title";
private final String kBookmarkUrl = "p_url";
private final String kBookmarkTitle = "b_title";
private final String kBookmarkGuid = "b_guid";
private final String kBookmarkId = "b_id";
private final String kBookmarkType = "b_type";
private final String kBookmarkParent = "b_parent";
private final String kBookmarkAdded = "b_added";
private final String kBookmarkModified = "b_modified";
private final String kBookmarkPosition = "b_position";
private final String kFaviconData = "f_data";
private final String kFaviconMime = "f_mime_type";
private final String kFaviconUrl = "f_url";
private final String kFaviconGuid = "f_guid";
// Helper constants
private static final int kPlacesTypeBookmark = 1;
private static final int kPlacesTypeFolder = 2;
/*
The sort criterion here corresponds to the one used for the
Awesomebar results. It's an simplification of Frecency.
Awesomebar results. It's a simplification of Frecency.
We must divide date by 1000 due to the micro (Places)
vs milli (Android) distiction.
*/
private final String historyQuery =
"SELECT places.url AS a_url, places.title AS a_title,"
+ "MAX(history.visit_date) AS a_date, COUNT(*) AS a_visits, "
private final String kHistoryQuery =
"SELECT places.url AS p_url, " +
" places.title AS p_title, " +
" MAX(history.visit_date) AS h_date, " +
" COUNT(*) AS h_visits, " +
// see BrowserDB.filterAllSites for this formula
+ "MAX(1, (((MAX(history.visit_date)/1000) - ?) / 86400000 + 120)) AS a_recent, "
+ "favicon.data AS a_favicon_data, favicon.mime_type AS a_favicon_mime "
+ "FROM (moz_historyvisits AS history JOIN moz_places AS places "
+ "ON places.id = history.place_id "
" MAX(1, (((MAX(history.visit_date)/1000) - ?) / 86400000 + 120)) AS a_recent, " +
" favicon.data AS f_data, " +
" favicon.mime_type AS f_mime_type, " +
" places.guid AS p_guid, " +
" favicon.url AS f_url, " +
" favicon.guid AS f_guid " +
"FROM (moz_historyvisits AS history " +
" JOIN moz_places AS places " +
" ON places.id = history.place_id " +
// Add favicon data if a favicon is present for this URL.
+ "LEFT OUTER JOIN moz_favicons AS favicon "
+ "ON places.favicon_id = favicon.id) "
+ "WHERE places.hidden <> 1 "
+ "GROUP BY a_url ORDER BY a_visits * a_recent DESC LIMIT ?";
private final String historyUrl = "a_url";
private final String historyTitle = "a_title";
private final String historyDate = "a_date";
private final String historyVisits = "a_visits";
private final String faviconData = "a_favicon_data";
private final String faviconMime = "a_favicon_mime";
" LEFT OUTER JOIN moz_favicons AS favicon " +
" ON places.favicon_id = favicon.id) " +
"WHERE places.hidden <> 1 " +
"GROUP BY p_url " +
"ORDER BY h_visits * a_recent " +
"DESC LIMIT ?";
private final String kHistoryUrl = "p_url";
private final String kHistoryTitle = "p_title";
private final String kHistoryGuid = "p_guid";
private final String kHistoryDate = "h_date";
private final String kHistoryVisits = "h_visits";
public ProfileMigrator(ContentResolver cr, File profileDir) {
mProfileDir = profileDir;
@ -114,10 +177,66 @@ public class ProfileMigrator {
}
public void launch() {
new PlacesTask().run();
new PlacesRunnable().run();
}
private class PlacesTask implements Runnable {
private class PlacesRunnable implements Runnable {
private Map<Long, Long> mRerootMap;
protected Uri getBookmarksUri() {
return Bookmarks.CONTENT_URI;
}
protected Uri getHistoryUri() {
return History.CONTENT_URI;
}
protected Uri getImagesUri() {
return Images.CONTENT_URI;
}
private long getFolderId(String guid) {
Cursor c = null;
try {
c = mCr.query(getBookmarksUri(),
new String[] { Bookmarks._ID },
Bookmarks.GUID + " = ?",
new String [] { guid },
null);
if (c.moveToFirst())
return c.getLong(c.getColumnIndexOrThrow(Bookmarks._ID));
} finally {
if (c != null)
c.close();
}
// Default fallback
return Bookmarks.FIXED_ROOT_ID;
}
// We want to know the id of special root folders in the places DB,
// and replace them by the corresponding root id in the Android DB.
protected void calculateReroot(SQLiteBridge db) {
mRerootMap = new HashMap<Long, Long>();
try {
ArrayList<Object[]> queryResult = db.query(kRootQuery);
final int rootCol = db.getColumnIndex(kRootName);
final int folderCol = db.getColumnIndex(kRootFolderId);
for (Object[] resultRow: queryResult) {
String name = (String)resultRow[rootCol];
long placesFolderId = Integer.parseInt((String)resultRow[folderCol]);
mRerootMap.put(placesFolderId, getFolderId(name));
Log.v(LOGTAG, "Name: " + name + ", pid=" + placesFolderId
+ ", nid=" + mRerootMap.get(placesFolderId));
}
} catch (SQLiteBridgeException e) {
Log.e(LOGTAG, "Failed to get bookmark roots: ", e);
return;
}
}
// Get a list of the last times an URL was accessed
protected Map<String, Long> gatherBrowserDBHistory() {
Map<String, Long> history = new HashMap<String, Long>();
@ -163,9 +282,119 @@ public class ProfileMigrator {
}
if (allowUpdate) {
BrowserDB.updateVisitedHistory(mCr, url);
// The above records one visit. Subtract that one visit here.
BrowserDB.updateHistoryEntry(mCr, url, title, date, visits - 1);
updateBrowserHistory(url, title, date, visits);
}
}
protected void updateBrowserHistory(String url, String title,
long date, int visits) {
Cursor cursor = null;
try {
final String[] projection = new String[] {
History._ID,
History.VISITS
};
cursor = mCr.query(getHistoryUri(),
projection,
History.URL + " = ?",
new String[] { url },
null);
ContentValues values = new ContentValues();
values.put(History.DATE_LAST_VISITED, date);
if (cursor.moveToFirst()) {
int visitsCol = cursor.getColumnIndexOrThrow(History.VISITS);
int oldVisits = cursor.getInt(visitsCol);
values.put(History.VISITS, oldVisits + visits);
if (title != null) {
values.put(History.TITLE, title);
}
int idCol = cursor.getColumnIndexOrThrow(History._ID);
// We use default profile anyway
Uri historyUri = ContentUris.withAppendedId(getHistoryUri(),
cursor.getLong(idCol));
mCr.update(historyUri, values, null, null);
} else {
values.put(History.URL, url);
values.put(History.VISITS, visits);
if (title != null) {
values.put(History.TITLE, title);
} else {
values.put(History.TITLE, url);
}
mCr.insert(getHistoryUri(), values);
}
} finally {
if (cursor != null)
cursor.close();
}
}
protected BitmapDrawable decodeImageData(ByteBuffer data) {
ByteBufferInputStream byteStream = new ByteBufferInputStream(data);
BitmapDrawable image =
(BitmapDrawable)Drawable.createFromStream(byteStream, "src");
return image;
}
protected void addFavicon(String url, String faviconUrl, String faviconGuid,
String mime, ByteBuffer data) {
// Some GIFs can cause us to lock up completely
// without exceptions or anything. Not cool.
if (mime == null || mime.compareTo("image/gif") == 0) {
return;
}
BitmapDrawable image = null;
// Decode non-PNG images.
if (mime.compareTo("image/png") != 0) {
image = decodeImageData(data);
// Can't decode, give up.
if (image == null) {
Log.i(LOGTAG, "Cannot decode image type " + mime
+ " for URL=" + url);
}
}
try {
ContentValues values = new ContentValues();
// Recompress decoded images to PNG.
if (image != null) {
Bitmap bitmap = image.getBitmap();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
values.put(Images.FAVICON, stream.toByteArray());
} else {
// PNG images can be passed directly. Well, aside
// from having to convert them into a byte[].
byte[] byteArray = new byte[data.remaining()];
data.get(byteArray);
values.put(Images.FAVICON, byteArray);
}
values.put(Images.URL, url);
values.put(Images.FAVICON_URL, faviconUrl);
// Restore deleted record if possible
values.put(Images.IS_DELETED, 0);
values.put(Images.GUID, faviconGuid);
int updated = mCr.update(getImagesUri(),
values,
Images.URL + " = ?",
new String[] { url });
if (updated == 0) {
mCr.insert(getImagesUri(), values);
}
} catch (SQLException e) {
Log.i(LOGTAG, "Migrating favicon failed: " + mime + " URL: " + url
+ " error:" + e.getMessage());
}
}
@ -184,35 +413,37 @@ public class ProfileMigrator {
Integer.toString(BrowserDB.getMaxHistoryCount())
};
ArrayList<Object[]> queryResult =
db.query(historyQuery, queryParams);
final int urlCol = db.getColumnIndex(historyUrl);
final int titleCol = db.getColumnIndex(historyTitle);
final int dateCol = db.getColumnIndex(historyDate);
final int visitsCol = db.getColumnIndex(historyVisits);
final int faviconMimeCol = db.getColumnIndex(faviconMime);
final int faviconDataCol = db.getColumnIndex(faviconData);
db.query(kHistoryQuery, queryParams);
final int urlCol = db.getColumnIndex(kHistoryUrl);
final int titleCol = db.getColumnIndex(kHistoryTitle);
final int dateCol = db.getColumnIndex(kHistoryDate);
final int visitsCol = db.getColumnIndex(kHistoryVisits);
final int faviconMimeCol = db.getColumnIndex(kFaviconMime);
final int faviconDataCol = db.getColumnIndex(kFaviconData);
final int faviconUrlCol = db.getColumnIndex(kFaviconUrl);
final int faviconGuidCol = db.getColumnIndex(kFaviconGuid);
for (Object[] resultRow: queryResult) {
String url = (String)resultRow[urlCol];
String title = (String)resultRow[titleCol];
long date = Long.parseLong((String)(resultRow[dateCol])) / (long)1000;
int visits = Integer.parseInt((String)(resultRow[visitsCol]));
addHistory(browserDBHistory, url, title, date, visits);
placesHistory.add(url);
ByteBuffer faviconDataBuff = (ByteBuffer)resultRow[faviconDataCol];
String faviconMime = (String)resultRow[faviconMimeCol];
String faviconUrl = (String)resultRow[faviconUrlCol];
String faviconGuid = (String)resultRow[faviconGuidCol];
String mime = (String)resultRow[faviconMimeCol];
if (mime != null) {
// Some GIFs can cause us to lock up completely
// without exceptions or anything. Not cool.
if (mime.compareTo("image/gif") != 0) {
ByteBuffer dataBuff =
(ByteBuffer)resultRow[faviconDataCol];
addFavicon(url, mime, dataBuff);
}
try {
placesHistory.add(url);
addFavicon(url, faviconUrl, faviconGuid,
faviconMime, faviconDataBuff);
addHistory(browserDBHistory, url, title, date, visits);
} catch (Exception e) {
Log.e(LOGTAG, "Error adding history entry: ", e);
}
}
} catch (SQLiteBridgeException e) {
Log.i(LOGTAG, "Failed to get bookmarks: " + e.getMessage());
Log.e(LOGTAG, "Failed to get history: ", e);
return;
}
// GlobalHistory access communicates with Gecko
@ -226,45 +457,161 @@ public class ProfileMigrator {
});
}
protected void addBookmark(String url, String title) {
if (!BrowserDB.isBookmark(mCr, url)) {
if (title == null) {
title = url;
}
BrowserDB.addBookmark(mCr, title, url);
protected void addBookmark(String url, String title, String guid,
long parent, long added,
long modified, long position,
boolean folder) {
ContentValues values = new ContentValues();
if (title == null && url != null) {
title = url;
}
if (title != null) {
values.put(Bookmarks.TITLE, title);
}
if (url != null) {
values.put(Bookmarks.URL, url);
}
if (guid != null) {
values.put(SyncColumns.GUID, guid);
}
values.put(SyncColumns.DATE_CREATED, added);
values.put(SyncColumns.DATE_MODIFIED, modified);
values.put(Bookmarks.POSITION, position);
// Restore deleted record if possible
values.put(Bookmarks.IS_DELETED, 0);
if (mRerootMap.containsKey(parent)) {
parent = mRerootMap.get(parent);
}
values.put(Bookmarks.PARENT, parent);
values.put(Bookmarks.IS_FOLDER, (folder ? 1 : 0));
int updated = 0;
if (url != null) {
updated = mCr.update(getBookmarksUri(),
values,
Bookmarks.URL + " = ?",
new String[] { url });
}
if (updated == 0) {
mCr.insert(getBookmarksUri(), values);
}
}
protected void migrateBookmarks(SQLiteBridge db) {
try {
ArrayList<Object[]> queryResult = db.query(bookmarkQuery);
final int urlCol = db.getColumnIndex(bookmarkUrl);
final int titleCol = db.getColumnIndex(bookmarkTitle);
ArrayList<Object[]> queryResult = db.query(kBookmarkQuery);
final int urlCol = db.getColumnIndex(kBookmarkUrl);
final int titleCol = db.getColumnIndex(kBookmarkTitle);
final int guidCol = db.getColumnIndex(kBookmarkGuid);
final int idCol = db.getColumnIndex(kBookmarkId);
final int typeCol = db.getColumnIndex(kBookmarkType);
final int parentCol = db.getColumnIndex(kBookmarkParent);
final int addedCol = db.getColumnIndex(kBookmarkAdded);
final int modifiedCol = db.getColumnIndex(kBookmarkModified);
final int positionCol = db.getColumnIndex(kBookmarkPosition);
final int faviconMimeCol = db.getColumnIndex(kFaviconMime);
final int faviconDataCol = db.getColumnIndex(kFaviconData);
final int faviconUrlCol = db.getColumnIndex(kFaviconUrl);
final int faviconGuidCol = db.getColumnIndex(kFaviconGuid);
for (Object[] resultRow: queryResult) {
String url = (String)resultRow[urlCol];
String title = (String)resultRow[titleCol];
addBookmark(url, title);
}
// The keys are places IDs.
Set<Long> openFolders = new HashSet<Long>();
Set<Long> knownFolders = new HashSet<Long>(mRerootMap.keySet());
// We iterate over all bookmarks, and add all bookmarks that
// have their parent folders present. If there are bookmarks
// that we can't add, we remember what these are and try again
// on the next iteration. The number of iterations scales
// according to the depth of the folders.
Set<Long> processedBookmarks = new HashSet<Long>();
int iterations = 0;
do {
// Reset the set of missing folders that block us from
// adding entries.
openFolders.clear();
int added = 0;
int skipped = 0;
for (Object[] resultRow: queryResult) {
long id = Long.parseLong((String)resultRow[idCol]);
// Already processed? if so just skip
if (processedBookmarks.contains(id))
continue;
int type = Integer.parseInt((String)resultRow[typeCol]);
long parent = Long.parseLong((String)resultRow[parentCol]);
// Places has an explicit root folder, id=1 parent=0.
// Skip that.
if (id == 1 && parent == 0 && type == kPlacesTypeFolder)
continue;
String url = (String)resultRow[urlCol];
String title = (String)resultRow[titleCol];
String guid = (String)resultRow[guidCol];
long dateadded =
Long.parseLong((String)resultRow[addedCol]) / (long)1000;
long datemodified =
Long.parseLong((String)resultRow[modifiedCol]) / (long)1000;
long position = Long.parseLong((String)resultRow[positionCol]);
ByteBuffer faviconDataBuff = (ByteBuffer)resultRow[faviconDataCol];
String faviconMime = (String)resultRow[faviconMimeCol];
String faviconUrl = (String)resultRow[faviconUrlCol];
String faviconGuid = (String)resultRow[faviconGuidCol];
// Is the parent for this bookmark already added?
// If so, we can add the bookmark itself.
if (knownFolders.contains(parent)) {
try {
boolean isFolder = (type == kPlacesTypeFolder);
addBookmark(url, title, guid, parent,
dateadded, datemodified,
position, isFolder);
addFavicon(url, faviconUrl, faviconGuid,
faviconMime, faviconDataBuff);
if (isFolder) {
long newFolderId = getFolderId(guid);
// Remap the folder IDs for parents.
mRerootMap.put(id, newFolderId);
knownFolders.add(id);
Log.d(LOGTAG, "Added folder: " + id);
}
processedBookmarks.add(id);
} catch (Exception e) {
Log.e(LOGTAG, "Error adding bookmark: ", e);
}
added++;
} else {
// We have to postpone until parent is processed;
openFolders.add(parent);
skipped++;
}
}
// Now check if any of the new folders we added was a folder
// that we were blocked on, by intersecting openFolders and
// knownFolders. If this is empty, we're done because the next
// iteration can't make progress.
boolean changed = openFolders.retainAll(knownFolders);
// If there are no folders that we can add next iteration,
// but there were still folders before the intersection,
// those folders are orphans. Report this situation here.
if (openFolders.isEmpty() && changed) {
Log.w(LOGTAG, "Orphaned bookmarks found, not imported");
}
iterations++;
Log.i(LOGTAG, "Iteration = " + iterations + ", added " + added +
" bookmark(s), skipped " + skipped + " bookmark(s)");
} while (!openFolders.isEmpty());
} catch (SQLiteBridgeException e) {
Log.i(LOGTAG, "Failed to get bookmarks: " + e.getMessage());
Log.e(LOGTAG, "Failed to get bookmarks: ", e);
return;
}
}
protected void addFavicon(String url, String mime, ByteBuffer data) {
ByteBufferInputStream byteStream = new ByteBufferInputStream(data);
BitmapDrawable image = (BitmapDrawable) Drawable.createFromStream(byteStream, "src");
if (image != null) {
try {
BrowserDB.updateFaviconForUrl(mCr, url, image);
} catch (SQLException e) {
Log.i(LOGTAG, "Migrating favicon failed: " + mime + " URL: " + url
+ " error:" + e.getMessage());
}
}
}
protected void migratePlaces(File aFile) {
String dbPath = aFile.getPath() + "/places.sqlite";
String dbPathWal = aFile.getPath() + "/places.sqlite-wal";
@ -283,6 +630,7 @@ public class ProfileMigrator {
GeckoAppShell.ensureSQLiteLibsLoaded(GeckoApp.mAppContext.getApplication().getPackageResourcePath());
try {
db = new SQLiteBridge(dbPath);
calculateReroot(db);
migrateBookmarks(db);
migrateHistory(db);
db.close();
@ -297,7 +645,7 @@ public class ProfileMigrator {
if (db != null) {
db.close();
}
Log.i(LOGTAG, "Error on places database:" + e.getMessage());
Log.e(LOGTAG, "Error on places database:", e);
return;
}
}

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

@ -903,11 +903,17 @@ public class BrowserProvider extends ContentProvider {
case BOOKMARKS: {
trace("Insert on BOOKMARKS: " + uri);
// Generate values if not specified. Don't overwrite
// if specified by caller.
long now = System.currentTimeMillis();
values.put(Bookmarks.DATE_CREATED, now);
values.put(Bookmarks.DATE_MODIFIED, now);
if (!values.containsKey(Bookmarks.DATE_CREATED)) {
values.put(Bookmarks.DATE_CREATED, now);
}
if (!values.containsKey(Bookmarks.DATE_MODIFIED)) {
values.put(Bookmarks.DATE_MODIFIED, now);
}
// Generate GUID for new bookmark. Don't override specified GUIDs.
if (!values.containsKey(Bookmarks.GUID)) {
values.put(Bookmarks.GUID, Utils.generateGuid());
}

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

@ -628,7 +628,8 @@ CustomElf::RelocateJumps()
symptr = GetSymbolPtrInDeps(strtab.GetStringAt(sym.st_name));
if (symptr == NULL) {
log("%s: Error: relocation to NULL @0x%08" PRIxAddr, GetPath(), rel->r_offset);
log("%s: Error: relocation to NULL @0x%08" PRIxAddr " for symbol \"%s\"",
GetPath(), rel->r_offset, strtab.GetStringAt(sym.st_name));
return false;
}
/* Apply relocation */

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

@ -80,7 +80,16 @@ function flipBackslashes(aUnsafeStr)
function assert(aCond, aMsg)
{
if (!aCond) {
throw("assertion failed: " + aMsg);
reportAssertionFailure(aMsg)
throw("aboutMemory.js assertion failed: " + aMsg);
}
}
function reportAssertionFailure(aMsg)
{
var debug = Cc["@mozilla.org/xpcom/debug;1"].getService(Ci.nsIDebug2);
if (debug.isDebugBuild) {
debug.assertion(aMsg, "false", "aboutMemory.js", 0);
}
}
@ -108,7 +117,7 @@ function onLoad()
if (location.href.startsWith("about:memory")) {
document.title = "about:memory";
onLoadAboutMemory();
} else if (location.href.startsWith("about:compartment")) {
} else if (location.href.startsWith("about:compartments")) {
document.title = "about:compartments";
onLoadAboutCompartments();
} else {
@ -576,7 +585,7 @@ function buildTree(aReports, aTreeName)
}
}
if (!foundReport) {
assert(aTreeName !== 'explicit');
assert(aTreeName !== 'explicit', "aTreeName !== 'explicit'");
return null;
}
@ -1254,10 +1263,11 @@ function appendTreeElements(aPOuter, aT, aProcess)
if (aT._amount === treeBytes) {
percText = "100.0";
} else {
let perc = (100 * aT._amount / treeBytes);
if (!(0 <= perc && perc <= 100)) {
if (!(0 <= aT._amount && aT._amount <= treeBytes)) {
tIsInvalid = true;
gUnsafePathsWithInvalidValuesForThisProcess.push(unsafePath);
reportAssertionFailure("Invalid value for " +
flipBackslashes(unsafePath));
}
percText = (100 * aT._amount / treeBytes).toFixed(2);
percText = pad(percText, 5, '0');
@ -1416,7 +1426,7 @@ function appendOtherElements(aP, aReportsByProcess)
if (!r._done) {
assert(r._kind === KIND_OTHER,
"_kind !== KIND_OTHER for " + flipBackslashes(r._unsafePath));
assert(r._nMerged === undefined); // we don't allow dup'd OTHER Reports
assert(r._nMerged === undefined, "dup'd OTHER report");
let o = new OtherReport(r._unsafePath, r._units, r._amount,
r._description);
otherReports.push(o);
@ -1434,6 +1444,8 @@ function appendOtherElements(aP, aReportsByProcess)
let oIsInvalid = o.isInvalid();
if (oIsInvalid) {
gUnsafePathsWithInvalidValuesForThisProcess.push(o._unsafePath);
reportAssertionFailure("Invalid value for " +
flipBackslashes(o._unsafePath));
}
appendMrValueSpan(pre, pad(o._asString, maxStringLength, ' '), oIsInvalid);
appendMrNameSpan(pre, KIND_OTHER, kNoKids, o._description, o._unsafePath,

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

@ -450,7 +450,7 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
if (aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) {
// Blacklist all ATI cards on OSX, except for
// 0x6760 and 0x9488
if (mAdapterVendorID == GfxDriverInfo::GetDeviceVendor(VendorATI) &&
if (mAdapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorATI), nsCaseInsensitiveStringComparator()) &&
(mAdapterDeviceID.LowerCaseEqualsLiteral("0x6760") ||
mAdapterDeviceID.LowerCaseEqualsLiteral("0x9488"))) {
*aStatus = nsIGfxInfo::FEATURE_NO_INFO;

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

@ -963,10 +963,10 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
return NS_ERROR_FAILURE;
}
if (adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorIntel) &&
adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorNVIDIA) &&
adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorAMD) &&
adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorATI) &&
if (!adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorIntel), nsCaseInsensitiveStringComparator()) &&
!adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), nsCaseInsensitiveStringComparator()) &&
!adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorAMD), nsCaseInsensitiveStringComparator()) &&
!adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorATI), nsCaseInsensitiveStringComparator()) &&
// FIXME - these special hex values are currently used in xpcshell tests introduced by
// bug 625160 patch 8/8. Maybe these tests need to be adjusted now that we're only whitelisting
// intel/ati/nvidia.
@ -988,7 +988,7 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
// whitelist them, actually we do know that this combination of device and driver version
// works well.
if (mWindowsVersion == gfxWindowsPlatform::kWindowsXP &&
adapterVendorID == GfxDriverInfo::GetDeviceVendor(VendorNVIDIA) &&
adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), nsCaseInsensitiveStringComparator()) &&
adapterDeviceID.LowerCaseEqualsLiteral("0x0861") && // GeForce 9400
driverVersion == V(6,14,11,7756))
{

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

@ -47,6 +47,7 @@
#include "nsCOMArray.h"
#include "nsAutoPtr.h"
#include "nsString.h"
#include "nsUnicharUtils.h"
#include "mozilla/Services.h"
#include "mozilla/Observer.h"
#include "nsIObserver.h"
@ -643,15 +644,15 @@ GfxInfoBase::FindBlocklistedDeviceInList(const nsTArray<GfxDriverInfo>& info,
continue;
}
if (info[i].mAdapterVendor != GfxDriverInfo::GetDeviceVendor(VendorAll) &&
info[i].mAdapterVendor != adapterVendorID) {
if (!info[i].mAdapterVendor.Equals(GfxDriverInfo::GetDeviceVendor(VendorAll), nsCaseInsensitiveStringComparator()) &&
!info[i].mAdapterVendor.Equals(adapterVendorID, nsCaseInsensitiveStringComparator())) {
continue;
}
if (info[i].mDevices != GfxDriverInfo::allDevices && info[i].mDevices->Length()) {
bool deviceMatches = false;
for (PRUint32 j = 0; j < info[i].mDevices->Length(); j++) {
if ((*info[i].mDevices)[j] == adapterDeviceID) {
if ((*info[i].mDevices)[j].Equals(adapterDeviceID, nsCaseInsensitiveStringComparator())) {
deviceMatches = true;
break;
}