Merge mozilla-central to mozilla-inbound

This commit is contained in:
Carsten "Tomcat" Book 2016-01-13 11:58:27 +01:00
commit b1b2328545
189 changed files with 2487 additions and 2122 deletions

View File

@ -40,6 +40,7 @@ Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise", "resource://gre/modules/Promise.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants", "resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyGetter(this, "libcutils", function () {
Cu.import("resource://gre/modules/systemlibs.js");
@ -146,7 +147,11 @@ this.PersistentDataBlock = {
}
if (this._libc.handler === null) {
#ifdef MOZ_WIDGET_GONK
if (AppConstants.platform != "gonk") {
log("This component requires Gonk!");
throw Cr.NS_ERROR_ABORT;
}
try {
this._libc.handler = this.ctypes.open(this.ctypes.libraryName("c"));
this._libc.close = this._libc.handler.declare("close",
@ -171,10 +176,6 @@ this.PersistentDataBlock = {
log("Unable to open libc.so: ex = " + ex);
throw Cr.NS_ERROR_FAILURE;
}
#else
log("This component requires Gonk!");
throw Cr.NS_ERROR_ABORT;
#endif
}
this._dataBlockFile = this._libcutils.property_get(PERSISTENT_DATA_BLOCK_PROPERTY);
@ -292,7 +293,11 @@ this.PersistentDataBlock = {
return 1024;
}
#ifdef MOZ_WIDGET_GONK
if (AppConstants.platform != "gonk") {
log("_getBlockDeviceSize: ERROR: This feature is only supported in Gonk!");
return -1;
}
const O_READONLY = 0;
const O_NONBLOCK = 1 << 11;
/* Getting the correct values for ioctl() operations by reading the headers is not a trivial task, so
@ -332,10 +337,6 @@ this.PersistentDataBlock = {
this._libc.close(fd);
debug("_getBlockDeviceSize: size =" + size.value);
return size.value;
#else
log("_getBlockDeviceSize: ERROR: This feature is only supported in Gonk!");
return -1;
#endif
},
/**
@ -604,7 +605,11 @@ this.PersistentDataBlock = {
return Promise.resolve();
}
#ifdef MOZ_WIDGET_GONK
if (AppConstants.platform != "gonk") {
log("wipe: ERROR: This feature is only supported in Gonk!");
return Promise.reject();
}
const O_READONLY = 0;
const O_RDWR = 2;
const O_NONBLOCK = 1 << 11;
@ -646,10 +651,6 @@ this.PersistentDataBlock = {
log("wipe: secure discard succeed");
return resolve();
});
#else
log("wipe: ERROR: This feature is only supported in Gonk!");
return Promise.reject();
#endif
},
/**

View File

@ -70,6 +70,7 @@ EXTRA_JS_MODULES += [
'LogShake.jsm',
'MultiscreenHandler.jsm',
'OrientationChangeHandler.jsm',
'PersistentDataBlock.jsm',
'SafeMode.jsm',
'Screenshot.jsm',
'SignInToWebsite.jsm',
@ -78,10 +79,6 @@ EXTRA_JS_MODULES += [
'WebappsUpdater.jsm',
]
EXTRA_PP_JS_MODULES += [
'PersistentDataBlock.jsm'
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
EXTRA_JS_MODULES += [
'GlobalSimulatorScreen.jsm'

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a38728b0641627dcd47a6f21b51fccf6ba0af58c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
@ -35,7 +35,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="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49da75221f9c9d69eadc28e6b23af8c5afa26374"/>
<!-- 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="0f86914b89cf8a069533e66b218533a17bad6b43"/>
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="6b1fb5b730b1299f99f9194c1fcf088579cc7977"/>
@ -168,7 +168,7 @@
<project name="platform/hardware/qcom/camera" path="hardware/qcom/camera" revision="l_LNX.LA.3.6"/>
-->
<!-- Sony platform specific things -->
<project name="codeaurora_kernel_msm" path="kernel" remote="b2g" revision="831789c04366336dd35ce0678f02656c1476d6d7"/>
<project name="codeaurora_kernel_msm" path="kernel" remote="b2g" revision="f4f1a6f3260d88f11671d57b4b759c0831a5c764"/>
<project name="device-qcom-sepolicy" path="device/qcom/sepolicy" remote="b2g" revision="e0a1cce6a8559ccc88e15da148531d36e18ae5f7"/>
<project name="android_external_busybox" path="external/busybox" remote="b2g" revision="757a15c84e7bf9897b908058f2e529fcffea73b8"/>
<project groups="device" name="init_sh" path="hardware/sony/init_sh" remote="b2g" revision="58d94ebe3a2e9a1af4bc8c003cd6837e53cc4867"/>
@ -177,17 +177,17 @@
<project groups="device" name="thermanager" path="hardware/sony/thermanager" remote="b2g" revision="ec9a2b6a7fe8254ecc3c2c4781e7304f3822e390"/>
<project groups="device" name="timekeep" path="hardware/sony/timekeep" remote="b2g" revision="4cbb0abc00681f116f043584661307b5c4855a31"/>
<!-- Shinano platform specific things -->
<project groups="device" name="device-sony-shinano" path="device/sony/shinano" remote="b2g" revision="fdc22f74b2271dfcfba1e7191b83257b5a2b1343"/>
<project groups="device" name="device-sony-shinano" path="device/sony/shinano" remote="b2g" revision="5d3d1df7d74fa631e1287bee834e464ea9456c81"/>
<project groups="device" name="device-sony-aries" path="device/sony/aries" remote="b2g" revision="56f665a19e35623d923949014bc15013d292fa37"/>
<project groups="device" name="device-sony-leo" path="device/sony/leo" remote="b2g" revision="3fdec3f02117be6b57d2f9c5946119f179119a51"/>
<project groups="device" name="device-sony-scorpion" path="device/sony/scorpion" remote="b2g" revision="b0cd32cb805637d2afda61b67d0421e2c39b2ffa"/>
<project groups="device" name="device-sony-sirius" path="device/sony/sirius" remote="b2g" revision="5e5c19c6cd7c042bcac41a2b30b3ad3eeb66e7ab"/>
<!-- Rhine platform specific things -->
<project groups="device" name="device-sony-rhine" path="device/sony/rhine" remote="b2g" revision="236bfcab94371ca7056dab2dab15b77a6f9fa1b3"/>
<project groups="device" name="device-sony-rhine" path="device/sony/rhine" remote="b2g" revision="fd11de9d08b6210092e523eb1f4fc1c79e483e36"/>
<project groups="device" name="device-sony-honami" path="device/sony/honami" remote="b2g" revision="f8a9d6d3a2ce73d336453b71db591a82f72a2120"/>
<project groups="device" name="device-sony-amami" path="device/sony/amami" remote="b2g" revision="9f05cdc34e60df19fcd9189ff8a14f752dcf07b9"/>
<!-- Yukon platform specific things -->
<project name="device-sony-yukon" path="device/sony/yukon" remote="b2g" revision="054306b53d6a9c85c6276fea625c3dfb55ac38c3"/>
<project name="device-sony-yukon" path="device/sony/yukon" remote="b2g" revision="ec062300acf2a127c3479faf5a9e3dafa99521d7"/>
<project name="device-sony-tianchi" path="device/sony/tianchi" remote="b2g" revision="571afbafe2abf52e031c2484f38ca5f6f81a114a"/>
<project name="device-sony-eagle" path="device/sony/eagle" remote="b2g" revision="b253fa75f0eeea10a1fa747fd98deb80ec71a654"/>
<project name="device-sony-flamingo" path="device/sony/flamingo" remote="b2g" revision="44fb20f16a9b1a44af6109dbfad2a975ca29fece"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a38728b0641627dcd47a6f21b51fccf6ba0af58c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
@ -35,7 +35,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="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49da75221f9c9d69eadc28e6b23af8c5afa26374"/>
<!-- 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"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a38728b0641627dcd47a6f21b51fccf6ba0af58c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
@ -35,7 +35,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="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49da75221f9c9d69eadc28e6b23af8c5afa26374"/>
<!-- 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"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a38728b0641627dcd47a6f21b51fccf6ba0af58c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a38728b0641627dcd47a6f21b51fccf6ba0af58c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
@ -31,7 +31,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49da75221f9c9d69eadc28e6b23af8c5afa26374"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
<!-- Stock Android things -->

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a38728b0641627dcd47a6f21b51fccf6ba0af58c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
@ -34,7 +34,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="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49da75221f9c9d69eadc28e6b23af8c5afa26374"/>
<!-- 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"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a38728b0641627dcd47a6f21b51fccf6ba0af58c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
@ -34,7 +34,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="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49da75221f9c9d69eadc28e6b23af8c5afa26374"/>
<!-- 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"/>
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a38728b0641627dcd47a6f21b51fccf6ba0af58c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a38728b0641627dcd47a6f21b51fccf6ba0af58c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
@ -35,7 +35,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="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49da75221f9c9d69eadc28e6b23af8c5afa26374"/>
<!-- 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"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

View File

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e",
"git_revision": "a38728b0641627dcd47a6f21b51fccf6ba0af58c",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "39dd39c9b2ff6718c79af1617577366fa9510603",
"revision": "39a5bfa4518693fb835e7fb2bccd88ca872cbf14",
"repo_path": "integration/gaia-central"
}

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a38728b0641627dcd47a6f21b51fccf6ba0af58c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
@ -35,7 +35,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="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49da75221f9c9d69eadc28e6b23af8c5afa26374"/>
<!-- 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"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a38728b0641627dcd47a6f21b51fccf6ba0af58c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
@ -32,7 +32,7 @@
<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="apitrace" path="external/apitrace" remote="apitrace" revision="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49da75221f9c9d69eadc28e6b23af8c5afa26374"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
<!-- Stock Android things -->

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a38728b0641627dcd47a6f21b51fccf6ba0af58c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
@ -35,7 +35,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="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49da75221f9c9d69eadc28e6b23af8c5afa26374"/>
<!-- 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"/>
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>

View File

@ -1327,6 +1327,8 @@ pref("prompts.tab_modal.enabled", true);
pref("browser.newtab.preload", true);
// Remembers if the about:newtab intro has been shown
// NOTE: This preference is unused but was not removed in case
// this information will be valuable in the future.
pref("browser.newtabpage.introShown", false);
// Toggles the content of 'about:newtab'. Shows the grid when enabled.

View File

@ -1,95 +0,0 @@
#ifdef 0
/* 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/. */
#endif
const PREF_INTRO_SHOWN = "browser.newtabpage.introShown";
const PREF_NEWTAB_ENHANCED = "browser.newtabpage.enhanced";
var gIntro = {
_nodeIDSuffixes: [
"mask",
"modal",
"text",
"buttons",
"header",
"footer"
],
_paragraphs: [],
_nodes: {},
init: function() {
for (let idSuffix of this._nodeIDSuffixes) {
this._nodes[idSuffix] = document.getElementById("newtab-intro-" + idSuffix);
}
},
_showMessage: function() {
// Set the paragraphs
let paragraphNodes = this._nodes.text.getElementsByTagName("p");
this._paragraphs.forEach((arg, index) => {
paragraphNodes[index].innerHTML = arg;
});
// Set the button
document.getElementById("newtab-intro-button").
setAttribute("value", newTabString("intro.gotit"));
},
_bold: function(str) {
return `<strong>${str}</strong>`;
},
_link: function(url, text) {
return `<a href="${url}" target="_blank">${text}</a>`;
},
_exitIntro: function() {
this._nodes.mask.style.opacity = 0;
this._nodes.mask.addEventListener("transitionend", () => {
this._nodes.mask.style.display = "none";
});
},
_generateParagraphs: function() {
let customizeIcon = '<input type="button" class="newtab-control newtab-customize"/>';
this._paragraphs.push(newTabString("intro1.paragraph1"));
this._paragraphs.push(newTabString("intro1.paragraph2",
[
this._link(TILES_PRIVACY_LINK, newTabString("privacy.link")),
customizeIcon
]));
},
showIfNecessary: function() {
if (!Services.prefs.getBoolPref(PREF_NEWTAB_ENHANCED)) {
return;
}
if (!Services.prefs.getBoolPref(PREF_INTRO_SHOWN)) {
this.showPanel();
Services.prefs.setBoolPref(PREF_INTRO_SHOWN, true);
}
},
showPanel: function() {
this._nodes.mask.style.display = "block";
this._nodes.mask.style.opacity = 1;
if (!this._paragraphs.length) {
// It's our first time showing the panel. Do some initial setup
this._generateParagraphs();
}
this._showMessage();
// Header text
this._nodes.header.innerHTML = newTabString("intro.header.update");
// Footer links
let footerLinkNode = document.getElementById("newtab-intro-link");
footerLinkNode.innerHTML = this._link(TILES_INTRO_LINK, newTabString("learn.link2"))
},
};

View File

@ -129,24 +129,13 @@ input[type=button] {
* toolkit.pageThumbs.minHeight
*/
/* CELLS */
.newtab-cell,
.newtab-intro-cell,
.newtab-intro-cell-hover {
.newtab-cell {
display: -moz-box;
height: 210px;
margin: 20px 10px 35px;
width: 290px;
}
.newtab-intro-cell-wrapper {
margin-top: -12px;
}
.newtab-intro-cell,
.newtab-intro-cell-hover {
margin: 0;
}
/* SITES */
.newtab-site {
position: relative;
@ -304,8 +293,7 @@ input[type=button] {
}
.newtab-control:-moz-focusring,
.newtab-cell:not([ignorehover]) > .newtab-site:hover > .newtab-control,
.newtab-intro-cell-hover .newtab-control {
.newtab-cell:not([ignorehover]) > .newtab-site:hover > .newtab-control {
opacity: 1;
}
@ -586,11 +574,6 @@ input[type=button] {
background-position: right 15px center;
}
.newtab-intro-image-customize .newtab-customize-panel-item,
.newtab-intro-image-customize .newtab-customize-complex-option {
max-width: 100%;
}
.newtab-customize-panel-item:not([selected]),
.newtab-customize-panel-subitem:not([selected]){
color: #7A7A7A;
@ -662,175 +645,3 @@ input[type=button] {
font: message-box;
font-size: 16px;
}
/**
* Onboarding styling
*/
#newtab-intro-mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #424F5A;
z-index:102;
background-color: rgba(66,79,90,0.95);
transition: opacity .5s linear;
overflow: auto;
display: none;
text-align: center;
}
#newtab-intro-modal {
font-family: "Helvetica";
max-height: 800px;
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
background: linear-gradient(#FFFFFF, #F9F9F9);
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.7);
border-radius: 8px 8px 0px 0px;
position: relative;
display: inline-block;
top: 50%;
transform: translateY(-50%);
}
#newtab-intro-header {
font-size: 28px;
color: #737980;
text-align: center;
top: 30px;
position: relative;
border-bottom: 2px solid #E0DFE0;
padding-bottom: 10px;
display: block;
margin: 0px 50px;
font-weight: 100;
padding: 0px 15px 10px;
}
#newtab-intro-header .bold {
font-weight: 500;
color: #343F48;
}
#newtab-intro-footer {
width: 100%;
height: 55px;
margin: 0px auto;
display: block;
position: absolute;
background-color: white;
box-shadow: 0 -1px 4px -1px #EBEBEB;
text-align: center;
vertical-align: middle;
line-height: 55px;
}
#newtab-intro-footer > ul {
list-style-type: none;
margin: 0px;
padding: 0px;
}
#newtab-intro-footer > ul > li {
display: inline;
padding-left: 10px;
padding-right: 10px;
}
#newtab-intro-footer > ul > li > a {
text-decoration: none;
color: #4A90E2;
}
#newtab-intro-footer > ul > li > a:hover {
color: #000000;
}
#newtab-intro-body {
position: relative;
display: block;
margin: 55px 50px 38px;
}
#newtab-intro-content > * {
display: inline-block;
}
#newtab-intro-content {
position: relative;
}
#newtab-intro-buttons {
text-align: center;
vertical-align: middle;
display: block;
bottom: 0px;
width: 100%;
}
#newtab-intro-tile {
width: 290px;
height: 100%;
}
#newtab-intro-text {
text-align: left;
right: 0px;
height: 100%;
font-size: 14px;
line-height: 20px;
width: 460px;
}
#newtab-intro-text > p {
margin: 0 0 30px;
}
#newtab-intro-text > p > a {
text-decoration: none;
color: #4A90E2;
}
#newtab-intro-text > p > a:hover {
color: #000000;
}
#newtab-intro-text .newtab-control {
background-size: 18px auto;
height: 18px;
width: 18px;
vertical-align: middle;
opacity: 1;
position: inherit;
pointer-events: none;
}
#newtab-intro-buttons > input {
min-width: 120px;
height: 50px;
margin: 0px 5px;
vertical-align: bottom;
border-radius: 2px;
border: solid 1px #2C72E2;
background-color: #FFFFFF;
color: #4A90E2;
-moz-user-focus: normal;
padding: 0px 10px;
}
#newtab-intro-buttons > input[default] {
background-color: #4A90E2;
color: #FFFFFF;
}
#newtab-intro-buttons > input:hover {
background-color: #2C72E2;
color: #FFFFFF;
}

View File

@ -66,7 +66,6 @@ const TILES_PRIVACY_LINK = "https://www.mozilla.org/privacy/";
#include undo.js
#include search.js
#include customize.js
#include intro.js
// Everything is loaded. Initialize the New Tab Page.
gPage.init();

View File

@ -53,62 +53,38 @@
</div>
</div>
<div id="newtab-intro-mask">
<div id="newtab-intro-modal">
<div id="newtab-intro-header"/>
<div id="newtab-intro-body">
<div id="newtab-intro-content">
<div id="newtab-intro-text">
<p/><p/>
</div>
</div>
<div id="newtab-intro-buttons">
<input id="newtab-intro-button" type="button" default="true" onclick="gIntro._exitIntro()"/>
</div>
</div>
<div id="newtab-intro-footer">
<ul>
<li id="newtab-intro-link"/>
</ul>
<div id="newtab-vertical-margin">
<div id="newtab-margin-top"/>
<div id="newtab-margin-undo-container">
<div id="newtab-undo-container" undo-disabled="true">
<label id="newtab-undo-label">&newtab.undo.removedLabel;</label>
<button id="newtab-undo-button" tabindex="-1"
class="newtab-undo-button">&newtab.undo.undoButton;</button>
<button id="newtab-undo-restore-button" tabindex="-1"
class="newtab-undo-button">&newtab.undo.restoreButton;</button>
<button id="newtab-undo-close-button" tabindex="-1" title="&newtab.undo.closeTooltip;"/>
</div>
</div>
</div>
<div id="newtab-vertical-margin">
<div id="newtab-margin-top"/>
<div id="newtab-margin-undo-container">
<div id="newtab-undo-container" undo-disabled="true">
<label id="newtab-undo-label">&newtab.undo.removedLabel;</label>
<button id="newtab-undo-button" tabindex="-1"
class="newtab-undo-button">&newtab.undo.undoButton;</button>
<button id="newtab-undo-restore-button" tabindex="-1"
class="newtab-undo-button">&newtab.undo.restoreButton;</button>
<button id="newtab-undo-close-button" tabindex="-1" title="&newtab.undo.closeTooltip;"/>
</div>
</div>
<div id="newtab-search-container">
<div id="newtab-search-form">
<div id="newtab-search-icon"/>
<input type="text" name="q" value="" id="newtab-search-text"
aria-label="&contentSearchInput.label;" maxlength="256" dir="auto"/>
<input id="newtab-search-submit" type="button" value=""
aria-label="&contentSearchSubmit.label;"/>
</div>
<div id="newtab-search-container">
<div id="newtab-search-form">
<div id="newtab-search-icon"/>
<input type="text" name="q" value="" id="newtab-search-text"
aria-label="&contentSearchInput.label;" maxlength="256" dir="auto"/>
<input id="newtab-search-submit" type="button" value=""
aria-label="&contentSearchSubmit.label;"/>
</div>
</div>
<div id="newtab-horizontal-margin">
<div class="newtab-side-margin"/>
<div id="newtab-grid">
</div>
<div class="newtab-side-margin"/>
<div id="newtab-horizontal-margin">
<div class="newtab-side-margin"/>
<div id="newtab-grid">
</div>
<div id="newtab-margin-bottom"/>
<div class="newtab-side-margin"/>
</div>
<div id="newtab-margin-bottom"/>
</div>
<input id="newtab-customize-button" type="button" dir="&locale.dir;" title="&newtab.customize.title;"/>
<input id="newtab-customize-button" type="button" dir="&locale.dir;" title="&newtab.customize.title;"/>
</body>
<script type="text/javascript;version=1.8" src="chrome://browser/content/contentSearchUI.js"/>
<script type="text/javascript;version=1.8" src="chrome://browser/content/newtab/newTab.js"/>

View File

@ -36,9 +36,6 @@ var gPage = {
// Initialize customize controls.
gCustomize.init();
// Initialize intro panel.
gIntro.init();
},
/**
@ -54,7 +51,6 @@ var gPage = {
// Update thumbnails to the new enhanced setting
if (aData == "browser.newtabpage.enhanced") {
this.update();
gIntro.showIfNecessary();
}
// Initialize the whole page if we haven't done that, yet.
@ -255,9 +251,6 @@ var gPage = {
onPageVisibleAndLoaded() {
// Send the index of the last visible tile.
this.reportLastVisibleTileIndex();
// Show the panel now that anchors are sized
gIntro.showIfNecessary();
},
reportLastVisibleTileIndex() {

View File

@ -28,7 +28,6 @@ skip-if = (os == 'mac' && os_version == '10.10') # bug 1122478 - newtab drag-dro
[browser_newtab_drop_preview.js]
[browser_newtab_enhanced.js]
[browser_newtab_focus.js]
[browser_newtab_intro.js]
[browser_newtab_perwindow_private_browsing.js]
[browser_newtab_reportLinkAction.js]
[browser_newtab_reflow_load.js]

View File

@ -1,46 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const INTRO_PREF = "browser.newtabpage.introShown";
const PRELOAD_PREF = "browser.newtab.preload";
function runTests() {
let origIntro = Services.prefs.getBoolPref(INTRO_PREF);
let origPreload = Services.prefs.getBoolPref(PRELOAD_PREF);
registerCleanupFunction(_ => {
Services.prefs.setBoolPref(INTRO_PREF, origIntro);
Services.prefs.setBoolPref(PRELOAD_PREF, origPreload);
});
// Test with preload false
Services.prefs.setBoolPref(INTRO_PREF, false);
Services.prefs.setBoolPref(PRELOAD_PREF, false);
yield addNewTabPageTab();
let intro;
intro = getContentDocument().getElementById("newtab-intro-mask");
is(intro.style.opacity, 1, "intro automatically shown on first opening");
is(getContentDocument().getElementById("newtab-intro-header").innerHTML,
'New Tab got an update!', "we show intro.");
is(Services.prefs.getBoolPref(INTRO_PREF), true, "newtab remembers that the intro was shown");
yield addNewTabPageTab();
intro = getContentDocument().getElementById("newtab-intro-mask");
is(intro.style.opacity, 0, "intro not shown on second opening");
// Test with preload true
Services.prefs.setBoolPref(INTRO_PREF, false);
Services.prefs.setBoolPref(PRELOAD_PREF, true);
yield addNewTabPageTab();
intro = getContentDocument().getElementById("newtab-intro-mask");
is(intro.style.opacity, 1, "intro automatically shown on preloaded opening");
is(getContentDocument().getElementById("newtab-intro-header").innerHTML,
'New Tab got an update!', "we show intro.");
is(Services.prefs.getBoolPref(INTRO_PREF), true, "newtab remembers that the intro was shown");
let gotit = getContentDocument().getElementById("newtab-intro-button");
gotit.click();
is(intro.style.opacity, 0, "intro exited");
}

View File

@ -1821,7 +1821,7 @@ BrowserGlue.prototype = {
},
_migrateUI: function BG__migrateUI() {
const UI_VERSION = 35;
const UI_VERSION = 36;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
let currentUIVersion = 0;
try {
@ -2171,6 +2171,12 @@ BrowserGlue.prototype = {
this._maybeMigrateTabGroups();
}
if (currentUIVersion < 36) {
xulStore.removeValue("chrome://passwordmgr/content/passwordManager.xul",
"passwordCol",
"hidden");
}
// Update the migration version.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
},

View File

@ -74,6 +74,62 @@ function createElementWithAttrs(document, type, attrs) {
return element;
}
XPCOMUtils.defineLazyGetter(this, "AboutSaved", function() {
return new PocketAboutPage("chrome://pocket/content/panels/saved.html",
"pocket-saved",
"{3e759f54-37af-7843-9824-f71b5993ceed}",
"About Pocket Saved");
});
XPCOMUtils.defineLazyGetter(this, "AboutSignup", function() {
return new PocketAboutPage("chrome://pocket/content/panels/signup.html",
"pocket-signup",
"{8548329d-00c4-234e-8f17-75026db3b56e}",
"About Pocket Signup");
});
function PocketAboutPage(chromeURL, aboutHost, classID, description) {
this.chromeURL = chromeURL;
this.aboutHost = aboutHost;
this.classID = Components.ID(classID);
this.description = description;
}
PocketAboutPage.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
getURIFlags: function(aURI) {
return Ci.nsIAboutModule.ALLOW_SCRIPT |
Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT |
Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT |
Ci.nsIAboutModule.MAKE_UNLINKABLE;
},
newChannel: function(aURI) {
let channel = Services.io.newChannel(this.chromeURL, null, null);
channel.originalURI = aURI;
return channel;
},
createInstance: function(outer, iid) {
if (outer != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
}
return this.QueryInterface(iid);
},
register: function() {
Cm.QueryInterface(Ci.nsIComponentRegistrar).registerFactory(
this.classID, this.description,
"@mozilla.org/network/protocol/about;1?what=" + this.aboutHost, this);
},
unregister: function() {
Cm.QueryInterface(Ci.nsIComponentRegistrar).unregisterFactory(
this.classID, this);
}
};
function CreatePocketWidget(reason) {
let id = "pocket-button"
let widget = CustomizableUI.getWidget(id);
@ -294,6 +350,8 @@ var PocketOverlay = {
this._sheetType = styleSheetService.AUTHOR_SHEET;
this._cachedSheet = styleSheetService.preloadSheet(gPocketStyleURI,
this._sheetType);
AboutSaved.register();
AboutSignup.register();
CreatePocketWidget(reason);
CustomizableUI.addListener(this);
PocketContextMenu.init();
@ -308,6 +366,8 @@ var PocketOverlay = {
}
},
shutdown: function(reason) {
AboutSaved.unregister();
AboutSignup.unregister();
CustomizableUI.removeListener(this);
for (let window of allBrowserWindows()) {
for (let id of ["panelMenu_pocket", "menu_pocket", "BMB_pocket",

View File

@ -162,7 +162,7 @@ var pktUI = (function() {
{
variant = pktApi.getSignupAB();
}
var panelId = showPanel("chrome://pocket/content/panels/signup.html?pockethost=" + Services.prefs.getCharPref("extensions.pocket.site") + "&fxasignedin=" + fxasignedin + "&variant=" + variant + '&inoverflowmenu=' + inOverflowMenu + "&locale=" + getUILocale(), {
var panelId = showPanel("about:pocket-signup?pockethost=" + Services.prefs.getCharPref("extensions.pocket.site") + "&fxasignedin=" + fxasignedin + "&variant=" + variant + '&inoverflowmenu=' + inOverflowMenu + "&locale=" + getUILocale(), {
onShow: function() {
},
onHide: panelDidHide,
@ -190,7 +190,7 @@ var pktUI = (function() {
startheight = overflowMenuHeight;
}
var panelId = showPanel("chrome://pocket/content/panels/saved.html?pockethost=" + Services.prefs.getCharPref("extensions.pocket.site") + "&premiumStatus=" + (pktApi.isPremiumUser() ? '1' : '0') + '&inoverflowmenu='+inOverflowMenu + "&locale=" + getUILocale(), {
var panelId = showPanel("about:pocket-saved?pockethost=" + Services.prefs.getCharPref("extensions.pocket.site") + "&premiumStatus=" + (pktApi.isPremiumUser() ? '1' : '0') + '&inoverflowmenu='+inOverflowMenu + "&locale=" + getUILocale(), {
onShow: function() {
var saveLinkMessageId = 'saveLink';

View File

@ -5,7 +5,7 @@
const constants = require('../constants');
const promise = require('promise');
const { asPaused, rdpInvoke } = require('../utils');
const { asPaused } = require('../utils');
const { PROMISE } = require('devtools/client/shared/redux/middleware/promise');
const {
getSource, getBreakpoint, getBreakpoints, makeLocationId
@ -55,7 +55,7 @@ function addBreakpoint(location, condition) {
const sourceClient = gThreadClient.source(
getSource(getState(), bp.location.actor)
);
const [response, bpClient] = yield rdpInvoke(sourceClient, sourceClient.setBreakpoint, {
const [response, bpClient] = yield sourceClient.setBreakpoint({
line: bp.location.line,
column: bp.location.column,
condition: bp.condition
@ -105,7 +105,7 @@ function _removeOrDisableBreakpoint(location, isDisabled) {
type: constants.REMOVE_BREAKPOINT,
breakpoint: bp,
disabled: isDisabled,
[PROMISE]: rdpInvoke(bpClient, bpClient.remove)
[PROMISE]: bpClient.remove()
});
}
}

View File

@ -4,7 +4,7 @@
"use strict";
const constants = require("../constants");
const { rdpInvoke, asPaused } = require("../utils");
const { asPaused } = require("../utils");
const { reportException } = require("devtools/shared/DevToolsUtils");
const FETCH_EVENT_LISTENERS_DELAY = 200; // ms
@ -50,7 +50,7 @@ function fetchEventListeners() {
}
const _getListeners = Task.async(function*() {
const response = yield rdpInvoke(gThreadClient, gThreadClient.eventListeners);
const response = yield gThreadClient.eventListeners();
// Make sure all the listeners are sorted by the event type, since
// they"re not guaranteed to be clustered together.
@ -86,7 +86,7 @@ const _getDefinitionSite = Task.async(function*(aFunction) {
let response;
try {
response = yield rdpInvoke(grip, grip.getDefinitionSite);
response = yield grip.getDefinitionSite();
}
catch(e) {
// Don't make this error fatal, because it would break the entire events pane.

View File

@ -5,7 +5,6 @@
const constants = require('../constants');
const promise = require('promise');
const { rdpInvoke } = require('../utils');
const { dumpn } = require("devtools/shared/DevToolsUtils");
const { PROMISE, HISTOGRAM_ID } = require('devtools/client/shared/redux/middleware/promise');
const { getSource, getSourceText } = require('../queries');
@ -62,7 +61,7 @@ function loadSources() {
return {
type: constants.LOAD_SOURCES,
[PROMISE]: Task.spawn(function*() {
const response = yield rdpInvoke(gThreadClient, gThreadClient.getSources);
const response = yield gThreadClient.getSources();
// Top-level breakpoints may pause the entire loading process
// because scripts are executed as they are loaded, so the
@ -104,8 +103,7 @@ function blackbox(source, shouldBlackBox) {
type: constants.BLACKBOX,
source: source,
[PROMISE]: Task.spawn(function*() {
yield rdpInvoke(client,
shouldBlackBox ? client.blackBox : client.unblackBox);
yield shouldBlackBox ? client.blackBox() : client.unblackBox();
return {
isBlackBoxed: shouldBlackBox
}
@ -143,13 +141,10 @@ function togglePrettyPrint(source) {
}
if (wantPretty) {
response = yield rdpInvoke(sourceClient,
sourceClient.prettyPrint,
Prefs.editorTabSize);
response = yield sourceClient.prettyPrint(Prefs.editorTabSize);
}
else {
response = yield rdpInvoke(sourceClient,
sourceClient.disablePrettyPrint);
response = yield sourceClient.disablePrettyPrint();
}
// Remove the cached source AST from the Parser, to avoid getting
@ -186,7 +181,7 @@ function loadSourceText(source) {
let histogram = Services.telemetry.getHistogramById(histogramId);
let startTime = Date.now();
const response = yield rdpInvoke(sourceClient, sourceClient.source);
const response = yield sourceClient.source();
histogram.add(Date.now() - startTime);

View File

@ -3,30 +3,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { promiseInvoke } = require("devtools/shared/async-utils");
const { reportException } = require("devtools/shared/DevToolsUtils");
// RDP utils
function rdpInvoke(client, method, ...args) {
return (promiseInvoke(client, method, ...args)
.then((packet) => {
if (packet.error) {
let { error, message } = packet;
const err = new Error(error + ": " + message);
err.rdpError = error;
err.rdpMessage = message;
throw err;
}
return packet;
}));
}
function asPaused(client, func) {
if (client.state != "paused") {
return Task.spawn(function*() {
yield rdpInvoke(client, client.interrupt);
yield client.interrupt();
let result;
try {
@ -35,11 +17,11 @@ function asPaused(client, func) {
catch(e) {
// Try to put the debugger back in a working state by resuming
// it
yield rdpInvoke(client, client.resume);
yield client.resume();
throw e;
}
yield rdpInvoke(client, client.resume);
yield client.resume();
return result;
});
} else {
@ -93,7 +75,6 @@ function deleteIn(destObj, path) {
}
module.exports = {
rdpInvoke,
asPaused,
handleError,
onReducerEvents,

View File

@ -763,15 +763,17 @@ StackFrames.prototype = {
DebuggerView.StackFrames.empty();
for (let frame of this.activeThread.cachedFrames) {
let { depth, source, where: { line } } = frame;
let { depth, source, where: { line, column } } = frame;
let isBlackBoxed = source ? this.activeThread.source(source).isBlackBoxed : false;
DebuggerView.StackFrames.addFrame(frame, line, depth, isBlackBoxed);
DebuggerView.StackFrames.addFrame(frame, line, column, depth, isBlackBoxed);
}
DebuggerView.StackFrames.selectedDepth = Math.max(this.currentFrameDepth, 0);
DebuggerView.StackFrames.dirty = this.activeThread.moreFrames;
DebuggerView.StackFrames.addCopyContextMenu();
window.emit(EVENTS.AFTER_FRAMES_REFILLED);
},

View File

@ -482,8 +482,7 @@ var DebuggerView = {
return;
}
else if (textInfo.error) {
let url = textInfo.error;
let msg = L10N.getFormatStr("errorLoadingText2", url);
let msg = L10N.getFormatStr("errorLoadingText2", textInfo.error);
this._setEditorText(msg);
Cu.reportError(msg);
dumpn(msg);

View File

@ -468,6 +468,10 @@ skip-if = e10s && debug
skip-if = e10s && debug
[browser_dbg_stack-07.js]
skip-if = e10s && debug
[browser_dbg_stack-contextmenu-01.js]
skip-if = e10s && debug
[browser_dbg_stack-contextmenu-02.js]
skip-if = e10s && debug
[browser_dbg_step-out.js]
skip-if = e10s && debug
[browser_dbg_tabactor-01.js]

View File

@ -55,7 +55,7 @@ function test() {
function testResumeButton() {
info ("Pressing the resume button, expecting a thread-paused");
ok (!gResumeButton.hasAttribute("disabled"), "Resume button is not disabled");
ok (!gResumeButton.hasAttribute("disabled"), "Resume button is not disabled 1");
ok (!gResumeButton.hasAttribute("break-on-next"), "Resume button isn't waiting for next execution");
ok (!gResumeButton.hasAttribute("checked"), "Resume button is not checked");
let oncePaused = gTarget.once("thread-paused");
@ -75,17 +75,20 @@ function test() {
.then(() => {
ok (!gResumeButton.hasAttribute("break-on-next"), "Resume button isn't waiting for next execution");
is (gResumeButton.getAttribute("checked"), "true", "Resume button is checked");
ok (!gResumeButton.hasAttribute("disabled"), "Resume button is not disabled");
ok (!gResumeButton.hasAttribute("disabled"), "Resume button is not disabled 2");
})
.then(() => {
let p = ensureThreadClientState(gPanel, "resumed");
gThreadClient.resume();
return p;
})
.then(() => gThreadClient.resume())
.then(() => ensureThreadClientState(gPanel, "resumed"))
}
function testResumeKeyboard() {
let key = gResumeKey.getAttribute("keycode");
info ("Triggering a pause with keyboard (" + key + "), expecting a thread-paused");
ok (!gResumeButton.hasAttribute("disabled"), "Resume button is not disabled");
ok (!gResumeButton.hasAttribute("disabled"), "Resume button is not disabled 3");
ok (!gResumeButton.hasAttribute("break-on-next"), "Resume button isn't waiting for next execution");
ok (!gResumeButton.hasAttribute("checked"), "Resume button is not checked");
@ -104,9 +107,12 @@ function test() {
.then(() => {
ok (!gResumeButton.hasAttribute("break-on-next"), "Resume button isn't waiting for next execution");
is (gResumeButton.getAttribute("checked"), "true", "Resume button is checked");
ok (!gResumeButton.hasAttribute("disabled"), "Resume button is not disabled");
ok (!gResumeButton.hasAttribute("disabled"), "Resume button is not disabled 4");
})
.then(() => {
let p = ensureThreadClientState(gPanel, "resumed");
gThreadClient.resume();
return p;
})
.then(() => gThreadClient.resume())
.then(() => ensureThreadClientState(gPanel, "resumed"))
}
}

View File

@ -9,22 +9,6 @@ const TAB1_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
var gTab1, gTab1Actor, gTab2, gTab2Actor, gClient;
function listTabs() {
let deferred = promise.defer();
gClient.listTabs(aResponse => {
deferred.resolve(aResponse.tabs);
});
return deferred.promise;
}
function request(params) {
let deferred = promise.defer();
gClient.request(params, deferred.resolve);
return deferred.promise;
}
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
@ -38,25 +22,26 @@ function test() {
"Root actor should identify itself as a browser.");
let tab = yield addTab(TAB1_URL);
let tabs = yield listTabs();
let { tabs } = yield gClient.listTabs();
is(tabs.length, 2, "Should be two tabs");
let tabGrip = tabs.filter(a => a.url ==TAB1_URL).pop();
ok(tabGrip, "Should have an actor for the tab");
let response = yield request({ to: tabGrip.actor, type: "attach" });
let response = yield gClient.request({ to: tabGrip.actor, type: "attach" });
is(response.type, "tabAttached", "Should have attached");
tabs = yield listTabs();
response = yield gClient.listTabs();
tabs = response.tabs;
response = yield request({ to: tabGrip.actor, type: "detach" });
response = yield gClient.request({ to: tabGrip.actor, type: "detach" });
is(response.type, "detached", "Should have detached");
let newGrip = tabs.filter(a => a.url ==TAB1_URL).pop();
is(newGrip.actor, tabGrip.actor, "Should have the same actor for the same tab");
response = yield request({ to: tabGrip.actor, type: "attach" });
response = yield gClient.request({ to: tabGrip.actor, type: "attach" });
is(response.type, "tabAttached", "Should have attached");
response = yield request({ to: tabGrip.actor, type: "detach" });
response = yield gClient.request({ to: tabGrip.actor, type: "detach" });
is(response.type, "detached", "Should have detached");
yield removeTab(tab);

View File

@ -30,7 +30,7 @@ function test() {
return function (aPacket, aCallback) {
if (aPacket.type == "prettyPrint") {
gPrettyPrinted = true;
return executeSoon(() => aCallback({ error: "prettyPrintError" }));
return promise.reject({ error: "prettyPrintError" });
}
return aOriginalRequestMethod(aPacket, aCallback);
};
@ -54,8 +54,8 @@ function test() {
yield actions.togglePrettyPrint(source);
ok(false, "The promise for a prettified source should be rejected!");
} catch(error) {
ok(error.rdpError, "Error came from a RDP request");
ok(error.rdpError.includes("prettyPrintError"),
ok(error.error, "Error came from a RDP request");
ok(error.error.includes("prettyPrintError"),
"The promise was correctly rejected with a meaningful message.");
}

View File

@ -27,7 +27,7 @@ function test(){
yield doInterrupt(gPanel);
let source = gThreadClient.source(getSourceForm(gSources, SECOND_SOURCE_VALUE));
yield rdpInvoke(source, source.setBreakpoint, {
yield source.setBreakpoint({
line: 6
});
yield doResume(gPanel);

View File

@ -25,7 +25,7 @@ function test() {
}
function testDebuggerLoadingError() {
ok(gEditor.getText().includes(gL10N.getFormatStr("errorLoadingText2", "noSuchActor")),
ok(gEditor.getText().includes(gL10N.getFormatStr("errorLoadingText2", "No such actor for ID: fake.actor")),
"The valid error loading message is displayed.");
}

View File

@ -0,0 +1,52 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test that the copy contextmenu has been added to the stack frames view.
*/
const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
let gTab, gPanel, gDebugger;
let gFrames, gContextMenu;
function test() {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gFrames = gDebugger.DebuggerView.StackFrames;
waitForDebuggerEvents(gPanel, gDebugger.EVENTS.AFTER_FRAMES_REFILLED)
.then(performTest);
callInTab(gTab, "simpleCall");
});
}
function performTest() {
gContextMenu = gDebugger.document.getElementById("stackFramesContextMenu");
is(gDebugger.gThreadClient.state, "paused",
"Should only be getting stack frames while paused.");
is(gFrames.itemCount, 1,
"Should have only one frame.");
ok(gContextMenu, "The stack frame's context menupopup is available.");
once(gContextMenu, "popupshown").then(testContextMenu);
EventUtils.synthesizeMouseAtCenter(gFrames.getItemAtIndex(0).prebuiltNode, {type: 'contextmenu', button: 2}, gDebugger);
}
function testContextMenu() {
let document = gDebugger.document;
ok(document.getElementById("copyStackMenuItem"),
"#copyStackMenuItem found.");
gContextMenu.hidePopup();
resumeDebuggerThenCloseAndFinish(gPanel);
}
registerCleanupFunction(function() {
gTab = null;
gPanel = null;
gDebugger = null;
gFrames = null;
gContextMenu = null;
});

