Merge mozilla-central to mozilla-inbound

This commit is contained in:
Matt Brubeck 2011-10-06 10:23:02 -07:00
Родитель 284d4cabaf ebe169a362
Коммит 090dd0e5ab
120 изменённых файлов: 2027 добавлений и 2469 удалений

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

@ -69,7 +69,7 @@ PARALLEL_DIRS = \
search \
sessionstore \
shell \
sidebar \
sidebar/src \
migration \
$(NULL)
@ -82,7 +82,7 @@ PARALLEL_DIRS += safebrowsing
endif
ifdef ENABLE_TESTS
DIRS += test
DIRS += test/browser
endif
DIRS += build

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

@ -43,8 +43,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = src
ifdef ENABLE_TESTS
DIRS += content/test
endif

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

@ -1,44 +0,0 @@
# ***** 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 Google Inc.
# Portions created by the Initial Developer are Copyright (C) 2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either 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@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk

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

@ -51,7 +51,7 @@ XPIDLSRCS = \
DIRS = src
ifdef ENABLE_TESTS
DIRS += test
DIRS += test/browser
endif
include $(topsrcdir)/config/rules.mk

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

@ -1,49 +0,0 @@
# ***** 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) 2007
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# 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@
include $(DEPTH)/config/autoconf.mk
DIRS += browser \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -1,48 +0,0 @@
#
# ***** 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
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1999
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either 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@
include $(DEPTH)/config/autoconf.mk
DIRS = src
include $(topsrcdir)/config/rules.mk

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

@ -1,48 +0,0 @@
#
# ***** 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
# the Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Robert Strong <robert.bugzilla@gmail.com> (Original Author)
#
# 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@
include $(DEPTH)/config/autoconf.mk
DIRS = browser
include $(topsrcdir)/config/rules.mk

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

@ -49,14 +49,13 @@ include $(topsrcdir)/config/config.mk
DIRS = \
highlighter \
webconsole \
scratchpad \
sourceeditor \
styleinspector \
shared \
$(NULL)
ifdef ENABLE_TESTS
# DIRS += test # no tests yet
DIRS += scratchpad/test
endif
include $(topsrcdir)/config/rules.mk

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

@ -1,50 +0,0 @@
#
# ***** 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 Scratchpad Build Code.
#
# The Initial Developer of the Original Code is The Mozilla Foundation.
#
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Rob Campbell <rcampbell@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either 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@
include $(DEPTH)/config/autoconf.mk
ifdef ENABLE_TESTS
DIRS += test
endif
include $(topsrcdir)/config/rules.mk

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

