Merge m-c to s-c.

This commit is contained in:
Richard Newman 2012-11-06 15:36:31 -08:00
commit ee0049e7be
205 changed files with 3369 additions and 1450 deletions

View File

@ -12,7 +12,6 @@ const Cr = Components.results;
this.EXPORTED_SYMBOLS = ['AccessFu'];
Cu.import('resource://gre/modules/Services.jsm');
Cu.import('resource://gre/modules/Geometry.jsm');
Cu.import('resource://gre/modules/accessibility/Utils.jsm');
Cu.import('resource://gre/modules/accessibility/TouchAdapter.jsm');
@ -32,33 +31,25 @@ this.AccessFu = {
// XXX: only supports attaching to one window now.
throw new Error('Only one window could be attached to AccessFu');
Logger.info('attach');
this.chromeWin = aWindow;
this.prefsBranch = Cc['@mozilla.org/preferences-service;1']
.getService(Ci.nsIPrefService).getBranch('accessibility.accessfu.');
this.prefsBranch.addObserver('activate', this, false);
this.touchAdapter = TouchAdapter;
switch (Utils.MozBuildApp) {
case 'mobile/android':
Services.obs.addObserver(this, 'Accessibility:Settings', false);
Cc['@mozilla.org/android/bridge;1'].
getService(Ci.nsIAndroidBridge).handleGeckoMessage(
JSON.stringify({ gecko: { type: 'Accessibility:Ready' } }));
this.touchAdapter = AndroidTouchAdapter;
break;
case 'b2g':
aWindow.addEventListener(
'ContentStart',
(function(event) {
let content = aWindow.shell.contentBrowser.contentWindow;
content.addEventListener('mozContentEvent', this, false, true);
}).bind(this), false);
break;
default:
break;
try {
Cc['@mozilla.org/android/bridge;1'].
getService(Ci.nsIAndroidBridge).handleGeckoMessage(
JSON.stringify({ gecko: { type: 'Accessibility:Ready' } }));
Services.obs.addObserver(this, 'Accessibility:Settings', false);
} catch (x) {
// Not on Android
aWindow.addEventListener(
'ContentStart',
(function(event) {
let content = aWindow.shell.contentBrowser.contentWindow;
content.addEventListener('mozContentEvent', this, false, true);
}).bind(this), false);
}
try {
@ -79,8 +70,14 @@ this.AccessFu = {
return;
this._enabled = true;
Cu.import('resource://gre/modules/accessibility/Utils.jsm');
Cu.import('resource://gre/modules/accessibility/TouchAdapter.jsm');
Logger.info('enable');
this.touchAdapter = (Utils.MozBuildApp == 'mobile/android') ?
AndroidTouchAdapter : TouchAdapter;
for each (let mm in Utils.getAllMessageManagers(this.chromeWin))
this._loadFrameScript(mm);
@ -137,7 +134,7 @@ this.AccessFu = {
else
this._disable();
} catch (x) {
Logger.logException(x);
dump('Error ' + x.message + ' ' + x.fileName + ':' + x.lineNumber);
}
},
@ -176,7 +173,6 @@ this.AccessFu = {
},
observe: function observe(aSubject, aTopic, aData) {
Logger.debug('observe', aTopic);
switch (aTopic) {
case 'Accessibility:Settings':
this._systemPref = JSON.parse(aData).enabled;
@ -253,6 +249,7 @@ this.AccessFu = {
var Output = {
attach: function attach(aWindow) {
this.chromeWin = aWindow;
Cu.import('resource://gre/modules/Geometry.jsm');
},
Speech: function Speech(aDetails, aBrowser) {
@ -482,36 +479,39 @@ var Input = {
mm.sendAsyncMessage('AccessFu:Scroll', {page: aPage, horizontal: aHorizontal, origin: 'top'});
},
keyMap: {
a: ['moveNext', 'Anchor'],
A: ['movePrevious', 'Anchor'],
b: ['moveNext', 'Button'],
B: ['movePrevious', 'Button'],
c: ['moveNext', 'Combobox'],
C: ['movePrevious', 'Combobox'],
e: ['moveNext', 'Entry'],
E: ['movePrevious', 'Entry'],
f: ['moveNext', 'FormElement'],
F: ['movePrevious', 'FormElement'],
g: ['moveNext', 'Graphic'],
G: ['movePrevious', 'Graphic'],
h: ['moveNext', 'Heading'],
H: ['movePrevious', 'Heading'],
i: ['moveNext', 'ListItem'],
I: ['movePrevious', 'ListItem'],
k: ['moveNext', 'Link'],
K: ['movePrevious', 'Link'],
l: ['moveNext', 'List'],
L: ['movePrevious', 'List'],
p: ['moveNext', 'PageTab'],
P: ['movePrevious', 'PageTab'],
r: ['moveNext', 'RadioButton'],
R: ['movePrevious', 'RadioButton'],
s: ['moveNext', 'Separator'],
S: ['movePrevious', 'Separator'],
t: ['moveNext', 'Table'],
T: ['movePrevious', 'Table'],
x: ['moveNext', 'Checkbox'],
X: ['movePrevious', 'Checkbox']
get keyMap() {
delete this.keyMap;
this.keyMap = {
a: ['moveNext', 'Anchor'],
A: ['movePrevious', 'Anchor'],
b: ['moveNext', 'Button'],
B: ['movePrevious', 'Button'],
c: ['moveNext', 'Combobox'],
C: ['movePrevious', 'Combobox'],
e: ['moveNext', 'Entry'],
E: ['movePrevious', 'Entry'],
f: ['moveNext', 'FormElement'],
F: ['movePrevious', 'FormElement'],
g: ['moveNext', 'Graphic'],
G: ['movePrevious', 'Graphic'],
h: ['moveNext', 'Heading'],
H: ['movePrevious', 'Heading'],
i: ['moveNext', 'ListItem'],
I: ['movePrevious', 'ListItem'],
k: ['moveNext', 'Link'],
K: ['movePrevious', 'Link'],
l: ['moveNext', 'List'],
L: ['movePrevious', 'List'],
p: ['moveNext', 'PageTab'],
P: ['movePrevious', 'PageTab'],
r: ['moveNext', 'RadioButton'],
R: ['movePrevious', 'RadioButton'],
s: ['moveNext', 'Separator'],
S: ['movePrevious', 'Separator'],
t: ['moveNext', 'Table'],
T: ['movePrevious', 'Table'],
x: ['moveNext', 'Checkbox'],
X: ['movePrevious', 'Checkbox']
};
}
};

View File

@ -14,7 +14,7 @@ var gDumpToConsole = false;
*/
function testNames()
{
enableLogging("tree,stack"); // debugging
//enableLogging("tree,stack"); // debugging
var request = new XMLHttpRequest();
request.open("get", gNameRulesFileURL, false);

View File

@ -1,7 +1,9 @@
{
"config_version": 1,
"tooltool_manifest": "releng-pandaboard.tt",
"mock_target": "mozilla-centos6-i386",
"mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA"],
"mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel"],
"mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]],
"build_targets": ["boottarball", "systemtarball", "userdatatarball"],
"upload_files": [
"{workdir}/out/target/product/panda/*.tar.bz2",
@ -10,5 +12,6 @@
"{objdir}/dist/b2g-*.crashreporter-symbols.zip",
"{srcdir}/b2g/config/panda/README",
"{workdir}/sources.xml"
]
],
"gaia": {"vcs": "hgtool", "repo": "http://hg.mozilla.org/projects/gaia"}
}

View File

@ -1,7 +1,7 @@
[
{
"size": 650795556,
"digest": "0286c08c0a9e2149761a41edc71e81aa7345e37a32b40cbf7a1f6eed1224f89f4f9bda8c9025989b4104faf0d9b362a2602504bed7f46de69dfffc8df5b274c2",
"size": 648794484,
"digest": "1d58eddea9392733a703f05d8f8263f977c649366d86cddc50b38b2ad8eb8f3feef2d842476ecca54ff4ab5ae7a0c827bff5a70a1d320129306eee41a4bcdef1",
"algorithm": "sha512",
"filename": "gonk.tar.xz"
}

View File

@ -9,88 +9,90 @@
<default remote="linaro" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
<!-- Gonk specific things and forks -->
<project name="platform_build" path="build" remote="b2g" revision="1532e3d7099724a8701da220ce29e705a33f78eb">
<project name="platform_build" path="build" remote="b2g" revision="273ba23d5c6c9f6a34995a3cc429804d1449ca9f">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="ec56d3ede37a051321ea7c1973b5c29ef53a88db"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5ca350e80f6b2a2a5f30e8f2f7a09abaf4c40a9a"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="32106d4ea635ebe17a1610b643b398db639b8b97"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="6ee1f8987ef36d688f97064c003ad57849dfadf2"/>
<!-- Stock Android things -->
<!-- Information: platform/abi/cpp is tagged with android-4.0.1_r1 --><project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
<!-- Information: platform/bionic is tagged with android-4.0.4_r1 --><project name="platform/bionic" path="bionic" revision="3d11bf0f3f3cf848f6f1e8449bf8736d8d1c78a3"/>
<!-- Information: platform/bootable/recovery is tagged with android-4.0.3_r1 --><project name="platform/bootable/recovery" path="bootable/recovery" revision="fadc5ac81d6400ebdd041f7d4ea64021596d6b7d"/>
<!-- Information: device/common is tagged with android-4.0.4_r1 --><project name="device/common" path="device/common" revision="7d4526582f88808a3194e1a3b304abb369d2745c"/>
<!-- Information: device/sample is tagged with android-4.0.4_r1.2 --><project name="device/sample" path="device/sample" revision="ef228b8b377a9663e94be4b1aeb6c2bf7a07d098"/>
<!-- Information: platform/external/apache-http is tagged with android-4.0.1_r1 --><project name="platform/external/apache-http" path="external/apache-http" revision="6c9d8c58d3ed710f87c26820d903bb8aad81754f"/>
<!-- Information: platform/external/bluetooth/bluez is tagged with android-4.0.4_r1 --><project name="platform/external/bluetooth/bluez" path="external/bluetooth/bluez" revision="966afbd88f0bfc325bf80274ad2723c238883fa1"/>
<!-- Information: platform/external/bluetooth/glib is tagged with android-3.2.6_r1 --><project name="platform/external/bluetooth/glib" path="external/bluetooth/glib" revision="1143b9918eab068401b604eb11c3f651f4e38b25"/>
<!-- Information: platform/external/bluetooth/hcidump is tagged with android-3.2.6_r1 --><project name="platform/external/bluetooth/hcidump" path="external/bluetooth/hcidump" revision="7322661808c2006b7848e79e6bb72b37fbcf6710"/>
<!-- Information: platform/external/bsdiff is tagged with android-4.0.1_r1 --><project name="platform/external/bsdiff" path="external/bsdiff" revision="81872540236d9bb15cccf963d05b9de48baa5375"/>
<!-- Information: platform/abi/cpp is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
<!-- Information: platform/bionic is tagged with android-4.0.4_r2.1 --><project name="platform/bionic" path="bionic" revision="3d11bf0f3f3cf848f6f1e8449bf8736d8d1c78a3"/>
<!-- Information: platform/bootable/recovery is tagged with android-4.0.4_r2.1 --><project name="platform/bootable/recovery" path="bootable/recovery" revision="fadc5ac81d6400ebdd041f7d4ea64021596d6b7d"/>
<!-- Information: device/common is tagged with android-sdk-adt_r20 --><project name="device/common" path="device/common" revision="7d4526582f88808a3194e1a3b304abb369d2745c"/>
<!-- Information: device/sample is tagged with android-4.0.4_r2.1 --><project name="device/sample" path="device/sample" revision="ef228b8b377a9663e94be4b1aeb6c2bf7a07d098"/>
<!-- Information: platform/external/apache-http is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/apache-http" path="external/apache-http" revision="6c9d8c58d3ed710f87c26820d903bb8aad81754f"/>
<!-- Information: platform/external/bluetooth/bluez is tagged with android-4.0.4_r2.1 --><project name="platform/external/bluetooth/bluez" path="external/bluetooth/bluez" revision="966afbd88f0bfc325bf80274ad2723c238883fa1"/>
<!-- Information: platform/external/bluetooth/glib is tagged with android-4.1.1_r6.1 --><project name="platform/external/bluetooth/glib" path="external/bluetooth/glib" revision="1143b9918eab068401b604eb11c3f651f4e38b25"/>
<!-- Information: platform/external/bluetooth/hcidump is tagged with android-4.1.1_r6.1 --><project name="platform/external/bluetooth/hcidump" path="external/bluetooth/hcidump" revision="7322661808c2006b7848e79e6bb72b37fbcf6710"/>
<!-- Information: platform/external/bsdiff is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/bsdiff" path="external/bsdiff" revision="81872540236d9bb15cccf963d05b9de48baa5375"/>
<project name="platform/external/busybox" path="external/busybox" remote="linaro" revision="4fa5717aed10a5617c52def848dbd42ec7eca35b"/>
<!-- Information: platform/external/bzip2 is tagged with android-4.0.1_r1 --><project name="platform/external/bzip2" path="external/bzip2" revision="048dacdca43eed1534689ececcf2781c63e1e4ba"/>
<!-- Information: platform/external/dbus is tagged with android-3.2.6_r1 --><project name="platform/external/dbus" path="external/dbus" revision="537eaff5de9aace3348436166d4cde7adc1e488e"/>
<!-- Information: platform/external/dhcpcd is tagged with android-4.0.3_r1 --><project name="platform/external/dhcpcd" path="external/dhcpcd" revision="ddaa48f57b54b2862b3e6dcf18a44c9647f3baaa"/>
<!-- Information: platform/external/dnsmasq is tagged with android-3.2.6_r1 --><project name="platform/external/dnsmasq" path="external/dnsmasq" revision="f621afad94df46204c25fc2593a19d704d2637f5"/>
<!-- Information: platform/external/expat is tagged with android-4.0.1_r1 --><project name="platform/external/expat" path="external/expat" revision="6df134250feab71edb5915ecaa6268210bca76c5"/>
<!-- Information: platform/external/fdlibm is tagged with android-4.0.1_r1 --><project name="platform/external/fdlibm" path="external/fdlibm" revision="988ffeb12a6e044ae3504838ef1fee3fe0716934"/>
<!-- Information: platform/external/flac is tagged with android-4.0.1_r1 --><project name="platform/external/flac" path="external/flac" revision="5893fbe890f5dab8e4146d2baa4bd2691c0739e0"/>
<!-- Information: platform/external/freetype is tagged with android-4.0.1_r1 --><project name="platform/external/freetype" path="external/freetype" revision="aeb407daf3711a10a27f3bc2223c5eb05158076e"/>
<!-- Information: platform/external/giflib is tagged with android-2.3.1_r1 --><project name="platform/external/giflib" path="external/giflib" revision="b2597268aef084202a8c349d1cc072c03c6e22eb"/>
<!-- Information: platform/external/bzip2 is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/bzip2" path="external/bzip2" revision="048dacdca43eed1534689ececcf2781c63e1e4ba"/>
<!-- Information: platform/external/dbus is tagged with android-4.1.1_r6.1 --><project name="platform/external/dbus" path="external/dbus" revision="537eaff5de9aace3348436166d4cde7adc1e488e"/>
<!-- Information: platform/external/dhcpcd is tagged with android-sdk-adt_r20 --><project name="platform/external/dhcpcd" path="external/dhcpcd" revision="ddaa48f57b54b2862b3e6dcf18a44c9647f3baaa"/>
<!-- Information: platform/external/dnsmasq is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/dnsmasq" path="external/dnsmasq" revision="f621afad94df46204c25fc2593a19d704d2637f5"/>
<!-- Information: platform/external/expat is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/expat" path="external/expat" revision="6df134250feab71edb5915ecaa6268210bca76c5"/>
<!-- Information: platform/external/fdlibm is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/fdlibm" path="external/fdlibm" revision="988ffeb12a6e044ae3504838ef1fee3fe0716934"/>
<!-- Information: platform/external/flac is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/flac" path="external/flac" revision="5893fbe890f5dab8e4146d2baa4bd2691c0739e0"/>
<!-- Information: platform/external/freetype is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/freetype" path="external/freetype" revision="aeb407daf3711a10a27f3bc2223c5eb05158076e"/>
<!-- Information: platform/external/giflib is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/giflib" path="external/giflib" revision="b2597268aef084202a8c349d1cc072c03c6e22eb"/>
<project name="platform/external/gtest" path="external/gtest" remote="linaro" revision="85030ffa1dd68c0cc05e9115430f28627996e019"/>
<!-- Information: platform/external/harfbuzz is tagged with android-4.0.3_r1 --><project name="platform/external/harfbuzz" path="external/harfbuzz" revision="bae491c03a00757d83ede8d855b7d85d246bde3d"/>
<!-- Information: platform/external/icu4c is tagged with android-4.0.1_r1 --><project name="platform/external/icu4c" path="external/icu4c" revision="0fa67b93b831c6636ca18b152a1b1b14cc99b034"/>
<!-- Information: platform/external/iptables is tagged with android-3.2.6_r1 --><project name="platform/external/iptables" path="external/iptables" revision="3b2deb17f065c5664bb25e1a28489e5792eb63ff"/>
<!-- Information: platform/external/jhead is tagged with android-4.0.1_r1 --><project name="platform/external/jhead" path="external/jhead" revision="754078052c687f6721536009c816644c73e4f145"/>
<!-- Information: platform/external/jpeg is tagged with android-4.0.1_r1 --><project name="platform/external/jpeg" path="external/jpeg" revision="d4fad7f50f79626455d88523207e05b868819cd8"/>
<!-- Information: platform/external/libgsm is tagged with android-2.3.1_r1 --><project name="platform/external/libgsm" path="external/libgsm" revision="5e4516958690b9a1b2c98f88eeecba3edd2dbda4"/>
<!-- Information: platform/external/liblzf is tagged with android-4.0.1_r1 --><project name="platform/external/liblzf" path="external/liblzf" revision="6946aa575b0949d045722794850896099d937cbb"/>
<!-- Information: platform/external/libnfc-nxp is tagged with android-4.0.3_r1 --><project name="platform/external/libnfc-nxp" path="external/libnfc-nxp" revision="533c14450e6239cce8acb74f4e4dea2c89f8f219"/>
<!-- Information: platform/external/libnl-headers is tagged with android-4.0.1_r1 --><project name="platform/external/libnl-headers" path="external/libnl-headers" revision="6ccf7349d61f73ac26a0675d735d903ab919c658"/>
<!-- Information: platform/external/libphonenumber is tagged with android-4.0.3_r1 --><project name="platform/external/libphonenumber" path="external/libphonenumber" revision="d470984844c388d6766c3de6ac64e93e00480fc9"/>
<!-- Information: platform/external/libpng is tagged with android-4.0.3_r1 --><project name="platform/external/libpng" path="external/libpng" revision="84d92c718ab9f48faec0f640747c4b6f7a995607"/>
<!-- Information: platform/external/libvpx is tagged with android-4.0.1_r1 --><project name="platform/external/libvpx" path="external/libvpx" revision="3a40da0d96da5c520e7707aa14f48a80956e20d7"/>
<!-- Information: platform/external/mksh is tagged with android-4.0.1_r1 --><project name="platform/external/mksh" path="external/mksh" revision="5155f1c7438ef540d7b25eb70aa1639579795b07"/>
<!-- Information: platform/external/harfbuzz is tagged with android-sdk-adt_r20 --><project name="platform/external/harfbuzz" path="external/harfbuzz" revision="bae491c03a00757d83ede8d855b7d85d246bde3d"/>
<!-- Information: platform/external/icu4c is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/icu4c" path="external/icu4c" revision="0fa67b93b831c6636ca18b152a1b1b14cc99b034"/>
<!-- Information: platform/external/iptables is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/iptables" path="external/iptables" revision="3b2deb17f065c5664bb25e1a28489e5792eb63ff"/>
<!-- Information: platform/external/jhead is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/jhead" path="external/jhead" revision="754078052c687f6721536009c816644c73e4f145"/>
<!-- Information: platform/external/jpeg is tagged with android-4.1.1_r6.1 --><project name="platform/external/jpeg" path="external/jpeg" revision="d4fad7f50f79626455d88523207e05b868819cd8"/>
<!-- Information: platform/external/libgsm is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/libgsm" path="external/libgsm" revision="5e4516958690b9a1b2c98f88eeecba3edd2dbda4"/>
<!-- Information: platform/external/liblzf is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/liblzf" path="external/liblzf" revision="6946aa575b0949d045722794850896099d937cbb"/>
<!-- Information: platform/external/libnfc-nxp is tagged with android-4.0.4_r2.1 --><project name="platform/external/libnfc-nxp" path="external/libnfc-nxp" revision="533c14450e6239cce8acb74f4e4dea2c89f8f219"/>
<!-- Information: platform/external/libnl-headers is tagged with android-4.2_pre3 --><project name="platform/external/libnl-headers" path="external/libnl-headers" revision="6ccf7349d61f73ac26a0675d735d903ab919c658"/>
<!-- Information: platform/external/libphonenumber is tagged with android-4.0.4_r2.1 --><project name="platform/external/libphonenumber" path="external/libphonenumber" revision="d470984844c388d6766c3de6ac64e93e00480fc9"/>
<!-- Information: platform/external/libpng is tagged with android-4.0.4_r2.1 --><project name="platform/external/libpng" path="external/libpng" revision="84d92c718ab9f48faec0f640747c4b6f7a995607"/>
<!-- Information: platform/external/libvpx is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/libvpx" path="external/libvpx" revision="3a40da0d96da5c520e7707aa14f48a80956e20d7"/>
<!-- Information: platform/external/mksh is tagged with M8960AAAAANLYA1099D --><project name="platform/external/mksh" path="external/mksh" revision="5155f1c7438ef540d7b25eb70aa1639579795b07"/>
<project name="platform_external_opensans" path="external/opensans" remote="b2g" revision="b5b4c226ca1d71e936153cf679dda6d3d60e2354"/>
<!-- Information: platform/external/openssl is tagged with android-4.0.3_r1 --><project name="platform/external/openssl" path="external/openssl" revision="ce96fb211b9a44bbd7fb5ef7ed0e6c1244045c2e"/>
<!-- Information: platform/external/protobuf is tagged with android-4.0.1_r1 --><project name="platform/external/protobuf" path="external/protobuf" revision="e217977611c52bccde7f7c78e1d3c790c6357431"/>
<!-- Information: platform/external/safe-iop is tagged with android-2.3.1_r1 --><project name="platform/external/safe-iop" path="external/safe-iop" revision="07073634e2e3aa4f518e36ed5dec3aabc549d5fb"/>
<!-- Information: platform/external/openssl is tagged with android-4.0.4_r2.1 --><project name="platform/external/openssl" path="external/openssl" revision="ce96fb211b9a44bbd7fb5ef7ed0e6c1244045c2e"/>
<!-- Information: platform/external/protobuf is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/protobuf" path="external/protobuf" revision="e217977611c52bccde7f7c78e1d3c790c6357431"/>
<!-- Information: platform/external/safe-iop is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/safe-iop" path="external/safe-iop" revision="07073634e2e3aa4f518e36ed5dec3aabc549d5fb"/>
<project name="screencap-gonk" path="external/screencap-gonk" remote="b2g" revision="e6403c71e9eca8cb943739d5a0a192deac60fc51"/>
<!-- Information: platform/external/skia is tagged with android-4.0.3_r1 --><project name="platform/external/skia" path="external/skia" revision="5c67a309e16bffe7013defda8f1217b3ce2420b4"/>
<!-- Information: platform/external/sonivox is tagged with android-4.0.1_r1 --><project name="platform/external/sonivox" path="external/sonivox" revision="5f9600971859fe072f31b38a51c38157f5f9b381"/>
<!-- Information: platform/external/speex is tagged with android-4.0.1_r1 --><project name="platform/external/speex" path="external/speex" revision="ebe6230a7f7c69f5a4389f2b09b7b19ef9e94f32"/>
<!-- Information: platform/external/sqlite is tagged with android-4.0.3_r1 --><project name="platform/external/sqlite" path="external/sqlite" revision="c999ff8c12a4cf81cb9ad628f47b2720effba5e5"/>
<!-- Information: platform/external/stlport is tagged with android-4.0.1_r1 --><project name="platform/external/stlport" path="external/stlport" revision="a6734e0645fce81c9610de0488b729207bfa576e"/>
<!-- Information: platform/external/strace is tagged with android-4.0.1_r1 --><project name="platform/external/strace" path="external/strace" revision="c9fd2e5ef7d002e12e7cf2512506c84a9414b0fd"/>
<!-- Information: platform/external/tagsoup is tagged with android-2.2.1_r1 --><project name="platform/external/tagsoup" path="external/tagsoup" revision="68c2ec9e0acdb3214b7fb91dbab8c9fab8736817"/>
<!-- Information: platform/external/tinyalsa is tagged with android-4.0.4_r1 --><project name="platform/external/tinyalsa" path="external/tinyalsa" revision="495239e683a728957c890c124b239f9b7b8ef5a8"/>
<!-- Information: platform/external/tremolo is tagged with android-4.0.1_r1 --><project name="platform/external/tremolo" path="external/tremolo" revision="25bd78d2392dbdc879ae53382cde9d019f79cf6f"/>
<!-- Information: platform/external/webp is tagged with android-4.0.1_r1 --><project name="platform/external/webp" path="external/webp" revision="88fe2b83c4b9232cd08729556fd0485d6a6a92cd"/>
<!-- Information: platform/external/webrtc is tagged with android-4.0.1_r1 --><project name="platform/external/webrtc" path="external/webrtc" revision="4b6dc1ec58105d17dc8c2f550124cc0621dc93b7"/>
<!-- Information: platform/external/wpa_supplicant is tagged with android-4.0.1_r1 --><project name="platform/external/wpa_supplicant" path="external/wpa_supplicant" revision="a01d37870bbf9892d43e792e5de0683ca41c5497"/>
<!-- Information: platform/external/skia is tagged with android-4.0.4_r2.1 --><project name="platform/external/skia" path="external/skia" revision="5c67a309e16bffe7013defda8f1217b3ce2420b4"/>
<!-- Information: platform/external/sonivox is tagged with android-sdk-adt_r20 --><project name="platform/external/sonivox" path="external/sonivox" revision="5f9600971859fe072f31b38a51c38157f5f9b381"/>
<!-- Information: platform/external/speex is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/speex" path="external/speex" revision="ebe6230a7f7c69f5a4389f2b09b7b19ef9e94f32"/>
<!-- Information: platform/external/sqlite is tagged with android-4.0.4_r2.1 --><project name="platform/external/sqlite" path="external/sqlite" revision="c999ff8c12a4cf81cb9ad628f47b2720effba5e5"/>
<!-- Information: platform/external/stlport is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/stlport" path="external/stlport" revision="a6734e0645fce81c9610de0488b729207bfa576e"/>
<!-- Information: platform/external/strace is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/strace" path="external/strace" revision="c9fd2e5ef7d002e12e7cf2512506c84a9414b0fd"/>
<!-- Information: platform/external/tagsoup is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/tagsoup" path="external/tagsoup" revision="68c2ec9e0acdb3214b7fb91dbab8c9fab8736817"/>
<!-- Information: platform/external/tinyalsa is tagged with android-4.0.4_r2.1 --><project name="platform/external/tinyalsa" path="external/tinyalsa" revision="495239e683a728957c890c124b239f9b7b8ef5a8"/>
<!-- Information: platform/external/tremolo is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/tremolo" path="external/tremolo" revision="25bd78d2392dbdc879ae53382cde9d019f79cf6f"/>
<!-- Information: platform/external/webp is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/webp" path="external/webp" revision="88fe2b83c4b9232cd08729556fd0485d6a6a92cd"/>
<!-- Information: platform/external/webrtc is tagged with android-sdk-adt_r20 --><project name="platform/external/webrtc" path="external/webrtc" revision="4b6dc1ec58105d17dc8c2f550124cc0621dc93b7"/>
<!-- Information: platform/external/wpa_supplicant is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/external/wpa_supplicant" path="external/wpa_supplicant" revision="a01d37870bbf9892d43e792e5de0683ca41c5497"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="6dd24fc3792d71edccef9b09140f9a44b063a553"/>
<!-- Information: platform/external/zlib is tagged with android-4.0.1_r1 --><project name="platform/external/zlib" path="external/zlib" revision="69e5801bd16a495e1c1666669fe827b1ddb8d56b"/>
<!-- Information: platform/external/yaffs2 is tagged with android-4.0.1_r1 --><project name="platform/external/yaffs2" path="external/yaffs2" revision="6232e2d5ab34a40d710e4b05ab0ec6e3727804e7"/>
<!-- Information: platform/frameworks/base is tagged with android-4.0.4_r1.1 --><project name="platform/frameworks/base" path="frameworks/base" revision="df331873c8576e0ae34ae1ee3cc258beed373535"/>
<!-- Information: platform/frameworks/opt/emoji is tagged with android-4.0.1_r1 --><project name="platform/frameworks/opt/emoji" path="frameworks/opt/emoji" revision="a95d8db002770469d72dfaf59ff37ac96db29a87"/>
<!-- Information: platform/frameworks/support is tagged with android-4.0.4_r1 --><project name="platform/frameworks/support" path="frameworks/support" revision="bfc8e01b7b0d5ea70ce89d0409b72b7f7d540f43"/>
<!-- Information: platform/hardware/libhardware is tagged with android-4.0.3_r1 --><project name="platform/hardware/libhardware" path="hardware/libhardware" revision="a9b677fce432b29ab8f61e13796f34880dc0fe0f"/>
<!-- Information: platform/hardware/libhardware_legacy is tagged with android-4.0.3_r1 --><project name="platform/hardware/libhardware_legacy" path="hardware/libhardware_legacy" revision="153d0f1a27e0a157cabb6ca9d0d88248630f5695"/>
<!-- Information: platform/hardware/ril is tagged with android-4.0.3_r1 --><project name="platform/hardware/ril" path="hardware/ril" revision="300105d1487f5238940c18792b879793826b61f4"/>
<!-- Information: platform/libcore is tagged with android-4.0.4_r1 --><project name="platform/libcore" path="libcore" revision="fc294a48d80d9e2b2ac126edf93ad316f5f6cf72"/>
<!-- Information: platform/ndk is tagged with android-4.0.3_r1 --><project name="platform/ndk" path="ndk" revision="2d77f5a05f60029c981f299b222cfe28db18ccf7"/>
<!-- Information: platform/prebuilt is tagged with android-4.0.4_r1 --><project name="platform/prebuilt" path="prebuilt" revision="0e104261b6d33f87e9f86ff4249bcc0306ab278b"/>
<!-- Information: platform/system/bluetooth is tagged with android-4.0.3_r1 --><project name="platform/system/bluetooth" path="system/bluetooth" revision="2588cd802f322650ed737dfb7a10e9ad94064e99"/>
<!-- Information: platform/system/core is tagged with android-4.0.4_r1 --><project name="platform/system/core" path="system/core" revision="c2db4ffb874783220abf967ca4ccd0e6cf1ba57f"/>
<!-- Information: platform/system/extras is tagged with android-4.0.4_r1 --><project name="platform/system/extras" path="system/extras" revision="fa351ab265957fa8815df3c4ca1f3c105f253e8b"/>
<!-- Information: platform/system/media is tagged with android-4.0.3_r1 --><project name="platform/system/media" path="system/media" revision="a8eea50f80327f15cb04bbdfee2d1cfcc4c3ce4a"/>
<!-- Information: platform/system/netd is tagged with android-4.0.4_r1 --><project name="platform/system/netd" path="system/netd" revision="3c903b555975fa59d6688a0a6417ac7512c202e7"/>
<!-- Information: platform/system/vold is tagged with android-4.0.1_r1 --><project name="platform/system/vold" path="system/vold" revision="3ad9072a5d6f6bda32123b367545649364e3c11d"/>
<!-- Information: platform/external/zlib is tagged with android-4.0.4_r2.1 --><project name="platform/external/zlib" path="external/zlib" revision="69e5801bd16a495e1c1666669fe827b1ddb8d56b"/>
<!-- Information: platform/external/yaffs2 is tagged with android-4.0.4-aah_r1 --><project name="platform/external/yaffs2" path="external/yaffs2" revision="6232e2d5ab34a40d710e4b05ab0ec6e3727804e7"/>
<!-- Information: platform/frameworks/base is tagged with android-4.0.4_r2.1 --><project name="platform/frameworks/base" path="frameworks/base" revision="df331873c8576e0ae34ae1ee3cc258beed373535"/>
<!-- Information: platform/frameworks/opt/emoji is tagged with AU_LINUX_GECKO_ICS_STRAWBERRY.01.00.00.19.079 --><project name="platform/frameworks/opt/emoji" path="frameworks/opt/emoji" revision="a95d8db002770469d72dfaf59ff37ac96db29a87"/>
<!-- Information: platform/frameworks/support is tagged with android-4.0.4_r2.1 --><project name="platform/frameworks/support" path="frameworks/support" revision="bfc8e01b7b0d5ea70ce89d0409b72b7f7d540f43"/>
<!-- Information: platform/hardware/libhardware is tagged with android-4.0.4_r2.1 --><project name="platform/hardware/libhardware" path="hardware/libhardware" revision="a9b677fce432b29ab8f61e13796f34880dc0fe0f"/>
<!-- Information: platform/hardware/libhardware_legacy is tagged with android-4.0.4_r2.1 --><project name="platform/hardware/libhardware_legacy" path="hardware/libhardware_legacy" revision="153d0f1a27e0a157cabb6ca9d0d88248630f5695"/>
<!-- Information: platform/hardware/ril is tagged with android-4.0.4_r2.1 --><project name="platform/hardware/ril" path="hardware/ril" revision="300105d1487f5238940c18792b879793826b61f4"/>
<!-- Information: platform/libcore is tagged with android-4.0.4_r2.1 --><project name="platform/libcore" path="libcore" revision="fc294a48d80d9e2b2ac126edf93ad316f5f6cf72"/>
<!-- Information: platform/ndk is tagged with android-4.0.4_r2.1 --><project name="platform/ndk" path="ndk" revision="2d77f5a05f60029c981f299b222cfe28db18ccf7"/>
<!-- Information: platform/prebuilt is tagged with tungsten-bootloader-ics-aah --><project name="platform/prebuilt" path="prebuilt" revision="0e104261b6d33f87e9f86ff4249bcc0306ab278b"/>
<!-- Information: platform/system/bluetooth is tagged with android-4.0.4_r2.1 --><project name="platform/system/bluetooth" path="system/bluetooth" revision="2588cd802f322650ed737dfb7a10e9ad94064e99"/>
<!-- Information: platform/system/core is tagged with android-4.0.4_r2.1 --><project name="platform/system/core" path="system/core" revision="c2db4ffb874783220abf967ca4ccd0e6cf1ba57f"/>
<!-- Information: platform/system/extras is tagged with android-4.0.4_r2.1 --><project name="platform/system/extras" path="system/extras" revision="fa351ab265957fa8815df3c4ca1f3c105f253e8b"/>
<!-- Information: platform/system/media is tagged with android-4.0.4_r2.1 --><project name="platform/system/media" path="system/media" revision="a8eea50f80327f15cb04bbdfee2d1cfcc4c3ce4a"/>
<!-- Information: platform/system/netd is tagged with android-4.0.4_r2.1 --><project name="platform/system/netd" path="system/netd" revision="3c903b555975fa59d6688a0a6417ac7512c202e7"/>
<!-- Information: platform/system/vold is tagged with android-4.0.4_r2.1 --><project name="platform/system/vold" path="system/vold" revision="3ad9072a5d6f6bda32123b367545649364e3c11d"/>
<!-- Pandaboard specific things -->
<project name="android-device-panda" path="device/ti/panda" remote="b2g" revision="295425a4f894d6042ea69dfeaceaad4d8d5e6204"/>
<!-- Information: platform/hardware/ti/omap4xxx is tagged with android-4.0.3_r1.1 --><project name="platform/hardware/ti/omap4xxx" path="hardware/ti/omap4xxx" revision="8be8e9a68c96b6cf43c08a58e7ecd7708737c599"/>
<project name="android-device-panda" path="device/ti/panda" remote="b2g" revision="122c4a65e7d0328a90e1a0596c914377d66a4d6f"/>
<!-- Information: platform/hardware/ti/omap4xxx is tagged with android-4.0.4_r2.1 --><project name="platform/hardware/ti/omap4xxx" path="hardware/ti/omap4xxx" revision="8be8e9a68c96b6cf43c08a58e7ecd7708737c599"/>
<project name="platform/hardware/ti/wlan" path="hardware/ti/wlan" revision="60dfeb6e4448bfed707946ebca6612980f525e69"/>
<project name="platform/hardware/ti/wpan" path="hardware/ti/wpan" revision="3ece7d9e08052989401e008bc397dbcd2557cfd0"/>
<project name="Negatus" path="external/negatus" remote="mozilla" revision="5d5288e7bec67d0a6a29320308cccb1321062b58"/>
</manifest>

View File

@ -1,7 +1,9 @@
{
"config_version": 1,
"tooltool_manifest": "releng-unagi.tt",
"mock_target": "mozilla-centos6-i386",
"mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients"],
"mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel"],
"mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]],
"build_targets": [],
"upload_files": [
"{workdir}/out/target/product/unagi/*.img",
@ -13,5 +15,6 @@
"env": {
"VARIANT": "user",
"B2GUPDATER": "1"
}
},
"gaia": {"vcs": "hgtool", "repo": "http://hg.mozilla.org/projects/gaia"}
}

View File

@ -42,6 +42,7 @@ MOZ_APP_ID={3c2e2abc-06d4-11e1-ac3b-374f68613e61}
MOZ_EXTENSION_MANAGER=1
MOZ_SYS_MSG=1
MOZ_TIME_MANAGER=1
MOZ_PAY=1
MOZ_TOOLKIT_SEARCH=

View File

@ -996,6 +996,7 @@ var SocialSidebar = {
let sbrowser = document.getElementById("social-sidebar-browser");
if (hideSidebar) {
sbrowser.removeEventListener("load", SocialSidebar._loadListener, true);
this.setSidebarVisibilityState(false);
// If we've been disabled, unload the sidebar content immediately;
// if the sidebar was just toggled to invisible, wait a timeout
@ -1018,19 +1019,19 @@ var SocialSidebar = {
if (sbrowser.getAttribute("origin") != Social.provider.origin) {
sbrowser.setAttribute("origin", Social.provider.origin);
sbrowser.setAttribute("src", Social.provider.sidebarURL);
sbrowser.addEventListener("load", function sidebarOnShow() {
sbrowser.removeEventListener("load", sidebarOnShow, true);
// let load finish, then fire our event
setTimeout(function () {
SocialSidebar.setSidebarVisibilityState(true);
}, 0);
}, true);
sbrowser.addEventListener("load", SocialSidebar._loadListener, true);
} else {
this.setSidebarVisibilityState(true);
}
}
},
_loadListener: function SocialSidebar_loadListener() {
let sbrowser = document.getElementById("social-sidebar-browser");
sbrowser.removeEventListener("load", SocialSidebar._loadListener, true);
SocialSidebar.setSidebarVisibilityState(true);
},
unloadSidebar: function SocialSidebar_unloadSidebar() {
let sbrowser = document.getElementById("social-sidebar-browser");
if (!sbrowser.hasAttribute("origin"))

View File

@ -13,6 +13,8 @@ var gTab = null;
var gDebugger = null;
var gDebuggee = null;
requestLongerTimeout(2);
function test()
{
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
@ -33,6 +35,7 @@ function addBreakpoint()
}, function() {
// Wait for the resume...
gDebugger.gClient.addOneTimeListener("resumed", function() {
gDebugger.DebuggerView.Variables.nonEnumVisible = false;
testVariablesExpand();
});
});
@ -194,15 +197,6 @@ function testVariablesExpand()
is(locationItem.target.querySelector(".details").hasAttribute("open"), true,
"The locationItem enumerables should still be expanded (1)");
is(thisItem.target.querySelector(".details.nonenum").hasAttribute("open"), true,
"The thisItem non-enumerables should still be expanded (1)");
is(windowItem.target.querySelector(".details.nonenum").hasAttribute("open"), true,
"The windowItem non-enumerables should still be expanded (1)");
is(documentItem.target.querySelector(".details.nonenum").hasAttribute("open"), true,
"The documentItem non-enumerables should still be expanded (1)");
is(locationItem.target.querySelector(".details.nonenum").hasAttribute("open"), true,
"The locationItem non-enumerables should still be expanded (1)");
is(thisItem.expanded, true,
"The local scope 'this' should still be expanded (1)");
is(windowItem.expanded, true,
@ -275,15 +269,6 @@ function testVariablesExpand()
is(locationItem.target.querySelector(".details").hasAttribute("open"), true,
"The locationItem enumerables should still be expanded (2)");
is(thisItem.target.querySelector(".details.nonenum").hasAttribute("open"), true,
"The thisItem non-enumerables should still be expanded (2)");
is(windowItem.target.querySelector(".details.nonenum").hasAttribute("open"), true,
"The windowItem non-enumerables should still be expanded (2)");
is(documentItem.target.querySelector(".details.nonenum").hasAttribute("open"), true,
"The documentItem non-enumerables should still be expanded (2)");
is(locationItem.target.querySelector(".details.nonenum").hasAttribute("open"), true,
"The locationItem non-enumerables should still be expanded (2)");
is(thisItem.expanded, true,
"The local scope 'this' should still be expanded (2)");
is(windowItem.expanded, true,

View File

@ -13,6 +13,8 @@ let gDebuggee = null;
let gDebugger = null;
let gView = null;
requestLongerTimeout(2);
function test()
{
let step = 0;

View File

@ -50,13 +50,14 @@ function testCompletion(hud) {
is(input.selectionEnd, 8, "end selection is alright");
is(jsterm.completeNode.value.replace(/ /g, ""), "", "'docu' completed");
// Test typing 'window.O' and press tab.
input.value = "window.O";
input.setSelectionRange(8, 8);
// Test typing 'window.Ob' and press tab. Just 'window.O' is
// ambiguous: could be window.Object, window.Option, etc.
input.value = "window.Ob";
input.setSelectionRange(9, 9);
jsterm.complete(jsterm.COMPLETE_FORWARD, testNext);
yield;
is(input.value, "window.Object", "'window.O' tab completion");
is(input.value, "window.Object", "'window.Ob' tab completion");
// Test typing 'document.getElem'.
input.value = "document.getElem";

View File

@ -7,14 +7,12 @@ import threading
import os
import Queue
import re
import socket
import shutil
import sys
import tempfile
import time
from automation import Automation
from devicemanager import DeviceManager, NetworkTools
from devicemanager import NetworkTools
from mozprocess import ProcessHandlerMixin
@ -261,26 +259,18 @@ class B2GRemoteAutomation(Automation):
Services.io.offline = false;
""")
if not self.context_chrome:
self.marionette.set_context(self.marionette.CONTEXT_CONTENT)
elif self.context_chrome:
if self.context_chrome:
self.marionette.set_context(self.marionette.CONTEXT_CHROME)
else:
self.marionette.set_context(self.marionette.CONTEXT_CONTENT)
# start the tests
if hasattr(self, 'testURL'):
# Start the tests by navigating to the mochitest url, by setting it
# as the 'src' attribute to the homescreen mozbrowser element
# provided by B2G's shell.js.
self.marionette.execute_script("document.getElementById('homescreen').src='%s';" % self.testURL)
# run the script that starts the tests
elif self.test_script:
if self.test_script:
if os.path.isfile(self.test_script):
script = open(self.test_script, 'r')
self.marionette.execute_script(script.read(), script_args=self.test_script_args)
script.close()
else:
# assume test_script is a string
elif isinstance(self.test_script, basestring):
self.marionette.execute_script(self.test_script, script_args=self.test_script_args)
else:
# assumes the tests are started on startup automatically

View File

@ -4293,6 +4293,7 @@ MOZ_WEBSMS_BACKEND=
MOZ_GRAPHITE=1
ACCESSIBILITY=1
MOZ_SYS_MSG=
MOZ_TIME_MANAGER=
MOZ_PAY=
case "$target_os" in
@ -7452,6 +7453,14 @@ if test -n "$MOZ_SYS_MSG"; then
fi
AC_SUBST(MOZ_SYS_MSG)
dnl ========================================================
dnl = Enable Support for Time Manager API
dnl ========================================================
if test -n "$MOZ_TIME_MANAGER"; then
AC_DEFINE(MOZ_TIME_MANAGER)
fi
AC_SUBST(MOZ_TIME_MANAGER)
dnl ========================================================
dnl = Enable Camera Interface for B2G (Gonk usually)
dnl ========================================================

View File

@ -232,8 +232,11 @@ public:
*/
bool IsInAnonymousSubtree() const
{
NS_ASSERTION(!IsInNativeAnonymousSubtree() || GetBindingParent() || !GetParent(),
"must have binding parent when in native anonymous subtree with a parent node");
NS_ASSERTION(!IsInNativeAnonymousSubtree() || GetBindingParent() ||
(!IsInDoc() &&
static_cast<nsIContent*>(SubtreeRoot())->IsInNativeAnonymousSubtree()),
"Must have binding parent when in native anonymous subtree which is in document.\n"
"Native anonymous subtree which is not in document must have native anonymous root.");
return IsInNativeAnonymousSubtree() || GetBindingParent() != nullptr;
}

View File

@ -0,0 +1,103 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Implementations of DOM Core's nsIDOMComment node.
*/
#include "nsCOMPtr.h"
#include "nsGenericElement.h" // DOMCI_NODE_DATA
#include "Comment.h"
using namespace mozilla;
using namespace dom;
// DOMCI_NODE_DATA needs to be outside our namespaces
DOMCI_NODE_DATA(Comment, Comment)
nsresult
NS_NewCommentNode(nsIContent** aInstancePtrResult,
nsNodeInfoManager *aNodeInfoManager)
{
NS_PRECONDITION(aNodeInfoManager, "Missing nodeinfo manager");
*aInstancePtrResult = nullptr;
nsCOMPtr<nsINodeInfo> ni = aNodeInfoManager->GetCommentNodeInfo();
NS_ENSURE_TRUE(ni, NS_ERROR_OUT_OF_MEMORY);
Comment *instance = new Comment(ni.forget());
if (!instance) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(*aInstancePtrResult = instance);
return NS_OK;
}
namespace mozilla {
namespace dom {
Comment::Comment(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericDOMDataNode(aNodeInfo)
{
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE,
"Bad NodeType in aNodeInfo");
}
Comment::~Comment()
{
}
// QueryInterface implementation for Comment
NS_INTERFACE_TABLE_HEAD(Comment)
NS_NODE_INTERFACE_TABLE3(Comment, nsIDOMNode, nsIDOMCharacterData,
nsIDOMComment)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Comment)
NS_INTERFACE_MAP_END_INHERITING(nsGenericDOMDataNode)
NS_IMPL_ADDREF_INHERITED(Comment, nsGenericDOMDataNode)
NS_IMPL_RELEASE_INHERITED(Comment, nsGenericDOMDataNode)
bool
Comment::IsNodeOfType(uint32_t aFlags) const
{
return !(aFlags & ~(eCONTENT | eCOMMENT | eDATA_NODE));
}
nsGenericDOMDataNode*
Comment::CloneDataNode(nsINodeInfo *aNodeInfo, bool aCloneText) const
{
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
Comment *it = new Comment(ni.forget());
if (it && aCloneText) {
it->mText = mText;
}
return it;
}
#ifdef DEBUG
void
Comment::List(FILE* out, int32_t aIndent) const
{
int32_t indx;
for (indx = aIndent; --indx >= 0; ) fputs(" ", out);
fprintf(out, "Comment@%p refcount=%d<!--", (void*)this, mRefCnt.get());
nsAutoString tmp;
ToCString(tmp, 0, mText.GetLength());
fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
fputs("-->\n", out);
}
#endif
} // namespace dom
} // namespace mozilla

View File

@ -0,0 +1,52 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMComment.h"
#include "nsGenericDOMDataNode.h"
namespace mozilla {
namespace dom {
class Comment : public nsGenericDOMDataNode,
public nsIDOMComment
{
public:
Comment(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~Comment();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMCharacterData
NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
// nsIDOMComment
// Empty interface
// nsINode
virtual bool IsNodeOfType(uint32_t aFlags) const;
virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo,
bool aCloneText) const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
#ifdef DEBUG
virtual void List(FILE* out, int32_t aIndent) const;
virtual void DumpContent(FILE* out = stdout, int32_t aIndent = 0,
bool aDumpAll = true) const
{
return;
}
#endif
};
} // namespace dom
} // namespace mozilla

View File

@ -46,11 +46,13 @@ EXPORTS = \
EXPORTS_NAMESPACES = mozilla/dom
EXPORTS_mozilla/dom = \
Comment.h \
DOMImplementation.h \
Link.h \
$(NULL)
CPPSRCS = \
Comment.cpp \
DirectionalityUtils.cpp \
DOMImplementation.cpp \
nsAtomListUtils.cpp \
@ -59,7 +61,6 @@ CPPSRCS = \
nsAttrValueOrString.cpp \
nsCCUncollectableMarker.cpp \
nsChannelPolicy.cpp \
nsCommentNode.cpp \
nsContentAreaDragDrop.cpp \
nsContentIterator.cpp \
nsContentList.cpp \

View File

@ -1,133 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Implementations of DOM Core's nsIDOMComment node.
*/
#include "nsIDOMComment.h"
#include "nsGenericDOMDataNode.h"
#include "nsCOMPtr.h"
#include "nsGenericElement.h" // DOMCI_NODE_DATA
class nsCommentNode : public nsGenericDOMDataNode,
public nsIDOMComment
{
public:
nsCommentNode(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsCommentNode();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMCharacterData
NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
// nsIDOMComment
// Empty interface
// nsINode
virtual bool IsNodeOfType(uint32_t aFlags) const;
virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo,
bool aCloneText) const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
#ifdef DEBUG
virtual void List(FILE* out, int32_t aIndent) const;
virtual void DumpContent(FILE* out = stdout, int32_t aIndent = 0,
bool aDumpAll = true) const
{
return;
}
#endif
};
nsresult
NS_NewCommentNode(nsIContent** aInstancePtrResult,
nsNodeInfoManager *aNodeInfoManager)
{
NS_PRECONDITION(aNodeInfoManager, "Missing nodeinfo manager");
*aInstancePtrResult = nullptr;
nsCOMPtr<nsINodeInfo> ni = aNodeInfoManager->GetCommentNodeInfo();
NS_ENSURE_TRUE(ni, NS_ERROR_OUT_OF_MEMORY);
nsCommentNode *instance = new nsCommentNode(ni.forget());
if (!instance) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(*aInstancePtrResult = instance);
return NS_OK;
}
nsCommentNode::nsCommentNode(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericDOMDataNode(aNodeInfo)
{
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE,
"Bad NodeType in aNodeInfo");
}
nsCommentNode::~nsCommentNode()
{
}
DOMCI_NODE_DATA(Comment, nsCommentNode)
// QueryInterface implementation for nsCommentNode
NS_INTERFACE_TABLE_HEAD(nsCommentNode)
NS_NODE_INTERFACE_TABLE3(nsCommentNode, nsIDOMNode, nsIDOMCharacterData,
nsIDOMComment)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Comment)
NS_INTERFACE_MAP_END_INHERITING(nsGenericDOMDataNode)
NS_IMPL_ADDREF_INHERITED(nsCommentNode, nsGenericDOMDataNode)
NS_IMPL_RELEASE_INHERITED(nsCommentNode, nsGenericDOMDataNode)
bool
nsCommentNode::IsNodeOfType(uint32_t aFlags) const
{
return !(aFlags & ~(eCONTENT | eCOMMENT | eDATA_NODE));
}
nsGenericDOMDataNode*
nsCommentNode::CloneDataNode(nsINodeInfo *aNodeInfo, bool aCloneText) const
{
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
nsCommentNode *it = new nsCommentNode(ni.forget());
if (it && aCloneText) {
it->mText = mText;
}
return it;
}
#ifdef DEBUG
void
nsCommentNode::List(FILE* out, int32_t aIndent) const
{
int32_t indx;
for (indx = aIndent; --indx >= 0; ) fputs(" ", out);
fprintf(out, "Comment@%p refcount=%d<!--", (void*)this, mRefCnt.get());
nsAutoString tmp;
ToCString(tmp, 0, mText.GetLength());
fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
fputs("-->\n", out);
}
#endif

View File

@ -22,6 +22,7 @@
#include "mozilla/dom/HTMLCollectionBinding.h"
#include "mozilla/dom/NodeListBinding.h"
#include "mozilla/Likely.h"
#include "nsGenericHTMLElement.h"
// Form related includes
#include "nsIDOMHTMLFormElement.h"
@ -600,6 +601,42 @@ nsContentList::NamedItem(const nsAString& aName, bool aDoFlush)
return nullptr;
}
void
nsContentList::GetSupportedNames(nsTArray<nsString>& aNames)
{
BringSelfUpToDate(true);
nsAutoTArray<nsIAtom*, 8> atoms;
for (uint32_t i = 0; i < mElements.Length(); ++i) {
nsIContent *content = mElements.ElementAt(i);
nsGenericHTMLElement* el = nsGenericHTMLElement::FromContent(content);
if (el) {
// XXXbz should we be checking for particular tags here? How
// stable is this part of the spec?
// Note: nsINode::HasName means the name is exposed on the document,
// which is false for options, so we don't check it here.
const nsAttrValue* val = el->GetParsedAttr(nsGkAtoms::name);
if (val && val->Type() == nsAttrValue::eAtom) {
nsIAtom* name = val->GetAtomValue();
if (!atoms.Contains(name)) {
atoms.AppendElement(name);
}
}
}
if (content->HasID()) {
nsIAtom* id = content->GetID();
if (!atoms.Contains(id)) {
atoms.AppendElement(id);
}
}
}
aNames.SetCapacity(atoms.Length());
for (uint32_t i = 0; i < atoms.Length(); ++i) {
aNames.AppendElement(nsDependentAtomString(atoms[i]));
}
}
int32_t
nsContentList::IndexOf(nsIContent *aContent, bool aDoFlush)
{

View File

@ -278,6 +278,7 @@ public:
virtual nsGenericElement* GetElementAt(uint32_t index);
virtual JSObject* NamedItem(JSContext* cx, const nsAString& name,
mozilla::ErrorResult& error);
virtual void GetSupportedNames(nsTArray<nsString>& aNames);
// nsContentList public methods
NS_HIDDEN_(uint32_t) Length(bool aDoFlush);

View File

@ -189,7 +189,7 @@ nsPreflightCache::GetEntry(nsIURI* aURI,
// Entry already existed so just return it. Also update the LRU list.
// Move to the head of the list.
entry->remove();
entry->removeFrom(mList);
mList.insertFront(entry);
return entry;
@ -243,13 +243,13 @@ nsPreflightCache::RemoveEntries(nsIURI* aURI, nsIPrincipal* aPrincipal)
nsCString key;
if (GetCacheKey(aURI, aPrincipal, true, key) &&
mTable.Get(key, &entry)) {
entry->remove();
entry->removeFrom(mList);
mTable.Remove(key);
}
if (GetCacheKey(aURI, aPrincipal, false, key) &&
mTable.Get(key, &entry)) {
entry->remove();
entry->removeFrom(mList);
mTable.Remove(key);
}
}
@ -273,7 +273,7 @@ nsPreflightCache::RemoveExpiredEntries(const nsACString& aKey,
if (aValue->mHeaders.IsEmpty() &&
aValue->mMethods.IsEmpty()) {
// Expired, remove from the list as well as the hash table.
aValue->remove();
aValue->removeFrom(sPreflightCache->mList);
return PL_DHASH_REMOVE;
}

View File

@ -33,6 +33,11 @@ public:
mNames.Clear();
}
void CopyList(nsTArray<nsString>& aNames)
{
aNames = mNames;
}
private:
nsTArray<nsString> mNames;
};

View File

@ -15,6 +15,7 @@
#include "nsImageLoadingContent.h"
#include "imgIRequest.h"
#include "nsEventStates.h"
#include "nsEventDispatcher.h"
class nsGenConImageContent : public nsXMLElement,
public nsImageLoadingContent
@ -40,6 +41,17 @@ public:
bool aCompileEventHandlers);
virtual void UnbindFromTree(bool aDeep, bool aNullParent);
virtual nsEventStates IntrinsicState() const;
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor)
{
MOZ_ASSERT(IsInNativeAnonymousSubtree());
if (aVisitor.mEvent->message == NS_LOAD ||
aVisitor.mEvent->message == NS_LOAD_ERROR) {
// Don't propagate the events to the parent.
return NS_OK;
}
return nsXMLElement::PreHandleEvent(aVisitor);
}
private:
virtual ~nsGenConImageContent();

View File

@ -29,7 +29,6 @@
#include "nsIDOMNodeSelector.h"
#include "nsIDOMXPathNSResolver.h"
#include "nsPresContext.h"
#include "nsIDOMDOMStringMap.h"
#include "nsDOMClassInfoID.h" // DOMCI_DATA
#include "nsIDOMTouchEvent.h"
#include "nsIInlineEventHandlers.h"

View File

@ -586,6 +586,7 @@ MOCHITEST_FILES_B = \
test_bug789856.html \
file_bug804395.jar \
test_bug804395.html \
test_bug809003.html \
$(NULL)
# OOP tests don't work on Windows (bug 763081) or native-fennec

View File

@ -0,0 +1,46 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=809003
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 809003</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#testdiv:before {
content: url('data:image/gif,GIF89a%01%00%01%00%80%01%00%FF%00%00%FF%FF%FF!%F9%04%01%00%00%01%00%2C%00%00%00%00%01%00%01%00%00%02%02D%01%00%3B');
}
#testdiv:after {
content: url('non_existing_image.gif');
}
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=809003">Mozilla Bug 809003</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 809003 **/
window.didGetLoad = false;
window.didGetError = false;
SimpleTest.waitForExplicitFinish();
setTimeout(function() {
is(window.didGetLoad, false, "Shouldn't have got load event!");
is(window.didGetError, false, "Shouldn't have got error event!");
SimpleTest.finish();
}, 1000);
</script>
</pre>
<div id="testdiv" onload="window.didGetLoad = true;" onerror="window.didGetError = true;"></div>
</body>
</html>

View File

@ -1562,7 +1562,7 @@ public:
mContext->gl->fDeleteBuffers(1, &mGLName);
mByteLength = 0;
mCache = nullptr;
LinkedListElement<WebGLBuffer>::remove(); // remove from mContext->mBuffers
LinkedListElement<WebGLBuffer>::removeFrom(mContext->mBuffers);
}
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const {
@ -1655,7 +1655,7 @@ public:
mImageInfos.Clear();
mContext->MakeContextCurrent();
mContext->gl->fDeleteTextures(1, &mGLName);
LinkedListElement<WebGLTexture>::remove(); // remove from mContext->mTextures
LinkedListElement<WebGLTexture>::removeFrom(mContext->mTextures);
}
bool HasEverBeenBound() { return mHasEverBeenBound; }
@ -2173,7 +2173,7 @@ public:
mTranslationLog.Truncate();
mContext->MakeContextCurrent();
mContext->gl->fDeleteShader(mGLName);
LinkedListElement<WebGLShader>::remove(); // remove from mContext->mShaders
LinkedListElement<WebGLShader>::removeFrom(mContext->mShaders);
}
WebGLuint GLName() { return mGLName; }
@ -2295,7 +2295,7 @@ public:
DetachShaders();
mContext->MakeContextCurrent();
mContext->gl->fDeleteProgram(mGLName);
LinkedListElement<WebGLProgram>::remove(); // remove from mContext->mPrograms
LinkedListElement<WebGLProgram>::removeFrom(mContext->mPrograms);
}
void DetachShaders() {
@ -2578,7 +2578,7 @@ public:
void Delete() {
mContext->MakeContextCurrent();
mContext->gl->fDeleteRenderbuffers(1, &mGLName);
LinkedListElement<WebGLRenderbuffer>::remove(); // remove from mContext->mRenderbuffers
LinkedListElement<WebGLRenderbuffer>::removeFrom(mContext->mRenderbuffers);
}
bool HasEverBeenBound() { return mHasEverBeenBound; }
@ -2823,7 +2823,7 @@ public:
mDepthStencilAttachment.Reset();
mContext->MakeContextCurrent();
mContext->gl->fDeleteFramebuffers(1, &mGLName);
LinkedListElement<WebGLFramebuffer>::remove(); // remove from mContext->mFramebuffers
LinkedListElement<WebGLFramebuffer>::removeFrom(mContext->mFramebuffers);
}
bool HasEverBeenBound() { return mHasEverBeenBound; }

View File

@ -64,6 +64,8 @@ public:
found = !!namedItem;
return namedItem;
}
virtual void GetSupportedNames(nsTArray<nsString>& aNames) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIHTMLCollection, NS_IHTMLCOLLECTION_IID)

View File

@ -348,6 +348,13 @@ HTMLPropertiesCollection::CrawlSubtree(Element* aElement)
}
}
void
HTMLPropertiesCollection::GetSupportedNames(nsTArray<nsString>& aNames)
{
EnsureFresh();
mNames->CopyList(aNames);
}
PropertyNodeList::PropertyNodeList(HTMLPropertiesCollection* aCollection,
nsIContent* aParent, const nsAString& aName)
: mName(aName),

View File

@ -77,6 +77,7 @@ public:
EnsureFresh();
return mNames;
}
virtual void GetSupportedNames(nsTArray<nsString>& aNames);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIDOMHTMLPROPERTIESCOLLECTION

View File

@ -7,11 +7,12 @@
#include "nsError.h"
#include "nsDOMStringMap.h"
#include "nsDOMClassInfoID.h"
#include "nsGenericHTMLElement.h"
#include "nsContentUtils.h"
#include "mozilla/dom/DOMStringMapBinding.h"
DOMCI_DATA(DOMStringMap, nsDOMStringMap)
using namespace mozilla;
using namespace mozilla::dom;
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMStringMap)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMStringMap)
@ -34,9 +35,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMStringMap)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsIDOMDOMStringMap)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DOMStringMap)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMStringMap)
@ -46,6 +45,7 @@ nsDOMStringMap::nsDOMStringMap(nsGenericHTMLElement* aElement)
: mElement(aElement),
mRemovingProp(false)
{
SetIsDOMBinding();
}
nsDOMStringMap::~nsDOMStringMap()
@ -57,84 +57,59 @@ nsDOMStringMap::~nsDOMStringMap()
}
}
class nsDOMStringMapRemoveProp : public nsRunnable {
public:
nsDOMStringMapRemoveProp(nsDOMStringMap* aDataset, nsIAtom* aProperty)
: mDataset(aDataset),
mProperty(aProperty)
{
}
NS_IMETHOD Run()
{
return mDataset->RemovePropInternal(mProperty);
}
virtual ~nsDOMStringMapRemoveProp()
{
}
protected:
nsRefPtr<nsDOMStringMap> mDataset;
nsCOMPtr<nsIAtom> mProperty;
};
/* [notxpcom] boolean hasDataAttr (in DOMString prop); */
NS_IMETHODIMP_(bool) nsDOMStringMap::HasDataAttr(const nsAString& aProp)
/* virtual */
JSObject*
nsDOMStringMap::WrapObject(JSContext *cx, JSObject *scope,
bool *triedToWrap)
{
nsAutoString attr;
if (!DataPropToAttr(aProp, attr)) {
return false;
}
nsCOMPtr<nsIAtom> attrAtom = do_GetAtom(attr);
if (!attrAtom) {
return false;
}
return mElement->HasAttr(kNameSpaceID_None, attrAtom);
return DOMStringMapBinding::Wrap(cx, scope, this, triedToWrap);
}
/* [noscript] DOMString getDataAttr (in DOMString prop); */
NS_IMETHODIMP nsDOMStringMap::GetDataAttr(const nsAString& aProp,
nsAString& aResult)
void
nsDOMStringMap::NamedGetter(const nsAString& aProp, bool& found,
nsString& aResult) const
{
nsAutoString attr;
if (!DataPropToAttr(aProp, attr)) {
aResult.SetIsVoid(true);
return NS_OK;
found = false;
return;
}
nsCOMPtr<nsIAtom> attrAtom = do_GetAtom(attr);
NS_ENSURE_TRUE(attrAtom, NS_ERROR_OUT_OF_MEMORY);
MOZ_ASSERT(attrAtom, "Should be infallible");
if (!mElement->GetAttr(kNameSpaceID_None, attrAtom, aResult)) {
aResult.SetIsVoid(true);
return NS_OK;
}
return NS_OK;
found = mElement->GetAttr(kNameSpaceID_None, attrAtom, aResult);
}
/* [noscript] void setDataAttr (in DOMString prop, in DOMString value); */
NS_IMETHODIMP nsDOMStringMap::SetDataAttr(const nsAString& aProp,
const nsAString& aValue)
void
nsDOMStringMap::NamedSetter(const nsAString& aProp,
const nsAString& aValue,
ErrorResult& rv)
{
nsAutoString attr;
NS_ENSURE_TRUE(DataPropToAttr(aProp, attr), NS_ERROR_DOM_SYNTAX_ERR);
if (!DataPropToAttr(aProp, attr)) {
rv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
return;
}
nsresult rv = nsContentUtils::CheckQName(attr, false);
NS_ENSURE_SUCCESS(rv, rv);
nsresult res = nsContentUtils::CheckQName(attr, false);
if (NS_FAILED(res)) {
rv.Throw(res);
return;
}
nsCOMPtr<nsIAtom> attrAtom = do_GetAtom(attr);
NS_ENSURE_TRUE(attrAtom, NS_ERROR_OUT_OF_MEMORY);
MOZ_ASSERT(attrAtom, "Should be infallible");
return mElement->SetAttr(kNameSpaceID_None, attrAtom, aValue, true);
res = mElement->SetAttr(kNameSpaceID_None, attrAtom, aValue, true);
if (NS_FAILED(res)) {
rv.Throw(res);
}
}
/* [notxpcom] void removeDataAttr (in DOMString prop); */
NS_IMETHODIMP_(void) nsDOMStringMap::RemoveDataAttr(const nsAString& aProp)
void
nsDOMStringMap::NamedDeleter(const nsAString& aProp, bool& found)
{
// Currently removing property, attribute is already removed.
if (mRemovingProp) {
@ -147,60 +122,19 @@ NS_IMETHODIMP_(void) nsDOMStringMap::RemoveDataAttr(const nsAString& aProp)
}
nsCOMPtr<nsIAtom> attrAtom = do_GetAtom(attr);
if (!attrAtom) {
return;
MOZ_ASSERT(attrAtom, "Should be infallible");
found = mElement->HasAttr(kNameSpaceID_None, attrAtom);
if (found) {
mRemovingProp = true;
mElement->UnsetAttr(kNameSpaceID_None, attrAtom, true);
mRemovingProp = false;
}
mElement->UnsetAttr(kNameSpaceID_None, attrAtom, true);
}
nsGenericHTMLElement* nsDOMStringMap::GetElement()
{
return mElement;
}
/* [notxpcom] void removeProp (in nsIAtom attr); */
NS_IMETHODIMP_(void) nsDOMStringMap::RemoveProp(nsIAtom* aAttr)
{
nsContentUtils::AddScriptRunner(new nsDOMStringMapRemoveProp(this, aAttr));
}
nsresult nsDOMStringMap::RemovePropInternal(nsIAtom* aAttr)
{
nsAutoString attr;
aAttr->ToString(attr);
nsAutoString prop;
NS_ENSURE_TRUE(AttrToDataProp(attr, prop), NS_OK);
jsval val;
JSContext* cx = nsContentUtils::GetCurrentJSContext();
nsresult rv = nsContentUtils::WrapNative(cx, JS_GetGlobalForScopeChain(cx),
this, &val);
NS_ENSURE_SUCCESS(rv, rv);
JSAutoCompartment ac(cx, JSVAL_TO_OBJECT(val));
// Guard against infinite recursion. Prevents the stack from looking like
// ...
// RemoveProp
// ...
// RemoveDataAttr
// ...
// RemoveProp
mRemovingProp = true;
jsval dummy;
JS_DeleteUCProperty2(cx, JSVAL_TO_OBJECT(val), prop.get(), prop.Length(),
&dummy);
mRemovingProp = false;
return NS_OK;
}
/**
* Returns a list of dataset properties corresponding to the data
* attributes on the element.
*/
nsresult nsDOMStringMap::GetDataPropList(nsTArray<nsString>& aResult)
void
nsDOMStringMap::GetSupportedNames(nsTArray<nsString>& aNames)
{
uint32_t attrCount = mElement->GetAttrCount();
@ -209,6 +143,10 @@ nsresult nsDOMStringMap::GetDataPropList(nsTArray<nsString>& aResult)
for (uint32_t i = 0; i < attrCount; ++i) {
nsAutoString attrString;
const nsAttrName* attrName = mElement->GetAttrNameAt(i);
// Skip the ones that are not in the null namespace
if (attrName->NamespaceID() != kNameSpaceID_None) {
continue;
}
attrName->LocalName()->ToString(attrString);
nsAutoString prop;
@ -216,10 +154,8 @@ nsresult nsDOMStringMap::GetDataPropList(nsTArray<nsString>& aResult)
continue;
}
aResult.AppendElement(prop);
aNames.AppendElement(prop);
}
return NS_OK;
}
/**

View File

@ -7,8 +7,6 @@
#ifndef nsDOMStringMap_h
#define nsDOMStringMap_h
#include "nsIDOMDOMStringMap.h"
#include "nsCycleCollectionParticipant.h"
#include "nsAutoPtr.h"
#include "nsTArray.h"
@ -16,12 +14,15 @@
#include "nsWrapperCache.h"
#include "nsGenericHTMLElement.h"
class nsDOMStringMap : public nsIDOMDOMStringMap,
namespace mozilla {
class ErrorResult;
}
class nsDOMStringMap : public nsISupports,
public nsWrapperCache
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIDOMDOMSTRINGMAP
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMStringMap)
nsINode* GetParentObject()
@ -29,35 +30,16 @@ public:
return mElement;
}
static nsDOMStringMap* FromSupports(nsISupports* aSupports)
{
nsIDOMDOMStringMap* map =
static_cast<nsDOMStringMap*>(aSupports);
#ifdef DEBUG
{
nsCOMPtr<nsIDOMDOMStringMap> map_qi =
do_QueryInterface(aSupports);
// If this assertion fires the QI implementation for the object in
// question doesn't use the nsIDOMDOMStringMap pointer as the
// nsISupports pointer. That must be fixed, or we'll crash...
NS_ASSERTION(map_qi == map, "Uh, fix QI!");
}
#endif
return static_cast<nsDOMStringMap*>(map);
}
nsDOMStringMap(nsGenericHTMLElement* aElement);
// GetDataPropList is not defined in IDL due to difficulty
// of returning arrays in IDL. Instead, we cast to this
// class if this method needs to be called.
nsresult GetDataPropList(nsTArray<nsString>& aResult);
nsresult RemovePropInternal(nsIAtom* aAttr);
nsGenericHTMLElement* GetElement();
// WebIDL API
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
bool *triedToWrap);
void NamedGetter(const nsAString& aProp, bool& found, nsString& aResult) const;
void NamedSetter(const nsAString& aProp, const nsAString& aValue,
mozilla::ErrorResult& rv);
void NamedDeleter(const nsAString& aProp, bool &found);
void GetSupportedNames(nsTArray<nsString>& aNames);
private:
virtual ~nsDOMStringMap();
@ -66,8 +48,8 @@ protected:
nsRefPtr<nsGenericHTMLElement> mElement;
// Flag to guard against infinite recursion.
bool mRemovingProp;
bool DataPropToAttr(const nsAString& aProp, nsAString& aResult);
bool AttrToDataProp(const nsAString& aAttr, nsAString& aResult);
static bool DataPropToAttr(const nsAString& aProp, nsAString& aResult);
static bool AttrToDataProp(const nsAString& aAttr, nsAString& aResult);
};
#endif

View File

@ -361,7 +361,7 @@ nsGenericHTMLElement::Dataset()
}
nsresult
nsGenericHTMLElement::GetDataset(nsIDOMDOMStringMap** aDataset)
nsGenericHTMLElement::GetDataset(nsISupports** aDataset)
{
*aDataset = Dataset().get();
return NS_OK;
@ -2050,12 +2050,6 @@ nsGenericHTMLElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
manager->RemoveEventHandler(aAttribute);
}
}
// Remove dataset property if necessary.
nsDOMSlots *slots = GetExistingDOMSlots();
if (slots && slots->mDataset) {
slots->mDataset->RemoveProp(aAttribute);
}
}
nsresult rv = nsGenericHTMLElementBase::UnsetAttr(aNameSpaceID, aAttribute,

View File

@ -31,7 +31,6 @@ class nsIEditor;
struct nsRect;
struct nsSize;
class nsHTMLFormElement;
class nsIDOMDOMStringMap;
class nsIDOMHTMLMenuElement;
class nsIDOMHTMLCollection;
class nsDOMSettableTokenList;
@ -218,7 +217,7 @@ public:
nsresult GetContentEditable(nsAString& aContentEditable);
nsresult GetIsContentEditable(bool* aContentEditable);
nsresult SetContentEditable(const nsAString &aContentEditable);
nsresult GetDataset(nsIDOMDOMStringMap** aDataset);
nsresult GetDataset(nsISupports** aDataset);
already_AddRefed<nsDOMStringMap> Dataset();
// Callback for destructor of of dataset to ensure to null out weak pointer.
nsresult ClearDataset();

View File

@ -100,6 +100,7 @@ public:
virtual JSObject* NamedItem(JSContext* cx, const nsAString& name,
mozilla::ErrorResult& error);
virtual void GetSupportedNames(nsTArray<nsString>& aNames);
nsresult AddElementToTable(nsGenericHTMLFormElement* aChild,
const nsAString& aName);
@ -2540,3 +2541,22 @@ nsFormControlList::NamedItem(JSContext* cx, const nsAString& name,
}
return &v.toObject();
}
static PLDHashOperator
CollectNames(const nsAString& aName,
nsISupports* /* unused */,
void* aClosure)
{
static_cast<nsTArray<nsString>*>(aClosure)->AppendElement(aName);
return PL_DHASH_NEXT;
}
void
nsFormControlList::GetSupportedNames(nsTArray<nsString>& aNames)
{
FlushPendingNotifications();
// Just enumerate mNameLookupTable. This won't guarantee order, but
// that's OK, because the HTML5 spec doesn't define an order for
// this enumeration.
mNameLookupTable.EnumerateRead(CollectNames, &aNames);
}

View File

@ -2196,6 +2196,37 @@ nsHTMLOptionCollection::NamedItem(JSContext* cx, const nsAString& name,
return &v.toObject();
}
void
nsHTMLOptionCollection::GetSupportedNames(nsTArray<nsString>& aNames)
{
nsAutoTArray<nsIAtom*, 8> atoms;
for (uint32_t i = 0; i < mElements.Length(); ++i) {
nsHTMLOptionElement *content = mElements.ElementAt(i);
if (content) {
// Note: HasName means the names is exposed on the document,
// which is false for options, so we don't check it here.
const nsAttrValue* val = content->GetParsedAttr(nsGkAtoms::name);
if (val && val->Type() == nsAttrValue::eAtom) {
nsIAtom* name = val->GetAtomValue();
if (!atoms.Contains(name)) {
atoms.AppendElement(name);
}
}
if (content->HasID()) {
nsIAtom* id = content->GetID();
if (!atoms.Contains(id)) {
atoms.AppendElement(id);
}
}
}
}
aNames.SetCapacity(atoms.Length());
for (uint32_t i = 0; i < atoms.Length(); ++i) {
aNames.AppendElement(nsDependentAtomString(atoms[i]));
}
}
NS_IMETHODIMP
nsHTMLOptionCollection::GetSelect(nsIDOMHTMLSelectElement **aReturn)
{

View File

@ -141,6 +141,7 @@ public:
{
aError = SetOption(aIndex, aOption);
}
virtual void GetSupportedNames(nsTArray<nsString>& aNames);
private:
/** The list of options (holds strong references). This is infallible, so

View File

@ -52,6 +52,7 @@ public:
virtual JSObject* NamedItem(JSContext* cx, const nsAString& name,
ErrorResult& error);
virtual void GetSupportedNames(nsTArray<nsString>& aNames);
NS_IMETHOD ParentDestroyed();
@ -273,6 +274,24 @@ TableRowsCollection::NamedItem(JSContext* cx, const nsAString& name,
return nullptr;
}
void
TableRowsCollection::GetSupportedNames(nsTArray<nsString>& aNames)
{
DO_FOR_EACH_ROWGROUP(
nsTArray<nsString> names;
nsCOMPtr<nsIHTMLCollection> coll = do_QueryInterface(rows);
if (coll) {
coll->GetSupportedNames(names);
for (uint32_t i = 0; i < names.Length(); ++i) {
if (!aNames.Contains(names[i])) {
aNames.AppendElement(names[i]);
}
}
}
);
}
NS_IMETHODIMP
TableRowsCollection::NamedItem(const nsAString& aName,
nsIDOMNode** aReturn)

View File

@ -329,6 +329,10 @@ MOCHITEST_FILES = \
test_iframe_sandbox_workers.html \
file_iframe_sandbox_g_if1.html \
file_iframe_sandbox_worker.js \
test_named_options.html \
test_htmlcollection.html \
test_formelements.html \
test_rowscollection.html \
$(NULL)
MOCHITEST_BROWSER_FILES = \

View File

@ -0,0 +1,60 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=772869
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 772869</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=772869">Mozilla Bug 772869</a>
<p id="display"></p>
<div id="content" style="display: none">
<form id="f">
<input name="x">
<input type="image" name="a">
<input type="file" name="y">
<input type="submit" name="z">
<input id="w">
<input name="w">
</form>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 772869 **/
var x = $("f").elements;
x.something = "another";
names = [];
for (var name in x) {
names.push(name);
}
is(names.length, 14, "Should have 14 items");
// Now sort entries 5 through 8, for comparison purposes. We don't sort the
// whole array, because we want to make sure the ordering between the parts
// is correct
temp = names.slice(5, 9);
temp.sort();
names.splice.bind(names, 5, 4).apply(null, temp);
is(names.length, 14, "Should have still have 14 items");
is(names[0], "0", "Entry 1")
is(names[1], "1", "Entry 2")
is(names[2], "2", "Entry 3")
is(names[3], "3", "Entry 4")
is(names[4], "4", "Entry 5")
is(names[5], "w", "Entry 6")
is(names[6], "x", "Entry 7")
is(names[7], "y", "Entry 8")
is(names[8], "z", "Entry 9")
is(names[9], "something", "Entry 10")
is(names[10], "item", "Entry 11")
is(names[11], "namedItem", "Entry 12")
is(names[12], "iterator", "Entry 13")
is(names[13], "length", "Entry 14")
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,48 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=772869
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 772869</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=772869">Mozilla Bug 772869</a>
<p id="display"></p>
<div id="content" style="display: none">
<a class="foo" name="x"></a>
<span class="foo" id="y"></span>
<span class="foo" name="x"></span>
<form class="foo" name="z" id="w"></form>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 772869 **/
var x = document.getElementsByClassName("foo");
x.something = "another";
names = [];
for (var name in x) {
names.push(name);
}
is(names.length, 13, "Should have 13 items");
is(names[0], "0", "Entry 1")
is(names[1], "1", "Entry 2")
is(names[2], "2", "Entry 3")
is(names[3], "3", "Entry 4")
is(names[4], "x", "Entry 5")
is(names[5], "y", "Entry 6")
is(names[6], "z", "Entry 7")
is(names[7], "w", "Entry 8")
is(names[8], "something", "Entry 9")
is(names[9], "item", "Entry 10")
is(names[10], "namedItem", "Entry 11")
is(names[11], "iterator", "Entry 12")
is(names[12], "length", "Entry 13")
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,52 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=772869
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 772869</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=772869">Mozilla Bug 772869</a>
<p id="display"></p>
<div id="content" style="display: none">
<select id="s">
<option name="x"></option>
<option name="y" id="z"></option>
<option name="z" id="x"></option>
<option id="w"></option>
</select>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 772869 **/
var opt = $("s").options;
opt.loopy = "something"
var names = Object.getOwnPropertyNames(opt);
is(names.length, 9, "Should have eight entries");
is(names[0], "0", "Entry 1")
is(names[1], "1", "Entry 2")
is(names[2], "2", "Entry 3")
is(names[3], "3", "Entry 4")
is(names[4], "x", "Entry 5")
is(names[5], "y", "Entry 6")
is(names[6], "z", "Entry 7")
is(names[7], "w", "Entry 8")
is(names[8], "loopy", "Entry 9")
var names2 = [];
for (var name in opt) {
names2.push(name);
}
for (var i = 0; i < names.length; ++i) {
is(names2[i], names[i], "Correct entry at " + i);
}
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,60 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=772869
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 772869</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=772869">Mozilla Bug 772869</a>
<p id="display"></p>
<div id="content" style="display: none">
<table id="f">
<thead>
<tr id="x"></tr>
</thead>
<tfoot>
<tr id="z"></tr>
<tr id="w"></tr>
</tfoot>
<tr id="x"></tr>
<tr id="y"></tr>
<tbody>
<tr id="z"></tr>
</tbody>
</table>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 772869 **/
var x = $("f").rows;
x.something = "another";
names = [];
for (var name in x) {
names.push(name);
}
is(names.length, 15, "Should have 15 items");
is(names[0], "0", "Entry 1")
is(names[1], "1", "Entry 2")
is(names[2], "2", "Entry 3")
is(names[3], "3", "Entry 4")
is(names[4], "4", "Entry 5")
is(names[5], "5", "Entry 6")
is(names[6], "x", "Entry 7")
is(names[7], "y", "Entry 8")
is(names[8], "z", "Entry 9")
is(names[9], "w", "Entry 10")
is(names[10], "something", "Entry 11")
is(names[11], "item", "Entry 12")
is(names[12], "namedItem", "Entry 13")
is(names[13], "iterator", "Entry 14")
is(names[14], "length", "Entry 15")
</script>
</pre>
</body>
</html>

View File

@ -20,7 +20,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(AudioBuffer)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mContext)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(mChannels)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_DROP_JS_OBJECTS(tmp, AudioBuffer);
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(AudioBuffer)
@ -49,21 +48,18 @@ AudioBuffer::AudioBuffer(AudioContext* aContext, uint32_t aLength,
mSampleRate(aSampleRate)
{
SetIsDOMBinding();
NS_HOLD_JS_OBJECTS(this, AudioBuffer);
}
AudioBuffer::~AudioBuffer()
{
// Drop the JS object reference if we're still holding to the channels
if (mChannels.Length()) {
NS_DROP_JS_OBJECTS(this, AudioBuffer);
}
NS_DROP_JS_OBJECTS(this, AudioBuffer);
}
bool
AudioBuffer::InitializeBuffers(uint32_t aNumberOfChannels, JSContext* aJSContext)
{
NS_HOLD_JS_OBJECTS(this, AudioBuffer);
if (!mChannels.SetCapacity(aNumberOfChannels)) {
return false;
}

View File

@ -14,6 +14,7 @@
#include "AudioBuffer.h"
#include "GainNode.h"
#include "DelayNode.h"
#include "AudioListener.h"
namespace mozilla {
namespace dom {
@ -22,11 +23,15 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(AudioContext)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(AudioContext)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mWindow)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDestination)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER_NATIVE
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(AudioContext)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDestination)
// Cannot use NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR since AudioListener
// does not inherit from nsISupports.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_PTR(tmp->mListener, AudioListener, "listener")
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_NATIVE_BEGIN(AudioContext)
@ -102,6 +107,15 @@ AudioContext::CreateDelay(float aMaxDelayTime)
return delayNode.forget();
}
AudioListener*
AudioContext::Listener()
{
if (!mListener) {
mListener = new AudioListener(this);
}
return mListener;
}
}
}

View File

@ -23,11 +23,12 @@ class ErrorResult;
namespace dom {
class AudioDestinationNode;
class AudioBufferSourceNode;
class AudioBuffer;
class GainNode;
class AudioBufferSourceNode;
class AudioDestinationNode;
class AudioListener;
class DelayNode;
class GainNode;
class AudioContext MOZ_FINAL : public nsWrapperCache,
public EnableWebAudioCheck
@ -56,6 +57,8 @@ public:
return mDestination;
}
AudioListener* Listener();
already_AddRefed<AudioBufferSourceNode> CreateBufferSource();
already_AddRefed<AudioBuffer>
@ -72,6 +75,7 @@ public:
private:
nsCOMPtr<nsIDOMWindow> mWindow;
nsRefPtr<AudioDestinationNode> mDestination;
nsRefPtr<AudioListener> mListener;
};
}

View File

@ -0,0 +1,56 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "AudioListener.h"
#include "AudioContext.h"
#include "nsContentUtils.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/AudioListenerBinding.h"
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_CLASS(AudioListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(AudioListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mContext)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER_NATIVE
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(AudioListener)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mContext, AudioContext)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_NATIVE_BEGIN(AudioListener)
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AudioListener, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AudioListener, Release)
AudioListener::AudioListener(AudioContext* aContext)
: mContext(aContext)
, mPosition()
, mOrientation(0.f, 0.f, -1.f)
, mUpVector(0.f, 1.f, 0.f)
, mVelocity()
, mDopplerFactor(1.f)
, mSpeedOfSound(343.3f) // meters/second
{
MOZ_ASSERT(aContext);
SetIsDOMBinding();
}
JSObject*
AudioListener::WrapObject(JSContext* aCx, JSObject* aScope,
bool* aTriedToWrap)
{
return AudioListenerBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
}
}

View File

@ -0,0 +1,100 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef AudioListener_h_
#define AudioListener_h_
#include "nsWrapperCache.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/Attributes.h"
#include "EnableWebAudioCheck.h"
#include "nsAutoPtr.h"
#include "ThreeDPoint.h"
#include "AudioContext.h"
struct JSContext;
namespace mozilla {
namespace dom {
class AudioContext;
class AudioListener MOZ_FINAL : public nsWrapperCache,
public EnableWebAudioCheck
{
public:
explicit AudioListener(AudioContext* aContext);
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(AudioListener)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(AudioListener)
AudioContext* GetParentObject() const
{
return mContext;
}
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope,
bool* aTriedToWrap);
double DopplerFactor() const
{
return mDopplerFactor;
}
void SetDopplerFactor(double aDopplerFactor)
{
mDopplerFactor = aDopplerFactor;
}
double SpeedOfSound() const
{
return mSpeedOfSound;
}
void SetSpeedOfSound(double aSpeedOfSound)
{
mSpeedOfSound = aSpeedOfSound;
}
void SetPosition(float aX, float aY, float aZ)
{
mPosition.x = aX;
mPosition.y = aY;
mPosition.z = aZ;
}
void SetOrientation(float aX, float aY, float aZ,
float aXUp, float aYUp, float aZUp)
{
mOrientation.x = aX;
mOrientation.y = aY;
mOrientation.z = aZ;
mUpVector.x = aXUp;
mUpVector.y = aYUp;
mUpVector.z = aZUp;
}
void SetVelocity(float aX, float aY, float aZ)
{
mVelocity.x = aX;
mVelocity.y = aY;
mVelocity.z = aZ;
}
private:
nsRefPtr<AudioContext> mContext;
ThreeDPoint mPosition;
ThreeDPoint mOrientation;
ThreeDPoint mUpVector;
ThreeDPoint mVelocity;
double mDopplerFactor;
double mSpeedOfSound;
};
}
}
#endif

View File

@ -19,6 +19,7 @@ CPPSRCS := \
AudioBufferSourceNode.cpp \
AudioContext.cpp \
AudioDestinationNode.cpp \
AudioListener.cpp \
AudioNode.cpp \
AudioParam.cpp \
AudioSourceNode.cpp \
@ -32,6 +33,7 @@ EXPORTS_mozilla/dom := \
AudioBuffer.h \
AudioBufferSourceNode.h \
AudioDestinationNode.h \
AudioListener.h \
AudioNode.h \
AudioParam.h \
AudioSourceNode.h \

View File

@ -0,0 +1,35 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef ThreeDPoint_h_
#define ThreeDPoint_h_
namespace mozilla {
namespace dom {
struct ThreeDPoint {
ThreeDPoint()
: x(0.f)
, y(0.f)
, z(0.f)
{
}
ThreeDPoint(float aX, float aY, float aZ)
: x(aX)
, y(aY)
, z(aZ)
{
}
float x, y, z;
};
}
}
#endif

View File

@ -11,8 +11,10 @@ relativesrcdir := @relativesrcdir@
include $(DEPTH)/config/autoconf.mk
MOCHITEST_FILES := \
test_bug808374.html \
test_AudioBuffer.html \
test_AudioContext.html \
test_AudioListener.html \
test_badConnect.html \
test_delayNode.html \
test_gainNode.html \

View File

@ -0,0 +1,37 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test AudioContext.listener and the AudioListener interface</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
var context = new mozAudioContext();
ok("listener" in context, "AudioContext.listener should exist");
ok(Math.abs(context.listener.dopplerFactor - 1.0) < 1e-4, "Correct default doppler factor");
ok(Math.abs(context.listener.speedOfSound - 343.3) < 1e-4, "Correct default speed of sound value");
context.listener.dopplerFactor = 0.5;
ok(Math.abs(context.listener.dopplerFactor - 0.5) < 1e-4, "The doppler factor value can be changed");
context.listener.speedOfSound = 400;
ok(Math.abs(context.listener.speedOfSound - 400) < 1e-4, "The speed of sound can be changed");
// The values set by the following cannot be read from script, but the
// implementation is simple enough, so we just make sure that nothing throws.
with (context.listener) {
setPosition(1.0, 1.0, 1.0);
setOrientation(1.0, 1.0, 1.0, 1.0, 1.0, 1.0);
setVelocity(0.5, 1.0, 1.5);
}
SpecialPowers.clearUserPref("media.webaudio.enabled");
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,20 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Crashtest for bug 808374</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
mozAudioContext().createBuffer(0, 0, 0);
ok(true, "The test should not crash during CC");
SpecialPowers.clearUserPref("media.webaudio.enabled");
</script>
</pre>
</body>
</html>

View File

@ -9,12 +9,16 @@
using namespace mozilla::dom;
#ifdef MOZ_SYS_MSG
DOMCI_DATA(MozActivity, Activity)
#endif
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(Activity)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozActivity)
NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
#ifdef MOZ_SYS_MSG
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozActivity)
#endif
NS_INTERFACE_MAP_END_INHERITING(DOMRequest)
NS_IMPL_ADDREF_INHERITED(Activity, DOMRequest)

View File

@ -129,7 +129,9 @@ NS_INTERFACE_MAP_BEGIN(Navigator)
#endif
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorCamera)
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorSystemMessages)
#ifdef MOZ_TIME_MANAGER
NS_INTERFACE_MAP_ENTRY(nsIDOMMozNavigatorTime)
#endif
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Navigator)
NS_INTERFACE_MAP_END
@ -1334,6 +1336,7 @@ Navigator::MozSetMessageHandler(const nsAString& aType,
//*****************************************************************************
// Navigator::nsIDOMNavigatorTime
//*****************************************************************************
#ifdef MOZ_TIME_MANAGER
NS_IMETHODIMP
Navigator::GetMozTime(nsIDOMMozTimeManager** aTime)
{
@ -1350,6 +1353,7 @@ Navigator::GetMozTime(nsIDOMMozTimeManager** aTime)
NS_ADDREF(*aTime = mTimeManager);
return NS_OK;
}
#endif
//*****************************************************************************
// nsNavigator::nsIDOMNavigatorCamera

View File

@ -102,7 +102,9 @@ class Navigator : public nsIDOMNavigator
#endif
, public nsIDOMNavigatorCamera
, public nsIDOMNavigatorSystemMessages
#ifdef MOZ_TIME_MANAGER
, public nsIDOMMozNavigatorTime
#endif
{
public:
Navigator(nsPIDOMWindow *aInnerWindow);
@ -132,7 +134,9 @@ public:
NS_DECL_NSIDOMNAVIGATORBLUETOOTH
#endif
NS_DECL_NSIDOMNAVIGATORSYSTEMMESSAGES
#ifdef MOZ_TIME_MANAGER
NS_DECL_NSIDOMMOZNAVIGATORTIME
#endif
static void Init();

View File

@ -111,8 +111,6 @@
#include "nsIDOMDOMTokenList.h"
#include "nsIDOMDOMSettableTokenList.h"
#include "nsDOMStringMap.h"
// HTMLFormElement helper includes
#include "nsIForm.h"
#include "nsIFormControl.h"
@ -438,8 +436,6 @@
#include "ArchiveReader.h"
#include "ArchiveRequest.h"
#include "nsIDOMDOMStringMap.h"
#include "nsIDOMDesktopNotification.h"
#include "nsIDOMNavigatorDesktopNotification.h"
#include "nsIDOMNavigatorDeviceStorage.h"
@ -523,8 +519,12 @@ using mozilla::dom::indexedDB::IDBWrapperCache;
#include "nsIDOMNavigatorSystemMessages.h"
#ifdef MOZ_SYS_MSG
#include "mozilla/dom/Activity.h"
#endif
#ifdef MOZ_TIME_MANAGER
#include "TimeManager.h"
#endif
#include "DOMCameraManager.h"
#include "DOMCameraControl.h"
@ -612,14 +612,6 @@ static const char kDOMStringBundleURL[] =
nsIXPCScriptable::WANT_GETPROPERTY | \
nsIXPCScriptable::WANT_ENUMERATE)
#define DOMSTRINGMAP_SCRIPTABLE_FLAGS \
(DOM_DEFAULT_SCRIPTABLE_FLAGS | \
nsIXPCScriptable::WANT_ENUMERATE | \
nsIXPCScriptable::WANT_PRECREATE | \
nsIXPCScriptable::WANT_DELPROPERTY | \
nsIXPCScriptable::WANT_SETPROPERTY | \
nsIXPCScriptable::WANT_GETPROPERTY)
#define EVENTTARGET_SCRIPTABLE_FLAGS \
(DOM_DEFAULT_SCRIPTABLE_FLAGS | \
nsIXPCScriptable::WANT_ADDPROPERTY)
@ -1445,9 +1437,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(MozURLProperty, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(DOMStringMap, nsDOMStringMapSH,
DOMSTRINGMAP_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(ModalContentWindow, nsWindowSH,
DEFAULT_SCRIPTABLE_FLAGS |
WINDOW_SCRIPTABLE_FLAGS)
@ -1691,11 +1680,15 @@ static nsDOMClassInfoData sClassInfoData[] = {
EVENTTARGET_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(LockedFile, nsEventTargetSH,
EVENTTARGET_SCRIPTABLE_FLAGS)
#ifdef MOZ_SYS_MSG
NS_DEFINE_CLASSINFO_DATA(MozActivity, nsEventTargetSH,
EVENTTARGET_SCRIPTABLE_FLAGS)
#endif
#ifdef MOZ_TIME_MANAGER
NS_DEFINE_CLASSINFO_DATA(MozTimeManager, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
#endif
#ifdef MOZ_WEBRTC
NS_DEFINE_CLASSINFO_DATA(DataChannel, nsEventTargetSH,
@ -1730,7 +1723,9 @@ NS_DEFINE_CONTRACT_CTOR(XSLTProcessor,
"@mozilla.org/document-transformer;1?type=xslt")
NS_DEFINE_CONTRACT_CTOR(EventSource, NS_EVENTSOURCE_CONTRACTID)
NS_DEFINE_CONTRACT_CTOR(MutationObserver, NS_DOMMUTATIONOBSERVER_CONTRACTID)
#ifdef MOZ_SYS_MSG
NS_DEFINE_CONTRACT_CTOR(MozActivity, NS_DOMACTIVITY_CONTRACTID)
#endif
#undef NS_DEFINE_CONTRACT_CTOR
@ -1801,7 +1796,9 @@ static const nsConstructorFuncMapData kConstructorFuncMap[] =
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(XSLTProcessor, XSLTProcessorCtor)
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(EventSource, EventSourceCtor)
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(MutationObserver, MutationObserverCtor)
#ifdef MOZ_SYS_MSG
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(MozActivity, MozActivityCtor)
#endif
};
nsIXPConnect *nsDOMClassInfo::sXPConnect = nullptr;
@ -2470,7 +2467,9 @@ nsDOMClassInfo::Init()
#ifdef MOZ_SYS_MSG
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorSystemMessages)
#endif
#ifdef MOZ_TIME_MANAGER
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozNavigatorTime)
#endif
DOM_CLASSINFO_MAP_END
@ -3997,10 +3996,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozURLProperty)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(DOMStringMap, nsIDOMDOMStringMap)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMStringMap)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ModalContentWindow, nsIDOMWindow)
DOM_CLASSINFO_WINDOW_MAP_ENTRIES(nsGlobalWindow::HasIndexedDBSupport())
DOM_CLASSINFO_MAP_ENTRY(nsIDOMModalContentWindow)
@ -4445,15 +4440,19 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMLockedFile)
DOM_CLASSINFO_MAP_END
#ifdef MOZ_SYS_MSG
DOM_CLASSINFO_MAP_BEGIN(MozActivity, nsIDOMMozActivity)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozActivity)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_END
#endif
#ifdef MOZ_TIME_MANAGER
DOM_CLASSINFO_MAP_BEGIN(MozTimeManager, nsIDOMMozTimeManager)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozTimeManager)
DOM_CLASSINFO_MAP_END
#endif
#ifdef MOZ_WEBRTC
DOM_CLASSINFO_MAP_BEGIN(DataChannel, nsIDOMDataChannel)
@ -5594,12 +5593,48 @@ nsWindowSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
return NS_OK;
}
struct ResolveGlobalNameClosure
{
JSContext* cx;
JSObject* obj;
bool* retval;
};
static PLDHashOperator
ResolveGlobalName(const nsAString& aName, void* aClosure)
{
ResolveGlobalNameClosure* closure =
static_cast<ResolveGlobalNameClosure*>(aClosure);
JS::Value dummy;
bool ok = JS_LookupUCProperty(closure->cx, closure->obj,
aName.BeginReading(), aName.Length(),
&dummy);
if (!ok) {
*closure->retval = false;
return PL_DHASH_STOP;
}
return PL_DHASH_NEXT;
}
NS_IMETHODIMP
nsWindowSH::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, bool *_retval)
{
if (!ObjectIsNativeWrapper(cx, obj)) {
*_retval = JS_EnumerateStandardClasses(cx, obj);
if (!*_retval) {
return NS_OK;
}
// Now resolve everything from the namespace manager
nsScriptNameSpaceManager *nameSpaceManager =
nsJSRuntime::GetNameSpaceManager();
if (!nameSpaceManager) {
NS_ERROR("Can't get namespace manager.");
return NS_ERROR_UNEXPECTED;
}
ResolveGlobalNameClosure closure = { cx, obj, _retval };
nameSpaceManager->EnumerateGlobalNames(ResolveGlobalName, &closure);
}
return NS_OK;
@ -6750,6 +6785,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
// ... and define the constants from the DOM interface on that
// constructor object.
JSAutoCompartment ac(cx, class_obj);
rv = DefineInterfaceConstants(cx, class_obj, &name_struct->mIID);
NS_ENSURE_SUCCESS(rv, rv);
@ -8497,142 +8533,6 @@ nsNamedNodeMapSH::GetNamedItem(nsISupports *aNative, const nsAString& aName,
return attr;
}
NS_IMETHODIMP
nsDOMStringMapSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, jsid id, uint32_t flags,
JSObject **objp, bool *_retval)
{
nsCOMPtr<nsIDOMDOMStringMap> dataset(do_QueryWrappedNative(wrapper, obj));
NS_ENSURE_TRUE(dataset, NS_ERROR_UNEXPECTED);
nsAutoString prop;
NS_ENSURE_TRUE(JSIDToProp(id, prop), NS_ERROR_UNEXPECTED);
if (dataset->HasDataAttr(prop)) {
*_retval = JS_DefinePropertyById(cx, obj, id, JSVAL_VOID,
nullptr, nullptr,
JSPROP_ENUMERATE | JSPROP_SHARED);
*objp = obj;
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMStringMapSH::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, bool *_retval)
{
nsCOMPtr<nsIDOMDOMStringMap> dataset(do_QueryWrappedNative(wrapper, obj));
NS_ENSURE_TRUE(dataset, NS_ERROR_UNEXPECTED);
nsDOMStringMap* stringMap = static_cast<nsDOMStringMap*>(dataset.get());
nsTArray<nsString> properties;
nsresult rv = stringMap->GetDataPropList(properties);
NS_ENSURE_SUCCESS(rv, rv);
for (uint32_t i = 0; i < properties.Length(); ++i) {
nsString& prop(properties[i]);
*_retval = JS_DefineUCProperty(cx, obj, prop.get(), prop.Length(),
JSVAL_VOID, nullptr, nullptr,
JSPROP_ENUMERATE | JSPROP_SHARED);
NS_ENSURE_TRUE(*_retval, NS_ERROR_FAILURE);
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMStringMapSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
JSObject *globalObj, JSObject **parentObj)
{
nsDOMStringMap* map = nsDOMStringMap::FromSupports(nativeObj);
nsINode* native_parent = map->GetParentObject();
if (!native_parent) {
return nsDOMClassInfo::PreCreate(nativeObj, cx, globalObj, parentObj);
}
return WrapNativeParent(cx, globalObj, native_parent, parentObj);
}
NS_IMETHODIMP
nsDOMStringMapSH::DelProperty(nsIXPConnectWrappedNative *wrapper,
JSContext *cx, JSObject *obj, jsid id,
jsval *vp, bool *_retval)
{
nsCOMPtr<nsIDOMDOMStringMap> dataset(do_QueryWrappedNative(wrapper, obj));
NS_ENSURE_TRUE(dataset, NS_ERROR_UNEXPECTED);
nsAutoString prop;
NS_ENSURE_TRUE(JSIDToProp(id, prop), NS_ERROR_UNEXPECTED);
dataset->RemoveDataAttr(prop);
return NS_OK;
}
NS_IMETHODIMP
nsDOMStringMapSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, jsid id, jsval *vp,
bool *_retval)
{
nsCOMPtr<nsIDOMDOMStringMap> dataset(do_QueryWrappedNative(wrapper, obj));
NS_ENSURE_TRUE(dataset, NS_ERROR_UNEXPECTED);
nsAutoString propName;
NS_ENSURE_TRUE(JSIDToProp(id, propName), NS_ERROR_UNEXPECTED);
nsAutoString propVal;
nsresult rv = dataset->GetDataAttr(propName, propVal);
NS_ENSURE_SUCCESS(rv, rv);
if (propVal.IsVoid()) {
*vp = JSVAL_VOID;
return NS_SUCCESS_I_DID_SOMETHING;
}
NS_ENSURE_TRUE(xpc::NonVoidStringToJsval(cx, propVal, vp),
NS_ERROR_OUT_OF_MEMORY);
return NS_SUCCESS_I_DID_SOMETHING;
}
NS_IMETHODIMP
nsDOMStringMapSH::SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, jsid id, jsval *vp,
bool *_retval)
{
nsCOMPtr<nsIDOMDOMStringMap> dataset(do_QueryWrappedNative(wrapper, obj));
NS_ENSURE_TRUE(dataset, NS_ERROR_UNEXPECTED);
nsAutoString propName;
NS_ENSURE_TRUE(JSIDToProp(id, propName), NS_ERROR_UNEXPECTED);
JSString *val = JS_ValueToString(cx, *vp);
NS_ENSURE_TRUE(val, NS_ERROR_UNEXPECTED);
nsDependentJSString propVal;
NS_ENSURE_TRUE(propVal.init(cx, val), NS_ERROR_UNEXPECTED);
nsresult rv = dataset->SetDataAttr(propName, propVal);
NS_ENSURE_SUCCESS(rv, rv);
return NS_SUCCESS_I_DID_SOMETHING;
}
bool
nsDOMStringMapSH::JSIDToProp(const jsid& aId, nsAString& aResult)
{
if (JSID_IS_INT(aId)) {
aResult.AppendInt(JSID_TO_INT(aId));
} else if (JSID_IS_STRING(aId)) {
aResult = nsDependentJSString(aId);
} else {
return false;
}
return true;
}
// Can't be static so GetterShim will compile
nsresult
DocumentURIObjectGetter(JSContext *cx, JSObject *obj, jsval *vp)

View File

@ -688,45 +688,6 @@ public:
}
};
// DOMStringMap helper for .dataset property on elements.
class nsDOMStringMapSH : public nsDOMGenericSH
{
public:
nsDOMStringMapSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
{
}
virtual ~nsDOMStringMapSH()
{
}
public:
NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, jsid id, uint32_t flags,
JSObject **objp, bool *_retval);
NS_IMETHOD Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, bool *_retval);
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
JSObject *globalObj, JSObject **parentObj);
NS_IMETHOD DelProperty(nsIXPConnectWrappedNative *wrapper,
JSContext *cx, JSObject *obj, jsid id,
jsval *vp, bool *_retval);
NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, jsid id, jsval *vp, bool *_retval);
NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, jsid id, jsval *vp, bool *_retval);
bool JSIDToProp(const jsid& aId, nsAString& aResult);
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
{
return new nsDOMStringMapSH(aData);
}
};
// Document helper, for document.location and document.on*
class nsDocumentSH : public nsNodeSH

View File

@ -368,8 +368,6 @@ DOMCI_CLASS(ArchiveReader)
DOMCI_CLASS(ArchiveRequest)
DOMCI_CLASS(MozURLProperty)
DOMCI_CLASS(DOMStringMap)
// DOM modal content window class, almost identical to Window
DOMCI_CLASS(ModalContentWindow)
@ -519,9 +517,13 @@ DOMCI_CLASS(DOMFileHandle)
DOMCI_CLASS(FileRequest)
DOMCI_CLASS(LockedFile)
#ifdef MOZ_SYS_MSG
DOMCI_CLASS(MozActivity)
#endif
#ifdef MOZ_TIME_MANAGER
DOMCI_CLASS(MozTimeManager)
#endif
#ifdef MOZ_WEBRTC
DOMCI_CLASS(DataChannel)

View File

@ -802,6 +802,29 @@ nsScriptNameSpaceManager::RegisterDefineDOMInterface(const nsAFlatString& aName,
}
}
struct GlobalNameClosure
{
nsScriptNameSpaceManager::GlobalNameEnumerator enumerator;
void* closure;
};
static PLDHashOperator
EnumerateGlobalName(PLDHashTable*, PLDHashEntryHdr *hdr, uint32_t,
void* aClosure)
{
GlobalNameMapEntry *entry = static_cast<GlobalNameMapEntry *>(hdr);
GlobalNameClosure* closure = static_cast<GlobalNameClosure*>(aClosure);
return closure->enumerator(entry->mKey, closure->closure);
}
void
nsScriptNameSpaceManager::EnumerateGlobalNames(GlobalNameEnumerator aEnumerator,
void* aClosure)
{
GlobalNameClosure closure = { aEnumerator, aClosure };
PL_DHashTableEnumerate(&mGlobalNames, EnumerateGlobalName, &closure);
}
static size_t
SizeOfEntryExcludingThis(PLDHashEntryHdr *aHdr, nsMallocSizeOfFun aMallocSizeOf,
void *aArg)

View File

@ -143,6 +143,12 @@ public:
mozilla::dom::DefineInterface aDefineDOMInterface,
mozilla::dom::PrefEnabled aPrefEnabled);
typedef PLDHashOperator
(* GlobalNameEnumerator)(const nsAString& aGlobalName, void* aClosure);
void EnumerateGlobalNames(GlobalNameEnumerator aEnumerator,
void* aClosure);
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf);
private:

View File

@ -17,6 +17,7 @@ MOCHITEST_FILES = \
test_gsp-qualified.html \
test_nondomexception.html \
test_screen_orientation.html \
test_window_enumeration.html \
$(NULL)
MOCHITEST_CHROME_FILES = \

View File

@ -0,0 +1,33 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=807222
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 807222</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=807222">Mozilla Bug 807222</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 807222 **/
var expectedProps = [ "Image", "Audio", "Option", "USSDReceivedEvent",
"PerformanceTiming", "CSS2Properties", "SVGElement" ];
var actualProps = Object.getOwnPropertyNames(window);
for (var i = 0; i < expectedProps.length; ++i) {
isnot(actualProps.indexOf(expectedProps[i]), -1,
"getOwnPropertyNames should include " + expectedProps[i]);
}
</script>
</pre>
</body>
</html>

View File

@ -811,7 +811,7 @@ XrayResolveNativeProperty(JSContext* cx, JSObject* wrapper, JSObject* obj,
bool
XrayEnumerateAttributes(Prefable<JSPropertySpec>* attributes,
jsid* attributeIds, JSPropertySpec* attributeSpecs,
JS::AutoIdVector& props)
unsigned flags, JS::AutoIdVector& props)
{
for (; attributes->specs; ++attributes) {
if (attributes->enabled) {
@ -819,7 +819,8 @@ XrayEnumerateAttributes(Prefable<JSPropertySpec>* attributes,
// looking at now.
size_t i = attributes->specs - attributeSpecs;
for ( ; attributeIds[i] != JSID_VOID; ++i) {
if ((attributeSpecs[i].flags & JSPROP_ENUMERATE) &&
if (((flags & JSITER_HIDDEN) ||
(attributeSpecs[i].flags & JSPROP_ENUMERATE)) &&
!props.append(attributeIds[i])) {
return false;
}
@ -830,7 +831,8 @@ XrayEnumerateAttributes(Prefable<JSPropertySpec>* attributes,
}
bool
XrayEnumerateProperties(JS::AutoIdVector& props, DOMObjectType type,
XrayEnumerateProperties(unsigned flags, JS::AutoIdVector& props,
DOMObjectType type,
const NativeProperties* nativeProperties)
{
Prefable<JSFunctionSpec>* methods;
@ -853,7 +855,8 @@ XrayEnumerateProperties(JS::AutoIdVector& props, DOMObjectType type,
// looking at now.
size_t i = method->specs - methodsSpecs;
for ( ; methodIds[i] != JSID_VOID; ++i) {
if ((methodsSpecs[i].flags & JSPROP_ENUMERATE) &&
if (((flags & JSITER_HIDDEN) ||
(methodsSpecs[i].flags & JSPROP_ENUMERATE)) &&
!props.append(methodIds[i])) {
return false;
}
@ -867,21 +870,22 @@ XrayEnumerateProperties(JS::AutoIdVector& props, DOMObjectType type,
!XrayEnumerateAttributes(nativeProperties->staticAttributes,
nativeProperties->staticAttributeIds,
nativeProperties->staticAttributeSpecs,
props)) {
flags, props)) {
return false;
}
} else {
if (nativeProperties->attributes &&
!XrayEnumerateAttributes(nativeProperties->attributes,
nativeProperties->attributeIds,
nativeProperties->attributeSpecs, props)) {
nativeProperties->attributeSpecs,
flags, props)) {
return false;
}
if (nativeProperties->unforgeableAttributes &&
!XrayEnumerateAttributes(nativeProperties->unforgeableAttributes,
nativeProperties->unforgeableAttributeIds,
nativeProperties->unforgeableAttributeSpecs,
props)) {
flags, props)) {
return false;
}
}
@ -909,7 +913,7 @@ bool
XrayEnumerateNativeProperties(JSContext* cx, JSObject* wrapper,
const NativePropertyHooks* nativePropertyHooks,
DOMObjectType type, JSObject* obj,
JS::AutoIdVector& props)
unsigned flags, JS::AutoIdVector& props)
{
if (type == eInterface &&
nativePropertyHooks->mPrototypeID != prototypes::id::_ID_Count &&
@ -919,6 +923,7 @@ XrayEnumerateNativeProperties(JSContext* cx, JSObject* wrapper,
if (type == eInterfacePrototype &&
nativePropertyHooks->mConstructorID != constructors::id::_ID_Count &&
(flags & JSITER_HIDDEN) &&
!AddStringToIDVector(cx, props, "constructor")) {
return false;
}
@ -927,13 +932,13 @@ XrayEnumerateNativeProperties(JSContext* cx, JSObject* wrapper,
nativePropertyHooks->mNativeProperties;
if (nativeProperties.regular &&
!XrayEnumerateProperties(props, type, nativeProperties.regular)) {
!XrayEnumerateProperties(flags, props, type, nativeProperties.regular)) {
return false;
}
if (nativeProperties.chromeOnly &&
xpc::AccessCheck::isChrome(js::GetObjectCompartment(wrapper)) &&
!XrayEnumerateProperties(props, type, nativeProperties.chromeOnly)) {
!XrayEnumerateProperties(flags, props, type, nativeProperties.chromeOnly)) {
return false;
}
@ -942,7 +947,7 @@ XrayEnumerateNativeProperties(JSContext* cx, JSObject* wrapper,
bool
XrayEnumerateProperties(JSContext* cx, JSObject* wrapper, JSObject* obj,
bool ownOnly, JS::AutoIdVector& props)
unsigned flags, JS::AutoIdVector& props)
{
DOMObjectType type;
const NativePropertyHooks* nativePropertyHooks =
@ -955,7 +960,7 @@ XrayEnumerateProperties(JSContext* cx, JSObject* wrapper, JSObject* obj,
return false;
}
if (ownOnly) {
if (flags & JSITER_OWNONLY) {
return true;
}
@ -967,16 +972,20 @@ XrayEnumerateProperties(JSContext* cx, JSObject* wrapper, JSObject* obj,
if (type == eInterfacePrototype) {
do {
if (!XrayEnumerateNativeProperties(cx, wrapper, nativePropertyHooks, type,
obj, props)) {
obj, flags, props)) {
return false;
}
if (flags & JSITER_OWNONLY) {
return true;
}
} while ((nativePropertyHooks = nativePropertyHooks->mProtoHooks));
return true;
}
return XrayEnumerateNativeProperties(cx, wrapper, nativePropertyHooks, type,
obj, props);
obj, flags, props);
}
NativePropertyHooks sWorkerNativePropertyHooks = {
@ -1163,7 +1172,8 @@ NativeToString(JSContext* cx, JSObject* wrapper, JSObject* obj, const char* pre,
str = ConcatJSString(cx, "[object ",
JS_NewStringCopyZ(cx, JS_GetClass(obj)->name),
"]");
} else if (JS_IsNativeFunction(obj, Constructor)) {
} else {
MOZ_ASSERT(JS_IsNativeFunction(obj, Constructor));
str = JS_DecompileFunction(cx, JS_GetObjectFunction(obj), 0);
}
str = ConcatJSString(cx, pre, str, post);

View File

@ -1314,10 +1314,11 @@ XrayResolveNativeProperty(JSContext* cx, JSObject* wrapper, JSObject* obj,
* wrapper is the Xray JS object.
* obj is the target object of the Xray, a binding's instance object or a
* interface or interface prototype object.
* flags are JSITER_* flags.
*/
bool
XrayEnumerateProperties(JSContext* cx, JSObject* wrapper, JSObject* obj,
bool ownOnly, JS::AutoIdVector& props);
unsigned flags, JS::AutoIdVector& props);
extern NativePropertyHooks sWorkerNativePropertyHooks;

View File

@ -83,12 +83,22 @@
# that require a JSContext as the first argument
# * resultNotAddRefed - attributes and methods specified in the .webidl file
# that do not AddRef the return value
#
# A descriptor can also have 'skipGen': True specified if it should be skipped
# when deciding what header includes to generate and should never have an
# implementation generated for it. This is only needed in special cases like
# worker descriptors for objects that will never actually appear in workers.
DOMInterfaces = {
'mozAudioContext': {
'nativeType': 'AudioContext',
'implicitJSContext': [ 'createBuffer' ],
'nativeOwnership': 'refcounted',
'resultNotAddRefed': [ 'destination', 'listener' ],
},
'AudioListener' : {
'nativeOwnership': 'refcounted'
},
@ -112,8 +122,7 @@ DOMInterfaces = {
'workers': True,
}],
'CanvasRenderingContext2D': [
{
'CanvasRenderingContext2D': {
'implicitJSContext': [
'createImageData', 'getImageData', 'putImageData', 'strokeStyle',
'fillStyle', 'mozDash'
@ -123,14 +132,13 @@ DOMInterfaces = {
'mozImageSmoothingEnabled': 'imageSmoothingEnabled',
'mozFillRule': 'fillRule'
}
}],
},
'ClientRectList': [
{
'ClientRectList': {
'nativeType': 'nsClientRectList',
'headerFile': 'nsClientRect.h',
'resultNotAddRefed': [ 'item' ]
}],
},
'CSS2Properties': {
'nativeType': 'nsDOMCSSDeclaration'
@ -150,24 +158,28 @@ DOMInterfaces = {
'nativeType': 'nsIDocument',
},
{
'nativeType': 'JSObject',
'workers': True,
'skipGen': True
}],
'DOMSettableTokenList': [
{
'DOMSettableTokenList': {
'nativeType': 'nsDOMSettableTokenList',
'binaryNames': {
'__stringifier': 'Stringify'
}
}],
},
'DOMTokenList': [
{
'DOMStringMap': {
'nativeType': 'nsDOMStringMap'
},
'DOMTokenList': {
'nativeType': 'nsDOMTokenList',
'binaryNames': {
'__stringifier': 'Stringify'
}
}],
},
'Event': [
{
@ -191,12 +203,11 @@ DOMInterfaces = {
'concrete': False
}],
'FileList': [
{
'FileList': {
'nativeType': 'nsDOMFileList',
'headerFile': 'nsDOMFile.h',
'resultNotAddRefed': [ 'item' ]
}],
},
'FileReaderSync': {
'workers': True,
@ -212,27 +223,24 @@ DOMInterfaces = {
'resultNotAddRefed': [ 'gain' ],
}],
'HTMLCollection': [
{
'HTMLCollection': {
'nativeType': 'nsIHTMLCollection',
'resultNotAddRefed': [ 'item' ]
}],
},
'HTMLOptionsCollection': [
{
'HTMLOptionsCollection': {
'nativeType': 'nsHTMLOptionCollection',
'headerFile': 'nsHTMLSelectElement.h',
'resultNotAddRefed': [ 'item' ],
'binaryNames': {
'__indexedsettercreator': 'SetOption'
}
}],
},
'HTMLPropertiesCollection': [
{
'HTMLPropertiesCollection': {
'headerFile': 'HTMLPropertiesCollection.h',
'resultNotAddRefed': [ 'item', 'namedItem', 'names' ]
}],
},
'IID': [
{
@ -273,18 +281,16 @@ DOMInterfaces = {
'workers': True,
}],
'NodeList': [
{
'NodeList': {
'nativeType': 'nsINodeList',
'resultNotAddRefed': [ 'item' ]
}],
},
'PaintRequestList': [
{
'PaintRequestList': {
'nativeType': 'nsPaintRequestList',
'headerFile': 'nsPaintRequest.h',
'resultNotAddRefed': [ 'item' ]
}],
},
'Performance': {
'nativeType': 'nsPerformance',
@ -301,51 +307,45 @@ DOMInterfaces = {
'headerFile': 'nsPerformance.h'
},
'PropertyNodeList': [
{
'PropertyNodeList': {
'headerFile': 'HTMLPropertiesCollection.h',
'resultNotAddRefed': [ 'item' ]
}],
},
'Screen': {
'nativeType': 'nsScreen',
'prefable': True,
},
'SVGLengthList': [
{
'SVGLengthList': {
'nativeType': 'mozilla::DOMSVGLengthList',
'headerFile': 'DOMSVGLengthList.h',
'resultNotAddRefed': [ 'getItem' ]
}],
},
'SVGNumberList': [
{
'SVGNumberList': {
'nativeType': 'mozilla::DOMSVGNumberList',
'headerFile': 'DOMSVGNumberList.h',
'resultNotAddRefed': [ 'getItem' ]
}],
},
'SVGPathSegList': [
{
'SVGPathSegList': {
'nativeType': 'mozilla::DOMSVGPathSegList',
'headerFile': 'DOMSVGPathSegList.h',
'resultNotAddRefed': [ 'getItem' ]
}],
},
'SVGPointList': [
{
'SVGPointList': {
'nativeType': 'mozilla::DOMSVGPointList',
'headerFile': 'DOMSVGPointList.h',
'resultNotAddRefed': [ 'getItem' ]
}],
},
'SVGTransformList': [
{
'SVGTransformList': {
'nativeType': 'mozilla::DOMSVGTransformList',
'headerFile': 'DOMSVGTransformList.h',
'resultNotAddRefed': [ 'getItem' ]
}],
},
'TextEncoder': {
'headerFile': 'mozilla/dom/TextEncoder.h',
@ -457,11 +457,10 @@ DOMInterfaces = {
'wrapperCache': False
},
'WebSocket': [
{
'WebSocket': {
'headerFile': 'WebSocket.h',
'implicitJSContext': [ 'constructor' ]
}],
},
'XMLHttpRequest': [
{
@ -514,7 +513,8 @@ DOMInterfaces = {
'receiveWeakNullableCastableObjectNullableSequence' ],
'binaryNames': { 'methodRenamedFrom': 'methodRenamedTo',
'attributeGetterRenamedFrom': 'attributeGetterRenamedTo',
'attributeRenamedFrom': 'attributeRenamedTo' }
'attributeRenamedFrom': 'attributeRenamedTo',
'__stringifier' : 'Stringify' }
},
'TestNonCastableInterface' : {
@ -596,6 +596,31 @@ DOMInterfaces = {
'nativeType': 'nsRenamedInterface'
},
'TestIndexedDeleterInterface' : {
'headerFile': 'TestBindingHeader.h',
'register': False
},
'TestIndexedDeleterWithRetvalInterface' : {
'headerFile': 'TestBindingHeader.h',
'register': False
},
'TestNamedDeleterInterface' : {
'headerFile': 'TestBindingHeader.h',
'register': False
},
'TestNamedDeleterWithRetvalInterface' : {
'headerFile': 'TestBindingHeader.h',
'register': False
},
'TestIndexedAndNamedDeleterInterface' : {
'headerFile': 'TestBindingHeader.h',
'register': False
},
'TestCppKeywordNamedMethodsInterface' : {
'headerFile': 'TestBindingHeader.h',
'register': False

View File

@ -1882,7 +1882,8 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
treatNullAs="Default",
treatUndefinedAs="Default",
isEnforceRange=False,
isClamp=False):
isClamp=False,
isNullOrUndefined=False):
"""
Get a template for converting a JS value to a native object based on the
given type and descriptor. If failureCode is given, then we're actually
@ -1954,6 +1955,9 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
# Also, we should not have a defaultValue if we know we're an object
assert(not isDefinitelyObject or defaultValue is None)
# And we can't both be an object and be null or undefined
assert not isDefinitelyObject or not isNullOrUndefined
# Helper functions for dealing with failures due to the JS value being the
# wrong type of value
def onFailureNotAnObject(failureCode):
@ -1994,8 +1998,14 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
# A helper function for wrapping up the template body for
# possibly-nullable objecty stuff
def wrapObjectTemplate(templateBody, isDefinitelyObject, type,
codeToSetNull, failureCode=None):
def wrapObjectTemplate(templateBody, type, codeToSetNull, failureCode=None):
if isNullOrUndefined:
assert type.nullable()
# Just ignore templateBody and set ourselves to null.
# Note that wedon't have to worry about default values
# here either, since we already examined this value.
return "%s;" % codeToSetNull
if not isDefinitelyObject:
# Handle the non-object cases by wrapping up the whole
# thing in an if cascade.
@ -2025,8 +2035,11 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
if type.isSequence():
assert not isEnforceRange and not isClamp
if failureCode is not None:
raise TypeError("Can't handle sequences when failureCode is not None")
if failureCode is None:
notSequence = "return ThrowErrorMessage(cx, MSG_NOT_SEQUENCE);"
else:
notSequence = failureCode
nullable = type.nullable();
# Be very careful not to change "type": we need it later
if nullable:
@ -2071,7 +2084,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
templateBody = ("""JSObject* seq = &${val}.toObject();\n
if (!IsArrayLike(cx, seq)) {
return ThrowErrorMessage(cx, MSG_NOT_SEQUENCE);
%s
}
uint32_t length;
// JS_GetArrayLength actually works on all objects
@ -2088,7 +2101,8 @@ for (uint32_t i = 0; i < length; ++i) {
if (!JS_GetElement(cx, seq, i, &temp)) {
return false;
}
""" % (elementDeclType.define(),
""" % (CGIndenter(CGGeneric(notSequence)).define(),
elementDeclType.define(),
elementDeclType.define(),
arrayRef))
@ -2102,8 +2116,7 @@ for (uint32_t i = 0; i < length; ++i) {
))).define()
templateBody += "\n}"
templateBody = wrapObjectTemplate(templateBody, isDefinitelyObject,
type,
templateBody = wrapObjectTemplate(templateBody, type,
"const_cast< %s & >(${declName}).SetNull()" % mutableTypeName.define())
return (templateBody, typeName, None, isOptional)
@ -2422,8 +2435,8 @@ for (uint32_t i = 0; i < length; ++i) {
# And store our tmp, before it goes out of scope.
templateBody += "${declName} = tmp;"
templateBody = wrapObjectTemplate(templateBody, isDefinitelyObject,
type, "${declName} = NULL",
templateBody = wrapObjectTemplate(templateBody, type,
"${declName} = NULL",
failureCode)
declType = CGGeneric(declType)
@ -2478,7 +2491,7 @@ for (uint32_t i = 0; i < length; ++i) {
template += "%s = ${holderName}.addr();" % nullableTarget
elif not isOptional:
template += "${declName} = ${holderName}.addr();"
template = wrapObjectTemplate(template, isDefinitelyObject, type,
template = wrapObjectTemplate(template, type,
"%s = NULL" % nullableTarget,
failureCode)
@ -2621,7 +2634,7 @@ for (uint32_t i = 0; i < length; ++i) {
"} else {\n"
"%s"
"}" % CGIndenter(onFailureNotCallable(failureCode)).define(),
isDefinitelyObject, type,
type,
"${declName} = nullptr",
failureCode)
return (template, declType, None, isOptional)
@ -2644,7 +2657,7 @@ for (uint32_t i = 0; i < length; ++i) {
raise TypeError("Can't handle member 'object'; need to sort out "
"rooting issues")
template = wrapObjectTemplate("${declName} = &${val}.toObject();",
isDefinitelyObject, type,
type,
"${declName} = NULL",
failureCode)
if type.nullable():
@ -3008,7 +3021,7 @@ if (!returnArray) {
if descriptor.interface.isCallback():
wrap = "WrapCallbackInterface(cx, obj, %s, ${jsvalPtr})" % result
failed = None
elif not descriptor.interface.isExternal():
elif not descriptor.interface.isExternal() and not descriptor.skipGen:
if descriptor.wrapperCache:
wrapMethod = "WrapNewBindingObject"
else:
@ -3536,8 +3549,12 @@ class CGMethodCall(CGThing):
distinguishingIndex = method.distinguishingIndexForArgCount(argCount)
# We can't handle unions at the distinguishing index.
for (returnType, args) in possibleSignatures:
for (_, args) in possibleSignatures:
# We should not have "any" args at distinguishingIndex,
# since we have multiple possible signatures remaining,
# but "any" is never distinguishable from anything else.
assert not args[distinguishingIndex].type.isAny()
# We can't handle unions at the distinguishing index.
if args[distinguishingIndex].type.isUnion():
raise TypeError("No support for unions as distinguishing "
"arguments yet: %s",
@ -3571,104 +3588,145 @@ class CGMethodCall(CGThing):
return True
return False
# First check for null or undefined
pickFirstSignature("%s.isNullOrUndefined()" % distinguishingArg,
lambda s: (s[1][distinguishingIndex].type.nullable() or
s[1][distinguishingIndex].type.isDictionary()))
def distinguishingType(signature):
return signature[1][distinguishingIndex].type
# Now check for distinguishingArg being an object that implements a
# non-callback interface. That includes typed arrays and
# arraybuffers.
interfacesSigs = [
def tryCall(signature, indent, isDefinitelyObject=False,
isNullOrUndefined=False):
assert not isDefinitelyObject or not isNullOrUndefined
assert isDefinitelyObject or isNullOrUndefined
if isDefinitelyObject:
failureCode = "break;"
else:
failureCode = None
type = distinguishingType(signature)
# The argument at index distinguishingIndex can't possibly
# be unset here, because we've already checked that argc is
# large enough that we can examine this argument.
testCode = instantiateJSToNativeConversionTemplate(
getJSToNativeConversionTemplate(type, descriptor,
failureCode=failureCode,
isDefinitelyObject=isDefinitelyObject,
isNullOrUndefined=isNullOrUndefined),
{
"declName" : "arg%d" % distinguishingIndex,
"holderName" : ("arg%d" % distinguishingIndex) + "_holder",
"val" : distinguishingArg
})
caseBody.append(CGIndenter(testCode, indent));
# If we got this far, we know we unwrapped to the right
# C++ type, so just do the call. Start conversion with
# distinguishingIndex + 1, since we already converted
# distinguishingIndex.
caseBody.append(CGIndenter(
getPerSignatureCall(signature, distinguishingIndex + 1),
indent))
# First check for null or undefined. That means looking for
# nullable arguments at the distinguishing index and outputting a
# separate branch for them. But if the nullable argument is a
# primitive, string, or enum, we don't need to do that. The reason
# for that is that at most one argument at the distinguishing index
# is nullable (since two nullable arguments are not
# distinguishable), and all the argument types other than
# primitive/string/enum end up inside isObject() checks. So if our
# nullable is a primitive/string/enum it's safe to not output the
# extra branch: we'll fall through to conversion for those types,
# which correctly handles null as needed, because isObject() will be
# false for null and undefined.
nullOrUndefSigs = [s for s in possibleSignatures
if ((distinguishingType(s).nullable() and not
distinguishingType(s).isString() and not
distinguishingType(s).isEnum() and not
distinguishingType(s).isPrimitive()) or
distinguishingType(s).isDictionary())]
# Can't have multiple nullable types here
assert len(nullOrUndefSigs) < 2
if len(nullOrUndefSigs) > 0:
caseBody.append(CGGeneric("if (%s.isNullOrUndefined()) {" %
distinguishingArg))
tryCall(nullOrUndefSigs[0], 2, isNullOrUndefined=True)
caseBody.append(CGGeneric("}"))
# Now check for distinguishingArg being various kinds of objects.
# The spec says to check for the following things in order:
# 1) A platform object that's not a platform array object, being
# passed to an interface or "object" arg.
# 2) A platform array object or Array or platform object with
# indexed properties being passed to an array or sequence or
# "object" arg.
# 3) A Date object being passed to a Date or "object" arg
# 4) Some other kind of object being passed to a callback
# interface, callback function, dictionary, or "object" arg.
#
# Unfortunately, we cannot push the "some other kind of object"
# check down into case 4, because dictionaries _can_ normally be
# initialized from platform objects. But we can coalesce the other
# three cases together, as long as we make sure to check whether our
# object works as an interface argument before checking whether it
# works as an arraylike.
# First grab all the overloads that have a non-callback interface
# (which includes typed arrays and arraybuffers) at the
# distinguishing index. We can also include the ones that have an
# "object" here, since if those are present no other object-typed
# argument will be.
objectSigs = [
s for s in possibleSignatures
if (s[1][distinguishingIndex].type.isObject() or
s[1][distinguishingIndex].type.isNonCallbackInterface()) ]
# There might be more than one of these; we need to check
if (distinguishingType(s).isObject() or
distinguishingType(s).isNonCallbackInterface()) ]
# Now append all the overloads that take an array or sequence:
objectSigs.extend(s for s in possibleSignatures
if (distinguishingType(s).isArray() or
distinguishingType(s).isSequence()))
# And all the overloads that take Date
objectSigs.extend(s for s in possibleSignatures
if distinguishingType(s).isDate())
# There might be more than one thing in objectSigs; we need to check
# which ones we unwrap to.
if len(interfacesSigs) > 0:
# The spec says that we should check for "platform objects
# implementing an interface", but it's enough to guard on these
# being an object. The code for unwrapping non-callback
# interfaces and typed arrays will just bail out and move on to
# the next overload if the object fails to unwrap correctly. We
# could even not do the isObject() check up front here, but in
# cases where we have multiple object overloads it makes sense
# to do it only once instead of for each overload. That will
# also allow the unwrapping test to skip having to do codegen
# for the null-or-undefined case, which we already handled
# above.
if len(objectSigs) > 0:
# Here it's enough to guard on our argument being an object. The
# code for unwrapping non-callback interfaces, typed arrays,
# sequences, arrays, and Dates will just bail out and move on to
# the next overload if the object fails to unwrap correctly,
# while "object" accepts any object anyway. We could even not
# do the isObject() check up front here, but in cases where we
# have multiple object overloads it makes sense to do it only
# once instead of for each overload. That will also allow the
# unwrapping test to skip having to do codegen for the
# null-or-undefined case, which we already handled above.
caseBody.append(CGGeneric("if (%s.isObject()) {" %
(distinguishingArg)))
for sig in interfacesSigs:
distinguishingArg))
for sig in objectSigs:
caseBody.append(CGIndenter(CGGeneric("do {")));
type = sig[1][distinguishingIndex].type
# The argument at index distinguishingIndex can't possibly
# be unset here, because we've already checked that argc is
# large enough that we can examine this argument.
testCode = instantiateJSToNativeConversionTemplate(
getJSToNativeConversionTemplate(type, descriptor,
failureCode="break;",
isDefinitelyObject=True),
{
"declName" : "arg%d" % distinguishingIndex,
"holderName" : ("arg%d" % distinguishingIndex) + "_holder",
"val" : distinguishingArg
})
# Indent by 4, since we need to indent further than our "do" statement
caseBody.append(CGIndenter(testCode, 4));
# If we got this far, we know we unwrapped to the right
# interface, so just do the call. Start conversion with
# distinguishingIndex + 1, since we already converted
# distinguishingIndex.
caseBody.append(CGIndenter(
getPerSignatureCall(sig, distinguishingIndex + 1), 4))
# Indent by 4, since we need to indent further
# than our "do" statement
tryCall(sig, 4, isDefinitelyObject=True)
caseBody.append(CGIndenter(CGGeneric("} while (0);")))
caseBody.append(CGGeneric("}"))
# XXXbz Now we're supposed to check for distinguishingArg being
# an array or a platform object that supports indexed
# properties... skip that last for now. It's a bit of a pain.
pickFirstSignature("%s.isObject() && IsArrayLike(cx, &%s.toObject())" %
(distinguishingArg, distinguishingArg),
lambda s:
(s[1][distinguishingIndex].type.isArray() or
s[1][distinguishingIndex].type.isSequence() or
s[1][distinguishingIndex].type.isObject()))
# Check for Date objects
# XXXbz Do we need to worry about security wrappers around the Date?
pickFirstSignature("%s.isObject() && JS_ObjectIsDate(cx, &%s.toObject())" %
(distinguishingArg, distinguishingArg),
lambda s: (s[1][distinguishingIndex].type.isDate() or
s[1][distinguishingIndex].type.isObject()))
# Check for vanilla JS objects
# XXXbz Do we need to worry about security wrappers?
pickFirstSignature("%s.isObject() && !IsPlatformObject(cx, &%s.toObject())" %
(distinguishingArg, distinguishingArg),
lambda s: (s[1][distinguishingIndex].type.isCallback() or
s[1][distinguishingIndex].type.isCallbackInterface() or
s[1][distinguishingIndex].type.isDictionary() or
s[1][distinguishingIndex].type.isObject()))
lambda s: (distinguishingType(s).isCallback() or
distinguishingType(s).isCallbackInterface() or
distinguishingType(s).isDictionary()))
# The remaining cases are mutually exclusive. The
# pickFirstSignature calls are what change caseBody
# Check for strings or enums
if pickFirstSignature(None,
lambda s: (s[1][distinguishingIndex].type.isString() or
s[1][distinguishingIndex].type.isEnum())):
lambda s: (distinguishingType(s).isString() or
distinguishingType(s).isEnum())):
pass
# Check for primitives
elif pickFirstSignature(None,
lambda s: s[1][distinguishingIndex].type.isPrimitive()):
pass
# Check for "any"
elif pickFirstSignature(None,
lambda s: s[1][distinguishingIndex].type.isAny()):
lambda s: distinguishingType(s).isPrimitive()):
pass
else:
# Just throw; we have no idea what we're supposed to
@ -4975,12 +5033,12 @@ class CGProxySpecialOperation(CGPerSignatureCall):
"valPtr": "&desc->value"
}
self.cgRoot.prepend(instantiateJSToNativeConversionTemplate(template, templateValues))
elif operation.isGetter():
elif operation.isGetter() or operation.isDeleter():
self.cgRoot.prepend(CGGeneric("bool found;"))
def getArguments(self):
args = [(a, a.identifier.name) for a in self.arguments]
if self.idlNode.isGetter():
if self.idlNode.isGetter() or self.idlNode.isDeleter():
args.append((FakeArgument(BuiltinTypes[IDLBuiltinType.Types.boolean],
self.idlNode),
"found"))
@ -5003,6 +5061,15 @@ class CGProxyIndexedGetter(CGProxySpecialOperation):
self.templateValues = templateValues
CGProxySpecialOperation.__init__(self, descriptor, 'IndexedGetter')
class CGProxyIndexedPresenceChecker(CGProxyIndexedGetter):
"""
Class to generate a call that checks whether an indexed property exists.
For now, we just delegate to CGProxyIndexedGetter
"""
def __init__(self, descriptor):
CGProxyIndexedGetter.__init__(self, descriptor)
class CGProxyIndexedSetter(CGProxySpecialOperation):
"""
Class to generate a call to an indexed setter.
@ -5019,6 +5086,15 @@ class CGProxyNamedGetter(CGProxySpecialOperation):
self.templateValues = templateValues
CGProxySpecialOperation.__init__(self, descriptor, 'NamedGetter')
class CGProxyNamedPresenceChecker(CGProxyNamedGetter):
"""
Class to generate a call that checks whether a named property exists.
For now, we just delegate to CGProxyNamedGetter
"""
def __init__(self, descriptor):
CGProxyNamedGetter.__init__(self, descriptor)
class CGProxyNamedSetter(CGProxySpecialOperation):
"""
Class to generate a call to a named setter.
@ -5026,6 +5102,20 @@ class CGProxyNamedSetter(CGProxySpecialOperation):
def __init__(self, descriptor):
CGProxySpecialOperation.__init__(self, descriptor, 'NamedSetter')
class CGProxyIndexedDeleter(CGProxySpecialOperation):
"""
Class to generate a call to an indexed deleter.
"""
def __init__(self, descriptor):
CGProxySpecialOperation.__init__(self, descriptor, 'IndexedDeleter')
class CGProxyNamedDeleter(CGProxySpecialOperation):
"""
Class to generate a call to a named deleter.
"""
def __init__(self, descriptor):
CGProxySpecialOperation.__init__(self, descriptor, 'NamedDeleter')
class CGProxyIsProxy(CGAbstractMethod):
def __init__(self, descriptor):
args = [Argument('JSObject*', 'obj')]
@ -5078,11 +5168,9 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(ClassMethod):
indexedSetter = self.descriptor.operations['IndexedSetter']
setOrIndexedGet = ""
if indexedGetter or indexedSetter:
if self.descriptor.supportsIndexedProperties():
setOrIndexedGet += "int32_t index = GetArrayIndexFromId(cx, id);\n"
if indexedGetter:
readonly = toStringBool(self.descriptor.operations['IndexedSetter'] is None)
readonly = toStringBool(indexedSetter is None)
fillDescriptor = "FillPropertyDescriptor(desc, proxy, %s);\nreturn true;" % readonly
templateValues = {'jsvalRef': 'desc->value', 'jsvalPtr': '&desc->value',
'obj': 'proxy', 'successCode': fillDescriptor}
@ -5120,8 +5208,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(ClassMethod):
CGIndenter(CGGeneric(get)).define() +
"}\n\n")
namedGetter = self.descriptor.operations['NamedGetter']
if namedGetter:
if self.descriptor.supportsNamedProperties():
readonly = toStringBool(self.descriptor.operations['NamedSetter'] is None)
fillDescriptor = "FillPropertyDescriptor(desc, proxy, %s);\nreturn true;" % readonly
templateValues = {'jsvalRef': 'desc->value', 'jsvalPtr': '&desc->value',
@ -5180,7 +5267,7 @@ class CGDOMJSProxyHandler_defineProperty(ClassMethod):
CGIndenter(CGProxyIndexedSetter(self.descriptor)).define() +
" return true;\n" +
"}\n") % (self.descriptor.nativeType)
elif self.descriptor.operations['IndexedGetter']:
elif self.descriptor.supportsIndexedProperties():
set += ("if (GetArrayIndexFromId(cx, id) >= 0) {\n" +
" return ThrowErrorMessage(cx, MSG_NO_PROPERTY_SETTER, \"%s\");\n" +
"}\n") % self.descriptor.name
@ -5199,8 +5286,9 @@ class CGDOMJSProxyHandler_defineProperty(ClassMethod):
"\n" +
" %s* self = UnwrapProxy(proxy);\n" +
CGIndenter(CGProxyNamedSetter(self.descriptor)).define() + "\n" +
" return true;\n" +
"}\n") % (self.descriptor.nativeType)
elif self.descriptor.operations['NamedGetter']:
elif self.descriptor.supportsNamedProperties():
set += ("if (JSID_IS_STRING(id)) {\n" +
" JS::Value nameVal = STRING_TO_JSVAL(JSID_TO_STRING(id));\n" +
" FakeDependentString name;\n"
@ -5209,13 +5297,86 @@ class CGDOMJSProxyHandler_defineProperty(ClassMethod):
" return false;\n" +
" }\n" +
" %s* self = UnwrapProxy(proxy);\n" +
CGIndenter(CGProxyNamedGetter(self.descriptor)).define() +
CGIndenter(CGProxyNamedPresenceChecker(self.descriptor)).define() +
" if (found) {\n"
" return ThrowErrorMessage(cx, MSG_NO_PROPERTY_SETTER, \"%s\");\n" +
" }\n" +
"}\n") % (self.descriptor.nativeType, self.descriptor.name)
return set + """return mozilla::dom::DOMProxyHandler::defineProperty(%s);""" % ", ".join(a.name for a in self.args)
class CGDOMJSProxyHandler_delete(ClassMethod):
def __init__(self, descriptor):
args = [Argument('JSContext*', 'cx'), Argument('JSObject*', 'proxy'),
Argument('jsid', 'id'),
Argument('bool*', 'bp')]
ClassMethod.__init__(self, "delete_", "bool", args)
self.descriptor = descriptor
def getBody(self):
def getDeleterBody(type):
"""
type should be "Named" or "Indexed"
"""
assert type is "Named" or type is "Indexed"
deleter = self.descriptor.operations[type + 'Deleter']
if deleter:
if (not deleter.signatures()[0][0].isPrimitive() or
deleter.signatures()[0][0].nullable() or
deleter.signatures()[0][0].tag() != IDLType.Tags.bool):
setBp = "*bp = true;"
else:
setBp = ("if (found) {\n"
" // XXXbz we should throw as needed if Throw is true\n"
" *bp = result;\n"
"} else {\n"
" *bp = true;\n"
"}")
body = (eval("CGProxy%sDeleter" % type)(self.descriptor).define() +
setBp)
elif eval("self.descriptor.supports%sProperties()" % type):
body = (eval("CGProxy%sPresenceChecker" % type)(self.descriptor).define() +
"if (found) {\n"
" // XXXbz we should throw if Throw is true!\n"
" *bp = false;\n"
"} else {\n"
" *bp = true;\n"
"}")
else:
body = None
return body
delete = ""
indexedBody = getDeleterBody("Indexed")
if indexedBody is not None:
delete += ("int32_t index = GetArrayIndexFromId(cx, id);\n" +
"if (index >= 0) {\n" +
" %s* self = UnwrapProxy(proxy);\n" +
CGIndenter(CGGeneric(indexedBody)).define() + "\n"
" // We always return here, even if the property was not found\n"
" return true;\n" +
"}\n") % self.descriptor.nativeType
namedBody = getDeleterBody("Named")
if namedBody is not None:
delete += ("if (JSID_IS_STRING(id) && !HasPropertyOnPrototype(cx, proxy, this, id)) {\n"
" jsval nameVal = STRING_TO_JSVAL(JSID_TO_STRING(id));\n" +
" FakeDependentString name;\n"
" if (!ConvertJSValueToString(cx, nameVal, &nameVal,\n" +
" eStringify, eStringify, name)) {\n" +
" return false;\n" +
" }\n" +
" %s* self = UnwrapProxy(proxy);\n" +
CGIndenter(CGGeneric(namedBody)).define() + "\n"
" if (found) {\n"
" return true;\n"
" }\n"
"}\n") % self.descriptor.nativeType
delete += "return dom::DOMProxyHandler::delete_(cx, proxy, id, bp);";
return delete
class CGDOMJSProxyHandler_getOwnPropertyNames(ClassMethod):
def __init__(self, descriptor):
args = [Argument('JSContext*', 'cx'), Argument('JSObject*', 'proxy'),
@ -5223,8 +5384,8 @@ class CGDOMJSProxyHandler_getOwnPropertyNames(ClassMethod):
ClassMethod.__init__(self, "getOwnPropertyNames", "bool", args)
self.descriptor = descriptor
def getBody(self):
indexedGetter = self.descriptor.operations['IndexedGetter']
if indexedGetter:
# Per spec, we do indices, then named props, then everything else
if self.descriptor.supportsIndexedProperties():
addIndices = """uint32_t length = UnwrapProxy(proxy)->Length();
MOZ_ASSERT(int32_t(length) >= 0);
for (int32_t i = 0; i < int32_t(length); ++i) {
@ -5237,13 +5398,23 @@ for (int32_t i = 0; i < int32_t(length); ++i) {
else:
addIndices = ""
return addIndices + """JSObject* expando;
if self.descriptor.supportsNamedProperties():
addNames = """nsTArray<nsString> names;
UnwrapProxy(proxy)->GetSupportedNames(names);
if (!AppendNamedPropertyIds(cx, proxy, names, props)) {
return false;
}
"""
else:
addNames = ""
return addIndices + addNames + """JSObject* expando;
if (!xpc::WrapperFactory::IsXrayWrapper(proxy) && (expando = DOMProxyHandler::GetExpandoObject(proxy)) &&
!js::GetPropertyNames(cx, expando, JSITER_OWNONLY | JSITER_HIDDEN, &props)) {
return false;
}
// FIXME: https://bugzilla.mozilla.org/show_bug.cgi?id=772869 Add named items
return true;"""
class CGDOMJSProxyHandler_hasOwn(ClassMethod):
@ -5253,20 +5424,18 @@ class CGDOMJSProxyHandler_hasOwn(ClassMethod):
ClassMethod.__init__(self, "hasOwn", "bool", args)
self.descriptor = descriptor
def getBody(self):
indexedGetter = self.descriptor.operations['IndexedGetter']
if indexedGetter:
if self.descriptor.supportsIndexedProperties():
indexed = ("int32_t index = GetArrayIndexFromId(cx, id);\n" +
"if (index >= 0) {\n" +
" %s* self = UnwrapProxy(proxy);\n" +
CGIndenter(CGProxyIndexedGetter(self.descriptor)).define() + "\n" +
CGIndenter(CGProxyIndexedPresenceChecker(self.descriptor)).define() + "\n" +
" *bp = found;\n" +
" return true;\n" +
"}\n\n") % (self.descriptor.nativeType)
else:
indexed = ""
namedGetter = self.descriptor.operations['NamedGetter']
if namedGetter:
if self.descriptor.supportsNamedProperties():
named = ("if (JSID_IS_STRING(id) && !HasPropertyOnPrototype(cx, proxy, this, id)) {\n" +
" jsval nameVal = STRING_TO_JSVAL(JSID_TO_STRING(id));\n" +
" FakeDependentString name;\n"
@ -5276,7 +5445,7 @@ class CGDOMJSProxyHandler_hasOwn(ClassMethod):
" }\n" +
"\n" +
" %s* self = UnwrapProxy(proxy);\n" +
CGIndenter(CGProxyNamedGetter(self.descriptor)).define() + "\n" +
CGIndenter(CGProxyNamedPresenceChecker(self.descriptor)).define() + "\n" +
" *bp = found;\n"
" return true;\n"
"}\n" +
@ -5319,8 +5488,7 @@ if (expando) {
templateValues = {'jsvalRef': '*vp', 'jsvalPtr': 'vp', 'obj': 'proxy'}
indexedGetter = self.descriptor.operations['IndexedGetter']
if indexedGetter:
if self.descriptor.supportsIndexedProperties():
getIndexedOrExpando = ("int32_t index = GetArrayIndexFromId(cx, id);\n" +
"if (index >= 0) {\n" +
" %s* self = UnwrapProxy(proxy);\n" +
@ -5335,8 +5503,7 @@ if (expando) {
else:
getIndexedOrExpando = getFromExpando + "\n"
namedGetter = self.descriptor.operations['NamedGetter']
if namedGetter:
if self.descriptor.supportsNamedProperties():
getNamed = ("if (JSID_IS_STRING(id)) {\n" +
" JS::Value nameVal = STRING_TO_JSVAL(JSID_TO_STRING(id));\n" +
" FakeDependentString name;\n"
@ -5393,8 +5560,7 @@ class CGDOMJSProxyHandler_getElementIfPresent(ClassMethod):
ClassMethod.__init__(self, "getElementIfPresent", "bool", args)
self.descriptor = descriptor
def getBody(self):
indexedGetter = self.descriptor.operations['IndexedGetter']
if indexedGetter:
if self.descriptor.supportsIndexedProperties():
successCode = """*present = found;
return true;"""
templateValues = {'jsvalRef': '*vp', 'jsvalPtr': 'vp',
@ -5461,7 +5627,8 @@ class CGDOMJSProxyHandler(CGClass):
CGDOMJSProxyHandler_obj_toString(descriptor),
CGDOMJSProxyHandler_finalize(descriptor),
CGDOMJSProxyHandler_getElementIfPresent(descriptor),
CGDOMJSProxyHandler_getInstance()])
CGDOMJSProxyHandler_getInstance(),
CGDOMJSProxyHandler_delete(descriptor)])
CGClass.__init__(self, 'DOMProxyHandler',
bases=[ClassBase('mozilla::dom::DOMProxyHandler')],
constructors=constructors,
@ -6023,7 +6190,8 @@ class CGBindingRoot(CGThing):
"""
def __init__(self, config, prefix, webIDLFile):
descriptors = config.getDescriptors(webIDLFile=webIDLFile,
hasInterfaceOrInterfacePrototypeObject=True)
hasInterfaceOrInterfacePrototypeObject=True,
skipGen=False)
dictionaries = config.getDictionaries(webIDLFile)
forwardDeclares = [CGClassForwardDeclare('XPCWrappedNativeScope')]

View File

@ -172,10 +172,14 @@ class Descriptor(DescriptorProvider):
headerDefault = headerDefault.replace("::", "/") + ".h"
self.headerFile = desc.get('headerFile', headerDefault)
if self.interface.isCallback() or self.interface.isExternal():
self.skipGen = desc.get('skipGen', False)
if (self.interface.isCallback() or self.interface.isExternal() or
self.skipGen):
if 'castable' in desc:
raise TypeError("%s is external or callback but has a castable "
"setting" % self.interface.identifier.name)
raise TypeError("%s is external or callback or skipGen but has "
"a castable setting" %
self.interface.identifier.name)
self.castable = False
else:
self.castable = desc.get('castable', True)
@ -234,14 +238,25 @@ class Descriptor(DescriptorProvider):
addIndexedOrNamedOperation('Creator', m)
if m.isDeleter():
addIndexedOrNamedOperation('Deleter', m)
raise TypeError("deleter specified on %s but we "
"don't support deleters yet" %
self.interface.identifier.name)
iface.setUserData('hasConcreteDescendant', True)
iface = iface.parent
if self.proxy:
if (not operations['IndexedGetter'] and
(operations['IndexedSetter'] or
operations['IndexedDeleter'] or
operations['IndexedCreator'])):
raise SyntaxError("%s supports indexed properties but does "
"not have an indexed getter.\n%s" %
(self.interface, self.interface.location))
if (not operations['NamedGetter'] and
(operations['NamedSetter'] or
operations['NamedDeleter'] or
operations['NamedCreator'])):
raise SyntaxError("%s supports named properties but does "
"not have a named getter.\n%s" %
(self.interface, self.interface.location))
iface = self.interface
while iface:
iface.setUserData('hasProxyDescendant', True)
@ -361,3 +376,9 @@ class Descriptor(DescriptorProvider):
throws = member.getExtendedAttribute(throwsAttr)
maybeAppendInfallibleToAttrs(attrs, throws)
return attrs
def supportsIndexedProperties(self):
return self.operations['IndexedGetter'] is not None
def supportsNamedProperties(self):
return self.operations['NamedGetter'] is not None

View File

@ -215,6 +215,32 @@ DOMProxyHandler::obj_toString(JSContext* cx, const char* className)
return str;
}
bool
DOMProxyHandler::AppendNamedPropertyIds(JSContext* cx, JSObject* proxy,
nsTArray<nsString>& names,
JS::AutoIdVector& props)
{
for (uint32_t i = 0; i < names.Length(); ++i) {
JS::Value v;
if (!xpc::NonVoidStringToJsval(cx, names[i], &v)) {
return false;
}
jsid id;
if (!JS_ValueToId(cx, v, &id)) {
return false;
}
if (!HasPropertyOnPrototype(cx, proxy, this, id)) {
if (!props.append(id)) {
return false;
}
}
}
return true;
}
int32_t
IdToInt32(JSContext* cx, jsid id)
{

View File

@ -56,6 +56,12 @@ public:
protected:
static JSString* obj_toString(JSContext* cx, const char* className);
// Append the property names in "names" that don't live on our proto
// chain to "props"
bool AppendNamedPropertyIds(JSContext* cx, JSObject* proxy,
nsTArray<nsString>& names,
JS::AutoIdVector& props);
};
extern jsid s_length_id;

View File

@ -600,8 +600,8 @@ class IDLInterface(IDLObjectWithScope):
ancestorConsequential.interfacesBasedOnSelf.add(self)
# Ensure that there's at most one of each {named,indexed}
# {getter,setter,creator,deleter}.
specialMembersSeen = set()
# {getter,setter,creator,deleter} and at most one stringifier.
specialMembersSeen = {}
for member in self.members:
if not member.isMethod():
continue
@ -614,21 +614,25 @@ class IDLInterface(IDLObjectWithScope):
memberType = "creators"
elif member.isDeleter():
memberType = "deleters"
elif member.isStringifier():
memberType = "stringifiers"
else:
continue
if member.isNamed():
memberType = "named " + memberType
elif member.isIndexed():
memberType = "indexed " + memberType
else:
continue
if memberType != "stringifiers":
if member.isNamed():
memberType = "named " + memberType
else:
assert member.isIndexed()
memberType = "indexed " + memberType
if memberType in specialMembersSeen:
raise WebIDLError("Multiple " + memberType + " on %s" % (self),
[self.location])
[self.location,
specialMembersSeen[memberType].location,
member.location])
specialMembersSeen.add(memberType)
specialMembersSeen[memberType] = member
def validate(self):
for member in self.members:
@ -2076,9 +2080,9 @@ class IDLAttribute(IDLInterfaceMember):
if identifier == "TreatNonCallableAsNull":
raise WebIDLError("TreatNonCallableAsNull cannot be specified on attributes",
[attr.location, self.location])
elif identifier == "SetterInfallible" and self.readonly:
elif identifier == "SetterThrows" and self.readonly:
raise WebIDLError("Readonly attributes must not be flagged as "
"[SetterInfallible]",
"[SetterThrows]",
[self.location])
elif identifier == "LenientThis":
if not attr.noArguments():
@ -2571,13 +2575,13 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
def handleExtendedAttribute(self, attr):
identifier = attr.identifier()
if identifier == "GetterInfallible":
if identifier == "GetterThrows":
raise WebIDLError("Methods must not be flagged as "
"[GetterInfallible]",
"[GetterThrows]",
[attr.location, self.location])
elif identifier == "SetterInfallible":
elif identifier == "SetterThrows":
raise WebIDLError("Methods must not be flagged as "
"[SetterInfallible]",
"[SetterThrows]",
[attr.location, self.location])
elif identifier == "Unforgeable":
raise WebIDLError("Methods must not be flagged as "
@ -2730,7 +2734,9 @@ class Tokenizer(object):
"null": "NULL",
"true": "TRUE",
"false": "FALSE",
"serializer": "SERIALIZER",
"stringifier": "STRINGIFIER",
"unrestricted": "UNRESTRICTED",
"attribute": "ATTRIBUTE",
"readonly": "READONLY",
"inherit": "INHERIT",
@ -3299,6 +3305,20 @@ class Parser(Tokenizer):
legacycaller=legacycaller, stringifier=stringifier)
p[0] = method
def p_Stringifier(self, p):
"""
Operation : STRINGIFIER SEMICOLON
"""
identifier = IDLUnresolvedIdentifier(BuiltinLocation("<auto-generated-identifier>"),
"__stringifier",
allowDoubleUnderscore=True)
method = IDLMethod(self.getLocation(p, 1),
identifier,
returnType=BuiltinTypes[IDLBuiltinType.Types.domstring],
arguments=[],
stringifier=True)
p[0] = method
def p_QualifierStatic(self, p):
"""
Qualifier : STATIC
@ -3407,7 +3427,7 @@ class Parser(Tokenizer):
def p_Argument(self, p):
"""
Argument : ExtendedAttributeList Optional Type Ellipsis IDENTIFIER DefaultValue
Argument : ExtendedAttributeList Optional Type Ellipsis ArgumentName DefaultValue
"""
t = p[3]
assert isinstance(t, IDLType)
@ -3430,6 +3450,32 @@ class Parser(Tokenizer):
p[0] = IDLArgument(self.getLocation(p, 5), identifier, t, optional, defaultValue, variadic)
p[0].addExtendedAttributes(p[1])
def p_ArgumentName(self, p):
"""
ArgumentName : IDENTIFIER
| ATTRIBUTE
| CALLBACK
| CONST
| CREATOR
| DELETER
| DICTIONARY
| ENUM
| EXCEPTION
| GETTER
| IMPLEMENTS
| INHERIT
| INTERFACE
| LEGACYCALLER
| PARTIAL
| SERIALIZER
| SETTER
| STATIC
| STRINGIFIER
| TYPEDEF
| UNRESTRICTED
"""
p[0] = p[1]
def p_Optional(self, p):
"""
Optional : OPTIONAL

View File

@ -293,10 +293,10 @@ def WebIDLTest(parser, harness):
try:
parser.parse("""
interface A {
[SetterInfallible] readonly attribute boolean foo;
[SetterThrows] readonly attribute boolean foo;
};
""")
results = parser.finish()
except Exception, x:
threw = True
harness.ok(threw, "Should not allow [SetterInfallible] on readonly attributes")
harness.ok(threw, "Should not allow [SetterThrows] on readonly attributes")

View File

@ -136,23 +136,23 @@ def WebIDLTest(parser, harness):
try:
parser.parse("""
interface A {
[GetterInfallible] void foo();
[GetterThrows] void foo();
};
""")
results = parser.finish()
except Exception, x:
threw = True
harness.ok(threw, "Should not allow [GetterInfallible] on methods")
harness.ok(threw, "Should not allow [GetterThrows] on methods")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface A {
[SetterInfallible] void foo();
[SetterThrows] void foo();
};
""")
results = parser.finish()
except Exception, x:
threw = True
harness.ok(threw, "Should not allow [SetterInfallible] on methods")
harness.ok(threw, "Should not allow [SetterThrows] on methods")

View File

@ -0,0 +1,46 @@
import WebIDL
def WebIDLTest(parser, harness):
parser.parse("""
interface TestStringifier {
stringifier;
};
""")
results = parser.finish()
harness.ok(isinstance(results[0].members[0], WebIDL.IDLMethod),
"Stringifer should be method")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface TestStringifier {
stringifier;
stringifier;
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should not allow two 'stringifier;'")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface TestStringifier {
stringifier;
stringifier DOMString foo();
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should not allow a 'stringifier;' and a 'stringifier()'")

View File

@ -438,6 +438,7 @@ public:
void SetAttrWithLenientThis(int32_t);
uint32_t UnforgeableAttr();
uint32_t UnforgeableAttr2();
void Stringify(nsString&);
void PassRenamedInterface(nsRenamedInterface&);
TestInterface* PutForwardsAttr();
TestInterface* PutForwardsAttr2();
@ -612,6 +613,7 @@ public:
virtual nsISupports* GetParentObject();
void NamedGetter(const nsAString&, bool&, nsAString&);
void GetSupportedNames(nsTArray<nsString>&);
};
class TestIndexedAndNamedGetterInterface : public nsISupports,
@ -627,6 +629,7 @@ public:
void NamedGetter(const nsAString&, bool&, nsAString&);
void NamedItem(const nsAString&, nsAString&);
uint32_t Length();
void GetSupportedNames(nsTArray<nsString>&);
};
class TestIndexedSetterInterface : public nsISupports,
@ -639,6 +642,8 @@ public:
virtual nsISupports* GetParentObject();
void IndexedSetter(uint32_t, const nsAString&);
void IndexedGetter(uint32_t, bool&, nsString&);
uint32_t Length();
void SetItem(uint32_t, const nsAString&);
};
@ -652,6 +657,8 @@ public:
virtual nsISupports* GetParentObject();
void NamedSetter(const nsAString&, TestIndexedSetterInterface&);
TestIndexedSetterInterface* NamedGetter(const nsAString&, bool&);
void GetSupportedNames(nsTArray<nsString>&);
};
class TestIndexedAndNamedSetterInterface : public nsISupports,
@ -664,8 +671,12 @@ public:
virtual nsISupports* GetParentObject();
void IndexedSetter(uint32_t, TestIndexedSetterInterface&);
TestIndexedSetterInterface* IndexedGetter(uint32_t, bool&);
uint32_t Length();
void NamedSetter(const nsAString&, TestIndexedSetterInterface&);
TestIndexedSetterInterface* NamedGetter(const nsAString&, bool&);
void SetNamedItem(const nsAString&, TestIndexedSetterInterface&);
void GetSupportedNames(nsTArray<nsString>&);
};
class TestIndexedAndNamedGetterAndSetterInterface : public TestIndexedSetterInterface
@ -680,6 +691,7 @@ public:
void NamedSetter(const nsAString&, const nsAString&);
void Stringify(nsAString&);
uint32_t Length();
void GetSupportedNames(nsTArray<nsString>&);
};
class TestCppKeywordNamedMethodsInterface : public nsISupports,
@ -696,6 +708,92 @@ public:
int32_t Volatile();
};
class TestIndexedDeleterInterface : public nsISupports,
public nsWrapperCache
{
public:
NS_DECL_ISUPPORTS
// We need a GetParentObject to make binding codegen happy
virtual nsISupports* GetParentObject();
void IndexedDeleter(uint32_t, bool&);
void IndexedDeleter(uint32_t) MOZ_DELETE;
long IndexedGetter(uint32_t, bool&);
uint32_t Length();
void DelItem(uint32_t);
void DelItem(uint32_t, bool&) MOZ_DELETE;
};
class TestIndexedDeleterWithRetvalInterface : public nsISupports,
public nsWrapperCache
{
public:
NS_DECL_ISUPPORTS
// We need a GetParentObject to make binding codegen happy
virtual nsISupports* GetParentObject();
bool IndexedDeleter(uint32_t, bool&);
bool IndexedDeleter(uint32_t) MOZ_DELETE;
long IndexedGetter(uint32_t, bool&);
uint32_t Length();
bool DelItem(uint32_t);
bool DelItem(uint32_t, bool&) MOZ_DELETE;
};
class TestNamedDeleterInterface : public nsISupports,
public nsWrapperCache
{
public:
NS_DECL_ISUPPORTS
// We need a GetParentObject to make binding codegen happy
virtual nsISupports* GetParentObject();
void NamedDeleter(const nsAString&, bool&);
long NamedGetter(const nsAString&, bool&);
void GetSupportedNames(nsTArray<nsString>&);
};
class TestNamedDeleterWithRetvalInterface : public nsISupports,
public nsWrapperCache
{
public:
NS_DECL_ISUPPORTS
// We need a GetParentObject to make binding codegen happy
virtual nsISupports* GetParentObject();
bool NamedDeleter(const nsAString&, bool&);
bool NamedDeleter(const nsAString&) MOZ_DELETE;
long NamedGetter(const nsAString&, bool&);
bool DelNamedItem(const nsAString&);
bool DelNamedItem(const nsAString&, bool&) MOZ_DELETE;
void GetSupportedNames(nsTArray<nsString>&);
};
class TestIndexedAndNamedDeleterInterface : public nsISupports,
public nsWrapperCache
{
public:
NS_DECL_ISUPPORTS
// We need a GetParentObject to make binding codegen happy
virtual nsISupports* GetParentObject();
void IndexedDeleter(uint32_t, bool&);
long IndexedGetter(uint32_t, bool&);
uint32_t Length();
void NamedDeleter(const nsAString&, bool&);
void NamedDeleter(const nsAString&) MOZ_DELETE;
long NamedGetter(const nsAString&, bool&);
void DelNamedItem(const nsAString&);
void DelNamedItem(const nsAString&, bool&) MOZ_DELETE;
void GetSupportedNames(nsTArray<nsString>&);
};
} // namespace dom
} // namespace mozilla

View File

@ -342,6 +342,7 @@ interface TestInterface {
[LenientThis] attribute long attrWithLenientThis;
[Unforgeable] readonly attribute long unforgeableAttr;
[Unforgeable, ChromeOnly] readonly attribute long unforgeableAttr2;
stringifier;
void passRenamedInterface(TestRenamedInterface arg);
[PutForwards=writableByte] readonly attribute TestInterface putForwardsAttr;
[PutForwards=writableByte, LenientThis] readonly attribute TestInterface putForwardsAttr2;
@ -424,7 +425,6 @@ dictionary DictContainingSequence {
interface TestIndexedGetterInterface {
getter long item(unsigned long index);
[Infallible]
readonly attribute unsigned long length;
};
@ -435,21 +435,24 @@ interface TestNamedGetterInterface {
interface TestIndexedAndNamedGetterInterface {
getter long (unsigned long index);
getter DOMString namedItem(DOMString name);
[Infallible]
readonly attribute unsigned long length;
};
interface TestIndexedSetterInterface {
setter creator void setItem(unsigned long index, DOMString item);
getter DOMString (unsigned long index);
};
interface TestNamedSetterInterface {
setter creator void (DOMString name, TestIndexedSetterInterface item);
getter TestIndexedSetterInterface (DOMString name);
};
interface TestIndexedAndNamedSetterInterface {
setter creator void (unsigned long index, TestIndexedSetterInterface item);
getter TestIndexedSetterInterface (unsigned long index);
setter creator void setNamedItem(DOMString name, TestIndexedSetterInterface item);
getter TestIndexedSetterInterface (DOMString name);
};
interface TestIndexedAndNamedGetterAndSetterInterface : TestIndexedSetterInterface {
@ -457,12 +460,37 @@ interface TestIndexedAndNamedGetterAndSetterInterface : TestIndexedSetterInterfa
getter DOMString namedItem(DOMString name);
setter creator void (unsigned long index, long item);
setter creator void (DOMString name, DOMString item);
[Infallible]
stringifier DOMString ();
[Infallible]
readonly attribute unsigned long length;
};
interface TestIndexedDeleterInterface {
deleter void delItem(unsigned long index);
getter long (unsigned long index);
};
interface TestIndexedDeleterWithRetvalInterface {
deleter boolean delItem(unsigned long index);
getter long (unsigned long index);
};
interface TestNamedDeleterInterface {
deleter void (DOMString name);
getter long (DOMString name);
};
interface TestNamedDeleterWithRetvalInterface {
deleter boolean delNamedItem(DOMString name);
getter long (DOMString name);
};
interface TestIndexedAndNamedDeleterInterface {
deleter void (unsigned long index);
getter long (unsigned long index);
deleter void delNamedItem(DOMString name);
getter long (DOMString name);
};
interface TestCppKeywordNamedMethodsInterface {
boolean continue();
boolean delete();

View File

@ -309,6 +309,7 @@ interface TestExampleInterface {
[LenientThis] attribute long attrWithLenientThis;
[Unforgeable] readonly attribute long unforgeableAttr;
[Unforgeable, ChromeOnly] readonly attribute long unforgeableAttr2;
stringifier;
void passRenamedInterface(TestRenamedInterface arg);
[PutForwards=writableByte] readonly attribute TestExampleInterface putForwardsAttr;
[PutForwards=writableByte, LenientThis] readonly attribute TestExampleInterface putForwardsAttr2;

View File

@ -16,7 +16,6 @@ MOCHITEST_FILES := \
test_DOMImplementation-createDocument.html.json \
test_Document-createElementNS.html.json \
test_Document-getElementsByTagName.html.json \
test_Element-children.html.json \
test_Event-constructors.html.json \
test_Event-defaultPrevented.html.json \
test_EventTarget-dispatchEvent.html.json \

View File

@ -1,3 +0,0 @@
{
"HTMLCollection edge cases 1": true
}

View File

@ -1528,6 +1528,12 @@ test(function () {
assert_equals( testEl.properties.item(2), testEl.childNodes[1].childNodes[0], 'item(2)' );
assert_equals( testEl.properties.item(3), testEl.childNodes[2], 'item(3)' );
}, 'properties.item must give each property in tree order');
test(function () {
var testEl = makeEl('div',{itemscope:'itemscope'},'<div itemprop="foo"></div><div itemprop="bar"><div itemprop="foo"></div></div><div itemprop="baz qux"></div>');
testEl.properties.something = "another";
var names = Object.getOwnPropertyNames(testEl.properties);
assert_array_equals( names, ["0", "1", "2", "3", "foo", "bar", "baz", "qux", "something"] );
}, 'properties.item must have the right property names on it when enumerated');
test(function () {
var testEl = makeEl('div',{itemscope:'itemscope'},'<div itemprop="foo"></div><div itemprop="bar"><div itemprop="foo"></div></div><div itemprop="baz qux"></div>');
assert_equals( testEl.properties.item(4), null, 'positive index' );

View File

@ -86,7 +86,6 @@ SDK_XPIDLSRCS = \
nsIDOMHTMLVideoElement.idl \
nsIDOMHTMLAudioElement.idl \
nsIDOMValidityState.idl \
nsIDOMDOMStringMap.idl \
nsIDOMMozBrowserFrame.idl \
$(NULL)

View File

@ -1,25 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "domstubs.idl"
interface nsIAtom;
[scriptable, uuid(47c9ab4f-1ca3-4551-95d1-c02a93a0e74f)]
interface nsIDOMDOMStringMap : nsISupports
{
[notxpcom] boolean hasDataAttr(in DOMString prop);
[noscript] DOMString getDataAttr(in DOMString prop);
[noscript] void setDataAttr(in DOMString prop, in DOMString value);
[notxpcom] void removeDataAttr(in DOMString prop);
/**
* Removes the property from the dataset object. Used to update the
* dataset object when data-* attribute has been removed from the
* element.
*/
[notxpcom] void removeProp(in nsIAtom attr);
};

View File

@ -6,7 +6,6 @@
#include "nsIDOMElement.idl"
#include "nsIVariant.idl"
interface nsIDOMDOMStringMap;
interface nsIDOMHTMLMenuElement;
interface nsIDOMHTMLPropertiesCollection;
@ -30,7 +29,7 @@ interface nsIDOMHTMLElement : nsIDOMElement
attribute DOMString lang;
attribute DOMString dir;
attribute DOMString className;
readonly attribute nsIDOMDOMStringMap dataset;
readonly attribute nsISupports dataset;
attribute boolean itemScope;
attribute nsIVariant itemType;

View File

@ -574,6 +574,11 @@ nsresult nsGeolocationService::Init()
return NS_ERROR_FAILURE;
}
if (XRE_GetProcessType() == GeckoProcessType_Content) {
sGeoInitPending = false;
return NS_OK;
}
nsCOMPtr<nsIGeolocationProvider> provider = do_GetService(NS_GEOLOCATION_PROVIDER_CONTRACTID);
if (provider) {
mProviders.AppendObject(provider);

View File

@ -271,6 +271,32 @@ nsDOMStoragePersistentDB::FlushTemporaryTable(nsCStringHashKey::KeyType aKey,
((TimeStamp::Now() - aData).ToSeconds() < TEMP_TABLE_MAX_AGE))
return PL_DHASH_NEXT;
{
nsCOMPtr<mozIStorageStatement> stmt =
data->mDB->mStatements.GetCachedStatement(
"SELECT SUM(modified) * 100.0 / COUNT(*) FROM webappsstore2_temp "
"WHERE scope = :scope"
);
mozStorageStatementScoper scope(stmt);
nsresult rv;
bool exists;
double percentFlushed;
if (stmt) {
rv = stmt->BindUTF8StringByName(NS_LITERAL_CSTRING("scope"), aKey);
if (NS_SUCCEEDED(rv)) {
rv = stmt->ExecuteStep(&exists);
if (NS_SUCCEEDED(rv) && exists) {
rv = stmt->GetDouble(0, &percentFlushed);
if (NS_SUCCEEDED(rv) && percentFlushed > 0.0) {
Telemetry::Accumulate(Telemetry::LOCALDOMSTORAGE_PERCENT_FLUSHED,
uint32_t(percentFlushed));
}
}
}
}
}
{
nsCOMPtr<mozIStorageStatement> stmt =
data->mDB->mStatements.GetCachedStatement(

View File

@ -92,6 +92,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=741267
} catch (e) {
ok(false, "'new XMLHttpRequest()' shouldn't throw in a sandbox");
}
try {
// have to run this test before document.defaultView.XMLHttpRequest
// gets munged in the sandbox.
var proto = Components.utils.evalInSandbox("XMLHttpRequest.prototype", sandbox);
props = [];
for (var i in proto) {
props.push(i);
}
isnot(props.indexOf("dispatchEvent"), -1,
"'dispatchEvent' property should be enumerable on XMLHttpRequest.prototype");
props = Object.getOwnPropertyNames(proto);
is(props.indexOf("dispatchEvent"), -1,
"'dispatchEvent' is not an own property on XMLHttpRequest.prototype; it's on EventTarget.prototype")
} catch (e) {
ok(false, "XMLHttpRequest.prototype manipulation via an Xray shouldn't throw" + e);
}
try {
Components.utils.evalInSandbox("document.defaultView.XMLHttpRequest = function() {};", sandbox);
var win = Components.utils.evalInSandbox("document.defaultView", sandbox);
@ -132,6 +150,37 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=741267
} catch (e) {
ok(false, "Imagedata manipulation via an Xray shouldn't throw " + e);
}
try {
var list = Components.utils.evalInSandbox("document.getElementsByTagName('*')", sandbox);
props = [];
for (var i in list) {
props.push(i);
}
is(props.indexOf("constructor"), -1,
"'constructor' property should not be enumerable on list object");
props = Object.getOwnPropertyNames(list);
is(props.indexOf("constructor"), -1,
"'constructor' property should not be an own property name on list object");
} catch (e) {
ok(false, "NodeList.prototype manipulation via an Xray shouldn't throw" + e);
}
try {
var proto = Components.utils.evalInSandbox("NodeList.prototype", sandbox);
props = [];
for (var i in proto) {
props.push(i);
}
is(props.indexOf("constructor"), -1,
"'constructor' property should not be enumerable on proto directly");
props = Object.getOwnPropertyNames(proto);
isnot(props.indexOf("constructor"), -1,
"'constructor' property should be an own property name on proto");
} catch (e) {
ok(false, "NodeList.prototype manipulation via an Xray shouldn't throw" + e);
}
SimpleTest.finish();
}

View File

@ -7,7 +7,9 @@
#include "nsITimeService.h"
#include "TimeManager.h"
#ifdef MOZ_TIME_MANAGER
DOMCI_DATA(MozTimeManager, mozilla::dom::time::TimeManager)
#endif
namespace mozilla {
namespace dom {
@ -16,7 +18,9 @@ namespace time {
NS_INTERFACE_MAP_BEGIN(TimeManager)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozTimeManager)
NS_INTERFACE_MAP_ENTRY(nsISupports)
#ifdef MOZ_TIME_MANAGER
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozTimeManager)
#endif
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(TimeManager)

View File

@ -14,6 +14,7 @@
interface mozAudioContext {
readonly attribute AudioDestinationNode destination;
readonly attribute AudioListener listener;
[Creator, Throws]
AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long length, float sampleRate);

View File

@ -0,0 +1,28 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
[PrefControlled]
interface AudioListener {
// same as OpenAL (default 1)
attribute float dopplerFactor;
// in meters / second (default 343.3)
attribute float speedOfSound;
// Uses a 3D cartesian coordinate system
void setPosition(float x, float y, float z);
void setOrientation(float x, float y, float z, float xUp, float yUp, float zUp);
void setVelocity(float x, float y, float z);
};

View File

@ -0,0 +1,19 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#domstringmap-0
*
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
interface DOMStringMap {
getter DOMString (DOMString name);
[Throws]
setter creator void (DOMString name, DOMString value);
deleter void (DOMString name);
};

View File

@ -11,7 +11,6 @@
[Constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options)]
interface TextDecoder {
[SetterThrows]
readonly attribute DOMString encoding;
[Throws]
DOMString decode(optional ArrayBufferView? input = null, optional TextDecodeOptions options);

View File

@ -11,7 +11,6 @@
[Constructor(optional DOMString label = "utf-8")]
interface TextEncoder {
[SetterThrows]
readonly attribute DOMString encoding;
[Throws]
Uint8Array encode(optional DOMString? input = null, optional TextEncodeOptions options);

View File

@ -13,6 +13,7 @@ webidl_files = \
AudioBufferSourceNode.webidl \
AudioContext.webidl \
AudioDestinationNode.webidl \
AudioListener.webidl \
AudioNode.webidl \
AudioParam.webidl \
AudioSourceNode.webidl \
@ -24,6 +25,7 @@ webidl_files = \
DOMImplementation.webidl \
DOMTokenList.webidl \
DOMSettableTokenList.webidl \
DOMStringMap.webidl \
Function.webidl \
EventHandler.webidl \
EventListener.webidl \

View File

@ -11,7 +11,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
const DEBUG = false; // set to true to show debug messages
var DEBUG = false; // set to true to show debug messages
const WIFIWORKER_CONTRACTID = "@mozilla.org/wifi/worker;1";
const WIFIWORKER_CID = Components.ID("{a14e8977-d259-433a-a88d-58dd44657e5b}");
@ -283,6 +283,48 @@ var WifiManager = (function() {
doBooleanCommand("SCAN", "OK", callback);
}
var debugEnabled = false;
function setLogLevel(level, callback) {
doBooleanCommand("LOG_LEVEL " + level, "OK", callback);
}
function syncDebug() {
if (debugEnabled !== DEBUG) {
let wanted = DEBUG;
setLogLevel(wanted ? "DEBUG" : "INFO", function(ok) {
if (ok)
debugEnabled = wanted;
});
}
}
function getLogLevel(callback) {
doStringCommand("LOG_LEVEL", callback);
}
function getDebugEnabled(callback) {
getLogLevel(function(level) {
if (level === null) {
debug("Unable to get wpa_supplicant's log level");
callback(false);
return;
}
var lines = level.split("\n");
for (let i = 0; i < lines.length; ++i) {
let match = /Current level: (.*)/.exec(lines[i]);
if (match) {
debugEnabled = match[1].toLowerCase() === "debug";
callback(true);
return;
}
}
// If we're here, we didn't get the current level.
callback(false);
});
}
function setScanModeCommand(setActive, callback) {
scanModeActive = setActive;
doSetScanModeCommand(setActive, callback);
@ -919,6 +961,9 @@ var WifiManager = (function() {
waitForEvent();
// Load up the supplicant state.
getDebugEnabled(function(ok) {
syncDebug();
});
statusCommand(function(status) {
parseStatus(status);
notify("supplicantconnection");
@ -1247,6 +1292,7 @@ var WifiManager = (function() {
return false;
}
}
manager.syncDebug = syncDebug;
manager.stateOrdinal = function(state) {
return supplicantStatesMap.indexOf(state);
}
@ -1835,9 +1881,28 @@ function WifiWorker() {
handleError: function handleError(aErrorMessage) {
debug("Error reading the 'wifi.enabled' setting. Default to wifi on.");
self.setWifiEnabled({enabled: true});
},
}
};
gSettingsService.createLock().get("wifi.enabled", initWifiEnabledCb);
var initWifiDebuggingEnabledCb = {
handle: function handle(aName, aResult) {
if (aName !== "wifi.debugging.enabled")
return;
if (aResult === null)
aResult = false;
DEBUG = aResult;
updateDebug();
},
handleError: function handleError(aErrorMessage) {
debug("Error reading the 'wifi.debugging.enabled' setting. Default to debugging off.");
DEBUG = false;
updateDebug();
}
};
let lock = gSettingsService.createLock();
lock.get("wifi.enabled", initWifiEnabledCb);
lock.get("wifi.debugging.enabled", initWifiDebuggingEnabledCb);
}
function translateState(state) {
@ -2572,6 +2637,11 @@ WifiWorker.prototype = {
}
let setting = JSON.parse(data);
if (setting.key === "wifi.debugging.enabled") {
DEBUG = setting.value;
updateDebug();
return;
}
if (setting.key !== "wifi.enabled" &&
setting.key !== "tethering.wifi.enabled") {
return;
@ -2596,10 +2666,14 @@ WifiWorker.prototype = {
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([WifiWorker]);
let debug;
if (DEBUG) {
debug = function (s) {
dump("-*- WifiWorker component: " + s + "\n");
};
} else {
debug = function (s) {};
function updateDebug() {
if (DEBUG) {
debug = function (s) {
dump("-*- WifiWorker component: " + s + "\n");
};
} else {
debug = function (s) {};
}
WifiManager.syncDebug();
}
updateDebug();

View File

@ -144,6 +144,12 @@ ImageContainer::CreateImage(const ImageFormat *aFormats,
uint32_t aNumFormats)
{
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
if (mImageContainerChild) {
nsRefPtr<Image> img = mImageContainerChild->CreateImage();
if (img) {
return img.forget();
}
}
return mImageFactory->CreateImage(aFormats, aNumFormats, mScaleHint, mRecycleBin);
}

View File

@ -39,6 +39,7 @@ class Shmem;
namespace layers {
class ImageContainerChild;
class SharedPlanarYCbCrImage;
struct ImageBackendData
{
@ -82,11 +83,15 @@ public:
int32_t GetSerial() { return mSerial; }
void MarkSent() { mSent = true; }
bool IsSentToCompositor() { return mSent; }
protected:
Image(void* aImplData, ImageFormat aFormat) :
mImplData(aImplData),
mSerial(PR_ATOMIC_INCREMENT(&sSerialCounter)),
mFormat(aFormat)
mFormat(aFormat),
mSent(false)
{}
nsAutoPtr<ImageBackendData> mBackendData[mozilla::layers::LAYERS_LAST];
@ -95,6 +100,7 @@ protected:
int32_t mSerial;
ImageFormat mFormat;
static int32_t sSerialCounter;
bool mSent;
};
/**
@ -696,6 +702,8 @@ public:
PlanarYCbCrImage(BufferRecycleBin *aRecycleBin);
virtual SharedPlanarYCbCrImage *AsSharedPlanarYCbCrImage() { return nullptr; }
protected:
/**
* Make a copy of the YCbCr data into local storage.

View File

@ -13,6 +13,7 @@
#include "GonkIOSurfaceImage.h"
#include "GrallocImages.h"
#include "mozilla/layers/ShmemYCbCrImage.h"
#include "mozilla/ReentrantMonitor.h"
using namespace mozilla::ipc;
@ -34,7 +35,6 @@ namespace layers {
* throttle that. So when the child side wants to allocate a new shared image
* but is already at its maximum of active shared images, it just discards the
* image (which is therefore not allocated and not sent to the compositor).
* (see ImageToSharedImage)
*
* The values for the two constants are arbitrary and should be tweaked if it
* happens that we run into shared memory problems.
@ -124,22 +124,6 @@ void ImageContainerChild::DestroySharedImage(const SharedImage& aImage)
DeallocSharedImageData(this, aImage);
}
SharedImage* ImageContainerChild::AsSharedImage(Image* aImage)
{
#ifdef MOZ_WIDGET_GONK
if (aImage->GetFormat() == GONK_IO_SURFACE) {
GonkIOSurfaceImage* gonkImage = static_cast<GonkIOSurfaceImage*>(aImage);
SharedImage* result = new SharedImage(gonkImage->GetSurfaceDescriptor());
return result;
} else if (aImage->GetFormat() == GRALLOC_PLANAR_YCBCR) {
GrallocPlanarYCbCrImage* GrallocImage = static_cast<GrallocPlanarYCbCrImage*>(aImage);
SharedImage* result = new SharedImage(GrallocImage->GetSurfaceDescriptor());
return result;
}
#endif
return nullptr; // XXX: bug 773440
}
bool ImageContainerChild::CopyDataIntoSharedImage(Image* src, SharedImage* dest)
{
if ((src->GetFormat() == PLANAR_YCBCR) &&
@ -205,6 +189,31 @@ SharedImage* ImageContainerChild::AllocateSharedImageFor(Image* image)
return nullptr;
}
void ImageContainerChild::RecycleSharedImageNow(SharedImage* aImage)
{
NS_ABORT_IF_FALSE(InImageBridgeChildThread(),"Must be in the ImageBridgeChild Thread.");
if (mStop || !AddSharedImageToPool(aImage)) {
DestroySharedImage(*aImage);
delete aImage;
}
}
void ImageContainerChild::RecycleSharedImage(SharedImage* aImage)
{
if (!aImage) {
return;
}
if (InImageBridgeChildThread()) {
RecycleSharedImageNow(aImage);
return;
}
GetMessageLoop()->PostTask(FROM_HERE,
NewRunnableMethod(this,
&ImageContainerChild::RecycleSharedImageNow,
aImage));
}
bool ImageContainerChild::AddSharedImageToPool(SharedImage* img)
{
NS_ABORT_IF_FALSE(InImageBridgeChildThread(),
@ -289,6 +298,10 @@ void ImageContainerChild::SendImageNow(Image* aImage)
return;
}
if (aImage->IsSentToCompositor()) {
return;
}
bool needsCopy = false;
// If the image can be converted to a shared image, no need to do a copy.
SharedImage* img = AsSharedImage(aImage);
@ -305,6 +318,7 @@ void ImageContainerChild::SendImageNow(Image* aImage)
if (img && (!needsCopy || CopyDataIntoSharedImage(aImage, img))) {
// Keep a reference to the image we sent to compositor to maintain a
// correct reference count.
aImage->MarkSent();
mImageQueue.AppendElement(aImage);
SendPublishImage(*img);
} else {
@ -381,6 +395,229 @@ void ImageContainerChild::DispatchDestroy()
NewRunnableMethod(this, &ImageContainerChild::DestroyNow));
}
// We can't pass more than 6 parameters to a 'NewRunableFunction' so some
// parameters are stored in a struct passed by pointer
struct CreateShmemParams
{
ImageContainerChild* mProtocol;
size_t mBufSize;
SharedMemory::SharedMemoryType mType;
ipc::Shmem* mShmem;
bool mResult;
};
static void AllocUnsafeShmemNow(CreateShmemParams* aParams,
ReentrantMonitor* aBarrier,
bool* aDone)
{
ReentrantMonitorAutoEnter autoBarrier(*aBarrier);
aParams->mResult = aParams->mProtocol->AllocUnsafeShmem(aParams->mBufSize,
aParams->mType,
aParams->mShmem);
*aDone = true;
aBarrier->NotifyAll();
}
bool ImageContainerChild::AllocUnsafeShmemSync(size_t aBufSize,
SharedMemory::SharedMemoryType aType,
ipc::Shmem* aShmem)
{
if (mStop) {
return false;
}
if (InImageBridgeChildThread()) {
AllocUnsafeShmem(aBufSize, aType, aShmem);
}
ReentrantMonitor barrier("ImageContainerChild::AllocUnsafeShmemSync");
ReentrantMonitorAutoEnter autoBarrier(barrier);
CreateShmemParams p = {
this,
aBufSize,
aType,
aShmem,
false,
};
bool done = false;
GetMessageLoop()->PostTask(FROM_HERE,
NewRunnableFunction(&AllocUnsafeShmemNow,
&p,
&barrier, &done));
while (!done) {
barrier.Wait();
}
return p.mResult;
}
static void DeallocShmemNow(ImageContainerChild* aProtocol, ipc::Shmem aShmem)
{
aProtocol->DeallocShmem(aShmem);
}
void ImageContainerChild::DeallocShmemAsync(ipc::Shmem& aShmem)
{
if (mStop) {
return;
}
GetMessageLoop()->PostTask(FROM_HERE,
NewRunnableFunction(&DeallocShmemNow,
this,
aShmem));
}
class SharedPlanarYCbCrImage : public PlanarYCbCrImage
{
public:
SharedPlanarYCbCrImage(ImageContainerChild* aProtocol)
: PlanarYCbCrImage(nullptr),
mImageContainerChild(aProtocol), mAllocated(false) {}
~SharedPlanarYCbCrImage() {
if (mAllocated) {
mImageContainerChild->RecycleSharedImage(ToSharedImage());
}
}
virtual SharedPlanarYCbCrImage* AsSharedPlanarYCbCrImage() MOZ_OVERRIDE
{
return this;
}
virtual already_AddRefed<gfxASurface> GetAsSurface() MOZ_OVERRIDE
{
if (!mAllocated) {
NS_WARNING("Can't get as surface");
return nullptr;
}
return PlanarYCbCrImage::GetAsSurface();
}
virtual void SetData(const PlanarYCbCrImage::Data& aData) MOZ_OVERRIDE
{
// If mShmem has not been allocated (through Allocate(aData)), allocate it.
// This code path is slower than the one used when Allocate has been called
// since it will trigger a full copy.
if (!mAllocated) {
Data data = aData;
if (!Allocate(data)) {
return;
}
}
// do not set mBuffer like in PlanarYCbCrImage because the later
// will try to manage this memory without knowing it belongs to a
// shmem.
mBufferSize = ShmemYCbCrImage::ComputeMinBufferSize(mData.mYSize,
mData.mCbCrSize);
mSize = mData.mPicSize;
ShmemYCbCrImage shmImg(mShmem);
if (!shmImg.CopyData(aData.mYChannel, aData.mCbChannel, aData.mCrChannel,
aData.mYSize, aData.mYStride,
aData.mCbCrSize, aData.mCbCrStride)) {
NS_WARNING("Failed to copy image data!");
}
mData.mYChannel = shmImg.GetYData();
mData.mCbChannel = shmImg.GetCbData();
mData.mCrChannel = shmImg.GetCrData();
}
virtual bool Allocate(PlanarYCbCrImage::Data& aData)
{
NS_ABORT_IF_FALSE(!mAllocated, "This image already has allocated data");
SharedMemory::SharedMemoryType shmType = OptimalShmemType();
size_t size = ShmemYCbCrImage::ComputeMinBufferSize(aData.mYSize,
aData.mCbCrSize);
if (!mImageContainerChild->AllocUnsafeShmemSync(size, shmType, &mShmem)) {
return false;
}
ShmemYCbCrImage::InitializeBufferInfo(mShmem.get<uint8_t>(),
aData.mYSize,
aData.mCbCrSize);
ShmemYCbCrImage shmImg(mShmem);
if (!shmImg.IsValid() || mShmem.Size<uint8_t>() < size) {
mImageContainerChild->DeallocShmemAsync(mShmem);
return false;
}
aData.mYChannel = shmImg.GetYData();
aData.mCbChannel = shmImg.GetCbData();
aData.mCrChannel = shmImg.GetCrData();
// copy some of aData's values in mData (most of them)
mData.mYChannel = aData.mYChannel;
mData.mCbChannel = aData.mCbChannel;
mData.mCrChannel = aData.mCrChannel;
mData.mYSize = aData.mYSize;
mData.mCbCrSize = aData.mCbCrSize;
mData.mPicX = aData.mPicX;
mData.mPicY = aData.mPicY;
mData.mPicSize = aData.mPicSize;
mData.mStereoMode = aData.mStereoMode;
// those members are not always equal to aData's, due to potentially different
// packing.
mData.mYSkip = 0;
mData.mCbSkip = 0;
mData.mCrSkip = 0;
mData.mYStride = mData.mYSize.width;
mData.mCbCrStride = mData.mCbCrSize.width;
mAllocated = true;
return true;
}
virtual bool IsValid() MOZ_OVERRIDE {
return mAllocated;
}
SharedImage* ToSharedImage() {
if (mAllocated) {
return new SharedImage(YCbCrImage(mShmem, 0, mData.GetPictureRect()));
}
return nullptr;
}
private:
Shmem mShmem;
nsRefPtr<ImageContainerChild> mImageContainerChild;
bool mAllocated;
};
already_AddRefed<Image> ImageContainerChild::CreateImage()
{
nsRefPtr<Image> img = new SharedPlanarYCbCrImage(this);
return img.forget();
}
SharedImage* ImageContainerChild::AsSharedImage(Image* aImage)
{
#ifdef MOZ_WIDGET_GONK
if (aImage->GetFormat() == GONK_IO_SURFACE) {
GonkIOSurfaceImage* gonkImage = static_cast<GonkIOSurfaceImage*>(aImage);
SharedImage* result = new SharedImage(gonkImage->GetSurfaceDescriptor());
return result;
} else if (aImage->GetFormat() == GRALLOC_PLANAR_YCBCR) {
GrallocPlanarYCbCrImage* GrallocImage = static_cast<GrallocPlanarYCbCrImage*>(aImage);
SharedImage* result = new SharedImage(GrallocImage->GetSurfaceDescriptor());
return result;
}
#endif
if (aImage->GetFormat() == PLANAR_YCBCR) {
SharedPlanarYCbCrImage* sharedYCbCr
= static_cast<PlanarYCbCrImage*>(aImage)->AsSharedPlanarYCbCrImage();
if (sharedYCbCr) {
return sharedYCbCr->ToSharedImage();
}
}
return nullptr;
}
} // namespace
} // namespace

View File

@ -10,6 +10,7 @@
#include "mozilla/layers/ImageBridgeChild.h"
namespace mozilla {
class ReentrantMonitor;
namespace layers {
class ImageBridgeCopyAndSendTask;
@ -115,8 +116,40 @@ public:
* Must be called on the ImageBridgeChild's thread.
*/
void SetIdleNow();
/**
* Can be called from any thread.
* deallocates or places aImage in a pool.
* If this method is not called on the ImageBridgeChild thread, a task is
* is dispatched and the recycling/deallocation happens asynchronously on
* the ImageBridgeChild thread.
*/
void RecycleSharedImage(SharedImage* aImage);
/**
* Creates a YCbCrImage using shared memory to store its data.
*/
already_AddRefed<Image> CreateImage();
/**
* Allocates an unsafe shmem.
* Unlike AllocUnsafeShmem, this method can be called from any thread.
* If the calling thread is not the ImageBridgeChild thread, this method will
* dispatch a synchronous call to AllocUnsafeShmem on the ImageBridgeChild
* thread meaning that the calling thread will be blocked until
* AllocUnsafeShmem returns on the ImageBridgeChild thread.
*/
bool AllocUnsafeShmemSync(size_t aBufSize,
SharedMemory::SharedMemoryType aType,
ipc::Shmem* aShmem);
/**
* Dispatches a task on the ImageBridgeChild thread to deallocate a shmem.
*/
void DeallocShmemAsync(ipc::Shmem& aShmem);
protected:
virtual PGrallocBufferChild*
AllocPGrallocBuffer(const gfxIntSize&, const gfxContentType&,
MaybeMagicGrallocBufferHandle*) MOZ_OVERRIDE
@ -142,6 +175,11 @@ protected:
mImageContainerID = id;
}
/**
* Must be called on the ImageBirdgeChild thread. (See RecycleSharedImage)
*/
void RecycleSharedImageNow(SharedImage* aImage);
/**
* Deallocates a shared image's shared memory.
* It is the caller's responsibility to delete the SharedImage itself.
@ -190,6 +228,7 @@ protected:
* Returns nullptr in case of failure.
* The returned image does not contain the image data, a copy still needs to
* be done afterward (see CopyDataIntoSharedImage).
* Must be called on the ImageBridgeChild thread.
*/
SharedImage* AllocateSharedImageFor(Image* aImage);

View File

@ -138,12 +138,12 @@ static void qcms_transform_module_clut_only(struct qcms_modular_transform *trans
float linear_g = *src++;
float linear_b = *src++;
int x = floor(linear_r * (transform->grid_size-1));
int y = floor(linear_g * (transform->grid_size-1));
int z = floor(linear_b * (transform->grid_size-1));
int x_n = ceil(linear_r * (transform->grid_size-1));
int y_n = ceil(linear_g * (transform->grid_size-1));
int z_n = ceil(linear_b * (transform->grid_size-1));
int x = floorf(linear_r * (transform->grid_size-1));
int y = floorf(linear_g * (transform->grid_size-1));
int z = floorf(linear_b * (transform->grid_size-1));
int x_n = ceilf(linear_r * (transform->grid_size-1));
int y_n = ceilf(linear_g * (transform->grid_size-1));
int z_n = ceilf(linear_b * (transform->grid_size-1));
float x_d = linear_r * (transform->grid_size-1) - x;
float y_d = linear_g * (transform->grid_size-1) - y;
float z_d = linear_b * (transform->grid_size-1) - z;
@ -198,12 +198,12 @@ static void qcms_transform_module_clut(struct qcms_modular_transform *transform,
float linear_b = lut_interp_linear_float(device_b,
transform->input_clut_table_b, transform->input_clut_table_length);
int x = floor(linear_r * (transform->grid_size-1));
int y = floor(linear_g * (transform->grid_size-1));
int z = floor(linear_b * (transform->grid_size-1));
int x_n = ceil(linear_r * (transform->grid_size-1));
int y_n = ceil(linear_g * (transform->grid_size-1));
int z_n = ceil(linear_b * (transform->grid_size-1));
int x = floorf(linear_r * (transform->grid_size-1));
int y = floorf(linear_g * (transform->grid_size-1));
int z = floorf(linear_b * (transform->grid_size-1));
int x_n = ceilf(linear_r * (transform->grid_size-1));
int y_n = ceilf(linear_g * (transform->grid_size-1));
int z_n = ceilf(linear_b * (transform->grid_size-1));
float x_d = linear_r * (transform->grid_size-1) - x;
float y_d = linear_g * (transform->grid_size-1) - y;
float z_d = linear_b * (transform->grid_size-1) - z;
@ -271,12 +271,12 @@ static void qcms_transform_module_tetra_clut(struct qcms_modular_transform *tran
float linear_b = lut_interp_linear_float(device_b,
transform->input_clut_table_b, transform->input_clut_table_length);
int x = floor(linear_r * (transform->grid_size-1));
int y = floor(linear_g * (transform->grid_size-1));
int z = floor(linear_b * (transform->grid_size-1));
int x_n = ceil(linear_r * (transform->grid_size-1));
int y_n = ceil(linear_g * (transform->grid_size-1));
int z_n = ceil(linear_b * (transform->grid_size-1));
int x = floorf(linear_r * (transform->grid_size-1));
int y = floorf(linear_g * (transform->grid_size-1));
int z = floorf(linear_b * (transform->grid_size-1));
int x_n = ceilf(linear_r * (transform->grid_size-1));
int y_n = ceilf(linear_g * (transform->grid_size-1));
int z_n = ceilf(linear_b * (transform->grid_size-1));
float rx = linear_r * (transform->grid_size-1) - x;
float ry = linear_g * (transform->grid_size-1) - y;
float rz = linear_b * (transform->grid_size-1) - z;

View File

@ -836,7 +836,7 @@ static uint16_t float_to_u8Fixed8Number(float a)
else if (a < 0.f)
return 0;
else
return floor(a*256.f + .5f);
return floorf(a*256.f + .5f);
}
static struct curveType *curve_from_gamma(float gamma)

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