View File

@ -0,0 +1,52 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test that the copy contextmenu copys the stack frames to the clipboard.
*/
const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
const STACK_STRING = "simpleCall@" + EXAMPLE_URL + "doc_recursion-stack.html:14:8";
function test() {
let gTab, gPanel, gDebugger, gFrames;
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gFrames = gDebugger.DebuggerView.StackFrames;
waitForDebuggerEvents(gPanel, gDebugger.EVENTS.AFTER_FRAMES_REFILLED)
.then(openContextMenu)
.then(testCopyStackMenuItem)
.then(() => resumeDebuggerThenCloseAndFinish(gPanel))
.then(null, aError => {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
callInTab(gTab, "simpleCall");
});
function clickCopyStack() {
return new Promise((resolve, reject) => {
let copyStackMenuItem = gDebugger.document.getElementById("copyStackMenuItem");
if (!copyStackMenuItem) {
reject(new Error("The Copy stack context menu item is not available."));
}
ok(copyStackMenuItem, "The Copy stack context menu item is available.");
EventUtils.synthesizeMouseAtCenter(copyStackMenuItem, {}, gDebugger);
resolve();
});
}
function testCopyStackMenuItem() {
return waitForClipboardPromise(clickCopyStack, STACK_STRING);
}
function openContextMenu() {
let contextMenu = gDebugger.document.getElementById("stackFramesContextMenu");
let contextMenuShown = once(contextMenu, "popupshown");
EventUtils.synthesizeMouseAtCenter(gFrames.getItemAtIndex(0).prebuiltNode, {type: 'contextmenu', button: 2}, gDebugger);
return contextMenuShown;
}
}

View File

@ -16,7 +16,6 @@ var { DebuggerServer } = require("devtools/server/main");
var { DebuggerClient, ObjectClient } = require("devtools/shared/client/main");
var { AddonManager } = Cu.import("resource://gre/modules/AddonManager.jsm", {});
var EventEmitter = require("devtools/shared/event-emitter");
const { promiseInvoke } = require("devtools/shared/async-utils");
var { Toolbox } = require("devtools/client/framework/toolbox")
// Override promise with deprecated-sync-thenables
@ -887,26 +886,14 @@ function attachAddonActorForUrl(aClient, aUrl) {
return deferred.promise;
}
function rdpInvoke(aClient, aMethod, ...args) {
return promiseInvoke(aClient, aMethod, ...args)
.then((packet) => {
let { error, message } = packet;
if (error) {
throw new Error(error + ": " + message);
}
return packet;
});
}
function doResume(aPanel) {
const threadClient = aPanel.panelWin.gThreadClient;
return rdpInvoke(threadClient, threadClient.resume);
return threadClient.resume();
}
function doInterrupt(aPanel) {
const threadClient = aPanel.panelWin.gThreadClient;
return rdpInvoke(threadClient, threadClient.interrupt);
return threadClient.interrupt();
}
function pushPrefs(...aPrefs) {
@ -1036,11 +1023,7 @@ function close(client) {
function listTabs(client) {
info("Listing tabs.");
return new Promise(function (resolve) {
client.listTabs(function (response) {
resolve(response);
});
});
return client.listTabs();
}
function findTab(tabs, url) {
@ -1121,7 +1104,7 @@ function waitForWorkerClose(workerClient) {
function resume(threadClient) {
info("Resuming thread.");
return rdpInvoke(threadClient, threadClient.resume);
return threadClient.resume();
}
function findSource(sources, url) {
@ -1161,12 +1144,12 @@ function waitForPause(threadClient) {
function setBreakpoint(sourceClient, location) {
info("Setting breakpoint.\n");
return rdpInvoke(sourceClient, sourceClient.setBreakpoint, location);
return sourceClient.setBreakpoint(location);
}
function source(sourceClient) {
info("Getting source.\n");
return rdpInvoke(sourceClient, sourceClient.source);
return sourceClient.source();
}
// Return a promise with a reference to jsterm, opening the split

View File

@ -20,6 +20,7 @@ function StackFramesView(DebuggerController, DebuggerView) {
this._onSelect = this._onSelect.bind(this);
this._onScroll = this._onScroll.bind(this);
this._afterScroll = this._afterScroll.bind(this);
this._getStackAsString = this._getStackAsString.bind(this);
}
StackFramesView.prototype = Heritage.extend(WidgetMethods, {
@ -29,9 +30,12 @@ StackFramesView.prototype = Heritage.extend(WidgetMethods, {
initialize: function() {
dumpn("Initializing the StackFramesView");
this._popupset = document.getElementById("debuggerPopupset");
this.widget = new BreadcrumbsWidget(document.getElementById("stackframes"));
this.widget.addEventListener("select", this._onSelect, false);
this.widget.addEventListener("scroll", this._onScroll, true);
this.widget.setAttribute("context", "stackFramesContextMenu");
window.addEventListener("resize", this._onScroll, true);
this.autoFocusOnFirstItem = false;
@ -66,7 +70,7 @@ StackFramesView.prototype = Heritage.extend(WidgetMethods, {
* @param boolean aIsBlackBoxed
* Whether or not the frame is black boxed.
*/
addFrame: function(aFrame, aLine, aDepth, aIsBlackBoxed) {
addFrame: function(aFrame, aLine, aColumn, aDepth, aIsBlackBoxed) {
let { source } = aFrame;
// The source may not exist in the source listing yet because it's
@ -101,7 +105,8 @@ StackFramesView.prototype = Heritage.extend(WidgetMethods, {
title: title,
url: location,
line: aLine,
depth: aDepth
depth: aDepth,
column: aColumn
},
// Make sure that when the stack frame item is removed, the corresponding
// mirrored item in the classic list is also removed.
@ -112,6 +117,29 @@ StackFramesView.prototype = Heritage.extend(WidgetMethods, {
this._mirror.addFrame(title, location, aLine, aDepth);
},
_getStackAsString: function() {
return [...this].map(frameItem => {
const { attachment: { title, url, line, column }} = frameItem;
return title + "@" + url + ":" + line + ":" + column;
}).join("\n")
},
addCopyContextMenu: function() {
let menupopup = document.createElement("menupopup");
let menuitem = document.createElement("menuitem");
menupopup.id = "stackFramesContextMenu";
menuitem.id = "copyStackMenuItem";
menuitem.setAttribute("label", "Copy");
menuitem.addEventListener("command", () => {
let stack = this._getStackAsString();
clipboardHelper.copyString(stack);
}, false);
menupopup.appendChild(menuitem);
this._popupset.appendChild(menupopup);
},
/**
* Selects the frame at the specified depth in this container.
* @param number aDepth

View File

@ -90,9 +90,7 @@ function clientConnect() {
var onConnectionReady = Task.async(function*(aType, aTraits) {
clearTimeout(gConnectionTimeout);
let deferred = promise.defer();
gClient.listAddons(deferred.resolve);
let response = yield deferred.promise;
let response = yield gClient.listAddons();
let parent = document.getElementById("addonActors")
if (!response.error && response.addons.length > 0) {
@ -110,9 +108,7 @@ var onConnectionReady = Task.async(function*(aType, aTraits) {
parent.remove();
}
deferred = promise.defer();
gClient.listTabs(deferred.resolve);
response = yield deferred.promise;
response = yield gClient.listTabs();
parent = document.getElementById("tabActors");

View File

@ -11,19 +11,19 @@
const {Cc, Ci, Cu} = require("chrome");
const ToolDefinitions = require("devtools/client/main").Tools;
const {CssLogic} = require("devtools/shared/styleinspector/css-logic");
const {CssLogic} = require("devtools/shared/inspector/css-logic");
const {ELEMENT_STYLE} = require("devtools/server/actors/styles");
const promise = require("promise");
const {setTimeout, clearTimeout} = Cu.import("resource://gre/modules/Timer.jsm", {});
const {OutputParser} = require("devtools/client/shared/output-parser");
const {PrefObserver, PREF_ORIG_SOURCES} = require("devtools/client/styleeditor/utils");
const {createChild} = require("devtools/client/styleinspector/utils");
const {createChild} = require("devtools/client/inspector/shared/utils");
const {gDevTools} = Cu.import("resource://devtools/client/framework/gDevTools.jsm", {});
loader.lazyRequireGetter(this, "overlays",
"devtools/client/styleinspector/style-inspector-overlays");
"devtools/client/inspector/shared/style-inspector-overlays");
loader.lazyRequireGetter(this, "StyleInspectorMenu",
"devtools/client/styleinspector/style-inspector-menu");
"devtools/client/inspector/shared/style-inspector-menu");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
@ -31,6 +31,16 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm");
XPCOMUtils.defineLazyGetter(CssComputedView, "_strings", function() {
return Services.strings.createBundle(
"chrome://devtools-shared/locale/styleinspector.properties");
});
XPCOMUtils.defineLazyGetter(this, "clipboardHelper", function() {
return Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper);
});
const FILTER_CHANGED_TIMEOUT = 150;
const HTML_NS = "http://www.w3.org/1999/xhtml";
@ -223,16 +233,6 @@ CssComputedView.l10n = function(name) {
}
};
XPCOMUtils.defineLazyGetter(CssComputedView, "_strings", function() {
return Services.strings.createBundle(
"chrome://devtools-shared/locale/styleinspector.properties");
});
XPCOMUtils.defineLazyGetter(this, "clipboardHelper", function() {
return Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper);
});
CssComputedView.prototype = {
// Cache the list of properties that match the selected element.
_matchedProperties: null,
@ -1406,5 +1406,125 @@ SelectorView.prototype = {
}
};
function ComputedViewTool(inspector, window) {
this.inspector = inspector;
this.document = window.document;
this.view = new CssComputedView(this.inspector, this.document,
this.inspector.pageStyle);
this.onSelected = this.onSelected.bind(this);
this.refresh = this.refresh.bind(this);
this.onPanelSelected = this.onPanelSelected.bind(this);
this.onMutations = this.onMutations.bind(this);
this.onResized = this.onResized.bind(this);
this.inspector.selection.on("detached", this.onSelected);
this.inspector.selection.on("new-node-front", this.onSelected);
this.inspector.selection.on("pseudoclass", this.refresh);
this.inspector.sidebar.on("computedview-selected", this.onPanelSelected);
this.inspector.pageStyle.on("stylesheet-updated", this.refresh);
this.inspector.walker.on("mutations", this.onMutations);
this.inspector.walker.on("resize", this.onResized);
this.view.selectElement(null);
this.onSelected();
}
ComputedViewTool.prototype = {
isSidebarActive: function() {
if (!this.view) {
return false;
}
return this.inspector.sidebar.getCurrentTabID() == "computedview";
},
onSelected: function(event) {
// Ignore the event if the view has been destroyed, or if it's inactive.
// But only if the current selection isn't null. If it's been set to null,
// let the update go through as this is needed to empty the view on
// navigation.
if (!this.view) {
return;
}
let isInactive = !this.isSidebarActive() &&
this.inspector.selection.nodeFront;
if (isInactive) {
return;
}
this.view.setPageStyle(this.inspector.pageStyle);
if (!this.inspector.selection.isConnected() ||
!this.inspector.selection.isElementNode()) {
this.view.selectElement(null);
return;
}
if (!event || event == "new-node-front") {
let done = this.inspector.updating("computed-view");
this.view.selectElement(this.inspector.selection.nodeFront).then(() => {
done();
});
}
},
refresh: function() {
if (this.isSidebarActive()) {
this.view.refreshPanel();
}
},
onPanelSelected: function() {
if (this.inspector.selection.nodeFront === this.view.viewedElement) {
this.refresh();
} else {
this.onSelected();
}
},
/**
* When markup mutations occur, if an attribute of the selected node changes,
* we need to refresh the view as that might change the node's styles.
*/
onMutations: function(mutations) {
for (let {type, target} of mutations) {
if (target === this.inspector.selection.nodeFront &&
type === "attributes") {
this.refresh();
break;
}
}
},
/**
* When the window gets resized, this may cause media-queries to match, and
* therefore, different styles may apply.
*/
onResized: function() {
this.refresh();
},
destroy: function() {
this.inspector.walker.off("mutations", this.onMutations);
this.inspector.walker.off("resize", this.onResized);
this.inspector.sidebar.off("computedview-selected", this.refresh);
this.inspector.selection.off("pseudoclass", this.refresh);
this.inspector.selection.off("new-node-front", this.onSelected);
this.inspector.selection.off("detached", this.onSelected);
this.inspector.sidebar.off("computedview-selected", this.onPanelSelected);
if (this.inspector.pageStyle) {
this.inspector.pageStyle.off("stylesheet-updated", this.refresh);
}
this.view.destroy();
this.view = this.document = this.inspector = null;
}
};
exports.CssComputedView = CssComputedView;
exports.ComputedViewTool = ComputedViewTool;
exports.PropertyView = PropertyView;

View File

@ -38,8 +38,8 @@
<script type="application/javascript;version=1.8">
window.setPanel = function(panel, iframe) {
let {require} = Components.utils.import("resource://devtools/shared/Loader.jsm", {});
let inspector = require("devtools/client/styleinspector/style-inspector");
this.computedview = new inspector.ComputedViewTool(panel, window);
let {ComputedViewTool} = require("devtools/client/inspector/computed/computed");
this.computedview = new ComputedViewTool(panel, window);
}
window.onunload = function() {
if (this.computedview) {

View File

@ -20,7 +20,7 @@ const {
VIEW_NODE_PROPERTY_TYPE,
VIEW_NODE_VALUE_TYPE,
VIEW_NODE_IMAGE_URL_TYPE
} = require("devtools/client/styleinspector/style-inspector-overlays");
} = require("devtools/client/inspector/shared/style-inspector-overlays");
const TEST_URI = `
<style type="text/css">

View File

@ -10,7 +10,7 @@
const TEST_URI = TEST_URL_ROOT + "doc_media_queries.html";
var {PropertyView} = require("devtools/client/inspector/computed/computed");
var {CssLogic} = require("devtools/shared/styleinspector/css-logic");
var {CssLogic} = require("devtools/shared/inspector/css-logic");
add_task(function*() {
yield addTab(TEST_URI);

View File

@ -10,7 +10,6 @@ var promise = require("promise");
var {getInplaceEditorForSpan: inplaceEditor} = require("devtools/client/shared/inplace-editor");
var clipboard = require("sdk/clipboard");
var {setTimeout, clearTimeout} = require("sdk/timers");
var {promiseInvoke} = require("devtools/shared/async-utils");
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
// All test are asynchronous
@ -763,10 +762,7 @@ function contextMenuClick(element) {
function registerTabActor(client, options) {
let moduleUrl = options.moduleUrl;
// Since client.listTabs doesn't use promises we need to
// 'promisify' it using 'promiseInvoke' helper method.
// This helps us to chain all promises and catch errors.
return promiseInvoke(client, client.listTabs).then(response => {
return client.listTabs().then(response => {
let config = {
prefix: options.prefix,
constructor: options.actorClass,

View File

@ -7,7 +7,8 @@ DIRS += [
'fonts',
'layout',
'markup',
'rules'
'rules',
'shared'
]
DevToolsModules(

View File

@ -0,0 +1,416 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 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/. */
"use strict";
const {Cc, Ci, Cu} = require("chrome");
const promise = require("promise");
const {Rule} = require("devtools/client/inspector/rules/models/rule");
const {promiseWarn} = require("devtools/client/inspector/shared/utils");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
loader.lazyImporter(this, "Services", "resource://gre/modules/Services.jsm");
loader.lazyGetter(this, "PSEUDO_ELEMENTS", () => {
return domUtils.getCSSPseudoElementNames();
});
XPCOMUtils.defineLazyGetter(this, "domUtils", function() {
return Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
});
/**
* ElementStyle maintains a list of Rule objects for a given element.
*
* @param {Element} element
* The element whose style we are viewing.
* @param {CssRuleView} ruleView
* The instance of the rule-view panel.
* @param {Object} store
* The ElementStyle can use this object to store metadata
* that might outlast the rule view, particularly the current
* set of disabled properties.
* @param {PageStyleFront} pageStyle
* Front for the page style actor that will be providing
* the style information.
* @param {Boolean} showUserAgentStyles
* Should user agent styles be inspected?
*/
function ElementStyle(element, ruleView, store, pageStyle,
showUserAgentStyles) {
this.element = element;
this.ruleView = ruleView;
this.store = store || {};
this.pageStyle = pageStyle;
this.showUserAgentStyles = showUserAgentStyles;
this.rules = [];
// We don't want to overwrite this.store.userProperties so we only create it
// if it doesn't already exist.
if (!("userProperties" in this.store)) {
this.store.userProperties = new UserProperties();
}
if (!("disabled" in this.store)) {
this.store.disabled = new WeakMap();
}
}
ElementStyle.prototype = {
// The element we're looking at.
element: null,
destroy: function() {
if (this.destroyed) {
return;
}
this.destroyed = true;
for (let rule of this.rules) {
if (rule.editor) {
rule.editor.destroy();
}
}
},
/**
* Called by the Rule object when it has been changed through the
* setProperty* methods.
*/
_changed: function() {
if (this.onChanged) {
this.onChanged();
}
},
/**
* Refresh the list of rules to be displayed for the active element.
* Upon completion, this.rules[] will hold a list of Rule objects.
*
* Returns a promise that will be resolved when the elementStyle is
* ready.
*/
populate: function() {
let populated = this.pageStyle.getApplied(this.element, {
inherited: true,
matchedSelectors: true,
filter: this.showUserAgentStyles ? "ua" : undefined,
}).then(entries => {
if (this.destroyed) {
return promise.resolve(undefined);
}
if (this.populated !== populated) {
// Don't care anymore.
return promise.resolve(undefined);
}
// Store the current list of rules (if any) during the population
// process. They will be reused if possible.
let existingRules = this.rules;
this.rules = [];
for (let entry of entries) {
this._maybeAddRule(entry, existingRules);
}
// Mark overridden computed styles.
this.markOverriddenAll();
this._sortRulesForPseudoElement();
// We're done with the previous list of rules.
for (let r of existingRules) {
if (r && r.editor) {
r.editor.destroy();
}
}
}).then(null, e => {
// populate is often called after a setTimeout,
// the connection may already be closed.
if (this.destroyed) {
return promise.resolve(undefined);
}
return promiseWarn(e);
});
this.populated = populated;
return this.populated;
},
/**
* Put pseudo elements in front of others.
*/
_sortRulesForPseudoElement: function() {
this.rules = this.rules.sort((a, b) => {
return (a.pseudoElement || "z") > (b.pseudoElement || "z");
});
},
/**
* Add a rule if it's one we care about. Filters out duplicates and
* inherited styles with no inherited properties.
*
* @param {Object} options
* Options for creating the Rule, see the Rule constructor.
* @param {Array} existingRules
* Rules to reuse if possible. If a rule is reused, then it
* it will be deleted from this array.
* @return {Boolean} true if we added the rule.
*/
_maybeAddRule: function(options, existingRules) {
// If we've already included this domRule (for example, when a
// common selector is inherited), ignore it.
if (options.rule &&
this.rules.some(rule => rule.domRule === options.rule)) {
return false;
}
if (options.system) {
return false;
}
let rule = null;
// If we're refreshing and the rule previously existed, reuse the
// Rule object.
if (existingRules) {
let ruleIndex = existingRules.findIndex((r) => r.matches(options));
if (ruleIndex >= 0) {
rule = existingRules[ruleIndex];
rule.refresh(options);
existingRules.splice(ruleIndex, 1);
}
}
// If this is a new rule, create its Rule object.
if (!rule) {
rule = new Rule(this, options);
}
// Ignore inherited rules with no visible properties.
if (options.inherited && !rule.hasAnyVisibleProperties()) {
return false;
}
this.rules.push(rule);
return true;
},
/**
* Calls markOverridden with all supported pseudo elements
*/
markOverriddenAll: function() {
this.markOverridden();
for (let pseudo of PSEUDO_ELEMENTS) {
this.markOverridden(pseudo);
}
},
/**
* Mark the properties listed in this.rules for a given pseudo element
* with an overridden flag if an earlier property overrides it.
*
* @param {String} pseudo
* Which pseudo element to flag as overridden.
* Empty string or undefined will default to no pseudo element.
*/
markOverridden: function(pseudo = "") {
// Gather all the text properties applied by these rules, ordered
// from more- to less-specific. Text properties from keyframes rule are
// excluded from being marked as overridden since a number of criteria such
// as time, and animation overlay are required to be check in order to
// determine if the property is overridden.
let textProps = [];
for (let rule of this.rules) {
if (rule.pseudoElement === pseudo && !rule.keyframes) {
for (let textProp of rule.textProps.slice(0).reverse()) {
if (textProp.enabled) {
textProps.push(textProp);
}
}
}
}
// Gather all the computed properties applied by those text
// properties.
let computedProps = [];
for (let textProp of textProps) {
computedProps = computedProps.concat(textProp.computed);
}
// Walk over the computed properties. As we see a property name
// for the first time, mark that property's name as taken by this
// property.
//
// If we come across a property whose name is already taken, check
// its priority against the property that was found first:
//
// If the new property is a higher priority, mark the old
// property overridden and mark the property name as taken by
// the new property.
//
// If the new property is a lower or equal priority, mark it as
// overridden.
//
// _overriddenDirty will be set on each prop, indicating whether its
// dirty status changed during this pass.
let taken = {};
for (let computedProp of computedProps) {
let earlier = taken[computedProp.name];
// Prevent -webkit-gradient from being selected after unchecking
// linear-gradient in this case:
// -moz-linear-gradient: ...;
// -webkit-linear-gradient: ...;
// linear-gradient: ...;
if (!computedProp.textProp.isValid()) {
computedProp.overridden = true;
continue;
}
let overridden;
if (earlier &&
computedProp.priority === "important" &&
earlier.priority !== "important" &&
(earlier.textProp.rule.inherited ||
!computedProp.textProp.rule.inherited)) {
// New property is higher priority. Mark the earlier property
// overridden (which will reverse its dirty state).
earlier._overriddenDirty = !earlier._overriddenDirty;
earlier.overridden = true;
overridden = false;
} else {
overridden = !!earlier;
}
computedProp._overriddenDirty =
(!!computedProp.overridden !== overridden);
computedProp.overridden = overridden;
if (!computedProp.overridden && computedProp.textProp.enabled) {
taken[computedProp.name] = computedProp;
}
}
// For each TextProperty, mark it overridden if all of its
// computed properties are marked overridden. Update the text
// property's associated editor, if any. This will clear the
// _overriddenDirty state on all computed properties.
for (let textProp of textProps) {
// _updatePropertyOverridden will return true if the
// overridden state has changed for the text property.
if (this._updatePropertyOverridden(textProp)) {
textProp.updateEditor();
}
}
},
/**
* Mark a given TextProperty as overridden or not depending on the
* state of its computed properties. Clears the _overriddenDirty state
* on all computed properties.
*
* @param {TextProperty} prop
* The text property to update.
* @return {Boolean} true if the TextProperty's overridden state (or any of
* its computed properties overridden state) changed.
*/
_updatePropertyOverridden: function(prop) {
let overridden = true;
let dirty = false;
for (let computedProp of prop.computed) {
if (!computedProp.overridden) {
overridden = false;
}
dirty = computedProp._overriddenDirty || dirty;
delete computedProp._overriddenDirty;
}
dirty = (!!prop.overridden !== overridden) || dirty;
prop.overridden = overridden;
return dirty;
}
};
/**
* Store of CSSStyleDeclarations mapped to properties that have been changed by
* the user.
*/
function UserProperties() {
this.map = new Map();
}
UserProperties.prototype = {
/**
* Get a named property for a given CSSStyleDeclaration.
*
* @param {CSSStyleDeclaration} style
* The CSSStyleDeclaration against which the property is mapped.
* @param {String} name
* The name of the property to get.
* @param {String} value
* Default value.
* @return {String}
* The property value if it has previously been set by the user, null
* otherwise.
*/
getProperty: function(style, name, value) {
let key = this.getKey(style);
let entry = this.map.get(key, null);
if (entry && name in entry) {
return entry[name];
}
return value;
},
/**
* Set a named property for a given CSSStyleDeclaration.
*
* @param {CSSStyleDeclaration} style
* The CSSStyleDeclaration against which the property is to be mapped.
* @param {String} bame
* The name of the property to set.
* @param {String} userValue
* The value of the property to set.
*/
setProperty: function(style, bame, userValue) {
let key = this.getKey(style, bame);
let entry = this.map.get(key, null);
if (entry) {
entry[bame] = userValue;
} else {
let props = {};
props[bame] = userValue;
this.map.set(key, props);
}
},
/**
* Check whether a named property for a given CSSStyleDeclaration is stored.
*
* @param {CSSStyleDeclaration} style
* The CSSStyleDeclaration against which the property would be mapped.
* @param {String} name
* The name of the property to check.
*/
contains: function(style, name) {
let key = this.getKey(style, name);
let entry = this.map.get(key, null);
return !!entry && name in entry;
},
getKey: function(style, name) {
return style.actorID + ":" + name;
},
clear: function() {
this.map.clear();
}
};
exports.ElementStyle = ElementStyle;

View File

@ -5,6 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DevToolsModules(
'element-style.js',
'rule.js',
'text-property.js',
)

View File

@ -8,11 +8,11 @@
const {Cc, Ci, Cu} = require("chrome");
const promise = require("promise");
const {CssLogic} = require("devtools/shared/styleinspector/css-logic");
const {CssLogic} = require("devtools/shared/inspector/css-logic");
const {ELEMENT_STYLE} = require("devtools/server/actors/styles");
const {TextProperty} =
require("devtools/client/inspector/rules/models/text-property");
const {promiseWarn} = require("devtools/client/styleinspector/utils");
const {promiseWarn} = require("devtools/client/inspector/shared/utils");
const {parseDeclarations} = require("devtools/client/shared/css-parsing-utils");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");

View File

@ -77,7 +77,7 @@ TextProperty.prototype = {
// This is a bit funky. To get the list of computed properties
// for this text property, we'll set the property on a dummy element
// and see what the computed style looks like.
let dummyElement = this.rule.elementStyle.dummyElement;
let dummyElement = this.rule.elementStyle.ruleView.dummyElement;
let dummyStyle = dummyElement.style;
dummyStyle.cssText = "";
dummyStyle.setProperty(this.name, this.value, this.priority);

View File

@ -3,20 +3,24 @@
/* 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/. */
/* globals gDevTools */
"use strict";
const {Cc, Ci, Cu} = require("chrome");
const promise = require("promise");
const {Tools} = require("devtools/client/main");
const {setTimeout, clearTimeout} =
Cu.import("resource://gre/modules/Timer.jsm", {});
const {CssLogic} = require("devtools/shared/styleinspector/css-logic");
const {CssLogic} = require("devtools/shared/inspector/css-logic");
const {InplaceEditor, editableField, editableItem} =
require("devtools/client/shared/inplace-editor");
const {ELEMENT_STYLE} = require("devtools/server/actors/styles");
const {OutputParser} = require("devtools/client/shared/output-parser");
const {PrefObserver, PREF_ORIG_SOURCES} =
require("devtools/client/styleeditor/utils");
const {ElementStyle} =
require("devtools/client/inspector/rules/models/element-style");
const {Rule} = require("devtools/client/inspector/rules/models/rule");
const {
createChild,
@ -25,7 +29,7 @@ const {
blurOnMultipleProperties,
promiseWarn,
throttle
} = require("devtools/client/styleinspector/utils");
} = require("devtools/client/inspector/shared/utils");
const {
parseDeclarations,
parseSingleValue,
@ -35,15 +39,31 @@ const {
SELECTOR_PSEUDO_CLASS
} = require("devtools/client/shared/css-parsing-utils");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
loader.lazyGetter(this, "gDevTools", () =>
Cu.import("resource://devtools/client/framework/gDevTools.jsm", {}).gDevTools);
loader.lazyRequireGetter(this, "overlays",
"devtools/client/styleinspector/style-inspector-overlays");
"devtools/client/inspector/shared/style-inspector-overlays");
loader.lazyRequireGetter(this, "EventEmitter",
"devtools/shared/event-emitter");
loader.lazyRequireGetter(this, "StyleInspectorMenu",
"devtools/client/styleinspector/style-inspector-menu");
"devtools/client/inspector/shared/style-inspector-menu");
loader.lazyImporter(this, "Services", "resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyGetter(this, "clipboardHelper", function() {
return Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper);
});
XPCOMUtils.defineLazyGetter(this, "_strings", function() {
return Services.strings.createBundle(
"chrome://devtools-shared/locale/styleinspector.properties");
});
loader.lazyGetter(this, "AutocompletePopup", function() {
return require("devtools/client/shared/autocomplete-popup").AutocompletePopup;
});
const HTML_NS = "http://www.w3.org/1999/xhtml";
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
@ -62,6 +82,40 @@ const FILTER_STRICT_RE = /\s*`(.*?)`\s*$/;
const IOService = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
/**
* Our model looks like this:
*
* ElementStyle:
* Responsible for keeping track of which properties are overridden.
* Maintains a list of Rule objects that apply to the element.
* Rule:
* Manages a single style declaration or rule.
* Responsible for applying changes to the properties in a rule.
* Maintains a list of TextProperty objects.
* TextProperty:
* Manages a single property from the authoredText attribute of the
* relevant declaration.
* Maintains a list of computed properties that come from this
* property declaration.
* Changes to the TextProperty are sent to its related Rule for
* application.
*
* View hierarchy mostly follows the model hierarchy.
*
* CssRuleView:
* Owns an ElementStyle and creates a list of RuleEditors for its
* Rules.
* RuleEditor:
* Owns a Rule object and creates a list of TextPropertyEditors
* for its TextProperties.
* Manages creation of new text properties.
* TextPropertyEditor:
* Owns a TextProperty object.
* Manages changes to the TextProperty.
* Can be expanded to display computed properties.
* Can mark a property disabled or enabled.
*/
/**
* To figure out how shorthand properties are interpreted by the
* engine, we will set properties on a dummy element and observe
@ -99,382 +153,6 @@ function createDummyDocument() {
return gDummyPromise;
}
/**
* Our model looks like this:
*
* ElementStyle:
* Responsible for keeping track of which properties are overridden.
* Maintains a list of Rule objects that apply to the element.
* Rule:
* Manages a single style declaration or rule.
* Responsible for applying changes to the properties in a rule.
* Maintains a list of TextProperty objects.
* TextProperty:
* Manages a single property from the authoredText attribute of the
* relevant declaration.
* Maintains a list of computed properties that come from this
* property declaration.
* Changes to the TextProperty are sent to its related Rule for
* application.
*/
/**
* ElementStyle maintains a list of Rule objects for a given element.
*
* @param {Element} element
* The element whose style we are viewing.
* @param {Object} store
* The ElementStyle can use this object to store metadata
* that might outlast the rule view, particularly the current
* set of disabled properties.
* @param {PageStyleFront} pageStyle
* Front for the page style actor that will be providing
* the style information.
* @param {Boolean} showUserAgentStyles
* Should user agent styles be inspected?
*/
function ElementStyle(element, store, pageStyle, showUserAgentStyles) {
this.element = element;
this.store = store || {};
this.pageStyle = pageStyle;
this.showUserAgentStyles = showUserAgentStyles;
this.rules = [];
// We don't want to overwrite this.store.userProperties so we only create it
// if it doesn't already exist.
if (!("userProperties" in this.store)) {
this.store.userProperties = new UserProperties();
}
if (!("disabled" in this.store)) {
this.store.disabled = new WeakMap();
}
}
// We're exporting _ElementStyle for unit tests.
exports._ElementStyle = ElementStyle;
ElementStyle.prototype = {
// The element we're looking at.
element: null,
// Empty, unconnected element of the same type as this node, used
// to figure out how shorthand properties will be parsed.
dummyElement: null,
init: function() {
// To figure out how shorthand properties are interpreted by the
// engine, we will set properties on a dummy element and observe
// how their .style attribute reflects them as computed values.
this.dummyElementPromise = createDummyDocument().then(document => {
// ::before and ::after do not have a namespaceURI
let namespaceURI = this.element.namespaceURI ||
document.documentElement.namespaceURI;
this.dummyElement = document.createElementNS(namespaceURI,
this.element.tagName);
document.documentElement.appendChild(this.dummyElement);
return this.dummyElement;
}).then(null, promiseWarn);
return this.dummyElementPromise;
},
destroy: function() {
if (this.destroyed) {
return;
}
this.destroyed = true;
for (let rule of this.rules) {
if (rule.editor) {
rule.editor.destroy();
}
}
this.dummyElement = null;
this.dummyElementPromise.then(dummyElement => {
dummyElement.remove();
this.dummyElementPromise = null;
}, console.error);
},
/**
* Called by the Rule object when it has been changed through the
* setProperty* methods.
*/
_changed: function() {
if (this.onChanged) {
this.onChanged();
}
},
/**
* Refresh the list of rules to be displayed for the active element.
* Upon completion, this.rules[] will hold a list of Rule objects.
*
* Returns a promise that will be resolved when the elementStyle is
* ready.
*/
populate: function() {
let populated = this.pageStyle.getApplied(this.element, {
inherited: true,
matchedSelectors: true,
filter: this.showUserAgentStyles ? "ua" : undefined,
}).then(entries => {
if (this.destroyed) {
return promise.resolve(undefined);
}
// Make sure the dummy element has been created before continuing...
return this.dummyElementPromise.then(() => {
if (this.populated !== populated) {
// Don't care anymore.
return;
}
// Store the current list of rules (if any) during the population
// process. They will be reused if possible.
let existingRules = this.rules;
this.rules = [];
for (let entry of entries) {
this._maybeAddRule(entry, existingRules);
}
// Mark overridden computed styles.
this.markOverriddenAll();
this._sortRulesForPseudoElement();
// We're done with the previous list of rules.
for (let r of existingRules) {
if (r && r.editor) {
r.editor.destroy();
}
}
});
}).then(null, e => {
// populate is often called after a setTimeout,
// the connection may already be closed.
if (this.destroyed) {
return promise.resolve(undefined);
}
return promiseWarn(e);
});
this.populated = populated;
return this.populated;
},
/**
* Put pseudo elements in front of others.
*/
_sortRulesForPseudoElement: function() {
this.rules = this.rules.sort((a, b) => {
return (a.pseudoElement || "z") > (b.pseudoElement || "z");
});
},
/**
* Add a rule if it's one we care about. Filters out duplicates and
* inherited styles with no inherited properties.
*
* @param {Object} options
* Options for creating the Rule, see the Rule constructor.
* @param {Array} existingRules
* Rules to reuse if possible. If a rule is reused, then it
* it will be deleted from this array.
* @return {Boolean} true if we added the rule.
*/
_maybeAddRule: function(options, existingRules) {
// If we've already included this domRule (for example, when a
// common selector is inherited), ignore it.
if (options.rule &&
this.rules.some(rule => rule.domRule === options.rule)) {
return false;
}
if (options.system) {
return false;
}
let rule = null;
// If we're refreshing and the rule previously existed, reuse the
// Rule object.
if (existingRules) {
let ruleIndex = existingRules.findIndex((r) => r.matches(options));
if (ruleIndex >= 0) {
rule = existingRules[ruleIndex];
rule.refresh(options);
existingRules.splice(ruleIndex, 1);
}
}
// If this is a new rule, create its Rule object.
if (!rule) {
rule = new Rule(this, options);
}
// Ignore inherited rules with no visible properties.
if (options.inherited && !rule.hasAnyVisibleProperties()) {
return false;
}
this.rules.push(rule);
return true;
},
/**
* Calls markOverridden with all supported pseudo elements
*/
markOverriddenAll: function() {
this.markOverridden();
for (let pseudo of PSEUDO_ELEMENTS) {
this.markOverridden(pseudo);
}
},
/**
* Mark the properties listed in this.rules for a given pseudo element
* with an overridden flag if an earlier property overrides it.
*
* @param {String} pseudo
* Which pseudo element to flag as overridden.
* Empty string or undefined will default to no pseudo element.
*/
markOverridden: function(pseudo = "") {
// Gather all the text properties applied by these rules, ordered
// from more- to less-specific. Text properties from keyframes rule are
// excluded from being marked as overridden since a number of criteria such
// as time, and animation overlay are required to be check in order to
// determine if the property is overridden.
let textProps = [];
for (let rule of this.rules) {
if (rule.pseudoElement === pseudo && !rule.keyframes) {
for (let textProp of rule.textProps.slice(0).reverse()) {
if (textProp.enabled) {
textProps.push(textProp);
}
}
}
}
// Gather all the computed properties applied by those text
// properties.
let computedProps = [];
for (let textProp of textProps) {
computedProps = computedProps.concat(textProp.computed);
}
// Walk over the computed properties. As we see a property name
// for the first time, mark that property's name as taken by this
// property.
//
// If we come across a property whose name is already taken, check
// its priority against the property that was found first:
//
// If the new property is a higher priority, mark the old
// property overridden and mark the property name as taken by
// the new property.
//
// If the new property is a lower or equal priority, mark it as
// overridden.
//
// _overriddenDirty will be set on each prop, indicating whether its
// dirty status changed during this pass.
let taken = {};
for (let computedProp of computedProps) {
let earlier = taken[computedProp.name];
// Prevent -webkit-gradient from being selected after unchecking
// linear-gradient in this case:
// -moz-linear-gradient: ...;
// -webkit-linear-gradient: ...;
// linear-gradient: ...;
if (!computedProp.textProp.isValid()) {
computedProp.overridden = true;
continue;
}
let overridden;
if (earlier &&
computedProp.priority === "important" &&
earlier.priority !== "important" &&
(earlier.textProp.rule.inherited ||
!computedProp.textProp.rule.inherited)) {
// New property is higher priority. Mark the earlier property
// overridden (which will reverse its dirty state).
earlier._overriddenDirty = !earlier._overriddenDirty;
earlier.overridden = true;
overridden = false;
} else {
overridden = !!earlier;
}
computedProp._overriddenDirty =
(!!computedProp.overridden !== overridden);
computedProp.overridden = overridden;
if (!computedProp.overridden && computedProp.textProp.enabled) {
taken[computedProp.name] = computedProp;
}
}
// For each TextProperty, mark it overridden if all of its
// computed properties are marked overridden. Update the text
// property's associated editor, if any. This will clear the
// _overriddenDirty state on all computed properties.
for (let textProp of textProps) {
// _updatePropertyOverridden will return true if the
// overridden state has changed for the text property.
if (this._updatePropertyOverridden(textProp)) {
textProp.updateEditor();
}
}
},
/**
* Mark a given TextProperty as overridden or not depending on the
* state of its computed properties. Clears the _overriddenDirty state
* on all computed properties.
*
* @param {TextProperty} prop
* The text property to update.
* @return {Boolean} true if the TextProperty's overridden state (or any of
* its computed properties overridden state) changed.
*/
_updatePropertyOverridden: function(prop) {
let overridden = true;
let dirty = false;
for (let computedProp of prop.computed) {
if (!computedProp.overridden) {
overridden = false;
}
dirty = computedProp._overriddenDirty || dirty;
delete computedProp._overriddenDirty;
}
dirty = (!!prop.overridden !== overridden) || dirty;
prop.overridden = overridden;
return dirty;
}
};
/**
* View hierarchy mostly follows the model hierarchy.
*
* CssRuleView:
* Owns an ElementStyle and creates a list of RuleEditors for its
* Rules.
* RuleEditor:
* Owns a Rule object and creates a list of TextPropertyEditors
* for its TextProperties.
* Manages creation of new text properties.
* TextPropertyEditor:
* Owns a TextProperty object.
* Manages changes to the TextProperty.
* Can be expanded to display computed properties.
* Can mark a property disabled or enabled.
*/
/**
* CssRuleView is a view of the style rules and declarations that
* apply to a given element. After construction, the 'element'
@ -574,8 +252,6 @@ function CssRuleView(inspector, document, store, pageStyle) {
EventEmitter.decorate(this);
}
exports.CssRuleView = CssRuleView;
CssRuleView.prototype = {
// The element that we're inspecting.
_viewedElement: null,
@ -583,6 +259,15 @@ CssRuleView.prototype = {
// Used for cancelling timeouts in the style filter.
_filterChangedTimeout: null,
// Empty, unconnected element of the same type as this node, used
// to figure out how shorthand properties will be parsed.
_dummyElement: null,
// Get the dummy elemenet.
get dummyElement() {
return this._dummyElement;
},
// Get the filter search value.
get searchValue() {
return this.searchField.value.toLowerCase();
@ -1076,6 +761,8 @@ CssRuleView.prototype = {
this.isDestroyed = true;
this.clear();
this._dummyElement = null;
this.dummyElementPromise = null;
gDummyPromise = null;
this._prefObserver.off(PREF_ORIG_SOURCES, this._onSourcePrefChanged);
@ -1182,13 +869,26 @@ CssRuleView.prototype = {
return promise.resolve(undefined);
}
let elementStyle = new ElementStyle(element, this.store,
// To figure out how shorthand properties are interpreted by the
// engine, we will set properties on a dummy element and observe
// how their .style attribute reflects them as computed values.
this.dummyElementPromise = createDummyDocument().then(document => {
// ::before and ::after do not have a namespaceURI
let namespaceURI = this.element.namespaceURI ||
document.documentElement.namespaceURI;
this._dummyElement = document.createElementNS(namespaceURI,
this.element.tagName);
document.documentElement.appendChild(this._dummyElement);
return this._dummyElement;
}).then(null, promiseWarn);
let elementStyle = new ElementStyle(element, this, this.store,
this.pageStyle, this.showUserAgentStyles);
this._elementStyle = elementStyle;
this._startSelectingElement();
return this._elementStyle.init().then(() => {
return this.dummyElementPromise.then(() => {
if (this._elementStyle === elementStyle) {
return this._populate();
}
@ -3068,84 +2768,6 @@ TextPropertyEditor.prototype = {
}
};
/**
* Store of CSSStyleDeclarations mapped to properties that have been changed by
* the user.
*/
function UserProperties() {
this.map = new Map();
}
UserProperties.prototype = {
/**
* Get a named property for a given CSSStyleDeclaration.
*
* @param {CSSStyleDeclaration} style
* The CSSStyleDeclaration against which the property is mapped.
* @param {String} name
* The name of the property to get.
* @param {String} value
* Default value.
* @return {String}
* The property value if it has previously been set by the user, null
* otherwise.
*/
getProperty: function(style, name, value) {
let key = this.getKey(style);
let entry = this.map.get(key, null);
if (entry && name in entry) {
return entry[name];
}
return value;
},
/**
* Set a named property for a given CSSStyleDeclaration.
*
* @param {CSSStyleDeclaration} style
* The CSSStyleDeclaration against which the property is to be mapped.
* @param {String} bame
* The name of the property to set.
* @param {String} userValue
* The value of the property to set.
*/
setProperty: function(style, bame, userValue) {
let key = this.getKey(style, bame);
let entry = this.map.get(key, null);
if (entry) {
entry[bame] = userValue;
} else {
let props = {};
props[bame] = userValue;
this.map.set(key, props);
}
},
/**
* Check whether a named property for a given CSSStyleDeclaration is stored.
*
* @param {CSSStyleDeclaration} style
* The CSSStyleDeclaration against which the property would be mapped.
* @param {String} name
* The name of the property to check.
*/
contains: function(style, name) {
let key = this.getKey(style, name);
let entry = this.map.get(key, null);
return !!entry && name in entry;
},
getKey: function(style, name) {
return style.actorID + ":" + name;
},
clear: function() {
this.map.clear();
}
};
/**
* Helper functions
*/
@ -3218,24 +2840,175 @@ function getPropertyNameAndValue(node) {
}
}
XPCOMUtils.defineLazyGetter(this, "clipboardHelper", function() {
return Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper);
});
function RuleViewTool(inspector, window) {
this.inspector = inspector;
this.document = window.document;
XPCOMUtils.defineLazyGetter(this, "_strings", function() {
return Services.strings.createBundle(
"chrome://devtools-shared/locale/styleinspector.properties");
});
this.view = new CssRuleView(this.inspector, this.document);
XPCOMUtils.defineLazyGetter(this, "domUtils", function() {
return Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
});
this.onLinkClicked = this.onLinkClicked.bind(this);
this.onSelected = this.onSelected.bind(this);
this.refresh = this.refresh.bind(this);
this.clearUserProperties = this.clearUserProperties.bind(this);
this.onPropertyChanged = this.onPropertyChanged.bind(this);
this.onViewRefreshed = this.onViewRefreshed.bind(this);
this.onPanelSelected = this.onPanelSelected.bind(this);
this.onMutations = this.onMutations.bind(this);
this.onResized = this.onResized.bind(this);
loader.lazyGetter(this, "AutocompletePopup", function() {
return require("devtools/client/shared/autocomplete-popup").AutocompletePopup;
});
this.view.on("ruleview-changed", this.onPropertyChanged);
this.view.on("ruleview-refreshed", this.onViewRefreshed);
this.view.on("ruleview-linked-clicked", this.onLinkClicked);
loader.lazyGetter(this, "PSEUDO_ELEMENTS", () => {
return domUtils.getCSSPseudoElementNames();
});
this.inspector.selection.on("detached", this.onSelected);
this.inspector.selection.on("new-node-front", this.onSelected);
this.inspector.selection.on("pseudoclass", this.refresh);
this.inspector.target.on("navigate", this.clearUserProperties);
this.inspector.sidebar.on("ruleview-selected", this.onPanelSelected);
this.inspector.pageStyle.on("stylesheet-updated", this.refresh);
this.inspector.walker.on("mutations", this.onMutations);
this.inspector.walker.on("resize", this.onResized);
this.onSelected();
}
RuleViewTool.prototype = {
isSidebarActive: function() {
if (!this.view) {
return false;
}
return this.inspector.sidebar.getCurrentTabID() == "ruleview";
},
onSelected: function(event) {
// Ignore the event if the view has been destroyed, or if it's inactive.
// But only if the current selection isn't null. If it's been set to null,
// let the update go through as this is needed to empty the view on
// navigation.
if (!this.view) {
return;
}
let isInactive = !this.isSidebarActive() &&
this.inspector.selection.nodeFront;
if (isInactive) {
return;
}
this.view.setPageStyle(this.inspector.pageStyle);
if (!this.inspector.selection.isConnected() ||
!this.inspector.selection.isElementNode()) {
this.view.selectElement(null);
return;
}
if (!event || event == "new-node-front") {
let done = this.inspector.updating("rule-view");
this.view.selectElement(this.inspector.selection.nodeFront)
.then(done, done);
}
},
refresh: function() {
if (this.isSidebarActive()) {
this.view.refreshPanel();
}
},
clearUserProperties: function() {
if (this.view && this.view.store && this.view.store.userProperties) {
this.view.store.userProperties.clear();
}
},
onPanelSelected: function() {
if (this.inspector.selection.nodeFront === this.view.viewedElement) {
this.refresh();
} else {
this.onSelected();
}
},
onLinkClicked: function(e, rule) {
let sheet = rule.parentStyleSheet;
// Chrome stylesheets are not listed in the style editor, so show
// these sheets in the view source window instead.
if (!sheet || sheet.isSystem) {
let href = rule.nodeHref || rule.href;
let toolbox = gDevTools.getToolbox(this.inspector.target);
toolbox.viewSource(href, rule.line);
return;
}
let location = promise.resolve(rule.location);
if (Services.prefs.getBoolPref(PREF_ORIG_SOURCES)) {
location = rule.getOriginalLocation();
}
location.then(({ source, href, line, column }) => {
let target = this.inspector.target;
if (Tools.styleEditor.isTargetSupported(target)) {
gDevTools.showToolbox(target, "styleeditor").then(function(toolbox) {
let sheet = source || href;
toolbox.getCurrentPanel().selectStyleSheet(sheet, line, column);
});
}
return;
});
},
onPropertyChanged: function() {
this.inspector.markDirty();
},
onViewRefreshed: function() {
this.inspector.emit("rule-view-refreshed");
},
/**
* When markup mutations occur, if an attribute of the selected node changes,
* we need to refresh the view as that might change the node's styles.
*/
onMutations: function(mutations) {
for (let {type, target} of mutations) {
if (target === this.inspector.selection.nodeFront &&
type === "attributes") {
this.refresh();
break;
}
}
},
/**
* When the window gets resized, this may cause media-queries to match, and
* therefore, different styles may apply.
*/
onResized: function() {
this.refresh();
},
destroy: function() {
this.inspector.walker.off("mutations", this.onMutations);
this.inspector.walker.off("resize", this.onResized);
this.inspector.selection.off("detached", this.onSelected);
this.inspector.selection.off("pseudoclass", this.refresh);
this.inspector.selection.off("new-node-front", this.onSelected);
this.inspector.target.off("navigate", this.clearUserProperties);
this.inspector.sidebar.off("ruleview-selected", this.onPanelSelected);
if (this.inspector.pageStyle) {
this.inspector.pageStyle.off("stylesheet-updated", this.refresh);
}
this.view.off("ruleview-linked-clicked", this.onLinkClicked);
this.view.off("ruleview-changed", this.onPropertyChanged);
this.view.off("ruleview-refreshed", this.onViewRefreshed);
this.view.destroy();
this.view = this.document = this.inspector = null;
}
};
exports.CssRuleView = CssRuleView;
exports.RuleViewTool = RuleViewTool;

View File

@ -23,8 +23,8 @@
<script type="application/javascript;version=1.8">
window.setPanel = function(panel, iframe) {
let {require} = Components.utils.import("resource://devtools/shared/Loader.jsm", {});
let inspector = require("devtools/client/styleinspector/style-inspector");
this.ruleview = new inspector.RuleViewTool(panel, window);
let {RuleViewTool} = require("devtools/client/inspector/rules/rules");
this.ruleview = new RuleViewTool(panel, window);
}
window.onunload = function() {
if (this.ruleview) {

View File

@ -2,6 +2,7 @@
tags = devtools
subsuite = devtools
support-files =
doc_author-sheet.html
doc_content_stylesheet.html
doc_content_stylesheet_imported.css
doc_content_stylesheet_imported2.css

View File

@ -10,23 +10,7 @@
var PREF_UA_STYLES = "devtools.inspector.showUserAgentStyles";
const { PrefObserver } = require("devtools/client/styleeditor/utils");
const TEST_URI = `
<style type='text/css'>
pre a {
color: orange;
}
</style>
<input type=text placeholder=test></input>
<input type=color></input>
<input type=range></input>
<input type=number></input>
<progress></progress>
<blockquote type=cite>
<pre _moz_quote=true>
inspect <a href="foo">user agent</a> styles
</pre>
</blockquote>
`;
const TEST_URI = TEST_URL_ROOT + "doc_author-sheet.html";
const TEST_DATA = [
{
@ -66,7 +50,7 @@ const TEST_DATA = [
},
{
selector: "a",
numUserRules: 2,
numUserRules: 3,
numUARules: 0
}
];
@ -77,7 +61,7 @@ add_task(function*() {
info("Starting the test with the pref set to true before toolbox is opened");
yield setUserAgentStylesPref(true);
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
yield addTab(TEST_URI);
let {inspector, view} = yield openRuleView();
info("Making sure that UA styles are visible on initial load");

View File

@ -0,0 +1,41 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<head>
<title>authored sheet test</title>
<style>
#target {
color: chartreuse;
}
</style>
<script>
var gIOService = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
.getService(SpecialPowers.Ci.nsIIOService)
var style = "data:text/css,div { background-color: seagreen; }";
var uri = gIOService.newURI(style, null, null);
var windowUtils = SpecialPowers.wrap(window)
.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
.getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
windowUtils.loadSheet(uri, windowUtils.AUTHOR_SHEET);
</script>
</head>
<body>
<div id="target"> the ocean </div>
<input type=text placeholder=test></input>
<input type=color></input>
<input type=range></input>
<input type=number></input>
<progress></progress>
<blockquote type=cite>
<pre _moz_quote=true>
inspect <a href="foo">user agent</a> styles
</pre>
</blockquote>
</body>
</html>

View File

@ -18,7 +18,7 @@
var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
var {CssLogic} = require("devtools/shared/styleinspector/css-logic");
var {CssLogic} = require("devtools/shared/inspector/css-logic");
var promise = require("promise");
/**

View File

@ -10,7 +10,7 @@ var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
var {TargetFactory} = require("devtools/client/framework/target");
var {CssRuleView, _ElementStyle} =
require("devtools/client/inspector/rules/rules");
var {CssLogic, CssSelector} = require("devtools/shared/styleinspector/css-logic");
var {CssLogic, CssSelector} = require("devtools/shared/inspector/css-logic");
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
var promise = require("promise");
var {editableField, getInplaceEditorForSpan: inplaceEditor} =

View File

@ -4,11 +4,10 @@
# 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/.
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
DevToolsModules(
'style-inspector-menu.js',
'style-inspector-overlays.js',
'style-inspector.js',
'utils.js',
'utils.js'
)
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']

View File

@ -3,14 +3,14 @@
/* 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/. */
/* global _strings */
"use strict";
const {Cc, Ci, Cu} = require("chrome");
const {PREF_ORIG_SOURCES} = require("devtools/client/styleeditor/utils");
loader.lazyRequireGetter(this, "overlays",
"devtools/client/styleinspector/style-inspector-overlays");
"devtools/client/inspector/shared/style-inspector-overlays");
loader.lazyImporter(this, "Services", "resource://gre/modules/Services.jsm");
loader.lazyServiceGetter(this, "clipboardHelper",
"@mozilla.org/widget/clipboardhelper;1", "nsIClipboardHelper");
@ -71,7 +71,7 @@ StyleInspectorMenu.prototype = {
this.styleDocument.popupNode = event.explicitOriginalTarget;
this.styleWindow.focus();
this._menupopup.openPopupAtScreen(event.screenX, event.screenY, true);
} catch(e) {
} catch (e) {
console.error(e);
}
},

View File

@ -12,7 +12,7 @@
// - in-content highlighters that appear when hovering over property values
// - etc.
const {Cc, Ci, Cu} = require("chrome");
const {Cu} = require("chrome");
const {
Tooltip,
SwatchColorPickerTooltip,

View File

@ -1,4 +1,4 @@
{
// Extend from the shared list of defined globals for mochitests.
"extends": "../../../.eslintrc.mochitests"
"extends": "../../../../.eslintrc.mochitests"
}

View File

@ -2,6 +2,7 @@
tags = devtools
subsuite = devtools
support-files =
doc_author-sheet.html
doc_content_stylesheet.html
doc_content_stylesheet.xul
doc_content_stylesheet_imported.css

View File

@ -11,6 +11,7 @@
// test
const TEST_URI_HTML = TEST_URL_ROOT + "doc_content_stylesheet.html";
const TEST_URI_AUTHOR = TEST_URL_ROOT + "doc_author-sheet.html";
const TEST_URI_XUL = TEST_URL_ROOT + "doc_content_stylesheet.xul";
const XUL_URI = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService)
@ -30,6 +31,14 @@ add_task(function*() {
info("Checking stylesheets");
yield checkSheets(target);
info("Checking authored stylesheets");
yield addTab(TEST_URI_AUTHOR);
({inspector} = yield openRuleView());
target = getNode("#target");
yield selectNode("#target", inspector);
yield checkSheets(target);
info("Checking stylesheets on XUL document");
info("Allowing XUL content");
allowXUL();
@ -62,7 +71,9 @@ function* checkSheets(target) {
for (let sheet of sheets) {
if (!sheet.href ||
/doc_content_stylesheet_/.test(sheet.href)) {
/doc_content_stylesheet_/.test(sheet.href) ||
// For the "authored" case.
/^data:.*seagreen/.test(sheet.href)) {
ok(sheet.isContentSheet,
sheet.href + " identified as content stylesheet");
} else {

View File

@ -0,0 +1,41 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<head>
<title>authored sheet test</title>
<style>
#target {
color: chartreuse;
}
</style>
<script>
var gIOService = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
.getService(SpecialPowers.Ci.nsIIOService)
var style = "data:text/css,div { background-color: seagreen; }";
var uri = gIOService.newURI(style, null, null);
var windowUtils = SpecialPowers.wrap(window)
.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
.getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
windowUtils.loadSheet(uri, windowUtils.AUTHOR_SHEET);
</script>
</head>
<body>
<div id="target"> the ocean </div>
<input type=text placeholder=test></input>
<input type=color></input>
<input type=range></input>
<input type=number></input>
<progress></progress>
<blockquote type=cite>
<pre _moz_quote=true>
inspect <a href="foo">user agent</a> styles
</pre>
</blockquote>
</body>
</html>

View File

@ -18,7 +18,7 @@
var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
var {CssLogic} = require("devtools/shared/styleinspector/css-logic");
var {CssLogic} = require("devtools/shared/inspector/css-logic");
var promise = require("promise");
/**

View File

@ -9,7 +9,7 @@ var {gDevTools} = Cu.import("resource://devtools/client/framework/gDevTools.jsm"
var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
var {TargetFactory} = require("devtools/client/framework/target");
var {CssRuleView, _ElementStyle} = require("devtools/client/inspector/rules/rules");
var {CssLogic, CssSelector} = require("devtools/shared/styleinspector/css-logic");
var {CssLogic, CssSelector} = require("devtools/shared/inspector/css-logic");
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
var promise = require("promise");
var {editableField, getInplaceEditorForSpan: inplaceEditor} =
@ -21,9 +21,9 @@ var {console} =
waitForExplicitFinish();
const TEST_URL_ROOT =
"http://example.com/browser/devtools/client/styleinspector/test/";
"http://example.com/browser/devtools/client/inspector/shared/test/";
const TEST_URL_ROOT_SSL =
"https://example.com/browser/devtools/client/styleinspector/test/";
"https://example.com/browser/devtools/client/inspector/shared/test/";
const ROOT_TEST_DIR = getRootDirectory(gTestPath);
const FRAME_SCRIPT_URL = ROOT_TEST_DIR + "doc_frame_script.js";

View File

@ -161,7 +161,7 @@ devtools.jar:
skin/images/controls@2x.png (themes/images/controls@2x.png)
skin/images/animation-fast-track.svg (themes/images/animation-fast-track.svg)
skin/images/performance-icons.svg (themes/images/performance-icons.svg)
* skin/widgets.css (themes/widgets.css)
skin/widgets.css (themes/widgets.css)
skin/images/power.svg (themes/images/power.svg)
skin/images/filetypes/dir-close.svg (themes/images/filetypes/dir-close.svg)
skin/images/filetypes/dir-open.svg (themes/images/filetypes/dir-open.svg)
@ -171,7 +171,7 @@ devtools.jar:
skin/images/commandline-icon@2x.png (themes/images/commandline-icon@2x.png)
skin/images/alerticon-warning.png (themes/images/alerticon-warning.png)
skin/images/alerticon-warning@2x.png (themes/images/alerticon-warning@2x.png)
* skin/rules.css (themes/rules.css)
skin/rules.css (themes/rules.css)
skin/commandline.css (themes/commandline.css)
skin/images/command-paintflashing.png (themes/images/command-paintflashing.png)
skin/images/command-paintflashing@2x.png (themes/images/command-paintflashing@2x.png)
@ -201,7 +201,7 @@ devtools.jar:
skin/images/editor-breakpoint@2x.png (themes/images/editor-breakpoint@2x.png)
skin/images/editor-debug-location.png (themes/images/editor-debug-location.png)
skin/images/editor-debug-location@2x.png (themes/images/editor-debug-location@2x.png)
* skin/webconsole.css (themes/webconsole.css)
skin/webconsole.css (themes/webconsole.css)
skin/images/webconsole.svg (themes/images/webconsole.svg)
skin/images/breadcrumbs-divider@2x.png (themes/images/breadcrumbs-divider@2x.png)
skin/images/breadcrumbs-scrollbutton.png (themes/images/breadcrumbs-scrollbutton.png)
@ -210,7 +210,7 @@ devtools.jar:
skin/eyedropper.css (themes/eyedropper.css)
skin/canvasdebugger.css (themes/canvasdebugger.css)
skin/debugger.css (themes/debugger.css)
* skin/netmonitor.css (themes/netmonitor.css)
skin/netmonitor.css (themes/netmonitor.css)
skin/performance.css (themes/performance.css)
skin/memory.css (themes/memory.css)
skin/promisedebugger.css (themes/promisedebugger.css)
@ -218,7 +218,7 @@ devtools.jar:
skin/scratchpad.css (themes/scratchpad.css)
skin/shadereditor.css (themes/shadereditor.css)
skin/storage.css (themes/storage.css)
* skin/splitview.css (themes/splitview.css)
skin/splitview.css (themes/splitview.css)
skin/styleeditor.css (themes/styleeditor.css)
skin/webaudioeditor.css (themes/webaudioeditor.css)
skin/images/magnifying-glass.png (themes/images/magnifying-glass.png)
@ -281,7 +281,7 @@ devtools.jar:
skin/images/dock-side@2x.png (themes/images/dock-side@2x.png)
* skin/floating-scrollbars.css (themes/floating-scrollbars.css)
skin/floating-scrollbars-light.css (themes/floating-scrollbars-light.css)
* skin/inspector.css (themes/inspector.css)
skin/inspector.css (themes/inspector.css)
skin/images/profiler-stopwatch.svg (themes/images/profiler-stopwatch.svg)
skin/images/emojis/emoji-command-pick.svg (themes/images/emojis/emoji-command-pick.svg)
skin/images/emojis/emoji-tool-webconsole.svg (themes/images/emojis/emoji-tool-webconsole.svg)

View File

@ -31,7 +31,6 @@ DIRS += [
'sourceeditor',
'storage',
'styleeditor',
'styleinspector',
'themes',
'tilt',
'webaudioeditor',

View File

@ -356,10 +356,8 @@ const LegacyPerformanceFront = Class({
}
let systemDeferred = promise.defer();
this._client.listTabs(form => {
systemDeferred.resolve(getDeviceFront(this._client, form).getDescription());
});
let systemHost = yield systemDeferred.promise;
let form = yield this._client.listTabs();
let systemHost = yield getDeviceFront(this._client, form).getDescription();
let systemClient = yield getSystemInfo();
// Set the results on the LegacyPerformanceRecording itself.

View File

@ -25,7 +25,7 @@ function* spawnTest() {
// Copy so we don't destructively change the request object, as we use
// the startTime on this object for filtering in the callback
let newData = merge({}, data, { startTime: void 0 });
request.call(target.client, newData, res);
return request.call(target.client, newData, res);
};
// Perform the first recording...

View File

@ -10,7 +10,7 @@
var Cu = Components.utils;
var Ci = Components.interfaces;
var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
var {advanceValidate} = require("devtools/client/styleinspector/utils");
var {advanceValidate} = require("devtools/client/inspector/shared/utils");
// 1 2 3
// 0123456789012345678901234567890

View File

@ -14,7 +14,7 @@ const Cu = Components.utils;
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
const Editor = require("devtools/client/sourceeditor/editor");
const promise = require("promise");
const {CssLogic} = require("devtools/shared/styleinspector/css-logic");
const {CssLogic} = require("devtools/shared/inspector/css-logic");
const {console} = require("resource://gre/modules/Console.jsm");
Cu.import("resource://gre/modules/Services.jsm");

View File

@ -6,7 +6,7 @@
// Test that changes in the style inspector are synchronized into the
// style editor.
Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtools/client/styleinspector/test/head.js", this);
Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtools/client/inspector/shared/test/head.js", this);
const TESTCASE_URI = TEST_BASE_HTTP + "sync.html";

View File

@ -5,7 +5,7 @@
// Test that adding a new rule is synced to the style editor.
Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtools/client/styleinspector/test/head.js", this);
Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtools/client/inspector/shared/test/head.js", this);
const TESTCASE_URI = TEST_BASE_HTTP + "sync.html";

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