mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Merge b2ginbound to central, a=merge
--HG-- extra : commitid : 8BWHv45ENi2
This commit is contained in:
commit
bef1f84b4d
@ -679,7 +679,7 @@ pref("javascript.options.mem.gc_max_empty_chunk_count", 2);
|
||||
pref("ui.showHideScrollbars", 1);
|
||||
pref("ui.useOverlayScrollbars", 1);
|
||||
pref("ui.scrollbarFadeBeginDelay", 450);
|
||||
pref("ui.scrollbarFadeDuration", 200);
|
||||
pref("ui.scrollbarFadeDuration", 0);
|
||||
|
||||
// Scrollbar position follows the document `dir` attribute
|
||||
pref("layout.scrollbar.side", 1);
|
||||
|
@ -403,17 +403,14 @@ var shell = {
|
||||
webNav.QueryInterface(Ci.nsIDocShell).windowDraggingAllowed = true;
|
||||
#endif
|
||||
|
||||
this.allowedAudioChannels = new Map();
|
||||
let audioChannels = systemAppFrame.allowedAudioChannels;
|
||||
audioChannels && audioChannels.forEach(function(audioChannel) {
|
||||
this.allowedAudioChannels.set(audioChannel.name, audioChannel);
|
||||
audioChannel.addEventListener('activestatechanged', this);
|
||||
// Set all audio channels as unmuted by default
|
||||
// because some audio in System app will be played
|
||||
// before AudioChannelService[1] is Gaia is loaded.
|
||||
// [1]: https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/audio_channel_service.js
|
||||
audioChannel.setMuted(false);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
// On firefox mulet, shell.html is loaded in a tab
|
||||
// and we have to listen on the chrome event handler
|
||||
@ -683,18 +680,6 @@ var shell = {
|
||||
case 'unload':
|
||||
this.stop();
|
||||
break;
|
||||
case 'activestatechanged':
|
||||
var channel = evt.target;
|
||||
// TODO: We should get the `isActive` state from evt.isActive.
|
||||
// Then we don't need to do `channel.isActive()` here.
|
||||
channel.isActive().onsuccess = function(evt) {
|
||||
SystemAppProxy._sendCustomEvent('mozSystemWindowChromeEvent', {
|
||||
type: 'system-audiochannel-state-changed',
|
||||
name: channel.name,
|
||||
isActive: evt.target.result
|
||||
});
|
||||
}.bind(this);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
@ -904,11 +889,6 @@ var CustomEventManager = {
|
||||
case 'inputregistry-remove':
|
||||
KeyboardHelper.handleEvent(detail);
|
||||
break;
|
||||
case 'system-audiochannel-list':
|
||||
case 'system-audiochannel-mute':
|
||||
case 'system-audiochannel-volume':
|
||||
SystemAppMozBrowserHelper.handleEvent(detail);
|
||||
break;
|
||||
case 'do-command':
|
||||
DoCommandHelper.handleEvent(detail.cmd);
|
||||
break;
|
||||
@ -1076,63 +1056,6 @@ var KeyboardHelper = {
|
||||
}
|
||||
};
|
||||
|
||||
var SystemAppMozBrowserHelper = {
|
||||
handleEvent: function systemAppMozBrowser_handleEvent(detail) {
|
||||
let request;
|
||||
let name;
|
||||
switch (detail.type) {
|
||||
case 'system-audiochannel-list':
|
||||
let audioChannels = [];
|
||||
shell.allowedAudioChannels.forEach(function(value, name) {
|
||||
audioChannels.push(name);
|
||||
});
|
||||
SystemAppProxy._sendCustomEvent('mozSystemWindowChromeEvent', {
|
||||
type: 'system-audiochannel-list',
|
||||
audioChannels: audioChannels
|
||||
});
|
||||
break;
|
||||
case 'system-audiochannel-mute':
|
||||
name = detail.name;
|
||||
let isMuted = detail.isMuted;
|
||||
request = shell.allowedAudioChannels.get(name).setMuted(isMuted);
|
||||
request.onsuccess = function() {
|
||||
SystemAppProxy._sendCustomEvent('mozSystemWindowChromeEvent', {
|
||||
type: 'system-audiochannel-mute-onsuccess',
|
||||
name: name,
|
||||
isMuted: isMuted
|
||||
});
|
||||
};
|
||||
request.onerror = function() {
|
||||
SystemAppProxy._sendCustomEvent('mozSystemWindowChromeEvent', {
|
||||
type: 'system-audiochannel-mute-onerror',
|
||||
name: name,
|
||||
isMuted: isMuted
|
||||
});
|
||||
};
|
||||
break;
|
||||
case 'system-audiochannel-volume':
|
||||
name = detail.name;
|
||||
let volume = detail.volume;
|
||||
request = shell.allowedAudioChannels.get(name).setVolume(volume);
|
||||
request.onsuccess = function() {
|
||||
sSystemAppProxy._sendCustomEvent('mozSystemWindowChromeEvent', {
|
||||
type: 'system-audiochannel-volume-onsuccess',
|
||||
name: name,
|
||||
volume: volume
|
||||
});
|
||||
};
|
||||
request.onerror = function() {
|
||||
SystemAppProxy._sendCustomEvent('mozSystemWindowChromeEvent', {
|
||||
type: 'system-audiochannel-volume-onerror',
|
||||
name: name,
|
||||
volume: volume
|
||||
});
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// This is the backend for Gaia's screenshot feature. Gaia requests a
|
||||
// screenshot by sending a mozContentEvent with detail.type set to
|
||||
// 'take-screenshot'. Then we take a screenshot and send a
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b6ede3d0fdec5fc922e9ca3401e60db461bf705c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a26eadc5e1133d5112b6cbc10badbb7670a1090f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
|
||||
@ -24,7 +24,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0c28789b9957913be975eb002a22323f93585d4c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1837d370a964a9719160c79155a07980f2ea4bdf"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b6ede3d0fdec5fc922e9ca3401e60db461bf705c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a26eadc5e1133d5112b6cbc10badbb7670a1090f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
|
||||
@ -24,7 +24,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0c28789b9957913be975eb002a22323f93585d4c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1837d370a964a9719160c79155a07980f2ea4bdf"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b6ede3d0fdec5fc922e9ca3401e60db461bf705c"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a26eadc5e1133d5112b6cbc10badbb7670a1090f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="4ace9aaee0e048dfda11bb787646c59982a3dc80"/>
|
||||
|
@ -17,10 +17,10 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b6ede3d0fdec5fc922e9ca3401e60db461bf705c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a26eadc5e1133d5112b6cbc10badbb7670a1090f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="3b9a47b517d345b8d98bc7f787b9a6c2f51ca75d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0c28789b9957913be975eb002a22323f93585d4c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1837d370a964a9719160c79155a07980f2ea4bdf"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b6ede3d0fdec5fc922e9ca3401e60db461bf705c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a26eadc5e1133d5112b6cbc10badbb7670a1090f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0c28789b9957913be975eb002a22323f93585d4c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1837d370a964a9719160c79155a07980f2ea4bdf"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b6ede3d0fdec5fc922e9ca3401e60db461bf705c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a26eadc5e1133d5112b6cbc10badbb7670a1090f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0c28789b9957913be975eb002a22323f93585d4c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1837d370a964a9719160c79155a07980f2ea4bdf"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b6ede3d0fdec5fc922e9ca3401e60db461bf705c"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a26eadc5e1133d5112b6cbc10badbb7670a1090f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="4ace9aaee0e048dfda11bb787646c59982a3dc80"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b6ede3d0fdec5fc922e9ca3401e60db461bf705c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a26eadc5e1133d5112b6cbc10badbb7670a1090f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
|
||||
@ -24,7 +24,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0c28789b9957913be975eb002a22323f93585d4c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1837d370a964a9719160c79155a07980f2ea4bdf"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"git": {
|
||||
"git_revision": "b6ede3d0fdec5fc922e9ca3401e60db461bf705c",
|
||||
"git_revision": "a26eadc5e1133d5112b6cbc10badbb7670a1090f",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "220b45ec153f267a2efc58275a30a665a4ec9e57",
|
||||
"revision": "a99ff14b3258f49f5902775a5e3b849f3455714a",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b6ede3d0fdec5fc922e9ca3401e60db461bf705c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a26eadc5e1133d5112b6cbc10badbb7670a1090f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
|
||||
@ -24,7 +24,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0c28789b9957913be975eb002a22323f93585d4c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1837d370a964a9719160c79155a07980f2ea4bdf"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
|
||||
|
@ -18,10 +18,10 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b6ede3d0fdec5fc922e9ca3401e60db461bf705c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a26eadc5e1133d5112b6cbc10badbb7670a1090f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="3b9a47b517d345b8d98bc7f787b9a6c2f51ca75d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0c28789b9957913be975eb002a22323f93585d4c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1837d370a964a9719160c79155a07980f2ea4bdf"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b6ede3d0fdec5fc922e9ca3401e60db461bf705c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a26eadc5e1133d5112b6cbc10badbb7670a1090f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
|
||||
@ -24,7 +24,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0c28789b9957913be975eb002a22323f93585d4c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1837d370a964a9719160c79155a07980f2ea4bdf"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
|
@ -130,6 +130,7 @@ function _setAppProperties(aObj, aApp) {
|
||||
aObj.kind = aApp.kind;
|
||||
aObj.enabled = aApp.enabled !== undefined ? aApp.enabled : true;
|
||||
aObj.sideloaded = aApp.sideloaded;
|
||||
aObj.extensionVersion = aApp.extensionVersion;
|
||||
#ifdef MOZ_B2GDROID
|
||||
aObj.android_packagename = aApp.android_packagename;
|
||||
aObj.android_classname = aApp.android_classname;
|
||||
|
@ -138,6 +138,10 @@ this.UserCustomizations = {
|
||||
result.icons = aManifest.icons;
|
||||
}
|
||||
|
||||
if (aManifest.version) {
|
||||
result.version = aManifest.version;
|
||||
}
|
||||
|
||||
// chrome extension manifests have a single 'author' property, that we
|
||||
// map to 'developer.name'.
|
||||
// Note that it has to match the one in the mini-manifest.
|
||||
|
@ -3812,6 +3812,10 @@ this.DOMApplicationRegistry = {
|
||||
throw "INVALID_MANIFEST";
|
||||
}
|
||||
newManifest = UserCustomizations.convertManifest(newManifest);
|
||||
// Keep track of the add-on version, to use for blocklisting.
|
||||
if (newManifest.version) {
|
||||
aNewApp.extensionVersion = newManifest.version;
|
||||
}
|
||||
}
|
||||
|
||||
if (!AppsUtils.checkManifest(newManifest, aOldApp)) {
|
||||
|
@ -79,10 +79,12 @@ function installApp(manifestURL, expectedError) {
|
||||
apps.push(req.result);
|
||||
is(req.result.manifestURL, manifestURL, "app installed");
|
||||
if (req.result.installState == "installed") {
|
||||
is(req.result.manifest.version, "1.0", "correct version");
|
||||
is(req.result.installState, "installed", "app downloaded");
|
||||
continueTest();
|
||||
} else {
|
||||
req.result.ondownloadapplied = function() {
|
||||
is(req.result.manifest.version, "1.0", "correct version");
|
||||
is(req.result.installState, "installed", "app downloaded");
|
||||
continueTest();
|
||||
}
|
||||
|
@ -164,11 +164,11 @@ function runTest() {
|
||||
ok(app, "App is non-null");
|
||||
is(app.manifestURL, gManifestURL, "App manifest url is correct.");
|
||||
|
||||
var context = {"manifestURL": app.manifestURL, "isInBrowserElement": false};
|
||||
var context = {manifestURL: app.manifestURL};
|
||||
|
||||
SpecialPowers.pushPermissions([{"type": "homescreen-webapps-manage",
|
||||
"allow": 1,
|
||||
"context": context}], continueTest);
|
||||
SpecialPowers.pushPermissions([{type: "homescreen-webapps-manage",
|
||||
allow: 1,
|
||||
context: context}], continueTest);
|
||||
yield undefined;
|
||||
|
||||
// Launch the app.
|
||||
|
@ -1607,9 +1607,10 @@ Navigator::HasFeature(const nsAString& aName, ErrorResult& aRv)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Hardcoded web-extensions feature which is b2g specific.
|
||||
// Hardcoded extensions features which are b2g specific.
|
||||
#ifdef MOZ_B2G
|
||||
if (aName.EqualsLiteral("web-extensions")) {
|
||||
if (aName.EqualsLiteral("web-extensions") ||
|
||||
aName.EqualsLiteral("late-customization")) {
|
||||
p->MaybeResolve(true);
|
||||
return p.forget();
|
||||
}
|
||||
@ -1622,6 +1623,7 @@ Navigator::HasFeature(const nsAString& aName, ErrorResult& aRv)
|
||||
#ifdef MOZ_B2G
|
||||
, "manifest.chrome.navigation"
|
||||
, "manifest.precompile"
|
||||
, "manifest.role.homescreen"
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -126,6 +126,7 @@ SpecialPowers.pushPermissions([
|
||||
info("Adding B2G specific tests");
|
||||
tests.push(createManifestTest("manifest.chrome.navigation"));
|
||||
tests.push(createManifestTest("manifest.precompile"));
|
||||
tests.push(createManifestTest("manifest.role.homescreen"));
|
||||
}
|
||||
runNextTest();
|
||||
ok(true, "Test DONE");
|
||||
|
@ -65,11 +65,19 @@ function testExtensions() {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return navigator.hasFeature("web-extensions").then(function(value) {
|
||||
is(value, true, "Resolve the Promise with " + value + " for web-extensions");
|
||||
}, function() {
|
||||
ok(false, "The Promise should not be rejected");
|
||||
var builtInFeatures = [
|
||||
{feature: "web-extensions", value: true},
|
||||
{feature: "late-customization", value: true}
|
||||
];
|
||||
|
||||
builtInFeatures.forEach(function(x) {
|
||||
navigator.hasFeature(x.feature).then(function(value) {
|
||||
is(value, x.value, "Resolve the Promise with " + value + " for feature: " + x.feature);
|
||||
}).catch(function(ex) {
|
||||
ok(false, "The Promise should not be rejected");
|
||||
});
|
||||
});
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
SpecialPowers.pushPermissions([
|
||||
|
@ -32,8 +32,8 @@ function setUp() {
|
||||
|
||||
let appId = gAppsService.getAppLocalIdByManifestURL(APP_MANIFEST);
|
||||
SpecialPowers.addPermission("foobar", true, { url: APP_URL,
|
||||
appId: appId,
|
||||
isInBrowserElement: false });
|
||||
originAttributes: { appId: appId }
|
||||
});
|
||||
SpecialPowers.pushPrefEnv({"set":[['dom.mozBrowserFramesEnabled', true],
|
||||
['dom.ipc.browser_frames.oop_by_default', true]]}, runNextTest);
|
||||
}
|
||||
|
@ -103,15 +103,17 @@
|
||||
addEventListener("load", function() {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
SpecialPowers.pushPermissions([
|
||||
{ "type": "browser", "allow": 1, "context": { "url": principal.URI.spec,
|
||||
"appId": principal.appId,
|
||||
"isInBrowserElement": false }},
|
||||
{ "type": "browser", "allow": 1, "context": { "url": principal.URI.spec,
|
||||
"appId": principal.appId,
|
||||
"isInBrowserElement": true }}
|
||||
{ type: "browser", allow: 1, context: { url: principal.URI.spec,
|
||||
originAttributes: {
|
||||
appId: principal.appId
|
||||
}}},
|
||||
{ type: "browser", allow: 1, context: { url: principal.URI.spec,
|
||||
originAttributes: {
|
||||
appId: principal.appId,
|
||||
inBrowser: true }}}
|
||||
], () => {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [
|
||||
set: [
|
||||
["dom.mozBrowserFramesEnabled", true],
|
||||
["dom.ipc.browser_frames.oop_by_default", false],
|
||||
]
|
||||
|
@ -477,6 +477,11 @@ BluetoothPbapManager::NotifyPbapRequest(const ObexHeaderSet& aHeader)
|
||||
reqId.AssignLiteral(PULL_VCARD_ENTRY_REQ_ID);
|
||||
tagCount = MOZ_ARRAY_LENGTH(sVCardEntryTags);
|
||||
tags = sVCardEntryTags;
|
||||
|
||||
// Convert relative path to absolute path if it's not using X-BT-UID.
|
||||
if (name.Find(NS_LITERAL_STRING("X-BT-UID")) == kNotFound) {
|
||||
name = mCurrentPath + NS_LITERAL_STRING("/") + name;
|
||||
}
|
||||
} else {
|
||||
BT_LOGR("Unknown PBAP request type: %s",
|
||||
NS_ConvertUTF16toUTF8(type).get());
|
||||
|
@ -22,17 +22,16 @@ function runTest() {
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
var context = { 'url': 'http://example.org',
|
||||
'appId': SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
|
||||
'isInBrowserElement': true };
|
||||
var context = {url: 'http://example.org',
|
||||
originAttributes: {inBrowser: true}};
|
||||
SpecialPowers.pushPermissions([
|
||||
{'type': 'browser', 'allow': 1, 'context': context},
|
||||
{'type': 'embed-apps', 'allow': 1, 'context': context}
|
||||
{type: 'browser', allow: 1, context: context},
|
||||
{type: 'embed-apps', allow: 1, context: context}
|
||||
], function() {
|
||||
iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_AllowEmbedAppsInNestedOOIframe.html';
|
||||
});
|
||||
}
|
||||
|
||||
addEventListener('testready', () => {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.ipc.tabs.nested.enabled", true]]}, runTest);
|
||||
SpecialPowers.pushPrefEnv({set: [["dom.ipc.tabs.nested.enabled", true]]}, runTest);
|
||||
});
|
||||
|
@ -343,13 +343,14 @@ function testCut2(e) {
|
||||
|
||||
// Give our origin permission to open browsers, and remove it when the test is complete.
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
var context = { 'url': SpecialPowers.wrap(principal.URI).spec,
|
||||
'appId': principal.appId,
|
||||
'isInBrowserElement': true };
|
||||
var context = { url: SpecialPowers.wrap(principal.URI).spec,
|
||||
originAttributes: {
|
||||
appId: principal.appId,
|
||||
inBrowser: true }};
|
||||
|
||||
addEventListener('testready', function() {
|
||||
SpecialPowers.pushPermissions([
|
||||
{'type': 'browser', 'allow': 1, 'context': context}
|
||||
{type: 'browser', allow: 1, context: context}
|
||||
], runTest);
|
||||
});
|
||||
|
||||
|
@ -28,12 +28,11 @@ function runTest() {
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
var context = { 'url': 'http://example.org',
|
||||
'appId': SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
|
||||
'isInBrowserElement': true };
|
||||
var context = {url: 'http://example.org',
|
||||
originAttributes: {inBrowser: true}};
|
||||
SpecialPowers.pushPermissions([
|
||||
{'type': 'browser', 'allow': 1, 'context': context},
|
||||
{'type': 'embed-apps', 'allow': 1, 'context': context}
|
||||
{type: 'browser', allow: 1, context: context},
|
||||
{type: 'embed-apps', allow: 1, context: context}
|
||||
], function() {
|
||||
iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_DisallowEmbedAppsInOOP.html';
|
||||
});
|
||||
|
@ -14,16 +14,18 @@ function runTest() {
|
||||
allow: true,
|
||||
context: {
|
||||
url: frameUrl,
|
||||
appId: SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
|
||||
isInBrowserElement: true
|
||||
originAttributes: {
|
||||
inBrowser: true
|
||||
}
|
||||
}
|
||||
},{
|
||||
type: 'browser',
|
||||
allow: true,
|
||||
context: {
|
||||
url: frameUrl,
|
||||
appId: SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
|
||||
isInBrowserElement: true
|
||||
originAttributes: {
|
||||
inBrowser: true
|
||||
}
|
||||
}
|
||||
}], createFrame);
|
||||
}
|
||||
|
@ -36,8 +36,7 @@ function runTest() {
|
||||
allow: true,
|
||||
context: {
|
||||
url: imeUrl,
|
||||
appId: SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
|
||||
isInBrowserElement: true
|
||||
originAttributes: {inBrowser: true}
|
||||
}
|
||||
}], SimpleTest.waitForFocus.bind(SimpleTest, createFrames));
|
||||
}
|
||||
|
@ -18,9 +18,11 @@ var iframe;
|
||||
|
||||
function runTest() {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
SpecialPowers.addPermission("browser", true, { url: SpecialPowers.wrap(principal.URI).spec,
|
||||
appId: principal.appId,
|
||||
isInBrowserElement: true });
|
||||
SpecialPowers.addPermission("browser", true, {url: SpecialPowers.wrap(principal.URI).spec,
|
||||
originAttributes: {
|
||||
appId: principal.appId,
|
||||
inBrowser: true
|
||||
}});
|
||||
|
||||
iframe = document.createElement('iframe');
|
||||
iframe.setAttribute('mozbrowser', 'true');
|
||||
@ -75,10 +77,11 @@ function finish() {
|
||||
iframe.removeEventListener('mozbrowsershowmodalprompt', checkMessage);
|
||||
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
SpecialPowers.removePermission("browser", { url: SpecialPowers.wrap(principal.URI).spec,
|
||||
appId: principal.appId,
|
||||
isInBrowserElement: true });
|
||||
|
||||
SpecialPowers.removePermission("browser", {url: SpecialPowers.wrap(principal.URI).spec,
|
||||
originAttributes: {
|
||||
appId: principal.appId,
|
||||
inBrowser: true
|
||||
}});
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -12,9 +12,11 @@ browserElementTestHelpers.addPermission();
|
||||
|
||||
function runTest() {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
SpecialPowers.addPermission("browser", true, { url: SpecialPowers.wrap(principal.URI).spec,
|
||||
appId: principal.appId,
|
||||
isInBrowserElement: true });
|
||||
SpecialPowers.addPermission("browser", true, {url: SpecialPowers.wrap(principal.URI).spec,
|
||||
originAttributes: {
|
||||
appId: principal.appId,
|
||||
inBrowser: true
|
||||
}});
|
||||
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.setAttribute('mozbrowser', 'true');
|
||||
@ -56,9 +58,11 @@ function runTest() {
|
||||
|
||||
function finish() {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
SpecialPowers.removePermission("browser", { url: SpecialPowers.wrap(principal.URI).spec,
|
||||
appId: principal.appId,
|
||||
isInBrowserElement: true });
|
||||
SpecialPowers.removePermission("browser", {url: SpecialPowers.wrap(principal.URI).spec,
|
||||
originAttributes: {
|
||||
appId: principal.appId,
|
||||
inBrowser: true
|
||||
}});
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
@ -22,15 +22,19 @@ SpecialPowers.addPermission("embed-apps", true, document);
|
||||
|
||||
// Give our origin permission to open browsers, and remove it when the test is complete.
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
SpecialPowers.addPermission("browser", true, { url: SpecialPowers.wrap(principal.URI).spec,
|
||||
appId: principal.appId,
|
||||
isInBrowserElement: true });
|
||||
SpecialPowers.addPermission("browser", true, {url: SpecialPowers.wrap(principal.URI).spec,
|
||||
originAttributes: {
|
||||
appId: principal.appId,
|
||||
inBrowser: true
|
||||
}});
|
||||
|
||||
addEventListener('unload', function() {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
SpecialPowers.removePermission("browser", { url: SpecialPowers.wrap(principal.URI).spec,
|
||||
appId: principal.appId,
|
||||
isInBrowserElement: true });
|
||||
SpecialPowers.removePermission("browser", {url: SpecialPowers.wrap(principal.URI).spec,
|
||||
originAttributes: {
|
||||
appId: principal.appId,
|
||||
inBrowser: true
|
||||
}});
|
||||
});
|
||||
|
||||
function runTest() {
|
||||
|
@ -21,15 +21,19 @@ browserElementTestHelpers.enableProcessPriorityManager();
|
||||
|
||||
// Give our origin permission to open browsers, and remove it when the test is complete.
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
SpecialPowers.addPermission("browser", true, { url: SpecialPowers.wrap(principal.URI).spec,
|
||||
appId: principal.appId,
|
||||
isInBrowserElement: true });
|
||||
SpecialPowers.addPermission("browser", true, {url: SpecialPowers.wrap(principal.URI).spec,
|
||||
originAttributes: {
|
||||
appId: principal.appId,
|
||||
inBrowser: true
|
||||
}});
|
||||
|
||||
addEventListener('unload', function() {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
SpecialPowers.removePermission("browser", { url: SpecialPowers.wrap(principal.URI).spec,
|
||||
appId: principal.appId,
|
||||
isInBrowserElement: true });
|
||||
SpecialPowers.removePermission("browser", {url: SpecialPowers.wrap(principal.URI).spec,
|
||||
originAttributes: {
|
||||
appId: principal.appId,
|
||||
inBrowser: true
|
||||
}});
|
||||
});
|
||||
|
||||
function runTest() {
|
||||
|
11
dom/cache/test/mochitest/driver.js
vendored
11
dom/cache/test/mochitest/driver.js
vendored
@ -35,16 +35,7 @@ function runTests(testFile, order) {
|
||||
// adapted from dom/indexedDB/test/helpers.js
|
||||
function clearStorage() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
var appId, inBrowser;
|
||||
var nsIPrincipal = SpecialPowers.Components.interfaces.nsIPrincipal;
|
||||
if (principal.appId != nsIPrincipal.UNKNOWN_APP_ID &&
|
||||
principal.appId != nsIPrincipal.NO_APP_ID) {
|
||||
appId = principal.appId;
|
||||
inBrowser = principal.isInBrowserElement;
|
||||
}
|
||||
SpecialPowers.clearStorageForURI(document.documentURI, resolve, appId,
|
||||
inBrowser);
|
||||
SpecialPowers.clearStorageForDoc(SpecialPowers.wrap(document), resolve);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -24,46 +24,19 @@ function setupTestIframe() {
|
||||
|
||||
function clearStorage() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
var appId, inBrowser;
|
||||
var nsIPrincipal = SpecialPowers.Components.interfaces.nsIPrincipal;
|
||||
if (principal.appId != nsIPrincipal.UNKNOWN_APP_ID &&
|
||||
principal.appId != nsIPrincipal.NO_APP_ID) {
|
||||
appId = principal.appId;
|
||||
inBrowser = principal.isInBrowserElement;
|
||||
}
|
||||
SpecialPowers.clearStorageForURI(document.documentURI, resolve, appId,
|
||||
inBrowser);
|
||||
SpecialPowers.clearStorageForDoc(SpecialPowers.wrap(document), resolve);
|
||||
});
|
||||
}
|
||||
|
||||
function storageUsage() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
var appId, inBrowser;
|
||||
var nsIPrincipal = SpecialPowers.Components.interfaces.nsIPrincipal;
|
||||
if (principal.appId != nsIPrincipal.UNKNOWN_APP_ID &&
|
||||
principal.appId != nsIPrincipal.NO_APP_ID) {
|
||||
appId = principal.appId;
|
||||
inBrowser = principal.isInBrowserElement;
|
||||
}
|
||||
SpecialPowers.getStorageUsageForURI(document.documentURI, resolve, appId,
|
||||
inBrowser);
|
||||
SpecialPowers.getStorageUsageForDoc(SpecialPowers.wrap(document), resolve);
|
||||
});
|
||||
}
|
||||
|
||||
function resetStorage() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
var appId, inBrowser;
|
||||
var nsIPrincipal = SpecialPowers.Components.interfaces.nsIPrincipal;
|
||||
if (principal.appId != nsIPrincipal.UNKNOWN_APP_ID &&
|
||||
principal.appId != nsIPrincipal.NO_APP_ID) {
|
||||
appId = principal.appId;
|
||||
inBrowser = principal.isInBrowserElement;
|
||||
}
|
||||
SpecialPowers.resetStorageForURI(document.documentURI, resolve, appId,
|
||||
inBrowser);
|
||||
SpecialPowers.resetStorageForDoc(SpecialPowers.wrap(document), resolve);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -24,46 +24,19 @@ function setupTestIframe() {
|
||||
|
||||
function clearStorage() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
var appId, inBrowser;
|
||||
var nsIPrincipal = SpecialPowers.Components.interfaces.nsIPrincipal;
|
||||
if (principal.appId != nsIPrincipal.UNKNOWN_APP_ID &&
|
||||
principal.appId != nsIPrincipal.NO_APP_ID) {
|
||||
appId = principal.appId;
|
||||
inBrowser = principal.isInBrowserElement;
|
||||
}
|
||||
SpecialPowers.clearStorageForURI(document.documentURI, resolve, appId,
|
||||
inBrowser);
|
||||
SpecialPowers.clearStorageForDoc(SpecialPowers.wrap(document), resolve);
|
||||
});
|
||||
}
|
||||
|
||||
function storageUsage() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
var appId, inBrowser;
|
||||
var nsIPrincipal = SpecialPowers.Components.interfaces.nsIPrincipal;
|
||||
if (principal.appId != nsIPrincipal.UNKNOWN_APP_ID &&
|
||||
principal.appId != nsIPrincipal.NO_APP_ID) {
|
||||
appId = principal.appId;
|
||||
inBrowser = principal.isInBrowserElement;
|
||||
}
|
||||
SpecialPowers.getStorageUsageForURI(document.documentURI, resolve, appId,
|
||||
inBrowser);
|
||||
SpecialPowers.getStorageUsageForDoc(SpecialPowers.wrap(document), resolve);
|
||||
});
|
||||
}
|
||||
|
||||
function resetStorage() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
var appId, inBrowser;
|
||||
var nsIPrincipal = SpecialPowers.Components.interfaces.nsIPrincipal;
|
||||
if (principal.appId != nsIPrincipal.UNKNOWN_APP_ID &&
|
||||
principal.appId != nsIPrincipal.NO_APP_ID) {
|
||||
appId = principal.appId;
|
||||
inBrowser = principal.isInBrowserElement;
|
||||
}
|
||||
SpecialPowers.resetStorageForURI(document.documentURI, resolve, appId,
|
||||
inBrowser);
|
||||
SpecialPowers.resetStorageForDoc(SpecialPowers.wrap(document), resolve);
|
||||
});
|
||||
}
|
||||
|
||||
|
11
dom/cache/test/mochitest/test_cache_restart.html
vendored
11
dom/cache/test/mochitest/test_cache_restart.html
vendored
@ -23,16 +23,7 @@ function setupTestIframe() {
|
||||
|
||||
function resetStorage() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
var appId, inBrowser;
|
||||
var nsIPrincipal = SpecialPowers.Components.interfaces.nsIPrincipal;
|
||||
if (principal.appId != nsIPrincipal.UNKNOWN_APP_ID &&
|
||||
principal.appId != nsIPrincipal.NO_APP_ID) {
|
||||
appId = principal.appId;
|
||||
inBrowser = principal.isInBrowserElement;
|
||||
}
|
||||
SpecialPowers.resetStorageForURI(document.documentURI, resolve, appId,
|
||||
inBrowser);
|
||||
SpecialPowers.resetStorageForDoc(SpecialPowers.wrap(document), resolve);
|
||||
});
|
||||
}
|
||||
|
||||
|
33
dom/cache/test/mochitest/test_cache_shrink.html
vendored
33
dom/cache/test/mochitest/test_cache_shrink.html
vendored
@ -24,46 +24,19 @@ function setupTestIframe() {
|
||||
|
||||
function clearStorage() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
var appId, inBrowser;
|
||||
var nsIPrincipal = SpecialPowers.Components.interfaces.nsIPrincipal;
|
||||
if (principal.appId != nsIPrincipal.UNKNOWN_APP_ID &&
|
||||
principal.appId != nsIPrincipal.NO_APP_ID) {
|
||||
appId = principal.appId;
|
||||
inBrowser = principal.isInBrowserElement;
|
||||
}
|
||||
SpecialPowers.clearStorageForURI(document.documentURI, resolve, appId,
|
||||
inBrowser);
|
||||
SpecialPowers.clearStorageForDoc(SpecialPowers.wrap(document), resolve);
|
||||
});
|
||||
}
|
||||
|
||||
function storageUsage() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
var appId, inBrowser;
|
||||
var nsIPrincipal = SpecialPowers.Components.interfaces.nsIPrincipal;
|
||||
if (principal.appId != nsIPrincipal.UNKNOWN_APP_ID &&
|
||||
principal.appId != nsIPrincipal.NO_APP_ID) {
|
||||
appId = principal.appId;
|
||||
inBrowser = principal.isInBrowserElement;
|
||||
}
|
||||
SpecialPowers.getStorageUsageForURI(document.documentURI, resolve, appId,
|
||||
inBrowser);
|
||||
SpecialPowers.getStorageUsageForDoc(SpecialPowers.wrap(document), resolve);
|
||||
});
|
||||
}
|
||||
|
||||
function resetStorage() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
var appId, inBrowser;
|
||||
var nsIPrincipal = SpecialPowers.Components.interfaces.nsIPrincipal;
|
||||
if (principal.appId != nsIPrincipal.UNKNOWN_APP_ID &&
|
||||
principal.appId != nsIPrincipal.NO_APP_ID) {
|
||||
appId = principal.appId;
|
||||
inBrowser = principal.isInBrowserElement;
|
||||
}
|
||||
SpecialPowers.resetStorageForURI(document.documentURI, resolve, appId,
|
||||
inBrowser);
|
||||
SpecialPowers.resetStorageForDoc(SpecialPowers.wrap(document), resolve);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -189,17 +189,7 @@ function grabFileUsageAndContinueHandler(usage, fileUsage)
|
||||
|
||||
function getUsage(usageHandler)
|
||||
{
|
||||
let principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
let appId, inBrowser;
|
||||
if (principal.appId != Components.interfaces.nsIPrincipal.UNKNOWN_APP_ID &&
|
||||
principal.appId != Components.interfaces.nsIPrincipal.NO_APP_ID) {
|
||||
appId = principal.appId;
|
||||
inBrowser = principal.isInBrowserElement;
|
||||
}
|
||||
SpecialPowers.getStorageUsageForURI(window.document.documentURI,
|
||||
usageHandler,
|
||||
appId,
|
||||
inBrowser);
|
||||
SpecialPowers.getStorageUsageForDoc(SpecialPowers.wrap(document), usageHandler);
|
||||
}
|
||||
|
||||
function getFileId(file)
|
||||
|
@ -34,14 +34,7 @@ function executeSoon(aFun)
|
||||
}
|
||||
|
||||
function clearAllDatabases(callback) {
|
||||
let principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
let appId, inBrowser;
|
||||
if (principal.appId != Components.interfaces.nsIPrincipal.UNKNOWN_APP_ID &&
|
||||
principal.appId != Components.interfaces.nsIPrincipal.NO_APP_ID) {
|
||||
appId = principal.appId;
|
||||
inBrowser = principal.isInBrowserElement;
|
||||
}
|
||||
SpecialPowers.clearStorageForURI(document.documentURI, callback, appId, inBrowser);
|
||||
SpecialPowers.clearStorageForDoc(SpecialPowers.wrap(document), callback);
|
||||
}
|
||||
|
||||
var testHarnessGenerator = testHarnessSteps();
|
||||
|
@ -117,11 +117,9 @@ function start()
|
||||
}
|
||||
|
||||
SpecialPowers.addPermission("browser", true, document);
|
||||
SpecialPowers.addPermission("browser", true, { manifestURL: manifestURL,
|
||||
isInBrowserElement: false });
|
||||
SpecialPowers.addPermission("browser", true, { manifestURL: manifestURL });
|
||||
SpecialPowers.addPermission("embed-apps", true, document);
|
||||
SpecialPowers.addPermission("indexedDB", true, { manifestURL: manifestURL,
|
||||
isInBrowserElement: false });
|
||||
SpecialPowers.addPermission("indexedDB", true, { manifestURL: manifestURL });
|
||||
|
||||
SpecialPowers.setAllAppsLaunchable(true);
|
||||
|
||||
|
@ -91,8 +91,9 @@ function runTest() {
|
||||
allow: true,
|
||||
context: {
|
||||
url: imeUrl,
|
||||
appId: SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
|
||||
isInBrowserElement: true
|
||||
originAttributes: {
|
||||
inBrowser: true
|
||||
}
|
||||
}
|
||||
}], function() {
|
||||
keyboardA.src = imeUrl;
|
||||
|
@ -78,8 +78,9 @@ function runTest() {
|
||||
allow: true,
|
||||
context: {
|
||||
url: imeUrl,
|
||||
appId: SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
|
||||
isInBrowserElement: true
|
||||
originAttributes: {
|
||||
inBrowser: true
|
||||
}
|
||||
}
|
||||
}], function() {
|
||||
// STEP 2c: Tell Gecko to use this iframe as its keyboard app
|
||||
|
@ -141,8 +141,9 @@ function setupInputAppFrame() {
|
||||
allow: true,
|
||||
context: {
|
||||
url: imeUrl,
|
||||
appId: SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
|
||||
isInBrowserElement: true
|
||||
originAttributes: {
|
||||
inBrowser: true
|
||||
}
|
||||
}
|
||||
}], function() {
|
||||
let mm = SpecialPowers.getBrowserFrameMessageManager(inputAppFrame);
|
||||
|
@ -70,8 +70,9 @@ function setupInputAppFrame() {
|
||||
allow: true,
|
||||
context: {
|
||||
url: imeUrl,
|
||||
appId: SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
|
||||
isInBrowserElement: true
|
||||
originAttributes: {
|
||||
inBrowser: true
|
||||
}
|
||||
}
|
||||
}], function() {
|
||||
let mm = appFrameMM =
|
||||
|
@ -103,8 +103,9 @@ function setupInputAppFrame() {
|
||||
allow: true,
|
||||
context: {
|
||||
url: imeUrl,
|
||||
appId: SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
|
||||
isInBrowserElement: true
|
||||
originAttributes: {
|
||||
inBrowser: true
|
||||
}
|
||||
}
|
||||
}], function() {
|
||||
let mm = appFrameMM =
|
||||
|
@ -33,8 +33,7 @@ var tests = [
|
||||
function() {
|
||||
var appId = gAppsService.getAppLocalIdByManifestURL(embedAppHostedManifestURL);
|
||||
var context = { url: embedApp.origin,
|
||||
appId: appId,
|
||||
isInBrowserElement: false };
|
||||
originAttributes: { appId: appId } };
|
||||
setupOpenAppPermission(context, runTests);
|
||||
},
|
||||
|
||||
|
@ -33,8 +33,7 @@ var tests = [
|
||||
function() {
|
||||
var appId = gAppsService.getAppLocalIdByManifestURL(embedAppHostedManifestURL);
|
||||
var context = { url: embedApp.origin,
|
||||
appId: appId,
|
||||
isInBrowserElement: false };
|
||||
originAttributes: { appId: appId } };
|
||||
setupOpenAppPermission(context, runTests);
|
||||
},
|
||||
|
||||
|
@ -53,8 +53,7 @@ function test1() {
|
||||
|
||||
if (!SpecialPowers.hasPermission( PERMISSION_TYPE,
|
||||
{ url: APP_URL,
|
||||
appId: appId,
|
||||
isInBrowserElement: false })) {
|
||||
originAttributes: { appId: appId }})) {
|
||||
errorHandler('[test 1] App should have permission: ' + PERMISSION_TYPE);
|
||||
}
|
||||
|
||||
@ -82,8 +81,7 @@ function test2() {
|
||||
|
||||
if (!SpecialPowers.hasPermission( PERMISSION_TYPE,
|
||||
{ url: APP_URL,
|
||||
appId: appId,
|
||||
isInBrowserElement: false })) {
|
||||
originAttributes: { appId: appId }})) {
|
||||
errorHandler('[test 2] App should have permission: ' + PERMISSION_TYPE);
|
||||
}
|
||||
|
||||
@ -111,8 +109,7 @@ function test3() {
|
||||
|
||||
if (!SpecialPowers.hasPermission(PERMISSION_TYPE,
|
||||
{ url: APP_URL,
|
||||
appId: appId,
|
||||
isInBrowserElement: false })) {
|
||||
originAttributes: { appId: appId }})) {
|
||||
errorHandler('[test 3] App should have permission: ' + PERMISSION_TYPE);
|
||||
}
|
||||
}
|
||||
@ -148,8 +145,7 @@ function test4() {
|
||||
|
||||
if (!SpecialPowers.hasPermission(PERMISSION_TYPE,
|
||||
{ url: APP_URL,
|
||||
appId: appId,
|
||||
isInBrowserElement: false })) {
|
||||
originAttributes: { appId: appId }})) {
|
||||
errorHandler('[test 4] App should have permission: ' + PERMISSION_TYPE);
|
||||
}
|
||||
}
|
||||
@ -174,8 +170,7 @@ function test5() {
|
||||
|
||||
if (!SpecialPowers.hasPermission( PERMISSION_TYPE,
|
||||
{ url: APP_URL,
|
||||
appId: appId,
|
||||
isInBrowserElement: false })) {
|
||||
originAttributes: { appId: appId }})) {
|
||||
errorHandler('[test 5] App should have permission: ' + PERMISSION_TYPE);
|
||||
}
|
||||
|
||||
@ -290,8 +285,7 @@ function addPermissionToApp(appURL, manifestURL) {
|
||||
"expireType":permManager.EXPIRE_SESSION,
|
||||
"expireTime":now + SESSION_PERSIST_MINUTES*60*1000,
|
||||
"context": { url: appURL,
|
||||
appId: appId,
|
||||
isInBrowserElement:false }
|
||||
originAttributes: { appId: appId } }
|
||||
}
|
||||
], function() {
|
||||
runTests();
|
||||
@ -303,8 +297,7 @@ function runNextIfAppHasPermission(round, expect, appURL, manifestURL) {
|
||||
|
||||
var hasPerm = SpecialPowers.hasPermission(PERMISSION_TYPE,
|
||||
{ url: appURL,
|
||||
appId: appId,
|
||||
isInBrowserElement: false });
|
||||
originAttributes: { appId: appId }});
|
||||
var result = (expect==hasPerm);
|
||||
if (result) {
|
||||
runTests();
|
||||
|
@ -33,8 +33,7 @@ var tests = [
|
||||
function() {
|
||||
var appId = gAppsService.getAppLocalIdByManifestURL(embedAppHostedManifestURL);
|
||||
var context = { url: embedApp.origin,
|
||||
appId: appId,
|
||||
isInBrowserElement: false };
|
||||
originAttributes: { appId: appId } };
|
||||
setupOpenAppPermission(context, runTests);
|
||||
},
|
||||
|
||||
|
@ -22,8 +22,9 @@ function installApp(aTestToken, aTemplate) {
|
||||
|
||||
var appId = gAppsService.getAppLocalIdByManifestURL(gApp.manifestURL);
|
||||
SpecialPowers.addPermission("tv", true, { url: gApp.origin,
|
||||
appId: appId,
|
||||
isInBrowserElement: false });
|
||||
originAttributes: {
|
||||
appId: appId
|
||||
}});
|
||||
|
||||
runTest();
|
||||
}
|
||||
|
@ -69,8 +69,7 @@ function installApp(aTestToken, aTemplate) {
|
||||
function pushPermissionsToApp() {
|
||||
var appId = gAppsService.getAppLocalIdByManifestURL(gApp.manifestURL);
|
||||
var context = { url: gApp.origin,
|
||||
appId: appId,
|
||||
isInBrowserElement: false };
|
||||
originAttributes: {appId: appId}};
|
||||
SpecialPowers.pushPermissions([
|
||||
{ "type": "pAppPermission", "allow": true, "context": context }
|
||||
], testPermissionsForApp);
|
||||
@ -79,8 +78,7 @@ function pushPermissionsToApp() {
|
||||
function testPermissionsForApp() {
|
||||
var appId = gAppsService.getAppLocalIdByManifestURL(gApp.manifestURL);
|
||||
var context = { url: gApp.origin,
|
||||
appId: appId,
|
||||
isInBrowserElement: false };
|
||||
originAttributes: {appId: appId}};
|
||||
ok(SpecialPowers.hasPermission('pAppPermission', context), 'pAppPermission should have permission');
|
||||
uninstallApp();
|
||||
}
|
||||
@ -95,10 +93,10 @@ function uninstallApp() {
|
||||
|
||||
function testPermissionsForSelfAndApp() {
|
||||
var appId = gAppsService.getAppLocalIdByManifestURL(gApp.manifestURL);
|
||||
var context = { url: gApp.origin,
|
||||
appId: appId,
|
||||
isInBrowserElement: false };
|
||||
ok(!SpecialPowers.hasPermission('pAppPermission', context), 'pAppPermission should not have permission');
|
||||
is(appId, 0, "appId should become NO_APP_ID");
|
||||
// since gApp is uninstalled, calling SpecialPowers.hasPermission with the
|
||||
// app's properties (manifestURL, origin, principal, ... etc) will throw.
|
||||
// So we don't need to test hasPermission for the app.
|
||||
|
||||
ok(SpecialPowers.hasPermission('pAppPermission', document), 'pAppPermission should have permission');
|
||||
|
||||
|
@ -57,8 +57,7 @@ function starttest(){
|
||||
SpecialPowers.addPermission(perms[0], true, origin);
|
||||
SpecialPowers.addPermission(perms[1], true, {manifestURL: manifest});
|
||||
SpecialPowers.addPermission(perms[2], true, document);
|
||||
SpecialPowers.addPermission(perms[3], true, {url: origin,
|
||||
appId: Ci.nsIScriptSecurityManager.NO_APP_ID});
|
||||
SpecialPowers.addPermission(perms[3], true, {url: origin});
|
||||
|
||||
is(Services.perms.testPermissionFromPrincipal(noappPrincipal, perms[0]),
|
||||
allow, "Set permission by string");
|
||||
@ -74,8 +73,7 @@ function starttest(){
|
||||
SpecialPowers.removePermission(perms[0], origin);
|
||||
SpecialPowers.removePermission(perms[1], {manifestURL: manifest});
|
||||
SpecialPowers.removePermission(perms[2], document);
|
||||
SpecialPowers.removePermission(perms[3], {url: origin,
|
||||
appId: Ci.nsIScriptSecurityManager.NO_APP_ID});
|
||||
SpecialPowers.removePermission(perms[3], {url: origin});
|
||||
|
||||
is(Services.perms.testPermissionFromPrincipal(noappPrincipal, perms[0]),
|
||||
unknown, "Removed permission by string");
|
||||
|
@ -234,7 +234,9 @@ SpecialPowersObserver.prototype = new SpecialPowersObserverAPI();
|
||||
// We need to ensure that it looks the same as a real permission,
|
||||
// so we fake these properties.
|
||||
msg.permission = {
|
||||
principal: { appId: permission.principal.appId },
|
||||
principal: {
|
||||
originAttributes: {appId: permission.principal.appId}
|
||||
},
|
||||
type: permission.type
|
||||
};
|
||||
default:
|
||||
|
@ -321,11 +321,7 @@ SpecialPowersObserverAPI.prototype = {
|
||||
|
||||
case "SPPermissionManager": {
|
||||
let msg = aMessage.json;
|
||||
|
||||
let secMan = Services.scriptSecurityManager;
|
||||
// TODO: Bug 1196665 - Add originAttributes into SpecialPowers
|
||||
let attrs = {appId: msg.appId, inBrowser: msg.isInBrowserElement};
|
||||
let principal = secMan.createCodebasePrincipal(this._getURI(msg.url), attrs);
|
||||
let principal = msg.principal;
|
||||
|
||||
switch (msg.op) {
|
||||
case "add":
|
||||
@ -336,17 +332,10 @@ SpecialPowersObserverAPI.prototype = {
|
||||
break;
|
||||
case "has":
|
||||
let hasPerm = Services.perms.testPermissionFromPrincipal(principal, msg.type);
|
||||
if (hasPerm == Ci.nsIPermissionManager.ALLOW_ACTION)
|
||||
return true;
|
||||
return false;
|
||||
break;
|
||||
return hasPerm == Ci.nsIPermissionManager.ALLOW_ACTION;
|
||||
case "test":
|
||||
let testPerm = Services.perms.testPermissionFromPrincipal(principal, msg.type, msg.value);
|
||||
if (testPerm == msg.value) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
return testPerm == msg.value;
|
||||
default:
|
||||
throw new SpecialPowersError(
|
||||
"Invalid operation for SPPermissionManager");
|
||||
@ -510,18 +499,13 @@ SpecialPowersObserverAPI.prototype = {
|
||||
.frameLoader
|
||||
.messageManager;
|
||||
let msg = aMessage.data;
|
||||
let principal = msg.principal;
|
||||
let op = msg.op;
|
||||
|
||||
if (op != 'clear' && op != 'getUsage' && op != 'reset') {
|
||||
throw new SpecialPowersError('Invalid operation for SPQuotaManager');
|
||||
}
|
||||
|
||||
let secMan = Services.scriptSecurityManager;
|
||||
let principal = secMan.createCodebasePrincipal(this._getURI(msg.uri), {
|
||||
appId: msg.appId,
|
||||
inBrowser: msg.inBrowser,
|
||||
});
|
||||
|
||||
if (op == 'clear') {
|
||||
qm.clearStoragesForPrincipal(principal);
|
||||
} else if (op == 'reset') {
|
||||
|
@ -786,8 +786,8 @@ SpecialPowersAPI.prototype = {
|
||||
originalValue = Ci.nsICookiePermission.ACCESS_LIMIT_THIRD_PARTY;
|
||||
}
|
||||
|
||||
let [url, appId, isInBrowserElement, isSystem] = this._getInfoFromPermissionArg(context);
|
||||
if (isSystem) {
|
||||
let principal = this._getPrincipalFromArg(context);
|
||||
if (principal.isSystemPrincipal) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -810,9 +810,7 @@ SpecialPowersAPI.prototype = {
|
||||
'type': permission.type,
|
||||
'permission': perm,
|
||||
'value': perm,
|
||||
'url': url,
|
||||
'appId': appId,
|
||||
'isInBrowserElement': isInBrowserElement,
|
||||
'principal': principal,
|
||||
'expireType': (typeof permission.expireType === "number") ?
|
||||
permission.expireType : 0, // default: EXPIRE_NEVER
|
||||
'expireTime': (typeof permission.expireTime === "number") ?
|
||||
@ -967,7 +965,7 @@ SpecialPowersAPI.prototype = {
|
||||
for (var j = 0; j < undos.length; j++) {
|
||||
var undo = undos[j];
|
||||
if (undo.op == this._obsDataMap[aData] &&
|
||||
undo.appId == permission.principal.appId &&
|
||||
undo.principal.originAttributes.appId == permission.principal.originAttributes.appId &&
|
||||
undo.type == permission.type) {
|
||||
// Remove this undo item if it has been done by others(not
|
||||
// specialpowers itself.)
|
||||
@ -1820,57 +1818,40 @@ SpecialPowersAPI.prototype = {
|
||||
.messageManager);
|
||||
},
|
||||
|
||||
_getInfoFromPermissionArg: function(arg) {
|
||||
let url = "";
|
||||
let appId = Ci.nsIScriptSecurityManager.NO_APP_ID;
|
||||
let isInBrowserElement = false;
|
||||
let isSystem = false;
|
||||
_getPrincipalFromArg: function(arg) {
|
||||
let principal;
|
||||
let secMan = Services.scriptSecurityManager;
|
||||
|
||||
if (typeof(arg) == "string") {
|
||||
// It's an URL.
|
||||
url = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService)
|
||||
.newURI(arg, null, null)
|
||||
.spec;
|
||||
let uri = Services.io.newURI(arg, null, null);
|
||||
principal = secMan.createCodebasePrincipal(uri, {});
|
||||
} else if (arg.manifestURL) {
|
||||
// It's a thing representing an app.
|
||||
let appsSvc = Cc["@mozilla.org/AppsService;1"]
|
||||
.getService(Ci.nsIAppsService)
|
||||
let app = appsSvc.getAppByManifestURL(arg.manifestURL);
|
||||
|
||||
if (!app) {
|
||||
throw "No app for this manifest!";
|
||||
}
|
||||
|
||||
appId = appsSvc.getAppLocalIdByManifestURL(arg.manifestURL);
|
||||
url = app.origin;
|
||||
isInBrowserElement = arg.isInBrowserElement || false;
|
||||
principal = app.principal;
|
||||
} else if (arg.nodePrincipal) {
|
||||
// It's a document.
|
||||
isSystem = (arg.nodePrincipal instanceof Ci.nsIPrincipal) &&
|
||||
Cc["@mozilla.org/scriptsecuritymanager;1"].
|
||||
getService(Ci.nsIScriptSecurityManager).
|
||||
isSystemPrincipal(arg.nodePrincipal);
|
||||
if (!isSystem) {
|
||||
// System principals don't have a URL associated with them, and they
|
||||
// don't really need any permissions to be registered with the
|
||||
// permission manager anyway.
|
||||
url = arg.nodePrincipal.URI.spec;
|
||||
appId = arg.nodePrincipal.appId;
|
||||
isInBrowserElement = arg.nodePrincipal.isInBrowserElement;
|
||||
}
|
||||
// In some tests the arg is a wrapped DOM element, so we unwrap it first.
|
||||
principal = unwrapIfWrapped(arg).nodePrincipal;
|
||||
} else {
|
||||
url = arg.url;
|
||||
appId = arg.appId;
|
||||
isInBrowserElement = arg.isInBrowserElement;
|
||||
let uri = Services.io.newURI(arg.url, null, null);
|
||||
let attrs = arg.originAttributes || {};
|
||||
principal = secMan.createCodebasePrincipal(uri, attrs);
|
||||
}
|
||||
|
||||
return [ url, appId, isInBrowserElement, isSystem ];
|
||||
return principal;
|
||||
},
|
||||
|
||||
addPermission: function(type, allow, arg, expireType, expireTime) {
|
||||
let [url, appId, isInBrowserElement, isSystem] = this._getInfoFromPermissionArg(arg);
|
||||
if (isSystem) {
|
||||
let principal = this._getPrincipalFromArg(arg);
|
||||
if (principal.isSystemPrincipal) {
|
||||
return; // nothing to do
|
||||
}
|
||||
|
||||
@ -1886,9 +1867,7 @@ SpecialPowersAPI.prototype = {
|
||||
'op': 'add',
|
||||
'type': type,
|
||||
'permission': permission,
|
||||
'url': url,
|
||||
'appId': appId,
|
||||
'isInBrowserElement': isInBrowserElement,
|
||||
'principal': principal,
|
||||
'expireType': (typeof expireType === "number") ? expireType : 0,
|
||||
'expireTime': (typeof expireTime === "number") ? expireTime : 0
|
||||
};
|
||||
@ -1897,51 +1876,46 @@ SpecialPowersAPI.prototype = {
|
||||
},
|
||||
|
||||
removePermission: function(type, arg) {
|
||||
let [url, appId, isInBrowserElement, isSystem] = this._getInfoFromPermissionArg(arg);
|
||||
if (isSystem) {
|
||||
let principal = this._getPrincipalFromArg(arg);
|
||||
if (principal.isSystemPrincipal) {
|
||||
return; // nothing to do
|
||||
}
|
||||
|
||||
var msg = {
|
||||
'op': 'remove',
|
||||
'type': type,
|
||||
'url': url,
|
||||
'appId': appId,
|
||||
'isInBrowserElement': isInBrowserElement
|
||||
'principal': principal
|
||||
};
|
||||
|
||||
this._sendSyncMessage('SPPermissionManager', msg);
|
||||
},
|
||||
|
||||
hasPermission: function (type, arg) {
|
||||
let [url, appId, isInBrowserElement, isSystem] = this._getInfoFromPermissionArg(arg);
|
||||
if (isSystem) {
|
||||
let principal = this._getPrincipalFromArg(arg);
|
||||
if (principal.isSystemPrincipal) {
|
||||
return true; // system principals have all permissions
|
||||
}
|
||||
|
||||
var msg = {
|
||||
'op': 'has',
|
||||
'type': type,
|
||||
'url': url,
|
||||
'appId': appId,
|
||||
'isInBrowserElement': isInBrowserElement
|
||||
'principal': principal
|
||||
};
|
||||
|
||||
return this._sendSyncMessage('SPPermissionManager', msg)[0];
|
||||
},
|
||||
|
||||
testPermission: function (type, value, arg) {
|
||||
let [url, appId, isInBrowserElement, isSystem] = this._getInfoFromPermissionArg(arg);
|
||||
if (isSystem) {
|
||||
let principal = this._getPrincipalFromArg(arg);
|
||||
if (principal.isSystemPrincipal) {
|
||||
return true; // system principals have all permissions
|
||||
}
|
||||
|
||||
var msg = {
|
||||
'op': 'test',
|
||||
'type': type,
|
||||
'value': value,
|
||||
'url': url,
|
||||
'appId': appId,
|
||||
'isInBrowserElement': isInBrowserElement
|
||||
'value': value,
|
||||
'principal': principal
|
||||
};
|
||||
return this._sendSyncMessage('SPPermissionManager', msg)[0];
|
||||
},
|
||||
@ -1966,28 +1940,20 @@ SpecialPowersAPI.prototype = {
|
||||
this._sendSyncMessage('SPObserverService', msg);
|
||||
},
|
||||
|
||||
clearStorageForURI: function(uri, callback, appId, inBrowser) {
|
||||
this._quotaManagerRequest('clear', uri, appId, inBrowser, callback);
|
||||
clearStorageForDoc: function(wrappedDocument, callback) {
|
||||
this._quotaManagerRequest('clear', wrappedDocument, callback);
|
||||
},
|
||||
|
||||
getStorageUsageForURI: function(uri, callback, appId, inBrowser) {
|
||||
this._quotaManagerRequest('getUsage', uri, appId, inBrowser, callback);
|
||||
getStorageUsageForDoc: function(wrappedDocument, callback) {
|
||||
this._quotaManagerRequest('getUsage', wrappedDocument, callback);
|
||||
},
|
||||
|
||||
// Technically this restarts the QuotaManager for all URIs, but we need
|
||||
// a specific one to perform the synchronized callback when the reset is
|
||||
// complete.
|
||||
resetStorageForURI: function(uri, callback, appId, inBrowser) {
|
||||
this._quotaManagerRequest('reset', uri, appId, inBrowser, callback);
|
||||
resetStorageForDoc: function(wrappedDocument, callback) {
|
||||
this._quotaManagerRequest('reset', wrappedDocument, callback);
|
||||
},
|
||||
|
||||
_quotaManagerRequest: function(op, uri, appId, inBrowser, callback) {
|
||||
_quotaManagerRequest: function(op, wrappedDocument, callback) {
|
||||
const messageTopic = "SPQuotaManager";
|
||||
|
||||
if (uri instanceof Ci.nsIURI) {
|
||||
uri = uri.spec;
|
||||
}
|
||||
|
||||
const id = Cc["@mozilla.org/uuid-generator;1"]
|
||||
.getService(Ci.nsIUUIDGenerator)
|
||||
.generateUUID()
|
||||
@ -2024,7 +1990,8 @@ SpecialPowersAPI.prototype = {
|
||||
this._quotaManagerCallbackInfos = [ callbackInfo ];
|
||||
}
|
||||
|
||||
let msg = { op: op, uri: uri, appId: appId, inBrowser: inBrowser, id: id };
|
||||
let principal = unwrapIfWrapped(wrappedDocument).nodePrincipal;
|
||||
let msg = { op: op, principal: principal, id: id };
|
||||
this._sendAsyncMessage(messageTopic, msg);
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user