@ -45,11 +45,11 @@ include $(DEPTH)/config/autoconf.mk
ifdef ENABLE_TESTS
ifneq (mobile,$(MOZ_BUILD_APP))
DIRS += test
DIRS += test/browser
endif
endif
include $(topsrcdir)/config/rules.mk
libs::
$(NSINSTALL) $(srcdir)/*.jsm $(FINAL_TARGET)/modules/devtools
$(NSINSTALL) $(srcdir)/*.jsm $(FINAL_TARGET)/modules/devtools

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

@ -1,48 +0,0 @@
#
# ***** 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 Style Inspector code.
#
# The Initial Developer of the Original Code is
# Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Mike Ratcliffe <mratcliffe@mozilla.com> (Original author)
#
# 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@
include $(DEPTH)/config/autoconf.mk
DIRS = browser
include $(topsrcdir)/config/rules.mk

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

@ -57,7 +57,7 @@ EXTRA_PP_JS_MODULES = \
ifdef ENABLE_TESTS
ifneq (mobile,$(MOZ_BUILD_APP))
DIRS += test
DIRS += test/browser
endif
endif

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

@ -1,48 +0,0 @@
#
# ***** 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 HUDService code.
#
# The Initial Developer of the Original Code is
# Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# David Dahl <ddahl@mozilla.com> (Original author)
#
# 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@
include $(DEPTH)/config/autoconf.mk
DIRS = browser
include $(topsrcdir)/config/rules.mk

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

@ -56,11 +56,9 @@ browser/components/preferences/Makefile
browser/components/privatebrowsing/Makefile
browser/components/privatebrowsing/src/Makefile
browser/components/safebrowsing/Makefile
browser/components/safebrowsing/src/Makefile
browser/components/search/Makefile
browser/components/sessionstore/Makefile
browser/components/sessionstore/src/Makefile
browser/components/sidebar/Makefile
browser/components/sidebar/src/Makefile
browser/components/shell/Makefile
browser/components/shell/public/Makefile
@ -90,7 +88,6 @@ if [ "$ENABLE_TESTS" ]; then
browser/components/certerror/test/Makefile
browser/components/preferences/tests/Makefile
browser/components/search/test/Makefile
browser/components/sessionstore/test/Makefile
browser/components/sessionstore/test/browser/Makefile
browser/components/shell/test/Makefile
browser/components/feeds/test/Makefile

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

@ -684,7 +684,7 @@ class DeviceManagerSUT(DeviceManager):
return None
# prompt should follow
read_exact(len(prompt), buffer, 'could not find prompt')
print 'DeviceManager: error pulling file: %s' % error_str
print "DeviceManager: error pulling file '%s': %s" % (remoteFile, error_str)
return None
# read file data

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

@ -40,6 +40,9 @@ import time
import sys
import os
import socket
import automationutils
import tempfile
import shutil
from automation import Automation
from devicemanager import DeviceManager, NetworkTools
@ -105,6 +108,15 @@ class RemoteAutomation(Automation):
return status
def checkForCrashes(self, directory, symbolsPath):
dumpDir = tempfile.mkdtemp()
self._devicemanager.getDirectory(self._remoteProfile + '/minidumps/', dumpDir)
automationutils.checkForCrashes(dumpDir, symbolsPath, self.lastTestSeen)
try:
shutil.rmtree(dumpDir)
except:
print "WARNING: unable to remove directory: %s" % (dumpDir)
def buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs):
# If remote profile is specified, use that instead
if (self._remoteProfile):

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

@ -46,7 +46,7 @@ MODULE = caps
DIRS = idl include src
ifdef ENABLE_TESTS
DIRS += tests
DIRS += tests/mochitest
endif
include $(topsrcdir)/config/rules.mk

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

@ -1,48 +0,0 @@
#
# ***** 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) 2008
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Mike Shaver <shaver@mozilla.com> (original cutter and paster)
#
# 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@
include $(DEPTH)/config/autoconf.mk
DIRS = mochitest
include $(topsrcdir)/config/rules.mk

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

@ -43,7 +43,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = content
PARALLEL_DIRS = base canvas events html mathml smil svg xml xul xbl xslt
PARALLEL_DIRS = base canvas events html mathml/content/src smil svg xml xul xbl xslt
ifdef MOZ_MEDIA
PARALLEL_DIRS += media

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

@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=648573
https://bugzilla.mozilla.org/show_bug.cgi?id=648573
-->
<head>
<title>Test for Bug 648573</title>
@ -19,7 +19,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=648573
/** Test for Bug 648573 **/
ok(!SpecialPowers.DOMWindowUtils.mayHaveTouchEventListeners,
var utils = SpecialPowers.getDOMWindowUtils(window);
ok(!utils.mayHaveTouchEventListeners,
"There shouldn't be any touch event listeners yet.");
ok("createTouch" in document, "Should have createTouch function");
@ -101,7 +103,7 @@ for (var i = 0; i < events.length; ++i) {
runEventTest(events[i]);
}
ok(SpecialPowers.DOMWindowUtils.mayHaveTouchEventListeners,
ok(utils.mayHaveTouchEventListeners,
"There should be touch event listeners.");
</script>
</pre>

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

@ -18,8 +18,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=662678
<script type="application/javascript">
/** Test for Bug 662678 **/
SimpleTest.waitForExplicitFinish();
var checkMotion = function(event) {
window.removeEventListener("devicemotion", checkMotion, true);
window.addEventListener("devicemotion", function(event) {
is(event.acceleration.x, 1.5);
is(event.acceleration.y, 1.5);
is(event.acceleration.z, 1.5);
@ -32,7 +35,9 @@ window.addEventListener("devicemotion", function(event) {
is(event.rotationRate.beta, 1.5);
is(event.rotationRate.gamma, 1.5);
SimpleTest.finish();
}, true);
};
window.addEventListener("devicemotion", checkMotion, true);
var event = DeviceMotionEvent;
ok(!!event, "Should have seen DeviceMotionEvent!");
@ -44,7 +49,6 @@ event.initDeviceMotionEvent('devicemotion', true, true,
{alpha:1.5,beta:1.5,gamma:1.5},
0);
window.dispatchEvent(event);
SimpleTest.waitForExplicitFinish();
</script>
</pre>

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

@ -1,47 +0,0 @@
#
# ***** 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
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# 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@
include $(DEPTH)/config/autoconf.mk
DIRS = content
include $(topsrcdir)/config/rules.mk

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

@ -1,48 +0,0 @@
#
# ***** 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
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# 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@
include $(DEPTH)/config/autoconf.mk
DIRS = src
include $(topsrcdir)/config/rules.mk

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

@ -42,6 +42,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
PARALLEL_DIRS = document content
PARALLEL_DIRS = document/src content
include $(topsrcdir)/config/rules.mk

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

@ -1,48 +0,0 @@
#
# ***** 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 the mozilla svg code.
#
# The Initial Developer of the Original Code is
# Bradley Baetz.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# 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@
include $(DEPTH)/config/autoconf.mk
DIRS = src
include $(topsrcdir)/config/rules.mk

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

@ -42,7 +42,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
PARALLEL_DIRS = content document
PARALLEL_DIRS = content/src document
include $(topsrcdir)/config/rules.mk

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

@ -1,48 +0,0 @@
#
# ***** 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
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# 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@
include $(DEPTH)/config/autoconf.mk
DIRS = src
include $(topsrcdir)/config/rules.mk

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

@ -46,7 +46,7 @@ MODULE = xultmpl
PARALLEL_DIRS = public src
ifdef ENABLE_TESTS
TOOL_DIRS += tests
TOOL_DIRS += tests/chrome
endif
include $(topsrcdir)/config/rules.mk

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

@ -1,49 +0,0 @@
#
# ***** 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.org.
# Portions created by the Initial Developer are Copyright (C) 2009
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# 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 = content/xul/templates/tests
include $(DEPTH)/config/autoconf.mk
DIRS = chrome
include $(topsrcdir)/config/rules.mk

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

@ -48,7 +48,7 @@ DIRS = \
base \
shistory \
build \
resources \
resources/content \
$(NULL)
ifdef ENABLE_TESTS

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

@ -1,48 +0,0 @@
#
# ***** 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 the Mozilla browser.
#
# The Initial Developer of the Original Code is
# Netscape Communications, Inc.
# Portions created by the Initial Developer are Copyright (C) 1999
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Adam Lock <adamlock@netscape.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@
include $(DEPTH)/config/autoconf.mk
DIRS=content
include $(topsrcdir)/config/rules.mk

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

@ -8,13 +8,19 @@
onload="setTimeout(nextTest,0);"
title="bug 293235 test">
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="application/javascript" src="docshell_helpers.js" />
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="application/javascript"><![CDATA[
const Ci = Components.interfaces;
const Cc = Components.classes;
var Ci = Components.interfaces;
var Cc = Components.classes;
Components.utils.import("resource://gre/modules/NetUtil.jsm");
// Define the generator-iterator for the tests.

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

@ -8,6 +8,12 @@
onload="setTimeout(nextTest,0);"
title="bug 298622 test">
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="application/javascript" src= "docshell_helpers.js" />
<script type="application/javascript"><![CDATA[

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

@ -8,6 +8,12 @@
onload="setTimeout(nextTest,0);"
title="bug 301397 test">
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="application/javascript" src="docshell_helpers.js" />
<script type="application/javascript"><![CDATA[

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

@ -8,6 +8,12 @@
onload="setTimeout(nextTest,0);"
title="bug 321671 test">
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="application/javascript" src="docshell_helpers.js" />
<script type="application/javascript"><![CDATA[

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

@ -8,6 +8,12 @@
onload="setTimeout(nextTest,0);"
title="bug 396649 test">
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="application/javascript" src="docshell_helpers.js" />
<script type="application/javascript"><![CDATA[

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

@ -8,6 +8,12 @@
onload="nextTestAsync();"
title="bug 582176 test">
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="application/javascript" src="docshell_helpers.js" />
<script type="application/javascript"><![CDATA[

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

@ -9,6 +9,12 @@
title="bug 89419 test">
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript" src="docshell_helpers.js" />
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>

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

@ -1873,8 +1873,8 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, void *aScope, void *aHandler
#ifdef NS_FUNCTION_TIMER
{
JSObject *obj = static_cast<JSObject *>(aHandler);
if (obj->isFunctionProxy())
obj = obj->unwrap(NULL);
if (js::IsFunctionProxy(obj))
obj = js::UnwrapObject(obj);
JSString *id = JS_GetFunctionId(static_cast<JSFunction *>(JS_GetPrivate(mContext, obj)));
JSAutoByteString bytes;
const char *name = !id ? "anonymous" : bytes.encode(mContext, id) ? bytes.ptr() : "<error>";

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

@ -50,7 +50,7 @@
function testSteps() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
let uri = SpecialPowers.getDocumentURIObject(window.document);
let uri = window.parent.SpecialPowers.getDocumentURIObject(window.document);
Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager)
.add(uri, "indexedDB",

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

@ -89,7 +89,7 @@
function testSteps() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
let uri = SpecialPowers.getDocumentURIObject(window.document);
let uri = window.parent.SpecialPowers.getDocumentURIObject(window.document);
Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager)
.add(uri, "indexedDB",

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

@ -46,7 +46,7 @@ include $(DEPTH)/config/autoconf.mk
DIRS = \
lib \
src \
test \
test/unit \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -1,50 +0,0 @@
#
# ***** 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) 2007
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# 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 = dom/tests/mochitest/ajax/scriptaculous/test
include $(DEPTH)/config/autoconf.mk
DIRS = \
unit \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -87,7 +87,7 @@ abstract public class GeckoApp
private IntentFilter mConnectivityFilter;
private BroadcastReceiver mConnectivityReceiver;
enum LaunchState {PreLaunch, Launching, WaitButton,
enum LaunchState {PreLaunch, Launching, WaitForDebugger,
Launched, GeckoRunning, GeckoExiting};
private static LaunchState sLaunchState = LaunchState.PreLaunch;
private static boolean sTryCatchAttached = false;
@ -427,21 +427,19 @@ abstract public class GeckoApp
}
final String action = intent.getAction();
if (ACTION_DEBUG.equals(action) &&
checkAndSetLaunchState(LaunchState.Launching, LaunchState.WaitButton)) {
final Button launchButton = new Button(this);
launchButton.setText("Launch"); // don't need to localize
launchButton.setOnClickListener(new Button.OnClickListener() {
public void onClick (View v) {
// hide the button so we can't be launched again
mainLayout.removeView(launchButton);
checkAndSetLaunchState(LaunchState.Launching, LaunchState.WaitForDebugger)) {
mMainHandler.postDelayed(new Runnable() {
public void run() {
Log.i(LOG_FILE_NAME, "Launching from debug intent after 5s wait");
setLaunchState(LaunchState.Launching);
launch(null);
}
});
mainLayout.addView(launchButton, 300, 200);
}, 1000 * 5 /* 5 seconds */);
Log.i(LOG_FILE_NAME, "Intent : ACTION_DEBUG - waiting 5s before launching");
return;
}
if (checkLaunchState(LaunchState.WaitButton) || launch(intent))
if (checkLaunchState(LaunchState.WaitForDebugger) || launch(intent))
return;
if (Intent.ACTION_MAIN.equals(action)) {

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

@ -279,6 +279,11 @@ public class GeckoInputConnection
if (req == null)
return null;
// Bail out here if gecko isn't running, otherwise we deadlock
// below when waiting for the reply to IME_GET_SELECTION.
if (!GeckoApp.checkLaunchState(GeckoApp.LaunchState.GeckoRunning))
return null;
//Log.d("GeckoAppJava", "IME: getExtractedText");
ExtractedText extract = new ExtractedText();

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

@ -45,11 +45,11 @@ include $(DEPTH)/config/autoconf.mk
# You'd think we could skip building ui if XUL is disabled,
# but we need to export interface headers from those directories.
DIRS = windowwatcher appstartup find webbrowserpersist commandhandler
DIRS = windowwatcher appstartup/src find webbrowserpersist commandhandler
ifdef MOZ_XUL
ifdef NS_PRINTING
DIRS += printingui
DIRS += printingui/src
endif
endif

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

@ -1,47 +0,0 @@
#
# ***** 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
# Netscape Communications, Inc.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either 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@
include $(DEPTH)/config/autoconf.mk
DIRS = src
include $(topsrcdir)/config/rules.mk

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

@ -1,50 +0,0 @@
#! gmake
#
# ***** 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
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2000
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Stuart Parmenter <pavlov@netscape.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either 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@
include $(DEPTH)/config/autoconf.mk
DIRS = src
include $(topsrcdir)/config/rules.mk

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

@ -1,42 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: Mozilla-sample-code 1.0
#
# Copyright (c) 2002 Netscape Communications Corporation and
# other contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this Mozilla sample software and associated documentation files
# (the "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# Contributor(s):
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
ifeq ($(OS_ARCH),WINNT)
DIRS = winEmbed
endif
include $(topsrcdir)/config/rules.mk

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

@ -45,7 +45,7 @@ MODULE = spellchecker
DIRS = idl locales hunspell src
ifdef ENABLE_TESTS
DIRS += tests
DIRS += tests/chrome
endif
include $(topsrcdir)/config/rules.mk

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

@ -1,48 +0,0 @@
#
# ***** 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
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# 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 = extensions/spellcheck/tests
include $(DEPTH)/config/autoconf.mk
DIRS = chrome
include $(topsrcdir)/config/rules.mk

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

@ -532,6 +532,9 @@ public:
ThebesLayer::ComputeEffectiveTransforms(aTransformToSurface);
}
// Sync front/back buffers content
virtual void SyncFrontBufferToBackBuffer() {}
protected:
BasicLayerManager* BasicManager()
{
@ -656,6 +659,7 @@ BasicThebesLayer::PaintThebes(gfxContext* aContext,
if (aReadback && UsedForReadback()) {
aReadback->GetThebesLayerUpdates(this, &readbackUpdates);
}
SyncFrontBufferToBackBuffer();
bool canUseOpaqueSurface = CanUseOpaqueSurface();
Buffer::ContentType contentType =
@ -2154,13 +2158,13 @@ public:
BasicShadowableThebesLayer(BasicShadowLayerManager* aManager)
: BasicThebesLayer(aManager)
, mIsNewBuffer(false)
, mFrontAndBackBufferDiffer(false)
{
MOZ_COUNT_CTOR(BasicShadowableThebesLayer);
}
virtual ~BasicShadowableThebesLayer()
{
if (IsSurfaceDescriptorValid(mBackBuffer))
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(&mBackBuffer);
DestroyBackBuffer();
MOZ_COUNT_DTOR(BasicShadowableThebesLayer);
}
@ -2173,7 +2177,7 @@ public:
virtual ShadowableLayer* AsShadowableLayer() { return this; }
virtual bool MustRetainContent() { return HasShadow(); }
void SetBackBufferAndAttrs(const ThebesBuffer& aBuffer,
void SetBackBufferAndAttrs(const OptionalThebesBuffer& aBuffer,
const nsIntRegion& aValidRegion,
const OptionalThebesBuffer& aReadOnlyFrontBuffer,
const nsIntRegion& aFrontUpdatedRegion);
@ -2186,6 +2190,8 @@ public:
virtual BasicShadowableThebesLayer* AsThebes() { return this; }
virtual void SyncFrontBufferToBackBuffer();
private:
BasicShadowLayerManager* BasicManager()
{
@ -2204,46 +2210,89 @@ private:
NS_OVERRIDE virtual already_AddRefed<gfxASurface>
CreateBuffer(Buffer::ContentType aType, const nsIntSize& aSize);
void DestroyBackBuffer()
{
if (IsSurfaceDescriptorValid(mBackBuffer)) {
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(&mBackBuffer);
}
}
// This describes the gfxASurface we hand to mBuffer. We keep a
// copy of the descriptor here so that we can call
// DestroySharedSurface() on the descriptor.
SurfaceDescriptor mBackBuffer;
nsIntRect mBackBufferRect;
nsIntPoint mBackBufferRectRotation;
bool mIsNewBuffer;
OptionalThebesBuffer mROFrontBuffer;
nsIntRegion mFrontUpdatedRegion;
nsIntRegion mFrontValidRegion;
PRPackedBool mFrontAndBackBufferDiffer;
};
void
BasicShadowableThebesLayer::SetBackBufferAndAttrs(const ThebesBuffer& aBuffer,
BasicShadowableThebesLayer::SetBackBufferAndAttrs(const OptionalThebesBuffer& aBuffer,
const nsIntRegion& aValidRegion,
const OptionalThebesBuffer& aReadOnlyFrontBuffer,
const nsIntRegion& aFrontUpdatedRegion)
{
mBackBuffer = aBuffer.buffer();
nsRefPtr<gfxASurface> backBuffer = BasicManager()->OpenDescriptor(mBackBuffer);
if (OptionalThebesBuffer::Tnull_t == aBuffer.type()) {
mBackBuffer = SurfaceDescriptor();
} else {
mBackBuffer = aBuffer.get_ThebesBuffer().buffer();
mBackBufferRect = aBuffer.get_ThebesBuffer().rect();
mBackBufferRectRotation = aBuffer.get_ThebesBuffer().rotation();
}
mFrontAndBackBufferDiffer = true;
mROFrontBuffer = aReadOnlyFrontBuffer;
mFrontUpdatedRegion = aFrontUpdatedRegion;
mFrontValidRegion = aValidRegion;
}
if (OptionalThebesBuffer::Tnull_t == aReadOnlyFrontBuffer.type()) {
void
BasicShadowableThebesLayer::SyncFrontBufferToBackBuffer()
{
if (!mFrontAndBackBufferDiffer) {
return;
}
nsRefPtr<gfxASurface> backBuffer;
if (!IsSurfaceDescriptorValid(mBackBuffer)) {
NS_ABORT_IF_FALSE(mROFrontBuffer.type() == OptionalThebesBuffer::TThebesBuffer,
"should have a front RO buffer by now");
const ThebesBuffer roFront = mROFrontBuffer.get_ThebesBuffer();
nsRefPtr<gfxASurface> roFrontBuffer = BasicManager()->OpenDescriptor(roFront.buffer());
backBuffer = CreateBuffer(roFrontBuffer->GetContentType(), roFrontBuffer->GetSize());
} else {
backBuffer = BasicManager()->OpenDescriptor(mBackBuffer);
}
mFrontAndBackBufferDiffer = false;
if (OptionalThebesBuffer::Tnull_t == mROFrontBuffer.type()) {
// We didn't get back a read-only ref to our old back buffer (the
// parent's new front buffer). If the parent is pushing updates
// to a texture it owns, then we probably got back the same buffer
// we pushed in the update and all is well. If not, ...
mValidRegion = aValidRegion;
mBuffer.SetBackingBuffer(backBuffer, aBuffer.rect(), aBuffer.rotation());
mValidRegion = mFrontValidRegion;
mBuffer.SetBackingBuffer(backBuffer, mBackBufferRect, mBackBufferRectRotation);
return;
}
MOZ_LAYERS_LOG(("BasicShadowableThebes(%p): reading back <x=%d,y=%d,w=%d,h=%d>",
this,
aFrontUpdatedRegion.GetBounds().x,
aFrontUpdatedRegion.GetBounds().y,
aFrontUpdatedRegion.GetBounds().width,
aFrontUpdatedRegion.GetBounds().height));
mFrontUpdatedRegion.GetBounds().x,
mFrontUpdatedRegion.GetBounds().y,
mFrontUpdatedRegion.GetBounds().width,
mFrontUpdatedRegion.GetBounds().height));
const ThebesBuffer roFront = aReadOnlyFrontBuffer.get_ThebesBuffer();
const ThebesBuffer roFront = mROFrontBuffer.get_ThebesBuffer();
nsRefPtr<gfxASurface> roFrontBuffer = BasicManager()->OpenDescriptor(roFront.buffer());
mBuffer.SetBackingBufferAndUpdateFrom(
backBuffer,
roFrontBuffer, roFront.rect(), roFront.rotation(),
aFrontUpdatedRegion);
mFrontUpdatedRegion);
mIsNewBuffer = false;
// Now the new back buffer has the same (interesting) pixels as the
// new front buffer, and mValidRegion et al. are correct wrt the new
// back buffer (i.e. as they were for the old back buffer)
@ -2305,36 +2354,21 @@ BasicShadowableThebesLayer::CreateBuffer(Buffer::ContentType aType,
aSize.width, aSize.height));
if (IsSurfaceDescriptorValid(mBackBuffer)) {
BasicManager()->DestroyedThebesBuffer(BasicManager()->Hold(this),
mBackBuffer);
mBackBuffer = SurfaceDescriptor();
}
// XXX error handling
SurfaceDescriptor tmpFront;
if (BasicManager()->ShouldDoubleBuffer()) {
if (!BasicManager()->AllocDoubleBuffer(gfxIntSize(aSize.width, aSize.height),
aType,
&tmpFront,
&mBackBuffer)) {
if (!BasicManager()->AllocBuffer(gfxIntSize(aSize.width, aSize.height),
aType,
&mBackBuffer)) {
NS_RUNTIMEABORT("creating ThebesLayer 'back buffer' failed!");
}
} else {
if (!BasicManager()->AllocBuffer(gfxIntSize(aSize.width, aSize.height),
aType,
&mBackBuffer)) {
NS_RUNTIMEABORT("creating ThebesLayer 'back buffer' failed!");
}
}
NS_ABORT_IF_FALSE(!mIsNewBuffer,
"Bad! Did we create a buffer twice without painting?");
mIsNewBuffer = true;
BasicManager()->CreatedThebesBuffer(BasicManager()->Hold(this),
nsIntRegion(),
nsIntRect(),
tmpFront);
return BasicManager()->OpenDescriptor(mBackBuffer);
}
@ -2681,9 +2715,6 @@ public:
MOZ_COUNT_DTOR(BasicShadowThebesLayer);
}
virtual void SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion);
virtual void SetValidRegion(const nsIntRegion& aRegion)
{
mOldValidRegion = mValidRegion;
@ -2698,7 +2729,7 @@ public:
virtual void
Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion);
virtual void DestroyFrontBuffer()
@ -2709,6 +2740,7 @@ public:
if (IsSurfaceDescriptorValid(mFrontBufferDescriptor)) {
mAllocator->DestroySharedSurface(&mFrontBufferDescriptor);
mFrontBufferDescriptor = SurfaceDescriptor();
}
}
@ -2733,48 +2765,46 @@ private:
nsIntRegion mOldValidRegion;
};
void
BasicShadowThebesLayer::SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion)
{
mValidRegion = mOldValidRegion = aValidRegion;
NS_ABORT_IF_FALSE(OptionalThebesBuffer::Tnull_t != aNewFront.type(),
"aNewFront must be valid here!");
const ThebesBuffer newFront = aNewFront.get_ThebesBuffer();
nsRefPtr<gfxASurface> newFrontBuffer =
BasicManager()->OpenDescriptor(newFront.buffer());
nsRefPtr<gfxASurface> unused;
nsIntRect unusedRect;
nsIntPoint unusedRotation;
mFrontBuffer.Swap(newFrontBuffer, newFront.rect(), newFront.rotation(),
getter_AddRefs(unused), &unusedRect, &unusedRotation);
mFrontBufferDescriptor = newFront.buffer();
}
void
BasicShadowThebesLayer::Swap(const ThebesBuffer& aNewFront,
const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack,
OptionalThebesBuffer* aNewBack,
nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront,
nsIntRegion* aFrontUpdatedRegion)
{
nsRefPtr<gfxASurface> newFrontBuffer =
BasicManager()->OpenDescriptor(aNewFront.buffer());
if (IsSurfaceDescriptorValid(mFrontBufferDescriptor)) {
nsRefPtr<gfxASurface> currentFront = BasicManager()->OpenDescriptor(mFrontBufferDescriptor);
if (currentFront->GetSize() != newFrontBuffer->GetSize()) {
// Current front buffer is obsolete
DestroyFrontBuffer();
}
}
// This code relies on Swap() arriving *after* attribute mutations.
aNewBack->buffer() = mFrontBufferDescriptor;
if (IsSurfaceDescriptorValid(mFrontBufferDescriptor)) {
*aNewBack = ThebesBuffer();
aNewBack->get_ThebesBuffer().buffer() = mFrontBufferDescriptor;
} else {
*aNewBack = null_t();
}
// We have to invalidate the pixels painted into the new buffer.
// They might overlap with our old pixels.
aNewBackValidRegion->Sub(mOldValidRegion, aUpdatedRegion);
nsRefPtr<gfxASurface> newFrontBuffer =
BasicManager()->OpenDescriptor(aNewFront.buffer());
nsRefPtr<gfxASurface> unused;
nsIntRect backRect;
nsIntPoint backRotation;
mFrontBuffer.Swap(
newFrontBuffer, aNewFront.rect(), aNewFront.rotation(),
getter_AddRefs(unused), &aNewBack->rect(), &aNewBack->rotation());
getter_AddRefs(unused), &backRect, &backRotation);
if (aNewBack->type() != OptionalThebesBuffer::Tnull_t) {
aNewBack->get_ThebesBuffer().rect() = backRect;
aNewBack->get_ThebesBuffer().rotation() = backRotation;
}
mFrontBufferDescriptor = aNewFront.buffer();

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

@ -729,11 +729,6 @@ LayerManagerD3D10::Render()
windowLayer = new WindowLayer(this);
windowLayer->SetShadow(ConstructShadowFor(windowLayer));
CreatedThebesLayer(windowLayer);
ShadowLayerForwarder::CreatedThebesBuffer(windowLayer,
contentRect,
contentRect,
SurfaceDescriptor());
mRootForShadowTree->InsertAfter(windowLayer, nsnull);
ShadowLayerForwarder::InsertAfter(mRootForShadowTree, windowLayer);
}

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

@ -469,18 +469,10 @@ ShadowThebesLayerD3D10::~ShadowThebesLayerD3D10()
{
}
void
ShadowThebesLayerD3D10::SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion)
{
NS_ABORT_IF_FALSE(OptionalThebesBuffer::Tnull_t == aNewFront.type(),
"Expected dummy front buffer initially");
}
void
ShadowThebesLayerD3D10::Swap(
const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion)
{
nsRefPtr<ID3D10Texture2D> newBackBuffer = mTexture;
@ -490,7 +482,7 @@ ShadowThebesLayerD3D10::Swap(
// The content process tracks back/front buffers on its own, so
// the newBack is in essence unused.
aNewBack->buffer() = aNewFront.buffer();
aNewBack->get_ThebesBuffer().buffer() = aNewFront.buffer();
// The content process doesn't need to read back from the front
// buffer (yet).

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

@ -108,12 +108,9 @@ public:
ShadowThebesLayerD3D10(LayerManagerD3D10* aManager);
virtual ~ShadowThebesLayerD3D10();
// ShadowThebesLayer impl
virtual void SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion);
virtual void
Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion);
virtual void DestroyFrontBuffer();

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

@ -619,25 +619,17 @@ ShadowThebesLayerD3D9::~ShadowThebesLayerD3D9()
{}
void
ShadowThebesLayerD3D9::SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion)
ShadowThebesLayerD3D9::Swap(const ThebesBuffer& aNewFront,
const nsIntRegion& aUpdatedRegion,
OptionalThebesBuffer* aNewBack,
nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront,
nsIntRegion* aFrontUpdatedRegion)
{
if (!mBuffer) {
mBuffer = new ShadowBufferD3D9(this);
}
NS_ASSERTION(OptionalThebesBuffer::Tnull_t == aNewFront.type(),
"Only one system-memory buffer expected");
}
void
ShadowThebesLayerD3D9::Swap(const ThebesBuffer& aNewFront,
const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack,
nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront,
nsIntRegion* aFrontUpdatedRegion)
{
if (mBuffer) {
nsRefPtr<gfxASurface> surf = ShadowLayerForwarder::OpenDescriptor(aNewFront.buffer());
mBuffer->Upload(surf, GetVisibleRegion().GetBounds());

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

@ -120,12 +120,9 @@ public:
ShadowThebesLayerD3D9(LayerManagerD3D9 *aManager);
virtual ~ShadowThebesLayerD3D9();
// ShadowThebesLayer impl
virtual void SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion);
virtual void
Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion);
virtual void DestroyFrontBuffer();

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

@ -109,17 +109,6 @@ union CanvasSurface {
null_t;
};
// For the "buffer creation" operations, we send an initial front
// buffer that only contains (transparent) black pixels just so that
// we can swap it back after the first OpPaint without a special case.
struct OpCreateThebesBuffer {
PLayer layer;
OptionalThebesBuffer initialFront;
nsIntRegion frontValidRegion;
};
struct OpDestroyThebesFrontBuffer { PLayer layer; };
// Change a layer's attributes
struct CommonLayerAttributes {
nsIntRegion visibleRegion;
@ -194,8 +183,6 @@ union Edit {
OpCreateImageLayer;
OpCreateColorLayer;
OpCreateCanvasLayer;
OpCreateThebesBuffer;
OpDestroyThebesFrontBuffer;
OpSetLayerAttributes;
@ -217,7 +204,7 @@ struct OpImageSwap { PLayer layer; SharedImage newBackImage; };
struct OpThebesBufferSwap {
PLayer layer;
ThebesBuffer newBackBuffer;
OptionalThebesBuffer newBackBuffer;
nsIntRegion newValidRegion;
// If the parent took the child's old back buffer and returned its
// old front buffer, |readOnlyFrontBuffer| may (if non-null) contain

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

@ -184,31 +184,6 @@ ShadowLayerForwarder::CreatedCanvasLayer(ShadowableLayer* aCanvas)
CreatedLayer<OpCreateCanvasLayer>(mTxn, aCanvas);
}
void
ShadowLayerForwarder::CreatedThebesBuffer(ShadowableLayer* aThebes,
const nsIntRegion& aFrontValidRegion,
const nsIntRect& aBufferRect,
const SurfaceDescriptor& aTempFrontBuffer)
{
OptionalThebesBuffer buffer = null_t();
if (IsSurfaceDescriptorValid(aTempFrontBuffer)) {
buffer = ThebesBuffer(aTempFrontBuffer,
aBufferRect,
nsIntPoint(0, 0));
}
mTxn->AddEdit(OpCreateThebesBuffer(NULL, Shadow(aThebes),
buffer,
aFrontValidRegion));
}
void
ShadowLayerForwarder::DestroyedThebesBuffer(ShadowableLayer* aThebes,
const SurfaceDescriptor& aBackBufferToDestroy)
{
mTxn->AddEdit(OpDestroyThebesFrontBuffer(NULL, Shadow(aThebes)));
mTxn->AddBufferToDestroy(aBackBufferToDestroy);
}
void
ShadowLayerForwarder::Mutated(ShadowableLayer* aMutant)
{

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

@ -140,38 +140,6 @@ public:
void CreatedColorLayer(ShadowableLayer* aColor);
void CreatedCanvasLayer(ShadowableLayer* aCanvas);
/**
* Notify the shadow manager that a buffer has been created for the
* specificed layer. |aInitialFrontSurface| is one of the newly
* created, transparent black buffers for the layer; the "real"
* layer holds on to the other as its back buffer. We send it
* across on buffer creation to avoid special cases in the buffer
* swapping logic for Painted*() operations.
*
* It is expected that Created*Buffer() will be followed by a
* Painted*Buffer() in the same transaction, so that
* |aInitialFrontBuffer| is never actually drawn to screen. It is
* OK if it is drawn though.
*/
/**
* |aBufferRect| is the screen rect covered by |aInitialFrontBuffer|.
*/
void CreatedThebesBuffer(ShadowableLayer* aThebes,
const nsIntRegion& aFrontValidRegion,
const nsIntRect& aBufferRect,
const SurfaceDescriptor& aInitialFrontBuffer);
/**
* The specified layer is destroying its buffers.
* |aBackBufferToDestroy| is deallocated when this transaction is
* posted to the parent. During the parent-side transaction, the
* shadow is told to destroy its front buffer. This can happen when
* a new front/back buffer pair have been created because of a layer
* resize, e.g.
*/
void DestroyedThebesBuffer(ShadowableLayer* aThebes,
const SurfaceDescriptor& aBackBufferToDestroy);
/**
* At least one attribute of |aMutant| has changed, and |aMutant|
* needs to sync to its shadow layer. This initial implementation
@ -506,15 +474,6 @@ class ShadowThebesLayer : public ShadowLayer,
public ThebesLayer
{
public:
/**
* CONSTRUCTION PHASE ONLY
*
* Override the front buffer and its valid region with the specified
* values. This is called when a new buffer has been created.
*/
virtual void SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion) = 0;
virtual void InvalidateRegion(const nsIntRegion& aRegion)
{
NS_RUNTIMEABORT("ShadowThebesLayers can't fill invalidated regions");
@ -538,7 +497,7 @@ public:
*/
virtual void
Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion) = 0;
/**

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

@ -203,29 +203,7 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
AsShadowLayer(edit.get_OpCreateCanvasLayer())->Bind(layer);
break;
}
case Edit::TOpCreateThebesBuffer: {
MOZ_LAYERS_LOG(("[ParentSide] CreateThebesBuffer"));
const OpCreateThebesBuffer& otb = edit.get_OpCreateThebesBuffer();
ShadowThebesLayer* thebes = static_cast<ShadowThebesLayer*>(
AsShadowLayer(otb)->AsLayer());
thebes->SetFrontBuffer(otb.initialFront(), otb.frontValidRegion());
break;
}
case Edit::TOpDestroyThebesFrontBuffer: {
MOZ_LAYERS_LOG(("[ParentSide] DestroyThebesFrontBuffer"));
const OpDestroyThebesFrontBuffer& odfb =
edit.get_OpDestroyThebesFrontBuffer();
ShadowThebesLayer* thebes = static_cast<ShadowThebesLayer*>(
AsShadowLayer(odfb)->AsLayer());
thebes->DestroyFrontBuffer();
break;
}
// Attributes
case Edit::TOpSetLayerAttributes: {
MOZ_LAYERS_LOG(("[ParentSide] SetLayerAttributes"));
@ -339,7 +317,7 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
static_cast<ShadowThebesLayer*>(shadow->AsLayer());
const ThebesBuffer& newFront = op.newFrontBuffer();
ThebesBuffer newBack;
OptionalThebesBuffer newBack;
nsIntRegion newValidRegion;
OptionalThebesBuffer readonlyFront;
nsIntRegion frontUpdatedRegion;

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

@ -878,31 +878,18 @@ ShadowThebesLayerOGL::ShadowThebesLayerOGL(LayerManagerOGL *aManager)
ShadowThebesLayerOGL::~ShadowThebesLayerOGL()
{}
void
ShadowThebesLayerOGL::SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion)
{
if (mDestroyed) {
return;
}
if (!mBuffer) {
mBuffer = new ShadowBufferOGL(this);
}
NS_ASSERTION(OptionalThebesBuffer::Tnull_t == aNewFront.type(),
"Only one system-memory buffer expected");
}
void
ShadowThebesLayerOGL::Swap(const ThebesBuffer& aNewFront,
const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack,
OptionalThebesBuffer* aNewBack,
nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront,
nsIntRegion* aFrontUpdatedRegion)
{
if (!mDestroyed && mBuffer) {
if (!mDestroyed) {
if (!mBuffer) {
mBuffer = new ShadowBufferOGL(this);
}
nsRefPtr<gfxASurface> surf = ShadowLayerForwarder::OpenDescriptor(aNewFront.buffer());
mBuffer->Upload(surf, aUpdatedRegion, aNewFront.rect(), aNewFront.rotation());
}

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

@ -91,12 +91,9 @@ public:
ShadowThebesLayerOGL(LayerManagerOGL *aManager);
virtual ~ShadowThebesLayerOGL();
// ShadowThebesLayer impl
virtual void SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion);
virtual void
Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion);
virtual void DestroyFrontBuffer();

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

@ -44,6 +44,7 @@
class nsHyphenator;
class nsIAtom;
class nsIURI;
class nsHyphenationManager
{
@ -65,7 +66,7 @@ protected:
void LoadAliases();
nsInterfaceHashtable<nsISupportsHashKey,nsIAtom> mHyphAliases;
nsInterfaceHashtable<nsISupportsHashKey,nsIFile> mPatternFiles;
nsInterfaceHashtable<nsISupportsHashKey,nsIURI> mPatternFiles;
nsRefPtrHashtable<nsISupportsHashKey,nsHyphenator> mHyphenators;
static nsHyphenationManager *sInstance;

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

@ -42,12 +42,13 @@
#include "nsString.h"
#include "nsTArray.h"
class nsIURI;
class nsIUGenCategory;
class nsHyphenator
{
public:
nsHyphenator(nsIFile *aFile);
nsHyphenator(nsIURI *aURI);
NS_INLINE_DECL_REFCOUNTING(nsHyphenator)

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

@ -39,10 +39,12 @@
#include "nsHyphenator.h"
#include "nsIAtom.h"
#include "nsIFile.h"
#include "nsIURI.h"
#include "nsIProperties.h"
#include "nsISimpleEnumerator.h"
#include "nsIDirectoryEnumerator.h"
#include "nsDirectoryServiceDefs.h"
#include "nsNetUtil.h"
#include "nsUnicharUtils.h"
#include "mozilla/Preferences.h"
@ -89,20 +91,20 @@ nsHyphenationManager::GetHyphenator(nsIAtom *aLocale)
if (hyph) {
return hyph.forget();
}
nsCOMPtr<nsIFile> file = mPatternFiles.Get(aLocale);
if (!file) {
nsCOMPtr<nsIURI> uri = mPatternFiles.Get(aLocale);
if (!uri) {
nsCOMPtr<nsIAtom> alias = mHyphAliases.Get(aLocale);
if (alias) {
mHyphenators.Get(alias, getter_AddRefs(hyph));
if (hyph) {
return hyph.forget();
}
file = mPatternFiles.Get(alias);
if (file) {
uri = mPatternFiles.Get(alias);
if (uri) {
aLocale = alias;
}
}
if (!file) {
if (!uri) {
// In the case of a locale such as "de-DE-1996", we try replacing
// successive trailing subtags with "-*" to find fallback patterns,
// so "de-DE-1996" -> "de-DE-*" (and then recursively -> "de-*")
@ -120,14 +122,14 @@ nsHyphenationManager::GetHyphenator(nsIAtom *aLocale)
}
}
}
hyph = new nsHyphenator(file);
hyph = new nsHyphenator(uri);
if (hyph->IsValid()) {
mHyphenators.Put(aLocale, hyph);
return hyph.forget();
}
#ifdef DEBUG
nsCString msg;
file->GetNativePath(msg);
uri->GetSpec(msg);
msg.Insert("failed to load patterns from ", 0);
NS_WARNING(msg.get());
#endif
@ -219,7 +221,11 @@ nsHyphenationManager::LoadPatternListFromDir(nsIFile *aDir)
NS_ConvertUTF16toUTF8(dictName).get());
#endif
nsCOMPtr<nsIAtom> localeAtom = do_GetAtom(locale);
mPatternFiles.Put(localeAtom, file);
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewFileURI(getter_AddRefs(uri), file);
if (NS_SUCCEEDED(rv)) {
mPatternFiles.Put(localeAtom, uri);
}
}
}

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

@ -40,22 +40,22 @@
#include "nsUTF8Utils.h"
#include "nsIUGenCategory.h"
#include "nsUnicharUtilCIID.h"
#include "nsNetUtil.h"
#include "nsIURI.h"
#include "hyphen.h"
nsHyphenator::nsHyphenator(nsIFile *aFile)
nsHyphenator::nsHyphenator(nsIURI *aURI)
: mDict(nsnull)
{
nsCString urlSpec;
nsresult rv = NS_GetURLSpecFromFile(aFile, urlSpec);
nsCString uriSpec;
nsresult rv = aURI->GetSpec(uriSpec);
if (NS_FAILED(rv)) {
return;
}
mDict = hnj_hyphen_load(urlSpec.get());
mDict = hnj_hyphen_load(uriSpec.get());
#ifdef DEBUG
if (mDict) {
printf("loaded hyphenation patterns from %s\n", urlSpec.get());
printf("loaded hyphenation patterns from %s\n", uriSpec.get());
}
#endif
mCategories = do_GetService(NS_UNICHARCATEGORY_CONTRACTID, &rv);

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

@ -1,49 +0,0 @@
# ***** 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 the Mozilla Browser code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Jason Orendorff <jorendorff@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either 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@
include $(topsrcdir)/config/config.mk
PARALLEL_DIRS += \
debugger \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -648,8 +648,6 @@ JSRuntime::JSRuntime()
protoHazardShape(0),
gcSystemAvailableChunkListHead(NULL),
gcUserAvailableChunkListHead(NULL),
gcEmptyChunkListHead(NULL),
gcEmptyChunkCount(0),
gcKeepAtoms(0),
gcBytes(0),
gcTriggerBytes(0),
@ -2792,9 +2790,9 @@ JS_GetGCParameter(JSRuntime *rt, JSGCParamKey key)
case JSGC_MODE:
return uint32(rt->gcMode);
case JSGC_UNUSED_CHUNKS:
return uint32(rt->gcEmptyChunkCount);
return uint32(rt->gcChunkPool.getEmptyCount());
case JSGC_TOTAL_CHUNKS:
return uint32(rt->gcChunkSet.count() + rt->gcEmptyChunkCount);
return uint32(rt->gcChunkSet.count() + rt->gcChunkPool.getEmptyCount());
default:
JS_ASSERT(key == JSGC_NUMBER);
return rt->gcNumber;
@ -4850,7 +4848,7 @@ CompileUCFunctionForPrincipalsCommon(JSContext *cx, JSObject *obj,
chars, length, filename, lineno, version)) {
return NULL;
}
if (obj && funAtom &&
!obj->defineProperty(cx, ATOM_TO_JSID(funAtom), ObjectValue(*fun),
NULL, NULL, JSPROP_ENUMERATE)) {

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

@ -2855,7 +2855,7 @@ typedef enum JSGCParamKey {
/* Select GC mode. */
JSGC_MODE = 6,
/* Number of GC chunks waiting to expire. */
/* Number of cached empty GC chunks. */
JSGC_UNUSED_CHUNKS = 7,
/* Total number of allocated GC chunks. */

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

@ -476,10 +476,10 @@ js_DestroyContext(JSContext *cx, JSDestroyContextMode mode)
) {
JS_ASSERT(!rt->gcRunning);
JS_UNLOCK_GC(rt);
#ifdef JS_THREADSAFE
rt->gcHelperThread.waitBackgroundSweepEnd(rt);
rt->gcHelperThread.waitBackgroundSweepEnd();
#endif
JS_UNLOCK_GC(rt);
if (last) {
#ifdef JS_THREADSAFE
@ -559,10 +559,10 @@ js_DestroyContext(JSContext *cx, JSDestroyContextMode mode)
js_ClearContextThread(cx);
JS_ASSERT_IF(JS_CLIST_IS_EMPTY(&t->contextList), !t->data.requestDepth);
#endif
JS_UNLOCK_GC(rt);
#ifdef JS_THREADSAFE
rt->gcHelperThread.waitBackgroundSweepEnd(rt);
rt->gcHelperThread.waitBackgroundSweepEnd();
#endif
JS_UNLOCK_GC(rt);
Foreground::delete_(cx);
}
@ -1177,7 +1177,10 @@ js_InvokeOperationCallback(JSContext *cx)
* We have to wait until the background thread is done in order
* to get a correct answer.
*/
rt->gcHelperThread.waitBackgroundSweepEnd(rt);
{
AutoLockGC lock(rt);
rt->gcHelperThread.waitBackgroundSweepEnd();
}
if (checkOutOfMemory(rt)) {
js_ReportOutOfMemory(cx);
return false;
@ -1518,8 +1521,17 @@ JSRuntime::onTooMuchMalloc()
JS_FRIEND_API(void *)
JSRuntime::onOutOfMemory(void *p, size_t nbytes, JSContext *cx)
{
/*
* Retry when we are done with the background sweeping and have stopped
* all the allocations and released the empty GC chunks.
*/
{
#ifdef JS_THREADSAFE
gcHelperThread.waitBackgroundSweepEnd(this);
AutoLockGC lock(this);
gcHelperThread.waitBackgroundSweepOrAllocEnd();
#endif
gcChunkPool.expire(this, true);
}
if (!p)
p = OffTheBooks::malloc_(nbytes);
else if (p == reinterpret_cast<void *>(1))
@ -1528,7 +1540,6 @@ JSRuntime::onOutOfMemory(void *p, size_t nbytes, JSContext *cx)
p = OffTheBooks::realloc_(p, nbytes);
if (p)
return p;
#endif
if (cx)
js_ReportOutOfMemory(cx);
return NULL;

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

@ -411,14 +411,7 @@ struct JSRuntime {
*/
js::gc::Chunk *gcSystemAvailableChunkListHead;
js::gc::Chunk *gcUserAvailableChunkListHead;
/*
* Singly-linked list of empty chunks and its length. We use the list not
* to release empty chunks immediately so they can be used for future
* allocations. This avoids very high overhead of chunk release/allocation.
*/
js::gc::Chunk *gcEmptyChunkListHead;
size_t gcEmptyChunkCount;
js::gc::ChunkPool gcChunkPool;
js::RootedValueMap gcRootsHash;
js::GCLocks gcLocksHash;

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

@ -414,8 +414,138 @@ FinalizeArenas(JSContext *cx, ArenaLists::ArenaList *al, AllocKind thingKind)
}
}
} /* namespace gc */
} /* namespace js */
#ifdef JS_THREADSAFE
inline bool
ChunkPool::wantBackgroundAllocation(JSRuntime *rt) const
{
/*
* To minimize memory waste we do not want to run the background chunk
* allocation if we have empty chunks or when the runtime needs just few
* of them.
*/
return rt->gcHelperThread.canBackgroundAllocate() &&
emptyCount == 0 &&
rt->gcChunkSet.count() >= 4;
}
#endif
/* Must be called with the GC lock taken. */
inline Chunk *
ChunkPool::get(JSRuntime *rt)
{
JS_ASSERT(this == &rt->gcChunkPool);
Chunk *chunk = emptyChunkListHead;
if (chunk) {
JS_ASSERT(emptyCount);
emptyChunkListHead = chunk->info.next;
--emptyCount;
} else {
JS_ASSERT(!emptyCount);
chunk = Chunk::allocate();
if (!chunk)
return NULL;
}
JS_ASSERT(chunk->unused());
JS_ASSERT(!rt->gcChunkSet.has(chunk));
#ifdef JS_THREADSAFE
if (wantBackgroundAllocation(rt))
rt->gcHelperThread.startBackgroundAllocationIfIdle();
#endif
return chunk;
}
/* Must be called either during the GC or with the GC lock taken. */
inline void
ChunkPool::put(JSRuntime *rt, Chunk *chunk)
{
JS_ASSERT(this == &rt->gcChunkPool);
size_t initialAge = 0;
#ifdef JS_THREADSAFE
/*
* When we have not yet started the background finalization, we must keep
* empty chunks until we are done with all the sweeping and finalization
* that cannot be done in the background even if shouldShrink() is true.
* This way we can safely call IsAboutToBeFinalized and Cell::isMarked for
* finalized GC things in empty chunks. So we only release the chunk if we
* are called from the background thread.
*/
if (rt->gcHelperThread.sweeping()) {
if (rt->gcHelperThread.shouldShrink()) {
Chunk::release(chunk);
return;
}
/*
* Set the age to one as we expire chunks early during the background
* sweep so this chunk already survived one GC cycle.
*/
initialAge = 1;
}
#endif
chunk->info.age = initialAge;
chunk->info.next = emptyChunkListHead;
emptyChunkListHead = chunk;
emptyCount++;
}
/* Must be called either during the GC or with the GC lock taken. */
void
ChunkPool::expire(JSRuntime *rt, bool releaseAll)
{
JS_ASSERT(this == &rt->gcChunkPool);
/*
* Return old empty chunks to the system while preserving the order of
* other chunks in the list. This way, if the GC runs several times
* without emptying the list, the older chunks will stay at the tail
* and are more likely to reach the max age.
*/
for (Chunk **chunkp = &emptyChunkListHead; *chunkp; ) {
JS_ASSERT(emptyCount);
Chunk *chunk = *chunkp;
JS_ASSERT(chunk->unused());
JS_ASSERT(!rt->gcChunkSet.has(chunk));
JS_ASSERT(chunk->info.age <= MAX_EMPTY_CHUNK_AGE);
if (releaseAll || chunk->info.age == MAX_EMPTY_CHUNK_AGE) {
*chunkp = chunk->info.next;
--emptyCount;
Chunk::release(chunk);
} else {
/* Keep the chunk but increase its age. */
++chunk->info.age;
chunkp = &chunk->info.next;
}
}
JS_ASSERT_IF(releaseAll, !emptyCount);
}
/* static */ Chunk *
Chunk::allocate()
{
Chunk *chunk = static_cast<Chunk *>(AllocGCChunk());
if (!chunk)
return NULL;
chunk->init();
#ifdef MOZ_GCTIMER
JS_ATOMIC_INCREMENT(&newChunkCount);
#endif
return chunk;
}
/* static */ inline void
Chunk::release(Chunk *chunk)
{
JS_ASSERT(chunk);
#ifdef MOZ_GCTIMER
JS_ATOMIC_INCREMENT(&destroyChunkCount);
#endif
FreeGCChunk(chunk);
}
void
Chunk::init()
@ -511,7 +641,7 @@ Chunk::releaseArena(ArenaHeader *aheader)
JSRuntime *rt = comp->rt;
#ifdef JS_THREADSAFE
AutoLockGC maybeLock;
if (rt->gcHelperThread.sweeping)
if (rt->gcHelperThread.sweeping())
maybeLock.lock(rt);
#endif
@ -519,7 +649,7 @@ Chunk::releaseArena(ArenaHeader *aheader)
JS_ASSERT(size_t(rt->gcBytes) >= ArenaSize);
JS_ASSERT(size_t(comp->gcBytes) >= ArenaSize);
#ifdef JS_THREADSAFE
if (rt->gcHelperThread.sweeping) {
if (rt->gcHelperThread.sweeping()) {
rt->reduceGCTriggerBytes(GC_HEAP_GROWTH_FACTOR * ArenaSize);
comp->reduceGCTriggerBytes(GC_HEAP_GROWTH_FACTOR * ArenaSize);
}
@ -540,40 +670,12 @@ Chunk::releaseArena(ArenaHeader *aheader)
} else {
rt->gcChunkSet.remove(this);
removeFromAvailableList();
/*
* We keep empty chunks until we are done with finalization to allow
* calling IsAboutToBeFinalized/Cell::isMarked for finalized GC things
* in empty chunks. So we add the chunk to the empty set even during
* GC_SHRINK.
*/
info.age = 0;
info.next = rt->gcEmptyChunkListHead;
rt->gcEmptyChunkListHead = this;
rt->gcEmptyChunkCount++;
rt->gcChunkPool.put(rt, this);
}
}
inline Chunk *
AllocateGCChunk(JSRuntime *rt)
{
Chunk *p = static_cast<Chunk *>(AllocGCChunk());
#ifdef MOZ_GCTIMER
if (p)
JS_ATOMIC_INCREMENT(&newChunkCount);
#endif
return p;
}
inline void
ReleaseGCChunk(JSRuntime *rt, Chunk *p)
{
JS_ASSERT(p);
#ifdef MOZ_GCTIMER
JS_ATOMIC_INCREMENT(&destroyChunkCount);
#endif
FreeGCChunk(p);
}
} /* namespace gc */
} /* namespace js */
/* The caller must hold the GC lock. */
static Chunk *
@ -585,25 +687,11 @@ PickChunk(JSCompartment *comp)
if (chunk)
return chunk;
/*
* We do not have available chunks, either get one from the empty set or
* allocate one.
*/
chunk = rt->gcEmptyChunkListHead;
if (chunk) {
JS_ASSERT(chunk->unused());
JS_ASSERT(!rt->gcChunkSet.has(chunk));
JS_ASSERT(rt->gcEmptyChunkCount >= 1);
rt->gcEmptyChunkListHead = chunk->info.next;
rt->gcEmptyChunkCount--;
} else {
chunk = AllocateGCChunk(rt);
if (!chunk)
return NULL;
chunk = rt->gcChunkPool.get(rt);
if (!chunk)
return NULL;
chunk->init();
rt->gcChunkAllocationSinceLastGC = true;
}
rt->gcChunkAllocationSinceLastGC = true;
/*
* FIXME bug 583732 - chunk is newly allocated and cannot be present in
@ -612,7 +700,7 @@ PickChunk(JSCompartment *comp)
GCChunkSet::AddPtr p = rt->gcChunkSet.lookupForAdd(chunk);
JS_ASSERT(!p);
if (!rt->gcChunkSet.add(p, chunk)) {
ReleaseGCChunk(rt, chunk);
Chunk::release(chunk);
return NULL;
}
@ -623,30 +711,6 @@ PickChunk(JSCompartment *comp)
return chunk;
}
static void
ExpireGCChunks(JSRuntime *rt, JSGCInvocationKind gckind)
{
AutoLockGC lock(rt);
/* Return old empty chunks to the system. */
for (Chunk **chunkp = &rt->gcEmptyChunkListHead; *chunkp; ) {
JS_ASSERT(rt->gcEmptyChunkCount);
Chunk *chunk = *chunkp;
JS_ASSERT(chunk->unused());
JS_ASSERT(!rt->gcChunkSet.has(chunk));
JS_ASSERT(chunk->info.age <= MAX_EMPTY_CHUNK_AGE);
if (gckind == GC_SHRINK || chunk->info.age == MAX_EMPTY_CHUNK_AGE) {
*chunkp = chunk->info.next;
--rt->gcEmptyChunkCount;
ReleaseGCChunk(rt, chunk);
} else {
/* Keep the chunk but increase its age. */
++chunk->info.age;
chunkp = &chunk->info.next;
}
}
}
JS_FRIEND_API(bool)
IsAboutToBeFinalized(JSContext *cx, const void *thing)
{
@ -698,7 +762,7 @@ js_InitGC(JSRuntime *rt, uint32 maxbytes)
rt->requestDone = JS_NEW_CONDVAR(rt->gcLock);
if (!rt->requestDone)
return false;
if (!rt->gcHelperThread.init(rt))
if (!rt->gcHelperThread.init())
return false;
#endif
@ -995,20 +1059,19 @@ js_FinishGC(JSRuntime *rt)
rt->gcSystemAvailableChunkListHead = NULL;
rt->gcUserAvailableChunkListHead = NULL;
for (GCChunkSet::Range r(rt->gcChunkSet.all()); !r.empty(); r.popFront())
ReleaseGCChunk(rt, r.front());
Chunk::release(r.front());
rt->gcChunkSet.clear();
for (Chunk *chunk = rt->gcEmptyChunkListHead; chunk; ) {
Chunk *next = chunk->info.next;
ReleaseGCChunk(rt, chunk);
chunk = next;
}
rt->gcEmptyChunkListHead = NULL;
rt->gcEmptyChunkCount = 0;
#ifdef JS_THREADSAFE
rt->gcHelperThread.finish(rt);
rt->gcHelperThread.finish();
#endif
/*
* Finish the pool after the background thread stops in case it was doing
* the background sweeping.
*/
rt->gcChunkPool.expire(rt, true);
#ifdef DEBUG
if (!rt->gcRootsHash.empty())
CheckLeakedRoots(rt);
@ -1237,7 +1300,7 @@ ArenaLists::allocateFromArena(JSCompartment *comp, AllocKind thingKind)
* added new empty arenas.
*/
JS_ASSERT(*bfs == BFS_RUN);
comp->rt->gcHelperThread.waitBackgroundSweepEnd(comp->rt, false);
comp->rt->gcHelperThread.waitBackgroundSweepEnd();
JS_ASSERT(*bfs == BFS_JUST_FINISHED || *bfs == BFS_DONE);
}
}
@ -1320,7 +1383,7 @@ ArenaLists::finalizeLater(JSContext *cx, AllocKind thingKind)
thingKind == FINALIZE_STRING);
#ifdef JS_THREADSAFE
JS_ASSERT(!cx->runtime->gcHelperThread.sweeping);
JS_ASSERT(!cx->runtime->gcHelperThread.sweeping());
ArenaList *al = &arenaLists[thingKind];
if (!al->head) {
@ -1468,8 +1531,10 @@ RunLastDitchGC(JSContext *cx)
js_GC(cx, rt->gcTriggerCompartment, GC_NORMAL);
#ifdef JS_THREADSAFE
if (rt->gcBytes >= rt->gcMaxBytes)
cx->runtime->gcHelperThread.waitBackgroundSweepEnd(cx->runtime);
if (rt->gcBytes >= rt->gcMaxBytes) {
AutoLockGC lock(rt);
cx->runtime->gcHelperThread.waitBackgroundSweepEnd();
}
#endif
}
@ -1999,7 +2064,7 @@ MaybeGC(JSContext *cx)
*/
int64 now = PRMJ_Now();
if (rt->gcNextFullGCTime && rt->gcNextFullGCTime <= now) {
if (rt->gcChunkAllocationSinceLastGC || rt->gcEmptyChunkListHead) {
if (rt->gcChunkAllocationSinceLastGC) {
GCREASON(MAYBEGC);
js_GC(cx, NULL, GC_SHRINK);
} else {
@ -2015,28 +2080,40 @@ MaybeGC(JSContext *cx)
namespace js {
bool
GCHelperThread::init(JSRuntime *rt)
GCHelperThread::init()
{
if (!(wakeup = PR_NewCondVar(rt->gcLock)))
if (!(wakeup = PR_NewCondVar(runtime()->gcLock)))
return false;
if (!(sweepingDone = PR_NewCondVar(rt->gcLock)))
if (!(done = PR_NewCondVar(runtime()->gcLock)))
return false;
thread = PR_CreateThread(PR_USER_THREAD, threadMain, rt, PR_PRIORITY_NORMAL,
thread = PR_CreateThread(PR_USER_THREAD, threadMain, this, PR_PRIORITY_NORMAL,
PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0);
return !!thread;
if (!thread)
return false;
backgroundAllocation = (js_GetCPUCount() >= 2);
return true;
}
inline JSRuntime *
GCHelperThread::runtime()
{
return reinterpret_cast<JSRuntime *>(reinterpret_cast<uintptr_t>(this) - offsetof(JSRuntime, gcHelperThread));
}
void
GCHelperThread::finish(JSRuntime *rt)
GCHelperThread::finish()
{
PRThread *join = NULL;
{
AutoLockGC lock(rt);
if (thread && !shutdown) {
shutdown = true;
PR_NotifyCondVar(wakeup);
AutoLockGC lock(runtime());
if (thread && state != SHUTDOWN) {
/* The allocation should have been stopped during the last GC. */
JS_ASSERT(state == IDLE || state == SWEEPING);
if (state == IDLE)
PR_NotifyCondVar(wakeup);
state = SHUTDOWN;
join = thread;
}
}
@ -2046,66 +2123,114 @@ GCHelperThread::finish(JSRuntime *rt)
}
if (wakeup)
PR_DestroyCondVar(wakeup);
if (sweepingDone)
PR_DestroyCondVar(sweepingDone);
if (done)
PR_DestroyCondVar(done);
}
/* static */
void
GCHelperThread::threadMain(void *arg)
{
JSRuntime *rt = static_cast<JSRuntime *>(arg);
rt->gcHelperThread.threadLoop(rt);
static_cast<GCHelperThread *>(arg)->threadLoop();
}
void
GCHelperThread::threadLoop(JSRuntime *rt)
GCHelperThread::threadLoop()
{
JSRuntime *rt = runtime();
AutoLockGC lock(rt);
while (!shutdown) {
/*
* Sweeping can be true here on the first iteration if a GC and the
* corresponding startBackgroundSweep call happen before this thread
* has a chance to run.
*/
if (!sweeping)
/*
* Even on the first iteration the state can be SHUTDOWN or SWEEPING if
* the stop request or the GC and the corresponding startBackgroundSweep call
* happen before this thread has a chance to run.
*/
for (;;) {
switch (state) {
case SHUTDOWN:
return;
case IDLE:
PR_WaitCondVar(wakeup, PR_INTERVAL_NO_TIMEOUT);
if (sweeping) {
AutoUnlockGC unlock(rt);
break;
case SWEEPING:
doSweep();
if (state == SWEEPING)
state = IDLE;
PR_NotifyAllCondVar(done);
break;
case ALLOCATING:
do {
Chunk *chunk;
{
AutoUnlockGC unlock(rt);
chunk = Chunk::allocate();
}
/* OOM stops the background allocation. */
if (!chunk)
break;
rt->gcChunkPool.put(rt, chunk);
} while (state == ALLOCATING && rt->gcChunkPool.wantBackgroundAllocation(rt));
if (state == ALLOCATING)
state = IDLE;
break;
case CANCEL_ALLOCATION:
state = IDLE;
PR_NotifyAllCondVar(done);
break;
}
sweeping = false;
PR_NotifyAllCondVar(sweepingDone);
}
}
bool
GCHelperThread::prepareForBackgroundSweep(JSContext *context) {
size_t maxArenaLists = MAX_BACKGROUND_FINALIZE_KINDS * context->runtime->compartments.length();
GCHelperThread::prepareForBackgroundSweep(JSContext *cx)
{
JS_ASSERT(cx->runtime == runtime());
JS_ASSERT(state == IDLE);
size_t maxArenaLists = MAX_BACKGROUND_FINALIZE_KINDS * runtime()->compartments.length();
if (!finalizeVector.reserve(maxArenaLists))
return false;
cx = context;
context = cx;
return true;
}
void
GCHelperThread::startBackgroundSweep(JSRuntime *rt, JSGCInvocationKind gckind)
/* Must be called with the GC lock taken. */
inline void
GCHelperThread::startBackgroundSweep(bool shouldShrink)
{
/* The caller takes the GC lock. */
JS_ASSERT(!sweeping);
lastGCKind = gckind;
sweeping = true;
JS_ASSERT(state == IDLE);
shrinkFlag = shouldShrink;
state = SWEEPING;
PR_NotifyCondVar(wakeup);
}
/* Must be called with the GC lock taken. */
void
GCHelperThread::waitBackgroundSweepEnd(JSRuntime *rt, bool gcUnlocked)
GCHelperThread::waitBackgroundSweepEnd()
{
AutoLockGC maybeLock;
if (gcUnlocked)
maybeLock.lock(rt);
while (sweeping)
PR_WaitCondVar(sweepingDone, PR_INTERVAL_NO_TIMEOUT);
while (state == SWEEPING)
PR_WaitCondVar(done, PR_INTERVAL_NO_TIMEOUT);
}
/* Must be called with the GC lock taken. */
void
GCHelperThread::waitBackgroundSweepOrAllocEnd()
{
if (state == ALLOCATING)
state = CANCEL_ALLOCATION;
while (state == SWEEPING || state == CANCEL_ALLOCATION)
PR_WaitCondVar(done, PR_INTERVAL_NO_TIMEOUT);
}
/* Must be called with the GC lock taken. */
inline void
GCHelperThread::startBackgroundAllocationIfIdle()
{
if (state == IDLE) {
state = ALLOCATING;
PR_NotifyCondVar(wakeup);
}
}
JS_FRIEND_API(void)
@ -2127,20 +2252,30 @@ GCHelperThread::replenishAndFreeLater(void *ptr)
Foreground::free_(ptr);
}
/* Must be called with the GC lock taken. */
void
GCHelperThread::doSweep()
{
JS_ASSERT(cx);
JS_ASSERT(context);
/*
* Expire the chunks released during the GC so they will be available to
* the rest of the system immediately.
*/
JSRuntime *rt = runtime();
rt->gcChunkPool.expire(rt, shouldShrink());
AutoUnlockGC unlock(rt);
/*
* We must finalize in the insert order, see comments in
* finalizeObjects.
*/
for (ArenaHeader **i = finalizeVector.begin(); i != finalizeVector.end(); ++i)
ArenaLists::backgroundFinalize(cx, *i);
ArenaLists::backgroundFinalize(context, *i);
finalizeVector.resize(0);
ExpireGCChunks(cx->runtime, lastGCKind);
cx = NULL;
context = NULL;
if (freeCursor) {
void **array = freeCursorEnd - FREE_ARRAY_LENGTH;
@ -2384,7 +2519,7 @@ SweepPhase(JSContext *cx, GCMarker *gcmarker, JSGCInvocationKind gckind GCTIMER_
* use IsAboutToBeFinalized().
* This is done on the GCHelperThread if JS_THREADSAFE is defined.
*/
ExpireGCChunks(rt, gckind);
rt->gcChunkPool.expire(rt, gckind == GC_SHRINK);
#endif
GCTIMESTAMP(sweepDestroyEnd);
@ -2397,8 +2532,7 @@ SweepPhase(JSContext *cx, GCMarker *gcmarker, JSGCInvocationKind gckind GCTIMER_
*
* In a JS_THREADSAFE build, the calling thread must be rt->gcThread and each
* other thread must be either outside all requests or blocked waiting for GC
* to finish. Note that the caller does not hold rt->gcLock.
* If comp is set, we perform a single-compartment GC.
* to finish. The caller must hold rt->gcLock.
*/
static void
MarkAndSweep(JSContext *cx, JSGCInvocationKind gckind GCTIMER_PARAM)
@ -2413,6 +2547,8 @@ MarkAndSweep(JSContext *cx, JSGCInvocationKind gckind GCTIMER_PARAM)
/* Reset malloc counter. */
rt->resetGCMallocBytes();
AutoUnlockGC unlock(rt);
GCMarker gcmarker(cx);
JS_ASSERT(IS_GC_MARKING_TRACER(&gcmarker));
JS_ASSERT(gcmarker.getMarkColor() == BLACK);
@ -2649,29 +2785,29 @@ GCCycle(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind GCTIMER_P
rt->gcCurrentCompartment = comp;
rt->gcMarkAndSweep = true;
{
AutoUnlockGC unlock(rt);
#ifdef JS_THREADSAFE
/*
* As we about to purge caches and clear the mark bits we must wait
* for any background finalization to finish.
*/
JS_ASSERT(!cx->gcBackgroundFree);
rt->gcHelperThread.waitBackgroundSweepEnd(rt);
if (gckind != GC_LAST_CONTEXT && rt->state != JSRTS_LANDING) {
if (rt->gcHelperThread.prepareForBackgroundSweep(cx))
cx->gcBackgroundFree = &rt->gcHelperThread;
}
#endif
MarkAndSweep(cx, gckind GCTIMER_ARG);
/*
* As we about to purge caches and clear the mark bits we must wait for
* any background finalization to finish. We must also wait for the
* background allocation to finish so we can avoid taking the GC lock
* when manipulating the chunks during the GC.
*/
JS_ASSERT(!cx->gcBackgroundFree);
rt->gcHelperThread.waitBackgroundSweepOrAllocEnd();
if (gckind != GC_LAST_CONTEXT && rt->state != JSRTS_LANDING) {
if (rt->gcHelperThread.prepareForBackgroundSweep(cx))
cx->gcBackgroundFree = &rt->gcHelperThread;
}
#endif
MarkAndSweep(cx, gckind GCTIMER_ARG);
#ifdef JS_THREADSAFE
if (gckind != GC_LAST_CONTEXT && rt->state != JSRTS_LANDING) {
JS_ASSERT(cx->gcBackgroundFree == &rt->gcHelperThread);
cx->gcBackgroundFree = NULL;
rt->gcHelperThread.startBackgroundSweep(rt, gckind);
rt->gcHelperThread.startBackgroundSweep(gckind == GC_SHRINK);
} else {
JS_ASSERT(!cx->gcBackgroundFree);
}
@ -2744,9 +2880,6 @@ js_GC(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind)
}
{
#ifdef JS_THREADSAFE
rt->gcHelperThread.waitBackgroundSweepEnd(rt);
#endif
/* Lock out other GC allocator and collector invocations. */
AutoLockGC lock(rt);
rt->gcPoke = false;
@ -2803,7 +2936,7 @@ TraceRuntime(JSTracer *trc)
AutoLockGC lock(rt);
AutoGCSession gcsession(cx);
rt->gcHelperThread.waitBackgroundSweepEnd(rt, false);
rt->gcHelperThread.waitBackgroundSweepEnd();
AutoUnlockGC unlock(rt);
AutoCopyFreeListToArenas copy(rt);
@ -2867,7 +3000,7 @@ IterateCompartmentsArenasCells(JSContext *cx, void *data,
AutoLockGC lock(rt);
AutoGCSession gcsession(cx);
#ifdef JS_THREADSAFE
rt->gcHelperThread.waitBackgroundSweepEnd(rt, false);
rt->gcHelperThread.waitBackgroundSweepEnd();
#endif
AutoUnlockGC unlock(rt);
@ -2901,7 +3034,7 @@ IterateCells(JSContext *cx, JSCompartment *compartment, AllocKind thingKind,
AutoLockGC lock(rt);
AutoGCSession gcsession(cx);
#ifdef JS_THREADSAFE
rt->gcHelperThread.waitBackgroundSweepEnd(rt, false);
rt->gcHelperThread.waitBackgroundSweepEnd();
#endif
AutoUnlockGC unlock(rt);

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

@ -641,8 +641,6 @@ struct Chunk {
return addr;
}
void init();
bool unused() const {
return info.numFree == ArenasPerChunk;
}
@ -657,11 +655,42 @@ struct Chunk {
ArenaHeader *allocateArena(JSCompartment *comp, AllocKind kind);
void releaseArena(ArenaHeader *aheader);
static Chunk *allocate();
static inline void release(Chunk *chunk);
private:
inline void init();
};
JS_STATIC_ASSERT(sizeof(Chunk) <= GC_CHUNK_SIZE);
JS_STATIC_ASSERT(sizeof(Chunk) + BytesPerArena > GC_CHUNK_SIZE);
class ChunkPool {
Chunk *emptyChunkListHead;
size_t emptyCount;
public:
ChunkPool()
: emptyChunkListHead(NULL),
emptyCount(0) { }
size_t getEmptyCount() const {
return emptyCount;
}
inline bool wantBackgroundAllocation(JSRuntime *rt) const;
/* Must be called with the GC lock taken. */
inline Chunk *get(JSRuntime *rt);
/* Must be called either during the GC or with the GC lock taken. */
inline void put(JSRuntime *rt, Chunk *chunk);
/* Must be called either during the GC or with the GC lock taken. */
void expire(JSRuntime *rt, bool releaseAll);
};
inline uintptr_t
Cell::address() const
{
@ -1288,26 +1317,35 @@ namespace js {
#ifdef JS_THREADSAFE
/*
* During the finalization we do not free immediately. Rather we add the
* corresponding pointers to a buffer which we later release on a separated
* thread.
*
* The buffer is implemented as a vector of 64K arrays of pointers, not as a
* simple vector, to avoid realloc calls during the vector growth and to not
* bloat the binary size of the inlined freeLater method. Any OOM during
* buffer growth results in the pointer being freed immediately.
*/
class GCHelperThread {
enum State {
IDLE,
SWEEPING,
ALLOCATING,
CANCEL_ALLOCATION,
SHUTDOWN
};
/*
* During the finalization we do not free immediately. Rather we add the
* corresponding pointers to a buffer which we later release on a
* separated thread.
*
* The buffer is implemented as a vector of 64K arrays of pointers, not as
* a simple vector, to avoid realloc calls during the vector growth and to
* not bloat the binary size of the inlined freeLater method. Any OOM
* during buffer growth results in the pointer being freed immediately.
*/
static const size_t FREE_ARRAY_SIZE = size_t(1) << 16;
static const size_t FREE_ARRAY_LENGTH = FREE_ARRAY_SIZE / sizeof(void *);
JSContext *cx;
PRThread* thread;
PRCondVar* wakeup;
PRCondVar* sweepingDone;
bool shutdown;
JSGCInvocationKind lastGCKind;
PRCondVar* done;
volatile State state;
JSContext *context;
bool shrinkFlag;
Vector<void **, 16, js::SystemAllocPolicy> freeVector;
void **freeCursor;
@ -1315,6 +1353,8 @@ class GCHelperThread {
Vector<js::gc::ArenaHeader *, 64, js::SystemAllocPolicy> finalizeVector;
bool backgroundAllocation;
friend struct js::gc::ArenaLists;
JS_FRIEND_API(void)
@ -1328,38 +1368,70 @@ class GCHelperThread {
}
static void threadMain(void* arg);
void threadLoop();
void threadLoop(JSRuntime *rt);
/* Must be called with the GC lock taken. */
void doSweep();
public:
GCHelperThread()
: thread(NULL),
wakeup(NULL),
sweepingDone(NULL),
shutdown(false),
done(NULL),
state(IDLE),
freeCursor(NULL),
freeCursorEnd(NULL),
sweeping(false) { }
backgroundAllocation(true)
{ }
volatile bool sweeping;
bool init(JSRuntime *rt);
void finish(JSRuntime *rt);
inline JSRuntime *runtime();
/* Must be called with GC lock taken. */
void startBackgroundSweep(JSRuntime *rt, JSGCInvocationKind gckind);
bool init();
void finish();
void waitBackgroundSweepEnd(JSRuntime *rt, bool gcUnlocked = true);
/* Must be called with the GC lock taken. */
inline void startBackgroundSweep(bool shouldShrink);
/* Must be called with the GC lock taken. */
void waitBackgroundSweepEnd();
/* Must be called with the GC lock taken. */
void waitBackgroundSweepOrAllocEnd();
/* Must be called with the GC lock taken. */
inline void startBackgroundAllocationIfIdle();
bool canBackgroundAllocate() const {
return backgroundAllocation;
}
void disableBackgroundAllocation() {
backgroundAllocation = false;
}
/*
* Outside the GC lock may give true answer when in fact the sweeping has
* been done.
*/
bool sweeping() const {
return state == SWEEPING;
}
bool shouldShrink() const {
JS_ASSERT(sweeping());
return shrinkFlag;
}
void freeLater(void *ptr) {
JS_ASSERT(!sweeping);
JS_ASSERT(!sweeping());
if (freeCursor != freeCursorEnd)
*freeCursor++ = ptr;
else
replenishAndFreeLater(ptr);
}
bool prepareForBackgroundSweep(JSContext *context);
/* Must be called with the GC lock taken. */
bool prepareForBackgroundSweep(JSContext *cx);
};
#endif /* JS_THREADSAFE */

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

@ -44,6 +44,13 @@
*/
#include <stdlib.h>
#include <string.h>
#ifdef XP_WIN
# include "jswin.h"
#else
# include <unistd.h>
#endif
#include "jspubtd.h"
#include "jsutil.h"
#include "jstypes.h"
@ -73,7 +80,6 @@ extern long __cdecl
_InterlockedCompareExchange(long *volatile dest, long exchange, long comp);
JS_END_EXTERN_C
#pragma intrinsic(_InterlockedCompareExchange)
JS_STATIC_ASSERT(sizeof(jsword) == sizeof(long));
static JS_ALWAYS_INLINE int
@ -92,11 +98,12 @@ NativeCompareAndSwap(volatile jsword *w, jsword ov, jsword nv)
}
#elif defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_X64))
JS_BEGIN_EXTERN_C
extern long long __cdecl
_InterlockedCompareExchange64(long long *volatile dest, long long exchange, long long comp);
JS_END_EXTERN_C
/*
* Compared with the _InterlockedCompareExchange in the 32 bit case above MSVC
* declares _InterlockedCompareExchange64 through <windows.h>.
*/
#pragma intrinsic(_InterlockedCompareExchange64)
JS_STATIC_ASSERT(sizeof(jsword) == sizeof(long long));
static JS_ALWAYS_INLINE int
NativeCompareAndSwap(volatile jsword *w, jsword ov, jsword nv)
@ -304,6 +311,23 @@ js_AtomicClearMask(volatile jsword *w, jsword mask)
} while (!js_CompareAndSwap(w, ov, nv));
}
unsigned
js_GetCPUCount()
{
static unsigned ncpus = 0;
if (ncpus == 0) {
# ifdef XP_WIN
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
ncpus = unsigned(sysinfo.dwNumberOfProcessors);
# else
long n = sysconf(_SC_NPROCESSORS_ONLN);
ncpus = (n > 0) ? unsigned(n) : 1;
# endif
}
return ncpus;
}
#ifndef NSPR_LOCK
struct JSFatLock {

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

@ -198,6 +198,9 @@ js_AtomicClearMask(volatile jsword *w, jsword mask);
#define JS_ATOMIC_SET_MASK(w, mask) js_AtomicSetMask(w, mask)
#define JS_ATOMIC_CLEAR_MASK(w, mask) js_AtomicClearMask(w, mask)
extern unsigned
js_GetCPUCount();
#else
static inline JSBool
@ -209,6 +212,12 @@ js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
#define JS_ATOMIC_SET_MASK(w, mask) (*(w) |= (mask))
#define JS_ATOMIC_CLEAR_MASK(w, mask) (*(w) &= ~(mask))
static inline unsigned
js_GetCPUCount()
{
return 1;
}
#endif
#ifdef __cplusplus

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

@ -8,6 +8,12 @@
onload="setTimeout(nextTest,0);"
title="bug 514732 test">
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/docshell_helpers.js">
</script>

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

@ -1,6 +1,7 @@
<!DOCTYPE HTML>
<html>
<!--
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
@ -27,24 +28,10 @@
SimpleTest.waitForExplicitFinish();
function get_pref(pref)
{
return SpecialPowers.getIntPref("font.size." + pref);
}
function set_pref(pref, val)
{
SpecialPowers.setIntPref("font.size." + pref, val);
}
var cs1 = getComputedStyle(document.getElementById("one"), "");
var cs2 = getComputedStyle(document.getElementById("two"), "");
var oldVariable = get_pref("variable.x-western");
var oldFixed = get_pref("fixed.x-western");
set_pref("variable.x-western", 25);
set_pref("fixed.x-western", 20);
setTimeout(part1, 0);
SpecialPowers.pushPrefEnv({'set': [['variable.x-western', 25], ['fixed.x-western', 20]]}, function() setTimeout(part1, 0));
function part1()
{
@ -52,8 +39,6 @@ function part1()
var fs2 = cs2.fontSize.match(/(.*)px/)[1];
ok(fs1 < fs2, "<font size=-1> shrinks relative to font-family: -moz-fixed");
set_pref("variable.x-western", oldVariable);
set_pref("fixed.x-western", oldFixed);
SimpleTest.finish();
}

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

@ -56,10 +56,7 @@ function fs(idx) {
return getComputedStyle(elts[idx], "").marginBottom;
}
SpecialPowers.clearUserPref('font.minimum-size.x-western');
// preference change is async (although one setTimeout might be enough?)
setTimeout(setTimeout, 0, step1, 0);
SpecialPowers.pushPrefEnv({'clear': [['font.minimum-size.x-western']]}, function() setTimeout(step1, 0));
function step1() {
is(fs(0), "0px", "at min font size 0, 0px should compute to 0px");
@ -67,10 +64,7 @@ function step1() {
is(fs(2), "12px", "at min font size 0, 12px should compute to 12px");
is(fs(3), "28px", "at min font size 0, 28px should compute to 28px");
SpecialPowers.setIntPref('font.minimum-size.x-western', 7);
// preference change is async (although one setTimeout might be enough?)
setTimeout(setTimeout, 0, step2, 0);
SpecialPowers.pushPrefEnv({'set': [['font.minimum-size.x-western', 7]]}, function() setTimeout(step2, 0));
}
function step2() {
@ -79,10 +73,7 @@ function step2() {
is(fs(2), "12px", "at min font size 7, 12px should compute to 12px");
is(fs(3), "28px", "at min font size 7, 28px should compute to 28px");
SpecialPowers.setIntPref('font.minimum-size.x-western', 18);
// preference change is async (although one setTimeout might be enough?)
setTimeout(setTimeout, 0, step3, 0);
SpecialPowers.pushPrefEnv({'set': [['font.minimum-size.x-western', 18]]}, function() setTimeout(step3, 0));
}
function step3() {
@ -91,9 +82,7 @@ function step3() {
is(fs(2), "18px", "at min font size 18, 12px should compute to 18px");
is(fs(3), "28px", "at min font size 18, 28px should compute to 28px");
SpecialPowers.clearUserPref('font.minimum-size.x-western');
SimpleTest.finish();
SpecialPowers.pushPrefEnv({'clear': [['font.minimum-size.x-western']]}, SimpleTest.finish);
}
</script>

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

@ -4,7 +4,7 @@
<title>Test for pointer-events in HTML</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<style type="text/css">
div { height: 10px; width: 10px; background: black; }
@ -69,8 +69,9 @@ function synthesizeMouseEvent(type, // string
modifiers, // long
ignoreWindowBounds) // boolean
{
SpecialPowers.DOMWindowUtils.sendMouseEvent(type, x, y, button, clickCount,
modifiers, ignoreWindowBounds);
var utils = SpecialPowers.getDOMWindowUtils(window);
utils.sendMouseEvent(type, x, y, button, clickCount,
modifiers, ignoreWindowBounds);
}
function run_test()

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

@ -43,7 +43,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = chrome locales components modules themes app
DIRS = chrome locales components modules themes/core app
ifndef LIBXUL_SDK
PARALLEL_DIRS += $(DEPTH)/xulrunner/tools/redit

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

@ -28,9 +28,19 @@ var AwesomeScreen = {
]
},
_popupShowing: false,
handleEvent: function(aEvent) {
switch (aEvent.type) {
case "PopupChanged" :
this._popupShowing = (aEvent.detail != null);
break;
case "TapDown" :
// If a popup has been shown on top of the active
// awesome panel (e.g. context menu), the panel should
// not be dismissed on TapDown.
if (this._popupShowing)
break;
let target = aEvent.target;
while (target && this._targets.indexOf(target) == -1)
target = target.parentNode;
@ -51,6 +61,7 @@ var AwesomeScreen = {
BrowserUI._editURI();
this.container.hidden = this.headers.hidden = false;
window.addEventListener("TapDown", this, false);
window.addEventListener("PopupChanged", this, false);
}
if (aPanel) {
@ -67,6 +78,7 @@ var AwesomeScreen = {
BrowserUI._edit.detachController();
BrowserUI.popDialog();
window.removeEventListener("TapDown", this, false);
window.removeEventListener("PopupChanged", this, false);
}
if (this._activePanel)

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

@ -25,6 +25,10 @@ function runNextTest() {
if (gTests.length > 0) {
gCurrentTest = gTests.shift();
info(gCurrentTest.desc);
// Ensure all tests start with hidden awesome screen
AwesomeScreen.activePanel = null;
gCurrentTest.run();
}
else {
@ -187,7 +191,6 @@ gTests.push({
});
setTimeout(function() {
AwesomeScreen.activePanel = null;
runNextTest();
}, 0);
}
@ -282,8 +285,6 @@ gTests.push({
edit.clickSelectsAll = oldClickSelectsAll;
AwesomeScreen.activePanel = null;
// Ensure the tab is well closed before doing the rest of the code, otherwise
// this cause some bugs with the composition events
let tabCount = Browser.tabs.length;
@ -348,7 +349,6 @@ gTests.push({
self.onPopupReady();
}, 500);
} else {
AwesomeScreen.activePanel = null;
runNextTest();
}
}
@ -435,3 +435,36 @@ gTests.push({
}
});
// Case: Test context popup dismiss on top of awesome panel
gTests.push({
desc: "Case: Test context popup dismiss on top of awesome panel",
run: function() {
waitForNavigationPanel(gCurrentTest.onPopupReady);
AllPagesList.doCommand();
},
onPopupReady: function() {
EventUtils.synthesizeMouse(AllPagesList.panel, AllPagesList.panel.width / 2,
AllPagesList.panel.height / 2, { type: "mousedown" });
// Simulate a long tap
setTimeout(function(self) {
EventUtils.synthesizeMouse(AllPagesList.panel, AllPagesList.panel.width / 2,
AllPagesList.panel.height / 2, { type: "mouseup" });
let contextContainer = document.getElementById("context-container");
ok(!AllPagesList.panel.hidden, "The context popup is still visible after long tap");
ok(!contextContainer.hidden, "The context popup is visible after long tap");
EventUtils.synthesizeMouse(AllPagesList.panel, 0, 0, {});
ok(contextContainer.hidden, "The context popup is not visible after tap");
ok(!AllPagesList.panel.hidden, "The awesome panel is still visible after popup is dismissed");
AwesomeScreen.activePanel = null;
runNextTest();
}, 500, this);
}
});

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

@ -52,7 +52,6 @@ mobile/modules/Makefile
mobile/installer/Makefile
mobile/locales/Makefile
mobile/Makefile
mobile/themes/Makefile
mobile/themes/core/Makefile"
if test -n "$MOZ_UPDATE_PACKAGING"; then

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

@ -1,52 +0,0 @@
# ***** 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 Mobile Browser.
#
# The Initial Developer of the Original Code is
# the Mozilla Foundation <http://www.mozilla.org/>.
# Portions created by the Initial Developer are Copyright (C) 2007
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Mark Finkle <mfinkle@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either 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@
include $(DEPTH)/config/autoconf.mk
#
# Theme Selection
#
# Add the core theme files
DIRS = core
include $(topsrcdir)/config/rules.mk

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

@ -69,6 +69,11 @@
#include "mozilla/Telemetry.h"
#include "nsDOMError.h"
// Device IDs for various cache types
const char kDiskDeviceID[] = "disk";
const char kMemoryDeviceID[] = "memory";
const char kOfflineDeviceID[] = "offline";
// True if the local cache should be bypassed when processing a request.
#define BYPASS_LOCAL_CACHE(loadFlags) \
(loadFlags & (nsIRequest::LOAD_BYPASS_CACHE | \
@ -272,6 +277,23 @@ nsHttpChannel::Connect(bool firstTime)
}
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::HTTP_CACHE_DISPOSITION, kCacheHit);
char* cacheDeviceID = nsnull;
mCacheEntry->GetDeviceID(&cacheDeviceID);
if (cacheDeviceID) {
if (!strcmp(cacheDeviceID, kDiskDeviceID))
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::HTTP_DISK_CACHE_DISPOSITION,
kCacheHit);
else if (!strcmp(cacheDeviceID, kMemoryDeviceID))
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::HTTP_MEMORY_CACHE_DISPOSITION,
kCacheHit);
else if (!strcmp(cacheDeviceID, kOfflineDeviceID))
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::HTTP_OFFLINE_CACHE_DISPOSITION,
kCacheHit);
}
return rv;
}
else if (mLoadFlags & LOAD_ONLY_FROM_CACHE) {
@ -1070,16 +1092,34 @@ nsHttpChannel::ProcessResponse()
break;
}
int cacheDisposition;
if (!mDidReval)
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::HTTP_CACHE_DISPOSITION, kCacheMissed);
cacheDisposition = kCacheMissed;
else if (successfulReval)
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::HTTP_CACHE_DISPOSITION, kCacheHitViaReval);
cacheDisposition = kCacheHitViaReval;
else
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::HTTP_CACHE_DISPOSITION,
kCacheMissedViaReval);
cacheDisposition = kCacheMissedViaReval;
mozilla::Telemetry::Accumulate(mozilla::Telemetry::HTTP_CACHE_DISPOSITION,
cacheDisposition);
if (mCacheEntry) {
char* cacheDeviceID = nsnull;
mCacheEntry->GetDeviceID(&cacheDeviceID);
if (cacheDeviceID) {
if (!strcmp(cacheDeviceID, kDiskDeviceID))
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::HTTP_DISK_CACHE_DISPOSITION,
cacheDisposition);
else if (!strcmp(cacheDeviceID, kMemoryDeviceID))
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::HTTP_MEMORY_CACHE_DISPOSITION,
cacheDisposition);
else if (!strcmp(cacheDeviceID, kOfflineDeviceID))
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::HTTP_OFFLINE_CACHE_DISPOSITION,
cacheDisposition);
}
}
return rv;
}

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

@ -95,7 +95,6 @@ _SERV_FILES = \
ipc.js \
browser-harness.xul \
redirect.html \
redirect.js \
$(topsrcdir)/build/pgo/server-locations.txt \
$(topsrcdir)/netwerk/test/httpserver/httpd.js \
mozprefs.js \

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

@ -23,6 +23,7 @@
-
- Contributor(s):
- Gavin Sharp <gavin@gavinsharp.com> (original author)
- Joel Maher <joel.maher@gmail.com>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or

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

@ -12,16 +12,16 @@ window.addEventListener("load", testOnLoad, false);
function testOnLoad() {
window.removeEventListener("load", testOnLoad, false);
// Make sure to launch the test harness for the first opened window only
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
if (prefs.prefHasUserValue("testing.browserTestHarness.running"))
return;
prefs.setBoolPref("testing.browserTestHarness.running", true);
gConfig = readConfig();
if (gConfig.testRoot == "browser") {
// Make sure to launch the test harness for the first opened window only
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
if (prefs.prefHasUserValue("testing.browserTestHarness.running"))
return;
prefs.setBoolPref("testing.browserTestHarness.running", true);
var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
getService(Ci.nsIWindowWatcher);
var sstring = Cc["@mozilla.org/supports-string;1"].
@ -30,6 +30,22 @@ function testOnLoad() {
ww.openWindow(window, "chrome://mochikit/content/browser-harness.xul", "browserTest",
"chrome,centerscreen,dialog=no,resizable,titlebar,toolbar=no,width=800,height=600", sstring);
} else {
// This code allows us to redirect without requiring specialpowers for chrome and a11y tests.
function messageHandler(m) {
messageManager.removeMessageListener("chromeEvent", messageHandler);
var url = m.json.data;
// Window is the [ChromeWindow] for messageManager, so we need content.window
// Currently chrome tests are run in a content window instead of a ChromeWindow
var webNav = content.window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation);
webNav.loadURI(url, null, null, null, null);
}
var listener = 'data:,function doLoad(e) { var data=e.getData("data");removeEventListener("contentEvent", function (e) { doLoad(e); }, false, true);sendAsyncMessage("chromeEvent", {"data":data}); };addEventListener("contentEvent", function (e) { doLoad(e); }, false, true);';
messageManager.loadFrameScript(listener, true);
messageManager.addMessageListener("chromeEvent", messageHandler);
}
}
@ -48,6 +64,9 @@ function Tester(aTests, aDumper, aCallback) {
getService(Ci.mozIJSSubScriptLoader);
this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", this.EventUtils);
var simpleTestScope = {};
this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js", simpleTestScope);
this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js", simpleTestScope);
this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/ChromePowers.js", simpleTestScope);
this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/SimpleTest.js", simpleTestScope);
this._scriptLoader.loadSubScript("chrome://mochikit/content/chrome-harness.js", simpleTestScope);
this.SimpleTest = simpleTestScope.SimpleTest;

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

@ -11,6 +11,12 @@
<window>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/LogController.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/TestRunner.js"/>
<script type="text/javascript"

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

@ -10,10 +10,12 @@ mochikit.jar:
content/ipc-overlay.xul (ipc-overlay.xul)
content/mozprefs.js (mozprefs.js)
content/redirect.html (redirect.html)
content/redirect.js (redirect.js)
content/server.js (server.js)
content/dynamic/getMyDirectory.sjs (dynamic/getMyDirectory.sjs)
content/static/harness.css (static/harness.css)
content/tests/SimpleTest/ChromePowers.js (tests/SimpleTest/ChromePowers.js)
content/tests/SimpleTest/specialpowersAPI.js (tests/SimpleTest/specialpowersAPI.js)
content/tests/SimpleTest/SpecialPowersObserverAPI.js (tests/SimpleTest/SpecialPowersObserverAPI.js)
content/tests/SimpleTest/EventUtils.js (tests/SimpleTest/EventUtils.js)
content/tests/SimpleTest/ChromeUtils.js (tests/SimpleTest/ChromeUtils.js)
content/tests/SimpleTest/MozillaLogger.js (tests/SimpleTest/MozillaLogger.js)

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

@ -2,9 +2,18 @@
<head>
<title>redirecting...</title>
<script type="text/javascript" src="redirect.js"></script>
<script type="text/javascript">
function redirect(aURL)
{
// We create a listener for this event in browser-test.js
// which will get picked up when specifying --chrome or --a11y
var element = document.createEvent("datacontainerevent");
element.initEvent("contentEvent", true, false);
element.setData("data", aURL + location.search);
element.setData("type", "loadURI");
document.dispatchEvent(element);
}
redirect("chrome://mochikit/content/harness.xul");
</script>
</head>

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

@ -1,45 +0,0 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et: */
/* ***** 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 MozJSHTTP code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Sayre <sayrer@gmail.com>
* Alexander Surkov <surkov.alexander@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either 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 ***** */
function redirect(aURL)
{
SpecialPowers.loadURI(window, aURL + location.search,
null, null, null, null);
}

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

@ -529,7 +529,6 @@ class Mochitest(object):
self.automation.initializeProfile(options.profilePath, options.extraPrefs, useServerLocations = True)
manifest = self.addChromeToProfile(options)
self.copyExtraFilesToProfile(options)
self.installSpecialPowersExtension(options)
self.installExtensionsToProfile(options)
return manifest

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

@ -192,6 +192,7 @@ class MochiRemote(Mochitest):
self._dm = devmgr
self.runSSLTunnel = False
self.remoteProfile = options.remoteTestRoot + "/profile"
self._automation.setRemoteProfile(self.remoteProfile)
self.remoteLog = options.remoteLogFile
def cleanup(self, manifest, options):

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

@ -50,19 +50,15 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
const CHILD_SCRIPT = "chrome://specialpowers/content/specialpowers.js"
const CHILD_SCRIPT_API = "chrome://specialpowers/content/specialpowersAPI.js"
const CHILD_LOGGER_SCRIPT = "chrome://specialpowers/content/MozillaLogger.js"
/**
* Special Powers Exception - used to throw exceptions nicely
**/
function SpecialPowersException(aMsg) {
this.message = aMsg;
this.name = "SpecialPowersException";
}
SpecialPowersException.prototype.toString = function() {
return this.name + ': "' + this.message + '"';
};
// Glue to add in the observer API to this object. This allows us to share code with chrome tests
var loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserverAPI.js");
/* XPCOM gunk */
function SpecialPowersObserver() {
@ -71,14 +67,16 @@ function SpecialPowersObserver() {
getService(Ci.nsIChromeFrameMessageManager);
}
SpecialPowersObserver.prototype = {
classDescription: "Special powers Observer for use in testing.",
classID: Components.ID("{59a52458-13e0-4d93-9d85-a637344f29a1}"),
contractID: "@mozilla.org/special-powers-observer;1",
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver]),
_xpcom_categories: [{category: "profile-after-change", service: true }],
observe: function(aSubject, aTopic, aData)
SpecialPowersObserver.prototype = new SpecialPowersObserverAPI();
SpecialPowersObserver.prototype.classDescription = "Special powers Observer for use in testing.";
SpecialPowersObserver.prototype.classID = Components.ID("{59a52458-13e0-4d93-9d85-a637344f29a1}");
SpecialPowersObserver.prototype.contractID = "@mozilla.org/special-powers-observer;1";
SpecialPowersObserver.prototype.QueryInterface = XPCOMUtils.generateQI([Components.interfaces.nsIObserver]);
SpecialPowersObserver.prototype._xpcom_categories = [{category: "profile-after-change", service: true }];
SpecialPowersObserver.prototype.observe = function(aSubject, aTopic, aData)
{
switch (aTopic) {
case "profile-after-change":
@ -93,6 +91,7 @@ SpecialPowersObserver.prototype = {
this._messageManager.addMessageListener("SPPingService", this);
this._messageManager.loadFrameScript(CHILD_LOGGER_SCRIPT, true);
this._messageManager.loadFrameScript(CHILD_SCRIPT_API, true);
this._messageManager.loadFrameScript(CHILD_SCRIPT, true);
this._isFrameScriptLoaded = true;
}
@ -102,180 +101,67 @@ SpecialPowersObserver.prototype = {
this.uninit();
break;
case "plugin-crashed":
case "ipc:content-shutdown":
function addDumpIDToMessage(propertyName) {
var id = aSubject.getPropertyAsAString(propertyName);
if (id) {
message.dumpIDs.push(id);
}
}
var message = { type: "crash-observed", dumpIDs: [] };
aSubject = aSubject.QueryInterface(Ci.nsIPropertyBag2);
if (aTopic == "plugin-crashed") {
addDumpIDToMessage("pluginDumpID");
addDumpIDToMessage("browserDumpID");
} else { // ipc:content-shutdown
addDumpIDToMessage("dumpID");
}
this._messageManager.sendAsyncMessage("SPProcessCrashService", message);
default:
this._observe(aSubject, aTopic, aData);
break;
}
},
};
init: function()
SpecialPowersObserver.prototype._sendAsyncMessage = function(msgname, msg)
{
this._messageManager.sendAsyncMessage(msgname, msg);
};
SpecialPowersObserver.prototype._receiveMessage = function(aMessage) {
return this._receiveMessageAPI(aMessage);
};
SpecialPowersObserver.prototype.init = function()
{
var obs = Services.obs;
obs.addObserver(this, "xpcom-shutdown", false);
obs.addObserver(this, "chrome-document-global-created", false);
},
};
uninit: function()
SpecialPowersObserver.prototype.uninit = function()
{
var obs = Services.obs;
obs.removeObserver(this, "chrome-document-global-created", false);
this.removeProcessCrashObservers();
},
addProcessCrashObservers: function() {
this._removeProcessCrashObservers();
};
SpecialPowersObserver.prototype._addProcessCrashObservers = function() {
if (this._processCrashObserversRegistered) {
return;
}
Services.obs.addObserver(this, "plugin-crashed", false);
Services.obs.addObserver(this, "ipc:content-shutdown", false);
this._processCrashObserversRegistered = true;
},
var obs = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
removeProcessCrashObservers: function() {
obs.addObserver(this, "plugin-crashed", false);
obs.addObserver(this, "ipc:content-shutdown", false);
this._processCrashObserversRegistered = true;
};
SpecialPowersObserver.prototype._removeProcessCrashObservers = function() {
if (!this._processCrashObserversRegistered) {
return;
}
Services.obs.removeObserver(this, "plugin-crashed");
Services.obs.removeObserver(this, "ipc:content-shutdown");
var obs = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
obs.removeObserver(this, "plugin-crashed");
obs.removeObserver(this, "ipc:content-shutdown");
this._processCrashObserversRegistered = false;
},
getCrashDumpDir: function() {
if (!this._crashDumpDir) {
var directoryService = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties);
this._crashDumpDir = directoryService.get("ProfD", Ci.nsIFile);
this._crashDumpDir.append("minidumps");
}
return this._crashDumpDir;
},
deleteCrashDumpFiles: function(aFilenames) {
var crashDumpDir = this.getCrashDumpDir();
if (!crashDumpDir.exists()) {
return false;
}
var success = aFilenames.length != 0;
aFilenames.forEach(function(crashFilename) {
var file = crashDumpDir.clone();
file.append(crashFilename);
if (file.exists()) {
file.remove(false);
} else {
success = false;
}
});
return success;
},
findCrashDumpFiles: function(aToIgnore) {
var crashDumpDir = this.getCrashDumpDir();
var entries = crashDumpDir.exists() && crashDumpDir.directoryEntries;
if (!entries) {
return [];
}
var crashDumpFiles = [];
while (entries.hasMoreElements()) {
var file = entries.getNext().QueryInterface(Ci.nsIFile);
var path = String(file.path);
if (path.match(/\.(dmp|extra)$/) && !aToIgnore[path]) {
crashDumpFiles.push(path);
}
}
return crashDumpFiles.concat();
},
};
/**
* messageManager callback function
* This will get requests from our API in the window and process them in chrome for it
**/
receiveMessage: function(aMessage) {
SpecialPowersObserver.prototype.receiveMessage = function(aMessage) {
switch(aMessage.name) {
case "SPPrefService":
var prefs = Services.prefs;
var prefType = aMessage.json.prefType.toUpperCase();
var prefName = aMessage.json.prefName;
var prefValue = "prefValue" in aMessage.json ? aMessage.json.prefValue : null;
if (aMessage.json.op == "get") {
if (!prefName || !prefType)
throw new SpecialPowersException("Invalid parameters for get in SPPrefService");
} else if (aMessage.json.op == "set") {
if (!prefName || !prefType || prefValue === null)
throw new SpecialPowersException("Invalid parameters for set in SPPrefService");
} else if (aMessage.json.op == "clear") {
if (!prefName)
throw new SpecialPowersException("Invalid parameters for clear in SPPrefService");
} else {
throw new SpecialPowersException("Invalid operation for SPPrefService");
}
// Now we make the call
switch(prefType) {
case "BOOL":
if (aMessage.json.op == "get")
return(prefs.getBoolPref(prefName));
else
return(prefs.setBoolPref(prefName, prefValue));
case "INT":
if (aMessage.json.op == "get")
return(prefs.getIntPref(prefName));
else
return(prefs.setIntPref(prefName, prefValue));
case "CHAR":
if (aMessage.json.op == "get")
return(prefs.getCharPref(prefName));
else
return(prefs.setCharPref(prefName, prefValue));
case "COMPLEX":
if (aMessage.json.op == "get")
return(prefs.getComplexValue(prefName, prefValue[0]));
else
return(prefs.setComplexValue(prefName, prefValue[0], prefValue[1]));
case "":
if (aMessage.json.op == "clear") {
prefs.clearUserPref(prefName);
return;
}
}
break;
case "SPProcessCrashService":
switch (aMessage.json.op) {
case "register-observer":
this.addProcessCrashObservers();
break;
case "unregister-observer":
this.removeProcessCrashObservers();
break;
case "delete-crash-dump-files":
return this.deleteCrashDumpFiles(aMessage.json.filenames);
case "find-crash-dump-files":
return this.findCrashDumpFiles(aMessage.json.crashDumpFilesToIgnore);
default:
throw new SpecialPowersException("Invalid operation for SPProcessCrashService");
}
break;
case "SPPingService":
if (aMessage.json.op == "ping") {
aMessage.target
@ -285,11 +171,9 @@ SpecialPowersObserver.prototype = {
.sendAsyncMessage("SPPingService", { op: "pong" });
}
break;
default:
throw new SpecialPowersException("Unrecognized Special Powers API");
return this._receiveMessage(aMessage);
}
}
};
};
const NSGetFactory = XPCOMUtils.generateNSGetFactory([SpecialPowersObserver]);

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

@ -38,399 +38,80 @@
* order to be used as a replacement for UniversalXPConnect
*/
var Ci = Components.interfaces;
var Cc = Components.classes;
function SpecialPowers(window) {
this.window = window;
bindDOMWindowUtils(this, window);
this._encounteredCrashDumpFiles = [];
this._unexpectedCrashDumpFiles = { };
this._crashDumpDir = null;
this.DOMWindowUtils = bindDOMWindowUtils(window);
this._pongHandlers = [];
this._messageListener = this._messageReceived.bind(this);
addMessageListener("SPPingService", this._messageListener);
this._consoleListeners = [];
}
function bindDOMWindowUtils(sp, window) {
var util = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
// This bit of magic brought to you by the letters
// B Z, and E, S and the number 5.
//
// Take all of the properties on the nsIDOMWindowUtils-implementing
// object, and rebind them onto a new object with a stub that uses
// apply to call them from this privileged scope. This way we don't
// have to explicitly stub out new methods that appear on
// nsIDOMWindowUtils.
var proto = Object.getPrototypeOf(util);
var target = {};
function rebind(desc, prop) {
if (prop in desc && typeof(desc[prop]) == "function") {
var oldval = desc[prop];
try {
desc[prop] = function() { return oldval.apply(util, arguments); };
} catch (ex) {
dump("WARNING: Special Powers failed to rebind function: " + desc + "::" + prop + "\n");
SpecialPowers.prototype = new SpecialPowersAPI();
SpecialPowers.prototype.toString = function() { return "[SpecialPowers]"; };
SpecialPowers.prototype.sanityCheck = function() { return "foo"; };
// This gets filled in in the constructor.
SpecialPowers.prototype.DOMWindowUtils = undefined;
SpecialPowers.prototype._sendSyncMessage = function(msgname, msg) {
return sendSyncMessage(msgname, msg);
};
SpecialPowers.prototype._sendAsyncMessage = function(msgname, msg) {
sendAsyncMessage(msgname, msg);
};
SpecialPowers.prototype.registerProcessCrashObservers = function() {
addMessageListener("SPProcessCrashService", this._messageListener);
sendSyncMessage("SPProcessCrashService", { op: "register-observer" });
};
SpecialPowers.prototype.unregisterProcessCrashObservers = function() {
addMessageListener("SPProcessCrashService", this._messageListener);
sendSyncMessage("SPProcessCrashService", { op: "unregister-observer" });
};
SpecialPowers.prototype._messageReceived = function(aMessage) {
switch (aMessage.name) {
case "SPProcessCrashService":
if (aMessage.json.type == "crash-observed") {
var self = this;
aMessage.json.dumpIDs.forEach(function(id) {
self._encounteredCrashDumpFiles.push(id + ".dmp");
self._encounteredCrashDumpFiles.push(id + ".extra");
});
}
}
}
for (var i in proto) {
var desc = Object.getOwnPropertyDescriptor(proto, i);
rebind(desc, "get");
rebind(desc, "set");
rebind(desc, "value");
Object.defineProperty(target, i, desc);
}
sp.DOMWindowUtils = target;
}
break;
SpecialPowers.prototype = {
toString: function() { return "[SpecialPowers]"; },
sanityCheck: function() { return "foo"; },
// This gets filled in in the constructor.
DOMWindowUtils: undefined,
// Mimic the get*Pref API
getBoolPref: function(aPrefName) {
return (this._getPref(aPrefName, 'BOOL'));
},
getIntPref: function(aPrefName) {
return (this._getPref(aPrefName, 'INT'));
},
getCharPref: function(aPrefName) {
return (this._getPref(aPrefName, 'CHAR'));
},
getComplexValue: function(aPrefName, aIid) {
return (this._getPref(aPrefName, 'COMPLEX', aIid));
},
// Mimic the set*Pref API
setBoolPref: function(aPrefName, aValue) {
return (this._setPref(aPrefName, 'BOOL', aValue));
},
setIntPref: function(aPrefName, aValue) {
return (this._setPref(aPrefName, 'INT', aValue));
},
setCharPref: function(aPrefName, aValue) {
return (this._setPref(aPrefName, 'CHAR', aValue));
},
setComplexValue: function(aPrefName, aIid, aValue) {
return (this._setPref(aPrefName, 'COMPLEX', aValue, aIid));
},
// Mimic the clearUserPref API
clearUserPref: function(aPrefName) {
var msg = {'op':'clear', 'prefName': aPrefName, 'prefType': ""};
sendSyncMessage('SPPrefService', msg);
},
// Private pref functions to communicate to chrome
_getPref: function(aPrefName, aPrefType, aIid) {
var msg = {};
if (aIid) {
// Overloading prefValue to handle complex prefs
msg = {'op':'get', 'prefName': aPrefName, 'prefType':aPrefType, 'prefValue':[aIid]};
} else {
msg = {'op':'get', 'prefName': aPrefName,'prefType': aPrefType};
}
var val = sendSyncMessage('SPPrefService', msg);
if (val == null || val[0] == null)
throw "Error getting pref";
return val[0];
},
_setPref: function(aPrefName, aPrefType, aValue, aIid) {
var msg = {};
if (aIid) {
msg = {'op':'set','prefName':aPrefName, 'prefType': aPrefType, 'prefValue': [aIid,aValue]};
} else {
msg = {'op':'set', 'prefName': aPrefName, 'prefType': aPrefType, 'prefValue': aValue};
}
return(sendSyncMessage('SPPrefService', msg)[0]);
},
//XXX: these APIs really ought to be removed, they're not e10s-safe.
// (also they're pretty Firefox-specific)
_getTopChromeWindow: function(window) {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow)
.QueryInterface(Ci.nsIDOMChromeWindow);
},
_getDocShell: function(window) {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
},
_getMUDV: function(window) {
return this._getDocShell(window).contentViewer
.QueryInterface(Ci.nsIMarkupDocumentViewer);
},
_getAutoCompletePopup: function(window) {
return this._getTopChromeWindow(window).document
.getElementById("PopupAutoComplete");
},
addAutoCompletePopupEventListener: function(window, listener) {
this._getAutoCompletePopup(window).addEventListener("popupshowing",
listener,
false);
},
removeAutoCompletePopupEventListener: function(window, listener) {
this._getAutoCompletePopup(window).removeEventListener("popupshowing",
listener,
false);
},
isBackButtonEnabled: function(window) {
return !this._getTopChromeWindow(window).document
.getElementById("Browser:Back")
.hasAttribute("disabled");
},
addChromeEventListener: function(type, listener, capture, allowUntrusted) {
addEventListener(type, listener, capture, allowUntrusted);
},
removeChromeEventListener: function(type, listener, capture) {
removeEventListener(type, listener, capture);
},
addErrorConsoleListener: function(listener) {
var consoleListener = {
userListener: listener,
observe: function(consoleMessage) {
this.userListener(consoleMessage.message);
}
};
Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService)
.registerListener(consoleListener);
this._consoleListeners.push(consoleListener);
},
removeErrorConsoleListener: function(listener) {
for (var index in this._consoleListeners) {
var consoleListener = this._consoleListeners[index];
if (consoleListener.userListener == listener) {
Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService)
.unregisterListener(consoleListener);
this._consoleListeners = this._consoleListeners.splice(index, 1);
break;
}
}
},
getFullZoom: function(window) {
return this._getMUDV(window).fullZoom;
},
setFullZoom: function(window, zoom) {
this._getMUDV(window).fullZoom = zoom;
},
getTextZoom: function(window) {
return this._getMUDV(window).textZoom;
},
setTextZoom: function(window, zoom) {
this._getMUDV(window).textZoom = zoom;
},
createSystemXHR: function() {
return Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
},
loadURI: function(window, uri, referrer, charset, x, y) {
var webNav = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation);
webNav.loadURI(uri, referrer, charset, x, y);
},
snapshotWindow: function (win, withCaret) {
var el = this.window.document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
el.width = win.innerWidth;
el.height = win.innerHeight;
var ctx = el.getContext("2d");
ctx.drawWindow(win, win.scrollX, win.scrollY,
win.innerWidth, win.innerHeight,
"rgb(255,255,255)",
withCaret ? ctx.DRAWWINDOW_DRAW_CARET : 0);
return el;
},
gc: function() {
this.DOMWindowUtils.garbageCollect();
},
forceGC: function() {
Components.utils.forceGC();
},
hasContentProcesses: function() {
try {
var rt = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);
return rt.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
} catch (e) {
return true;
}
},
_xpcomabi: null,
get XPCOMABI() {
if (this._xpcomabi != null)
return this._xpcomabi;
var xulRuntime = Cc["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULAppInfo)
.QueryInterface(Components.interfaces.nsIXULRuntime);
this._xpcomabi = xulRuntime.XPCOMABI;
return this._xpcomabi;
},
_os: null,
get OS() {
if (this._os != null)
return this._os;
var xulRuntime = Cc["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULAppInfo)
.QueryInterface(Components.interfaces.nsIXULRuntime);
this._os = xulRuntime.OS;
return this._os;
},
registerProcessCrashObservers: function() {
addMessageListener("SPProcessCrashService", this._messageListener);
sendSyncMessage("SPProcessCrashService", { op: "register-observer" });
},
_messageReceived: function(aMessage) {
switch (aMessage.name) {
case "SPProcessCrashService":
if (aMessage.json.type == "crash-observed") {
var self = this;
aMessage.json.dumpIDs.forEach(function(id) {
self._encounteredCrashDumpFiles.push(id + ".dmp");
self._encounteredCrashDumpFiles.push(id + ".extra");
});
case "SPPingService":
if (aMessage.json.op == "pong") {
var handler = this._pongHandlers.shift();
if (handler) {
handler();
}
break;
case "SPPingService":
if (aMessage.json.op == "pong") {
var handler = this._pongHandlers.shift();
if (handler) {
handler();
}
}
break;
}
return true;
},
removeExpectedCrashDumpFiles: function(aExpectingProcessCrash) {
var success = true;
if (aExpectingProcessCrash) {
var message = {
op: "delete-crash-dump-files",
filenames: this._encounteredCrashDumpFiles
};
if (!sendSyncMessage("SPProcessCrashService", message)[0]) {
success = false;
}
}
this._encounteredCrashDumpFiles.length = 0;
return success;
},
break;
}
return true;
};
findUnexpectedCrashDumpFiles: function() {
var self = this;
var message = {
op: "find-crash-dump-files",
crashDumpFilesToIgnore: this._unexpectedCrashDumpFiles
};
var crashDumpFiles = sendSyncMessage("SPProcessCrashService", message)[0];
crashDumpFiles.forEach(function(aFilename) {
self._unexpectedCrashDumpFiles[aFilename] = true;
});
return crashDumpFiles;
},
executeAfterFlushingMessageQueue: function(aCallback) {
this._pongHandlers.push(aCallback);
sendAsyncMessage("SPPingService", { op: "ping" });
},
executeSoon: function(aFunc) {
var tm = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager);
tm.mainThread.dispatch({
run: function() {
aFunc();
}
}, Ci.nsIThread.DISPATCH_NORMAL);
},
addSystemEventListener: function(target, type, listener, useCapture) {
Cc["@mozilla.org/eventlistenerservice;1"].
getService(Ci.nsIEventListenerService).
addSystemEventListener(target, type, listener, useCapture);
},
removeSystemEventListener: function(target, type, listener, useCapture) {
Cc["@mozilla.org/eventlistenerservice;1"].
getService(Ci.nsIEventListenerService).
removeSystemEventListener(target, type, listener, useCapture);
},
setLogFile: function(path) {
this._mfl = new MozillaFileLogger(path);
},
log: function(data) {
this._mfl.log(data);
},
closeLogFile: function() {
this._mfl.close();
},
addCategoryEntry: function(category, entry, value, persists, replace) {
Cc["@mozilla.org/categorymanager;1"].
getService(Components.interfaces.nsICategoryManager).
addCategoryEntry(category, entry, value, persists, replace);
},
getNodePrincipal: function(aNode) {
return aNode.nodePrincipal;
},
getNodeBaseURIObject: function(aNode) {
return aNode.baseURIObject;
},
getDocumentURIObject: function(aDocument) {
return aDocument.documentURIObject;
},
copyString: function(str) {
Cc["@mozilla.org/widget/clipboardhelper;1"].
getService(Ci.nsIClipboardHelper).
copyString(str);
},
SpecialPowers.prototype.executeAfterFlushingMessageQueue = function(aCallback) {
this._pongHandlers.push(aCallback);
sendAsyncMessage("SPPingService", { op: "ping" });
};
// Expose everything but internal APIs (starting with underscores) to
// web content.
// web content. We cannot use Object.keys to view SpecialPowers.prototype since
// we are using the functions from SpecialPowersAPI.prototype
SpecialPowers.prototype.__exposedProps__ = {};
for each (i in Object.keys(SpecialPowers.prototype).filter(function(v) {return v.charAt(0) != "_";})) {
SpecialPowers.prototype.__exposedProps__[i] = "r";
for (var i in SpecialPowers.prototype) {
if (i.charAt(0) != "_")
SpecialPowers.prototype.__exposedProps__[i] = "r";
}
// Attach our API to the window.
@ -439,7 +120,16 @@ function attachSpecialPowersToWindow(aWindow) {
if ((aWindow !== null) &&
(aWindow !== undefined) &&
(aWindow.wrappedJSObject) &&
(aWindow.parent !== null) &&
(aWindow.parent !== undefined) &&
(aWindow.parent.wrappedJSObject.SpecialPowers) &&
!(aWindow.wrappedJSObject.SpecialPowers)) {
aWindow.wrappedJSObject.SpecialPowers = aWindow.parent.SpecialPowers;
}
else if ((aWindow !== null) &&
(aWindow !== undefined) &&
(aWindow.wrappedJSObject) &&
!(aWindow.wrappedJSObject.SpecialPowers)) {
aWindow.wrappedJSObject.SpecialPowers = new SpecialPowers(aWindow);
}
} catch(ex) {

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

@ -1,4 +1,6 @@
specialpowers.jar:
% content specialpowers %content/
content/specialpowers.js (content/specialpowers.js)
content/specialpowersAPI.js (../tests/SimpleTest/specialpowersAPI.js)
content/SpecialPowersObserverAPI.js (../tests/SimpleTest/SpecialPowersObserverAPI.js)
content/MozillaLogger.js (../tests/SimpleTest/MozillaLogger.js)

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

@ -0,0 +1,120 @@
/* ***** 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 Special Powers code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Joel Maher <joel.maher@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either 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 ***** */
function ChromePowers(window) {
this.window = window;
// In the case of browser-chrome tests, we are running as a [ChromeWindow]
// and we have no window.QueryInterface available, content.window is what we need
if (typeof(window) == "ChromeWindow" && typeof(content.window) == "Window") {
this.DOMWindowUtils = bindDOMWindowUtils(content.window);
this.window = content.window
} else {
this.DOMWindowUtils = bindDOMWindowUtils(window);
}
this.spObserver = new SpecialPowersObserverAPI();
}
ChromePowers.prototype = new SpecialPowersAPI();
ChromePowers.prototype.toString = function() { return "[ChromePowers]"; };
ChromePowers.prototype.sanityCheck = function() { return "foo"; };
// This gets filled in in the constructor.
ChromePowers.prototype.DOMWindowUtils = undefined;
ChromePowers.prototype._sendSyncMessage = function(type, msg) {
var aMessage = {'name':type, 'json': msg};
return [this._receiveMessage(aMessage)];
};
ChromePowers.prototype._sendAsyncMessage = function(type, msg) {
var aMessage = {'name':type, 'json': msg};
this._receiveMessage(aMessage);
};
ChromePowers.prototype.registerProcessCrashObservers = function() {
this._sendSyncMessage("SPProcessCrashService", { op: "register-observer" });
};
ChromePowers.prototype.unregisterProcessCrashObservers = function() {
this._sendSyncMessage("SPProcessCrashService", { op: "unregister-observer" });
};
ChromePowers.prototype._receiveMessage = function(aMessage) {
switch (aMessage.name) {
case "SPProcessCrashService":
if (aMessage.json.op == "register-observer" || aMessage.json.op == "unregister-observer") {
// Hack out register/unregister specifically for browser-chrome leaks
break;
} else if (aMessage.type == "crash-observed") {
var self = this;
msg.dumpIDs.forEach(function(id) {
self._encounteredCrashDumpFiles.push(id + ".dmp");
self._encounteredCrashDumpFiles.push(id + ".extra");
});
}
default:
// All calls go here, because we need to handle SPProcessCrashService calls as well
return this.spObserver._receiveMessageAPI(aMessage);
break;
}
};
ChromePowers.prototype.executeAfterFlushingMessageQueue = function(aCallback) {
aCallback();
};
// Expose everything but internal APIs (starting with underscores) to
// web content. We cannot use Object.keys to view SpecialPowers.prototype since
// we are using the functions from SpecialPowersAPI.prototype
ChromePowers.prototype.__exposedProps__ = {};
for (var i in ChromePowers.prototype) {
if (i.charAt(0) != "_")
ChromePowers.prototype.__exposedProps__[i] = "r";
}
if ((window.parent !== null) &&
(window.parent !== undefined) &&
(window.parent.wrappedJSObject.SpecialPowers) &&
!(window.wrappedJSObject.SpecialPowers)) {
window.wrappedJSObject.SpecialPowers = window.parent.SpecialPowers;
} else {
window.wrappedJSObject.SpecialPowers = new ChromePowers(window);
}

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

@ -53,6 +53,8 @@ _SIMPLETEST_FILES = MozillaLogger.js \
ChromeUtils.js \
WindowSnapshot.js \
PluginUtils.js \
specialpowersAPI.js \
SpecialPowersObserverAPI.js \
$(DEPTH)/toolkit/content/tests/browser/common/mockObjects.js \
$(DEPTH)/docshell/test/chrome/docshell_helpers.js \
$(NULL)

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше