Merge mozilla-central to fx-team

This commit is contained in:
Carsten "Tomcat" Book 2014-01-31 13:19:31 +01:00
Родитель 458d39f54e eb003fc9d5
Коммит 2827cdf2a2
563 изменённых файлов: 54065 добавлений и 26376 удалений

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

@ -40,6 +40,7 @@
#include "nsIURI.h"
#include "nsIWebNavigation.h"
#include "nsFocusManager.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Assertions.h"
#include "mozilla/dom/DocumentType.h"
#include "mozilla/dom/Element.h"
@ -65,7 +66,7 @@ static nsIAtom** kRelationAttrs[] =
&nsGkAtoms::control
};
static const uint32_t kRelationAttrsLen = NS_ARRAY_LENGTH(kRelationAttrs);
static const uint32_t kRelationAttrsLen = ArrayLength(kRelationAttrs);
////////////////////////////////////////////////////////////////////////////////
// Constructor/desctructor

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

@ -815,9 +815,6 @@ pref("network.sntp.pools", // Servers separated by ';'.
pref("network.sntp.port", 123);
pref("network.sntp.timeout", 30); // In seconds.
// Enable promise
pref("dom.promise.enabled", false);
// Enable dataStore
#ifdef RELEASE_BUILD
pref("dom.datastore.enabled", false);
@ -887,3 +884,7 @@ pref("apz.asyncscroll.throttle", 40);
// Using a software canvas can save memory when JS calls getImageData()
// on the canvas frequently. See bug 884226.
pref("gfx.canvas.willReadFrequently.enable", true);
// Disable autofocus until we can have it not bring up the keyboard.
// https://bugzilla.mozilla.org/show_bug.cgi?id=965763
pref("browser.autofocus", false);

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

@ -107,10 +107,8 @@ function test() {
});
}
// ensure Promise API is enabled
SpecialPowers.pushPrefEnv({
"set": [
["dom.promise.enabled", true],
['media.navigator.permission.disabled', true]
]
}, test);

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

@ -59,10 +59,8 @@ function test() {
});
}
// ensure Promise API is enabled
SpecialPowers.pushPrefEnv({
"set": [
["dom.promise.enabled", true],
['media.navigator.permission.disabled', true]
]
}, test);

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

@ -60,10 +60,8 @@ function test() {
});
}
// ensure Promise API is enabled
SpecialPowers.pushPrefEnv({
"set": [
["dom.promise.enabled", true],
['media.navigator.permission.disabled', true]
]
}, test);

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

@ -96,10 +96,8 @@ function test() {
});
}
// ensure Promise API is enabled
SpecialPowers.pushPrefEnv({
"set": [
["dom.promise.enabled", true],
['media.navigator.permission.disabled', true]
]
}, test);

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

@ -12,7 +12,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="09064f43116d1b965cb3ab6516fa0f1fa3c98a4c"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="aedd5c9636f305d4433491056a0ca984dfb859b1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="eda08beb3ba9a159843c70ffde0f9660ec351eb9"/>

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

@ -11,7 +11,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="09064f43116d1b965cb3ab6516fa0f1fa3c98a4c"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="aedd5c9636f305d4433491056a0ca984dfb859b1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="e33ea242b4328fb0d1824c951f379332b5021512"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0ff2eb11982b9d3c7a3333900cf0d3a5c0f77e32"/>

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

@ -12,7 +12,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="09064f43116d1b965cb3ab6516fa0f1fa3c98a4c"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="aedd5c9636f305d4433491056a0ca984dfb859b1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="eda08beb3ba9a159843c70ffde0f9660ec351eb9"/>

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

@ -1,4 +1,4 @@
{
"revision": "7240a5ab28eff83c26891c7a9141613149f226e9",
"revision": "a7eca2fffd8345f66a3908a52ae00408bff82497",
"repo_path": "/integration/gaia-central"
}

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

@ -11,7 +11,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="09064f43116d1b965cb3ab6516fa0f1fa3c98a4c"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="aedd5c9636f305d4433491056a0ca984dfb859b1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>

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

@ -10,7 +10,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="09064f43116d1b965cb3ab6516fa0f1fa3c98a4c"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="aedd5c9636f305d4433491056a0ca984dfb859b1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>

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

@ -12,7 +12,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="09064f43116d1b965cb3ab6516fa0f1fa3c98a4c"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="aedd5c9636f305d4433491056a0ca984dfb859b1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>

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

@ -11,7 +11,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="09064f43116d1b965cb3ab6516fa0f1fa3c98a4c"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="aedd5c9636f305d4433491056a0ca984dfb859b1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>

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

@ -11,7 +11,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="09064f43116d1b965cb3ab6516fa0f1fa3c98a4c"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="aedd5c9636f305d4433491056a0ca984dfb859b1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="e33ea242b4328fb0d1824c951f379332b5021512"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0ff2eb11982b9d3c7a3333900cf0d3a5c0f77e32"/>

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

@ -2,6 +2,8 @@
# 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/.
no_tooltool=1
# This file is included at the top of all b2g mozconfigs
. "$topsrcdir/build/mozconfig.common"

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

@ -11,7 +11,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="09064f43116d1b965cb3ab6516fa0f1fa3c98a4c"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="aedd5c9636f305d4433491056a0ca984dfb859b1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>

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

@ -8,6 +8,7 @@
#include "AboutRedirector.h"
#include "nsNetUtil.h"
#include "nsIScriptSecurityManager.h"
#include "mozilla/ArrayUtils.h"
namespace mozilla {
namespace browser {
@ -97,7 +98,7 @@ static RedirEntry kRedirMap[] = {
{ "customizing", "chrome://browser/content/customizableui/aboutCustomizing.xhtml",
nsIAboutModule::ALLOW_SCRIPT },
};
static const int kRedirTotal = NS_ARRAY_LENGTH(kRedirMap);
static const int kRedirTotal = ArrayLength(kRedirMap);
static nsAutoCString
GetAboutModuleName(nsIURI *aURI)

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

@ -1,3 +1,5 @@
no_tooltool=1
. $topsrcdir/browser/config/mozconfigs/linux32/nightly
ac_add_options --enable-valgrind

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

@ -1,3 +1,5 @@
no_tooltool=1
. $topsrcdir/browser/config/mozconfigs/linux64/nightly
ac_add_options --enable-valgrind

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

@ -1 +1,14 @@
[]
[
{
"size": 40,
"digest": "459b332864aece4742cd1a6886e56cf3f202e5c27bb481cfae6145ce3e2e52fb34d1448788c6618e58a26a64e415341895326d293e0d2968e56efc0ae990acd0",
"algorithm": "sha512",
"filename": "setup.sh"
},
{
"size": 80458572,
"digest": "e5101f9dee1e462f6cbd3897ea57eede41d23981825c7b20d91d23ab461875d54d3dfc24999aa58a31e8b01f49fb3140e05ffe5af2957ef1d1afb89fd0dfe1ad",
"algorithm": "sha512",
"filename": "gcc.tar.xz"
}
]

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

@ -1 +1,14 @@
[]
[
{
"size": 40,
"digest": "459b332864aece4742cd1a6886e56cf3f202e5c27bb481cfae6145ce3e2e52fb34d1448788c6618e58a26a64e415341895326d293e0d2968e56efc0ae990acd0",
"algorithm": "sha512",
"filename": "setup.sh"
},
{
"size": 80458572,
"digest": "e5101f9dee1e462f6cbd3897ea57eede41d23981825c7b20d91d23ab461875d54d3dfc24999aa58a31e8b01f49fb3140e05ffe5af2957ef1d1afb89fd0dfe1ad",
"algorithm": "sha512",
"filename": "gcc.tar.xz"
}
]

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

@ -278,12 +278,15 @@ appUpdater.prototype =
return;
}
Services.metro.updatePending = true;
appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit |
Components.interfaces.nsIAppStartup.eRestartTouchEnvironment);
return;
}
const URI_UPDATE_PROMPT_DIALOG = "chrome://mozapps/content/update/updates.xul";
// XXX We can't create dialogs in metro, and we currently don't support addons, so
// commenting this out for now.
/* const URI_UPDATE_PROMPT_DIALOG = "chrome://mozapps/content/update/updates.xul";
// Firefox no longer displays a license for updates and the licenseURL check
// is just in case a distibution does.
if (this.update && (this.update.billboardURL || this.update.licenseURL ||
@ -296,7 +299,7 @@ appUpdater.prototype =
Services.ww.openWindow(null, URI_UPDATE_PROMPT_DIALOG, "", openFeatures, ary);
window.close();
return;
}
}*/
this.selectPanel("checkingForUpdates");
this.isChecking = true;

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

@ -59,6 +59,7 @@ pref("apz.cross_slide.enabled", true);
// Enable Microsoft TSF support by default for imes.
pref("intl.tsf.enable", true);
pref("intl.tsf.support_imm", false);
pref("intl.tsf.hack.atok.create_native_caret", false);
pref("general.autoScroll", true);
pref("general.smoothScroll", true);

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

@ -13,6 +13,8 @@
HANDLE sCon;
LPCWSTR metroDX10Available = L"MetroD3DAvailable";
LPCWSTR metroLastAHE = L"MetroLastAHE";
LPCWSTR cehDumpDebugStrings = L"CEHDump";
extern const WCHAR* kFirefoxExe;
typedef HRESULT (WINAPI*D3D10CreateDevice1Func)
(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT,
@ -23,7 +25,10 @@ void
Log(const wchar_t *fmt, ...)
{
#if !defined(SHOW_CONSOLE)
return;
DWORD dwRes = 0;
if (!GetDWORDRegKey(cehDumpDebugStrings, dwRes) || !dwRes) {
return;
}
#endif
va_list a = nullptr;
wchar_t szDebugString[1024];
@ -39,10 +44,8 @@ Log(const wchar_t *fmt, ...)
WriteConsoleW(sCon, szDebugString, lstrlenW(szDebugString), &len, nullptr);
WriteConsoleW(sCon, L"\n", 1, &len, nullptr);
if (IsDebuggerPresent()) {
OutputDebugStringW(szDebugString);
OutputDebugStringW(L"\n");
}
OutputDebugStringW(szDebugString);
OutputDebugStringW(L"\n");
}
#if defined(SHOW_CONSOLE)
@ -108,6 +111,18 @@ IsProcessRunning(const wchar_t *processName, bool bCheckIfMetro)
return exists;
}
bool
IsMetroProcessRunning()
{
return IsProcessRunning(kFirefoxExe, true);
}
bool
IsDesktopProcessRunning()
{
return IsProcessRunning(kFirefoxExe, false);
}
/*
* Retrieve the last front end ui we launched so we can target it
* again. This value is updated down in nsAppRunner when the browser

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

@ -31,4 +31,5 @@ bool IsDX10Available();
bool GetDWORDRegKey(LPCWSTR name, DWORD &value);
bool SetDWORDRegKey(LPCWSTR name, DWORD value);
bool IsImmersiveProcessDynamic(HANDLE process);
bool IsProcessRunning(const wchar_t *processName, bool bCheckIfMetro);
bool IsMetroProcessRunning();
bool IsDesktopProcessRunning();

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

@ -32,17 +32,10 @@
// Pulled from desktop browser's shell
#define APP_REG_NAME L"Firefox"
// If we have a restart request, attempt to wait up to RESTART_WAIT_TIMEOUT
// until the previous instance closes. We don't want to wait too long
// because the browser could appear to randomly start for the user. We want
// it to also be long enough so the browser has time to close.
#define RESTART_WAIT_PER_RETRY 50
#define RESTART_WAIT_TIMEOUT 38000
static const WCHAR* kFirefoxExe = L"firefox.exe";
static const WCHAR* kMetroFirefoxExe = L"firefox.exe";
const WCHAR* kFirefoxExe = L"firefox.exe";
static const WCHAR* kDefaultMetroBrowserIDPathKey = L"FirefoxURL";
static const WCHAR* kMetroRestartCmdLine = L"--metro-restart";
static const WCHAR* kMetroUpdateCmdLine = L"--metro-update";
static const WCHAR* kDesktopRestartCmdLine = L"--desktop-restart";
static bool GetDefaultBrowserPath(CStringW& aPathBuffer);
@ -96,22 +89,22 @@ class __declspec(uuid("5100FEC1-212B-4BF5-9BF8-3E650FD794A3"))
public:
CExecuteCommandVerb() :
mRef(1),
mRef(0),
mShellItemArray(nullptr),
mUnkSite(nullptr),
mTargetIsFileSystemLink(false),
mTargetIsDefaultBrowser(false),
mTargetIsBrowser(false),
mIsDesktopRequest(true),
mIsRestartMetroRequest(false),
mIsRestartDesktopRequest(false),
mRequestType(DEFAULT_LAUNCH),
mRequestMet(false),
mDelayedLaunchType(NONE),
mVerb(L"open")
{
}
bool RequestMet() { return mRequestMet; }
long RefCount() { return mRef; }
void HeartBeat();
// IUnknown
IFACEMETHODIMP QueryInterface(REFIID aRefID, void **aInt)
@ -152,10 +145,12 @@ public:
{
Log(L"SetParameters: '%s'", aParameters);
if (_wcsicmp(aParameters, kMetroRestartCmdLine) == 0) {
mIsRestartMetroRequest = true;
if (!_wcsicmp(aParameters, kMetroRestartCmdLine)) {
mRequestType = METRO_RESTART;
} else if (_wcsicmp(aParameters, kMetroUpdateCmdLine) == 0) {
mRequestType = METRO_UPDATE;
} else if (_wcsicmp(aParameters, kDesktopRestartCmdLine) == 0) {
mIsRestartDesktopRequest = true;
mRequestType = DESKTOP_RESTART;
} else {
mParameters = aParameters;
}
@ -262,7 +257,6 @@ public:
{
Log(L"IExecuteCommandApplicationHostEnvironment::GetValue()");
*aLaunchType = GetLaunchType();
mIsDesktopRequest = (*aLaunchType == AHE_DESKTOP);
return S_OK;
}
@ -272,26 +266,22 @@ public:
*
* AHE_DESKTOP = 0, AHE_IMMERSIVE = 1
*/
AHE_TYPE GetLaunchType() {
AHE_TYPE GetLaunchType()
{
AHE_TYPE ahe = GetLastAHE();
Log(L"Previous AHE: %d", ahe);
if (!mIsRestartMetroRequest && IsProcessRunning(kFirefoxExe, false)) {
Log(L"Returning AHE_DESKTOP because desktop is already running");
return AHE_DESKTOP;
} else if (!mIsRestartDesktopRequest && IsProcessRunning(kMetroFirefoxExe, true)) {
Log(L"Returning AHE_IMMERSIVE because Metro is already running");
return AHE_IMMERSIVE;
}
if (mIsRestartDesktopRequest) {
// Default launch settings from GetLastAHE() can be overriden by
// custom parameter values we receive.
if (mRequestType == DESKTOP_RESTART) {
Log(L"Restarting in desktop host environment.");
return AHE_DESKTOP;
}
if (mIsRestartMetroRequest) {
} else if (mRequestType == METRO_RESTART) {
Log(L"Restarting in metro host environment.");
ahe = AHE_IMMERSIVE;
} else if (mRequestType == METRO_UPDATE) {
// Shouldn't happen from GetValue above, but might from other calls.
ahe = AHE_IMMERSIVE;
}
if (ahe == AHE_IMMERSIVE) {
@ -308,6 +298,16 @@ public:
return ahe;
}
bool DefaultLaunchIsDesktop()
{
return GetLaunchType() == AHE_DESKTOP;
}
bool DefaultLaunchIsMetro()
{
return GetLaunchType() == AHE_IMMERSIVE;
}
/*
* Retrieve the target path if it is the default browser
* or if not default, retreives the target path if it is a firefox browser
@ -391,7 +391,32 @@ private:
}
void LaunchDesktopBrowser();
bool LaunchMetroBrowser();
bool SetTargetPath(IShellItem* aItem);
bool TestForUpdateLock();
/*
* Defines the type of startup request we receive.
*/
enum RequestType {
DEFAULT_LAUNCH,
DESKTOP_RESTART,
METRO_RESTART,
METRO_UPDATE,
};
RequestType mRequestType;
/*
* Defines the type of delayed launch we might do.
*/
enum DelayedLaunchType {
NONE,
DESKTOP,
METRO,
};
DelayedLaunchType mDelayedLaunchType;
long mRef;
IShellItemArray *mShellItemArray;
@ -403,9 +428,6 @@ private:
bool mTargetIsDefaultBrowser;
bool mTargetIsBrowser;
DWORD mKeyState;
bool mIsDesktopRequest;
bool mIsRestartMetroRequest;
bool mIsRestartDesktopRequest;
bool mRequestMet;
};
@ -588,7 +610,7 @@ void LaunchDesktopBrowserWithParams(CStringW& aBrowserPath, CStringW& aVerb,
params += aParameters;
}
Log(L"Desktop Launch: verb:%s exe:%s params:%s", aVerb, aBrowserPath, params);
Log(L"Desktop Launch: verb:'%s' exe:'%s' params:'%s'", aVerb, aBrowserPath, params);
// Relaunch in Desktop mode uses a special URL to trick Windows into
// switching environments. We shouldn't actually try to open this URL.
@ -624,7 +646,8 @@ void LaunchDesktopBrowserWithParams(CStringW& aBrowserPath, CStringW& aVerb,
Log(L"Desktop browser process id: %d", procInfo.dwProcessId);
}
void CExecuteCommandVerb::LaunchDesktopBrowser()
void
CExecuteCommandVerb::LaunchDesktopBrowser()
{
CStringW browserPath;
if (!GetDesktopBrowserPath(browserPath)) {
@ -635,24 +658,30 @@ void CExecuteCommandVerb::LaunchDesktopBrowser()
mTargetIsDefaultBrowser, mTargetIsBrowser);
}
class AutoSetRequestMet
void
CExecuteCommandVerb::HeartBeat()
{
public:
explicit AutoSetRequestMet(bool* aFlag) :
mFlag(aFlag) {}
~AutoSetRequestMet() { if (mFlag) *mFlag = true; }
private:
bool* mFlag;
};
if (mRequestType == METRO_UPDATE && mDelayedLaunchType == DESKTOP &&
!IsMetroProcessRunning()) {
mDelayedLaunchType = NONE;
LaunchDesktopBrowser();
mRequestMet = true;
}
if (mDelayedLaunchType == METRO && !TestForUpdateLock()) {
mDelayedLaunchType = NONE;
LaunchMetroBrowser();
mRequestMet = true;
}
}
static HRESULT
static bool
PrepareActivationManager(CComPtr<IApplicationActivationManager> &activateMgr)
{
HRESULT hr = activateMgr.CoCreateInstance(CLSID_ApplicationActivationManager,
nullptr, CLSCTX_LOCAL_SERVER);
if (FAILED(hr)) {
Log(L"CoCreateInstance failed, launching on desktop.");
return E_FAIL;
return false;
}
// Hand off focus rights to the out-of-process activation server. Without
@ -660,108 +689,47 @@ PrepareActivationManager(CComPtr<IApplicationActivationManager> &activateMgr)
hr = CoAllowSetForegroundWindow(activateMgr, nullptr);
if (FAILED(hr)) {
Log(L"CoAllowSetForegroundWindow result %X", hr);
return E_FAIL;
return false;
}
return S_OK;
return true;
}
DWORD WINAPI
DelayedExecuteThread(LPVOID param)
bool
CExecuteCommandVerb::TestForUpdateLock()
{
Log(L"Starting delayed execute thread...");
bool &bRequestMet(*(bool*)param);
AutoSetRequestMet asrm(&bRequestMet);
CoInitialize(nullptr);
CComPtr<IApplicationActivationManager> activateMgr;
if (FAILED(PrepareActivationManager(activateMgr))) {
Log(L"Warning: Could not prepare activation manager");
CStringW browserPath;
if (!GetDefaultBrowserPath(browserPath)) {
return false;
}
size_t currentWaitTime = 0;
while(currentWaitTime < RESTART_WAIT_TIMEOUT) {
if (!IsProcessRunning(kMetroFirefoxExe, true))
break;
currentWaitTime += RESTART_WAIT_PER_RETRY;
Sleep(RESTART_WAIT_PER_RETRY);
}
Log(L"Done waiting, getting app ID");
// Activate the application as long as we can obtian the appModelID
WCHAR appModelID[256];
if (GetDefaultBrowserAppModelID(appModelID)) {
Log(L"Activating application");
DWORD processID;
HRESULT hr = activateMgr->ActivateApplication(appModelID, L"", AO_NOERRORUI, &processID);
if (SUCCEEDED(hr)) {
Log(L"Activate application succeeded");
} else {
Log(L"Activate application failed! (%x)", hr);
}
}
CoUninitialize();
return 0;
HANDLE hFile = CreateFileW(browserPath,
FILE_EXECUTE, FILE_SHARE_READ|FILE_SHARE_WRITE,
nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile != INVALID_HANDLE_VALUE) {
CloseHandle(hFile);
return false;
}
return true;
}
IFACEMETHODIMP CExecuteCommandVerb::Execute()
bool
CExecuteCommandVerb::LaunchMetroBrowser()
{
Log(L"Execute()");
if (!mTarget.GetLength()) {
// We shut down when this flips to true
mRequestMet = true;
return E_FAIL;
}
if (mIsRestartMetroRequest) {
HANDLE thread = CreateThread(nullptr, 0, DelayedExecuteThread,
&mRequestMet, 0, nullptr);
CloseHandle(thread);
return S_OK;
}
if (mIsRestartDesktopRequest) {
CStringW browserPath;
if (!GetDesktopBrowserPath(browserPath)) {
return E_FAIL;
}
LaunchDesktopBrowserWithParams(browserPath,
mVerb,
mTarget,
mParameters,
mTargetIsDefaultBrowser,
mTargetIsBrowser);
return S_OK;
}
// We shut down when this flips to true
AutoSetRequestMet asrm(&mRequestMet);
// Launch on the desktop
if (mIsDesktopRequest) {
LaunchDesktopBrowser();
return S_OK;
}
// Launch in metro
CComPtr<IApplicationActivationManager> activateMgr;
if (FAILED(PrepareActivationManager(activateMgr))) {
LaunchDesktopBrowser();
return S_OK;
if (!PrepareActivationManager(activateMgr)) {
return false;
}
HRESULT hr;
WCHAR appModelID[256];
if (!GetDefaultBrowserAppModelID(appModelID)) {
Log(L"GetDefaultBrowserAppModelID failed, launching on desktop.");
LaunchDesktopBrowser();
return S_OK;
Log(L"GetDefaultBrowserAppModelID failed.");
return false;
}
Log(L"Metro Launch: verb:%s appid:%s params:%s", mVerb, appModelID, mTarget);
Log(L"Metro Launch: verb:'%s' appid:'%s' params:'%s'", mVerb, appModelID, mTarget);
// shortcuts to the application
DWORD processID;
@ -777,6 +745,58 @@ IFACEMETHODIMP CExecuteCommandVerb::Execute()
hr = activateMgr->ActivateForProtocol(appModelID, mShellItemArray, &processID);
Log(L"ActivateForProtocol result %X", hr);
}
return true;
}
class AutoSetRequestMet
{
public:
explicit AutoSetRequestMet(bool* aFlag) :
mFlag(aFlag) {}
~AutoSetRequestMet() { if (mFlag) *mFlag = true; }
private:
bool* mFlag;
};
IFACEMETHODIMP CExecuteCommandVerb::Execute()
{
Log(L"Execute()");
if (!mTarget.GetLength()) {
// We shut down when this flips to true
mRequestMet = true;
return E_FAIL;
}
// Deal with metro restart for an update - launch desktop with a command
// that tells it to run updater then launch the metro browser.
if (mRequestType == METRO_UPDATE) {
// We'll complete this in the heart beat callback from the main msg loop.
// We do this because the last browser instance makes this call to Execute
// sync. So we want to make sure it's completely shutdown before we do
// the update.
mParameters = kMetroUpdateCmdLine;
mDelayedLaunchType = DESKTOP;
return S_OK;
}
// Launch on the desktop
if (mRequestType == DESKTOP_RESTART ||
(mRequestType == DEFAULT_LAUNCH && DefaultLaunchIsDesktop())) {
LaunchDesktopBrowser();
mRequestMet = true;
return S_OK;
}
// If we have an update in the works, don't try to activate yet,
// delay until the lock is removed.
if (TestForUpdateLock()) {
mDelayedLaunchType = METRO;
return S_OK;
}
LaunchMetroBrowser();
mRequestMet = true;
return S_OK;
}
@ -864,8 +884,6 @@ int APIENTRY wWinMain(HINSTANCE, HINSTANCE, PWSTR pszCmdLine, int)
#if defined(SHOW_CONSOLE)
SetupConsole();
#endif
//Log(pszCmdLine);
if (!wcslen(pszCmdLine) || StrStrI(pszCmdLine, L"-Embedding"))
{
CoInitialize(nullptr);
@ -896,6 +914,7 @@ int APIENTRY wWinMain(HINSTANCE, HINSTANCE, PWSTR pszCmdLine, int)
long beatCount = 0;
while (GetMessage(&msg, 0, 0, 0) > 0) {
if (msg.message == WM_TIMER) {
pHandler->HeartBeat();
if (++beatCount > REQUEST_WAIT_TIMEOUT ||
(pHandler->RequestMet() && pHandler->RefCount() < 2)) {
break;

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

@ -22,6 +22,10 @@ gyp_vars = {
'use_system_libvpx': 0,
'build_libjpeg': 0,
'build_libvpx': 0,
'build_libyuv': 0,
'libyuv_dir': '/media/libyuv',
'yuv_disable_avx2': 0 if CONFIG['HAVE_X86_AVX2'] else 1,
# saves 4MB when webrtc_trace is off
'enable_lazy_trace_alloc': 1,
@ -95,6 +99,8 @@ if CONFIG['ARM_ARCH']:
# CPU detection for ARM works on Android only. armv7 always uses CPU
# detection, so we have to set armv7=0 for non-Android target
gyp_vars['armv7'] = 0
# For libyuv
gyp_vars['arm_version'] = CONFIG['ARM_ARCH']
# Don't try to compile ssse3/sse4.1 code if toolchain doesn't support
if CONFIG['INTEL_ARCHITECTURE']:

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

@ -1,7 +1,21 @@
. "$topsrcdir/build/mozconfig.common"
CC="/tools/gcc-4.7.3-0moz1/bin/gcc"
CXX="/tools/gcc-4.7.3-0moz1/bin/g++"
# some b2g desktop builds still happen on i686 machines, and the tooltool
# toolchain is x86_64 only.
# We also deal with valgrind builds here, they don't use tooltool manifests at
# all yet.
if [ -z "$no_tooltool" ]
then
CC="$topsrcdir/gcc/bin/gcc"
CXX="$topsrcdir/gcc/bin/g++"
# We want to make sure we use binutils and other binaries in the tooltool
# package.
mk_add_options PATH="$topsrcdir/gcc/bin:$PATH"
else
CC="/tools/gcc-4.7.3-0moz1/bin/gcc"
CXX="/tools/gcc-4.7.3-0moz1/bin/g++"
fi
ac_add_options --enable-elf-hack

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

@ -1351,6 +1351,20 @@ if test "$GNU_CC"; then
AC_MSG_RESULT([no]))
CFLAGS=$_SAVE_CFLAGS
case "${CPU_ARCH}" in
x86 | x86_64)
AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
AC_TRY_COMPILE([],
[asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
result="yes", result="no")
AC_MSG_RESULT("$result")
if test "$result" = "yes"; then
HAVE_X86_AVX2=1
AC_DEFINE(HAVE_X86_AVX2)
AC_SUBST(HAVE_X86_AVX2)
fi
esac
# Turn on GNU-specific warnings:
# -Wall - turn on a lot of warnings
# -Wpointer-arith - good to have
@ -3932,6 +3946,9 @@ if test -n "$MOZ_NATIVE_ICU"; then
PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 50.1)
MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_ICU_LIBS"
MOZ_SHARED_ICU=1
else
MOZ_ICU_CFLAGS='-I$(topsrcdir)/intl/icu/source/common -I$(topsrcdir)/intl/icu/source/i18n'
AC_SUBST(MOZ_ICU_CFLAGS)
fi
AC_SUBST(MOZ_NATIVE_ICU)

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

@ -54,10 +54,18 @@ const R_HOST = new RegExp ("\\*|(((\\*\\.)?" + R_HOSTCHAR.source +
// port = ":" ( 1*DIGIT / "*" )
const R_PORT = new RegExp ("(\\:([0-9]+|\\*))", 'i');
// host-source = [ scheme "://" ] host [ port ]
const R_HOSTSRC = new RegExp ("^((" + R_SCHEME.source + "\\:\\/\\/)?("
+ R_HOST.source + ")"
+ R_PORT.source + "?)$", 'i');
// path
const R_PATH = new RegExp("(\\/(([a-zA-Z0-9\\-\\_]+)\\/?)*)", 'i');
// file
const R_FILE = new RegExp("(\\/([a-zA-Z0-9\\-\\_]+)\\.([a-zA-Z]+))", 'i');
// host-source = [ scheme "://" ] host [ port path file ]
const R_HOSTSRC = new RegExp ("^((((" + R_SCHEME.source + "\\:\\/\\/)?("
+ R_HOST.source + ")"
+ R_PORT.source + "?)"
+ R_PATH.source + "?)"
+ R_FILE.source + "?)$", 'i');
// ext-host-source = host-source "/" *( <VCHAR except ";" and ","> )
// ; ext-host-source is reserved for future use.
@ -1346,6 +1354,11 @@ CSPSource.fromString = function(aStr, aCSPRep, self, enforceSelfChecks) {
if (schemeMatch)
hostMatch = R_HOSTSRC.exec(aStr.substring(schemeMatch[0].length + 3));
// Bug 916054: in CSP 1.0, source-expressions that are paths should have
// the path after the origin ignored and only the origin enforced.
hostMatch[0] = hostMatch[0].replace(R_FILE, "");
hostMatch[0] = hostMatch[0].replace(R_PATH, "");
var portMatch = R_PORT.exec(hostMatch);
// Host regex also gets port, so remove the port here.

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

@ -200,6 +200,7 @@ nsContentSink::Init(nsIDocument* aDoc,
if (sEnablePerfMode != 0) {
mDynamicLowerValue = sEnablePerfMode == 1;
FavorPerformanceHint(!mDynamicLowerValue, 0);
}
return NS_OK;
@ -1375,6 +1376,15 @@ nsContentSink::DidProcessATokenImpl()
//----------------------------------------------------------------------
void
nsContentSink::FavorPerformanceHint(bool perfOverStarvation, uint32_t starvationDelay)
{
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
if (appShell)
appShell->FavorPerformanceHint(perfOverStarvation, starvationDelay);
}
void
nsContentSink::BeginUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType)
{
@ -1452,6 +1462,12 @@ nsContentSink::DropParserAndPerfHint(void)
// reference.
nsRefPtr<nsParserBase> kungFuDeathGrip(mParser.forget());
if (mDynamicLowerValue) {
// Reset the performance hint which was set to FALSE
// when mDynamicLowerValue was set.
FavorPerformanceHint(true, 0);
}
if (!mRunsToCompletion) {
mDocument->UnblockOnload(true);
}
@ -1489,6 +1505,7 @@ nsContentSink::WillParseImpl(void)
(currentTime - lastEventTime) < uint32_t(sInteractiveTime));
if (mDynamicLowerValue != newDynLower) {
FavorPerformanceHint(!newDynLower, 0);
mDynamicLowerValue = newDynLower;
}
}

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

@ -237,6 +237,9 @@ public:
static void NotifyDocElementCreated(nsIDocument* aDoc);
protected:
void
FavorPerformanceHint(bool perfOverStarvation, uint32_t starvationDelay);
inline int32_t GetNotificationInterval()
{
if (mDynamicLowerValue) {

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

@ -2047,13 +2047,6 @@ GK_ATOM(windows_theme_royale, "windows-theme-royale")
GK_ATOM(windows_theme_zune, "windows-theme-zune")
GK_ATOM(windows_theme_generic, "windows-theme-generic")
// windows version info selector metrics, helpful in removing ambiguity
// in theme selectors.
GK_ATOM(windows_version_xp, "windows-version-xp")
GK_ATOM(windows_version_vista, "windows-version-vista")
GK_ATOM(windows_version_win7, "windows-version-win7")
GK_ATOM(windows_version_win8, "windows-version-win8")
// And the same again, as media query keywords.
GK_ATOM(_moz_color_picker_available, "-moz-color-picker-available")
GK_ATOM(_moz_scrollbar_start_backward, "-moz-scrollbar-start-backward")

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

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Bug 916054 - URLs with path are ignored by FF's CSP parser</title>
</head>
<body>
<div id="testdiv">blocked</div>
<script src="http://test1.example.com/tests/content/base/test/csp/file_csp_regexp_parsing.js"></script>
</body>
</html>

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

@ -0,0 +1 @@
document.getElementById("testdiv").innerHTML = "allowed";

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

@ -0,0 +1,45 @@
// SJS file for CSP mochitests
Components.utils.import("resource://gre/modules/NetUtil.jsm");
function loadHTMLFromFile(path) {
// Load the HTML to return in the response from file.
// Since it's relative to the cwd of the test runner, we start there and
// append to get to the actual path of the file.
var testHTMLFile =
Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
get("CurWorkD", Components.interfaces.nsILocalFile);
var dirs = path.split("/");
for (var i = 0; i < dirs.length; i++) {
testHTMLFile.append(dirs[i]);
}
var testHTMLFileStream =
Components.classes["@mozilla.org/network/file-input-stream;1"].
createInstance(Components.interfaces.nsIFileInputStream);
testHTMLFileStream.init(testHTMLFile, -1, 0, 0);
var testHTML = NetUtil.readInputStreamToString(testHTMLFileStream, testHTMLFileStream.available());
return testHTML;
}
function handleRequest(request, response)
{
var query = {};
request.queryString.split('&').forEach(function (val) {
var [name, value] = val.split('=');
query[name] = unescape(value);
});
var csp = unescape(query['csp']);
var file = unescape(query['file']);
// avoid confusing cache behaviors
response.setHeader("Cache-Control", "no-cache", false);
// Deliver the CSP policy encoded in the URI
response.setHeader("Content-Security-Policy", csp, false);
// Send HTML to test allowed/blocked behaviors
response.setHeader("Content-Type", "text/html", false);
response.write(loadHTMLFromFile(file));
}

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

@ -108,6 +108,9 @@ support-files =
file_dual_headers_warning.html^headers^
file_self_none_as_hostname_confusion.html
file_self_none_as_hostname_confusion.html^headers^
file_csp_testserver.sjs
file_csp_regexp_parsing.html
file_csp_regexp_parsing.js
[test_CSP.html]
[test_CSP_bug663567.html]
@ -133,3 +136,4 @@ support-files =
[test_dual_headers_warning.html]
[test_self_none_as_hostname_confusion.html]
[test_bug949549.html]
[test_csp_regexp_parsing.html]

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

@ -0,0 +1,107 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Bug 916054 - URLs with path are ignored by FF's CSP parser</title>
<!-- Including SimpleTest.js so we can use waitForExplicitFinish !-->
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="visibility: hidden">
<iframe style="width:100%;" id="testframe"></iframe>
</div>
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
var policies = [
["allowed", "*"],
["allowed", "test1.example.com"],
["allowed", "test1.example.com/"],
["allowed", "test1.example.com/path-1"],
["allowed", "test1.example.com/path-1/"],
["allowed", "test1.example.com/path-1/path_2/"],
["allowed", "test1.example.com/path-1/path_2/file.js"],
["allowed", "test1.example.com/path-1/path_2/file_1.js"],
["allowed", "test1.example.com/path-1/path_2/file-2.js"],
["allowed", "test1.example.com/path-1/path_2/f.js"],
["allowed", "*.example.com"],
["allowed", "*.example.com/"],
["allowed", "*.example.com/path-1"],
["allowed", "*.example.com/path-1/"],
["allowed", "*.example.com/path-1/path_2/"],
["allowed", "*.example.com/path-1/path_2/file.js"],
["allowed", "*.example.com/path-1/path_2/file_1.js"],
["allowed", "*.example.com/path-1/path_2/file-2.js"],
["allowed", "*.example.com/path-1/path_2/f.js"],
["allowed", "test1.example.com:80"],
["allowed", "test1.example.com:80/"],
["allowed", "test1.example.com:80/path-1"],
["allowed", "test1.example.com:80/path-1/"],
["allowed", "test1.example.com:80/path-1/path_2"],
["allowed", "test1.example.com:80/path-1/path_2/"],
["allowed", "test1.example.com:80/path-1/path_2/file.js"],
["allowed", "test1.example.com:*"],
["allowed", "test1.example.com:*/"],
["allowed", "test1.example.com:*/path-1"],
["allowed", "test1.example.com:*/path-1/"],
["allowed", "test1.example.com:*/path-1/path_2"],
["allowed", "test1.example.com:*/path-1/path_2/"],
["allowed", "test1.example.com:*/path-1/path_2/file.js"],
// the following tests should fail
["blocked", "test1.example.com/path-1//path_2"],
["blocked", "test1.example.com/path-1/file.js.cpp"],
["blocked", "test1.example.com:88path-1/"],
["blocked", "test1.example.com:80//"],
["blocked", "test1.example.com:80//path-1"],
["blocked", "test1.example.com:80/.js"],
["blocked", "test1.example.com:80.js"],
["blocked", "test1.example.com:*.js"],
["blocked", "test1.example.com:*."]
]
var counter = 0;
var policy;
function loadNextTest() {
if (counter == policies.length) {
SimpleTest.finish();
}
else {
policy = policies[counter++];
var src = "file_csp_testserver.sjs";
// append the file that should be served
src += "?file=" + escape("tests/content/base/test/csp/file_csp_regexp_parsing.html");
// append the CSP that should be used to serve the file
src += "&csp=" + escape("default-src 'none'; script-src " + policy[1]);
document.getElementById("testframe").addEventListener("load", test, false);
document.getElementById("testframe").src = src;
}
}
function test() {
try {
document.getElementById("testframe").removeEventListener('load', test, false);
var testframe = document.getElementById("testframe");
var divcontent = testframe.contentWindow.document.getElementById('testdiv').innerHTML;
is(divcontent, policy[0], "should be " + policy[0] + " in test " + (counter - 1) + "!");
}
catch (e) {
ok(false, "ERROR: could not access content in test " + (counter - 1) + "!");
}
loadNextTest();
}
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true]]},
function () {
loadNextTest();
}
);
</script>
</body>
</html>

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

@ -0,0 +1,133 @@
/* 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/. */
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import('resource://gre/modules/CSPUtils.jsm');
var ioService = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
var self = ioService.newURI("http://test1.example.com:80", null, null);
function testValidSRCsRegularHost() {
var csps = [
"test1.example.com",
"test1.example.com/",
"test1.example.com/path-1",
"test1.example.com/path-1/",
"test1.example.com/path-1/path_2/",
"test1.example.com/path-1/path_2/file.js",
"test1.example.com/path-1/path_2/file_1.js",
"test1.example.com/path-1/path_2/file-2.js",
"test1.example.com/path-1/path_2/f.js"
]
var obj;
var expected = "http://test1.example.com:80";
for (let i in csps) {
var src = csps[i];
obj = CSPSourceList.fromString(src, undefined, self);
do_check_eq(1, obj._sources.length);
do_check_eq(obj._sources[0], expected);
}
}
function testValidSRCsWildCardHost() {
var csps = [
"*.example.com",
"*.example.com/",
"*.example.com/path-1",
"*.example.com/path-1/",
"*.example.com/path-1/path_2/",
"*.example.com/path-1/path_2/file.js",
"*.example.com/path-1/path_2/file_1.js",
"*.example.com/path-1/path_2/file-2.js",
"*.example.com/path-1/path_2/f.js",
]
var obj;
var expected = "http://*.example.com:80";
for (let i in csps) {
var src = csps[i];
obj = CSPSourceList.fromString(src, undefined, self);
do_check_eq(1, obj._sources.length);
do_check_eq(obj._sources[0], expected);
}
}
function testValidSRCsRegularPort() {
var csps = [
"test1.example.com:80",
"test1.example.com:80/",
"test1.example.com:80/path-1",
"test1.example.com:80/path-1/",
"test1.example.com:80/path-1/path_2",
"test1.example.com:80/path-1/path_2/",
"test1.example.com:80/path-1/path_2/file.js"
]
var obj;
var expected = "http://test1.example.com:80";
for (let i in csps) {
var src = csps[i];
obj = CSPSourceList.fromString(src, undefined, self);
do_check_eq(1, obj._sources.length);
do_check_eq(obj._sources[0], expected);
}
}
function testValidSRCsWildCardPort() {
var csps = [
"test1.example.com:*",
"test1.example.com:*/",
"test1.example.com:*/path-1",
"test1.example.com:*/path-1/",
"test1.example.com:*/path-1/path_2",
"test1.example.com:*/path-1/path_2/",
"test1.example.com:*/path-1/path_2/file.js"
]
var obj;
var expected = "http://test1.example.com:*";
for (let i in csps) {
var src = csps[i];
obj = CSPSourceList.fromString(src, undefined, self);
do_check_eq(1, obj._sources.length);
do_check_eq(obj._sources[0], expected);
}
}
function testInvalidSRCs() {
var csps = [
"test1.example.com/path-1//path_2",
"test1.example.com/path-1/file.js.cpp",
"test1.example.com:88path-1/",
"test1.example.com:80//",
"test1.example.com:80//path-1",
"test1.example.com:80/.js",
"test1.example.com:80.js",
"test1.example.com:*.js",
"test1.example.com:*."
]
var obj;
var expected = [];
for (let i in csps) {
var src = csps[i];
obj = CSPSourceList.fromString(src, undefined, self);
do_check_eq(0, obj._sources.length);
}
}
function run_test() {
testValidSRCsRegularHost();
testValidSRCsWildCardHost();
testValidSRCsRegularPort();
testValidSRCsWildCardPort();
testInvalidSRCs();
do_test_finished();
}

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

@ -30,3 +30,4 @@ run-sequentially = Hardcoded 4444 port.
[test_thirdpartyutil.js]
[test_xhr_standalone.js]
[test_xmlserializer.js]
[test_csp_ignores_path.js]

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

@ -613,7 +613,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
nullptr)
&& parseSizeKeywords) {
static const char sizes[3][7] = { "small", "normal", "big" };
static const int32_t values[NS_ARRAY_LENGTH(sizes)] = {
static const int32_t values[MOZ_ARRAY_LENGTH(sizes)] = {
NS_STYLE_FONT_SIZE_SMALL, NS_STYLE_FONT_SIZE_MEDIUM,
NS_STYLE_FONT_SIZE_LARGE
};
@ -730,7 +730,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
"bold-sans-serif", "sans-serif-italic", "sans-serif-bold-italic",
"monospace", "initial", "tailed", "looped", "stretched"
};
static const int32_t values[NS_ARRAY_LENGTH(sizes)] = {
static const int32_t values[MOZ_ARRAY_LENGTH(sizes)] = {
NS_MATHML_MATHVARIANT_NORMAL, NS_MATHML_MATHVARIANT_BOLD,
NS_MATHML_MATHVARIANT_ITALIC, NS_MATHML_MATHVARIANT_BOLD_ITALIC,
NS_MATHML_MATHVARIANT_SCRIPT, NS_MATHML_MATHVARIANT_BOLD_SCRIPT,
@ -876,7 +876,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
direction->GetUnit() == eCSSUnit_Null) {
nsAutoString str(value->GetStringValue());
static const char dirs[][4] = { "ltr", "rtl" };
static const int32_t dirValues[NS_ARRAY_LENGTH(dirs)] = {
static const int32_t dirValues[MOZ_ARRAY_LENGTH(dirs)] = {
NS_STYLE_DIRECTION_LTR, NS_STYLE_DIRECTION_RTL
};
for (uint32_t i = 0; i < ArrayLength(dirs); ++i) {

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

@ -72,6 +72,7 @@ ValidatePlane(const VideoData::YCbCrBuffer::Plane& aPlane)
aPlane.mStride > 0;
}
#if 0
static bool
IsYV12Format(const VideoData::YCbCrBuffer::Plane& aYPlane,
const VideoData::YCbCrBuffer::Plane& aCbPlane,
@ -85,6 +86,7 @@ IsYV12Format(const VideoData::YCbCrBuffer::Plane& aYPlane,
aCbPlane.mWidth == aCrPlane.mWidth &&
aCbPlane.mHeight == aCrPlane.mHeight;
}
#endif
bool
VideoInfo::ValidateVideoRegion(const nsIntSize& aFrame,
@ -221,13 +223,15 @@ VideoData* VideoData::Create(VideoInfo& aInfo,
const YCbCrBuffer::Plane &Cr = aBuffer.mPlanes[2];
if (!aImage) {
// Currently our decoder only knows how to output to PLANAR_YCBCR
// Currently our decoder only knows how to output to ImageFormat::PLANAR_YCBCR
// format.
ImageFormat format[2] = {PLANAR_YCBCR, GRALLOC_PLANAR_YCBCR};
#if 0
if (IsYV12Format(Y, Cb, Cr)) {
v->mImage = aContainer->CreateImage(format, 2);
} else {
v->mImage = aContainer->CreateImage(format, 1);
v->mImage = aContainer->CreateImage(ImageFormat::GRALLOC_PLANAR_YCBCR);
}
#endif
if (!v->mImage) {
v->mImage = aContainer->CreateImage(ImageFormat::PLANAR_YCBCR);
}
} else {
v->mImage = aImage;
@ -236,8 +240,8 @@ VideoData* VideoData::Create(VideoInfo& aInfo,
if (!v->mImage) {
return nullptr;
}
NS_ASSERTION(v->mImage->GetFormat() == PLANAR_YCBCR ||
v->mImage->GetFormat() == GRALLOC_PLANAR_YCBCR,
NS_ASSERTION(v->mImage->GetFormat() == ImageFormat::PLANAR_YCBCR ||
v->mImage->GetFormat() == ImageFormat::GRALLOC_PLANAR_YCBCR,
"Wrong format?");
PlanarYCbCrImage* videoImage = static_cast<PlanarYCbCrImage*>(v->mImage.get());
@ -363,12 +367,11 @@ VideoData* VideoData::Create(VideoInfo& aInfo,
aTimecode,
aInfo.mDisplay));
ImageFormat format = GRALLOC_PLANAR_YCBCR;
v->mImage = aContainer->CreateImage(&format, 1);
v->mImage = aContainer->CreateImage(ImageFormat::GRALLOC_PLANAR_YCBCR);
if (!v->mImage) {
return nullptr;
}
NS_ASSERTION(v->mImage->GetFormat() == GRALLOC_PLANAR_YCBCR,
NS_ASSERTION(v->mImage->GetFormat() == ImageFormat::GRALLOC_PLANAR_YCBCR,
"Wrong format?");
typedef mozilla::layers::GrallocImage GrallocImage;
GrallocImage* videoImage = static_cast<GrallocImage*>(v->mImage.get());
@ -389,7 +392,7 @@ void* MediaDecoderReader::VideoQueueMemoryFunctor::operator()(void* anObject) {
return nullptr;
}
if (v->mImage->GetFormat() == PLANAR_YCBCR) {
if (v->mImage->GetFormat() == ImageFormat::PLANAR_YCBCR) {
mozilla::layers::PlanarYCbCrImage* vi = static_cast<mozilla::layers::PlanarYCbCrImage*>(v->mImage.get());
mResult += vi->GetDataSize();
}

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

@ -33,7 +33,7 @@ class VideoInfo {
public:
VideoInfo()
: mDisplay(0,0),
mStereoMode(STEREO_MODE_MONO),
mStereoMode(StereoMode::MONO),
mHasVideo(false)
{}

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

@ -955,9 +955,8 @@ MediaStreamGraphImpl::PlayVideo(MediaStream* aStream)
VideoFrameContainer* output = aStream->mVideoOutputs[i];
if (frame->GetForceBlack()) {
static const ImageFormat formats[1] = { PLANAR_YCBCR };
nsRefPtr<Image> image =
output->GetImageContainer()->CreateImage(formats, 1);
output->GetImageContainer()->CreateImage(ImageFormat::PLANAR_YCBCR);
if (image) {
// Sets the image to a single black pixel, which will be scaled to fill
// the rendered size.

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

@ -9,8 +9,8 @@
#include "dmoreg.h"
#include "DirectShowUtils.h"
#include "nsAutoPtr.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/RefPtr.h"
#include "nsMemory.h"
namespace mozilla {
@ -38,7 +38,7 @@ static const GuidToName GuidToNameTable[] = {
const char*
GetDirectShowGuidName(const GUID& aGuid)
{
size_t len = NS_ARRAY_LENGTH(GuidToNameTable);
const size_t len = ArrayLength(GuidToNameTable);
for (unsigned i = 0; i < len; i++) {
if (IsEqualGUID(aGuid, GuidToNameTable[i].guid)) {
return GuidToNameTable[i].name;

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

@ -248,7 +248,7 @@ nsresult VP8TrackEncoder::PrepareRawFrame(VideoChunk &aChunk)
return NS_ERROR_NULL_POINTER;
}
ImageFormat format = img->GetFormat();
if (format != PLANAR_YCBCR) {
if (format != ImageFormat::PLANAR_YCBCR) {
VP8LOG("Unsupported video format\n");
return NS_ERROR_FAILURE;
}

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

@ -921,8 +921,9 @@ GstFlowReturn GStreamerReader::AllocateVideoBufferFull(GstPad* aPad,
{
/* allocate an image using the container */
ImageContainer* container = mDecoder->GetImageContainer();
ImageFormat format = PLANAR_YCBCR;
PlanarYCbCrImage* img = reinterpret_cast<PlanarYCbCrImage*>(container->CreateImage(&format, 1).get());
PlanarYCbCrImage* img =
reinterpret_cast<PlanarYCbCrImage*>(
container->CreateImage(ImageFormat::PLANAR_YCBCR).get());
nsRefPtr<PlanarYCbCrImage> image = dont_AddRef(img);
/* prepare a GstBuffer pointing to the underlying PlanarYCbCrImage buffer */

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

@ -249,7 +249,7 @@ OMXVideoEncoder::Encode(const Image* aImage, int aWidth, int aHeight,
MOZ_ASSERT(aWidth == img->GetSize().width &&
aHeight == img->GetSize().height);
if (format == GRALLOC_PLANAR_YCBCR) {
if (format == ImageFormat::GRALLOC_PLANAR_YCBCR) {
// Get graphic buffer pointer.
void* imgPtr = nullptr;
GrallocImage* nativeImage = static_cast<GrallocImage*>(img);
@ -284,7 +284,7 @@ OMXVideoEncoder::Encode(const Image* aImage, int aWidth, int aHeight,
ConvertPlanarYCbCrToNV12(&nv21, dst);
graphicBuffer->unlock();
} else if (format == PLANAR_YCBCR) {
} else if (format == ImageFormat::PLANAR_YCBCR) {
ConvertPlanarYCbCrToNV12(static_cast<PlanarYCbCrImage*>(img)->GetData(),
dst);
} else {

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

@ -135,6 +135,7 @@ struct PluginHost {
void (*SetMetaDataReadMode)(Decoder *aDecoder);
void (*SetPlaybackReadMode)(Decoder *aDecoder);
bool (*GetIntPref)(const char *aPref, int32_t *aResult);
bool (*GetSystemInfoString)(const char *aKey, char *aResult, uint32_t aResultLen);
};
struct Decoder {

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

@ -67,12 +67,34 @@ static bool GetIntPref(const char* aPref, int32_t* aResult)
return NS_SUCCEEDED(NS_DispatchToMainThread(event, NS_DISPATCH_SYNC));
}
static bool
GetSystemInfoString(const char *aKey, char *aResult, size_t aResultLength)
{
NS_ENSURE_TRUE(aKey, false);
NS_ENSURE_TRUE(aResult, false);
nsCOMPtr<nsIPropertyBag2> infoService = do_GetService("@mozilla.org/system-info;1");
NS_ASSERTION(infoService, "Could not find a system info service");
nsAutoCString key(aKey);
nsAutoCString info;
nsresult rv = infoService->GetPropertyAsACString(NS_ConvertUTF8toUTF16(key),
info);
NS_ENSURE_SUCCESS(rv, false);
strncpy(aResult, info.get(), aResultLength);
return true;
}
static PluginHost sPluginHost = {
nullptr,
nullptr,
nullptr,
nullptr,
GetIntPref
GetIntPref,
GetSystemInfoString,
};
// Return true if Omx decoding is supported on the device. This checks the

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

@ -373,9 +373,7 @@ uint8_t *
MediaPluginReader::ImageBufferCallback::CreateI420Image(size_t aWidth,
size_t aHeight)
{
ImageFormat format = PLANAR_YCBCR;
mImage = mImageContainer->CreateImage(&format, 1 /* numFormats */);
mImage = mImageContainer->CreateImage(ImageFormat::PLANAR_YCBCR);
PlanarYCbCrImage *yuvImage = static_cast<PlanarYCbCrImage *>(mImage.get());
if (!yuvImage) {

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

@ -38,17 +38,14 @@ void EbmlComposer::GenerateHeader()
EbmlLoc trackLoc;
Ebml_StartSubElement(&ebml, &trackLoc, Tracks);
{
char cid_string[8];
// Video
if (mWidth > 0 && mHeight > 0) {
strcpy(cid_string, "V_VP8");
writeVideoTrack(&ebml, 0x1, 0, cid_string,
writeVideoTrack(&ebml, 0x1, 0, "V_VP8",
mWidth, mHeight, mFrameRate);
}
// Audio
if (mCodecPrivateData.Length() > 0) {
strcpy(cid_string, "A_VORBIS");
writeAudioTrack(&ebml, 0x2, 0x0, cid_string, mSampleFreq,
writeAudioTrack(&ebml, 0x2, 0x0, "A_VORBIS", mSampleFreq,
mChannels, mCodecPrivateData.Elements(),
mCodecPrivateData.Length());
}

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

@ -344,19 +344,19 @@ nsresult WebMReader::ReadMetadata(MediaInfo* aInfo,
switch (params.stereo_mode) {
case NESTEGG_VIDEO_MONO:
mInfo.mVideo.mStereoMode = STEREO_MODE_MONO;
mInfo.mVideo.mStereoMode = StereoMode::MONO;
break;
case NESTEGG_VIDEO_STEREO_LEFT_RIGHT:
mInfo.mVideo.mStereoMode = STEREO_MODE_LEFT_RIGHT;
mInfo.mVideo.mStereoMode = StereoMode::LEFT_RIGHT;
break;
case NESTEGG_VIDEO_STEREO_BOTTOM_TOP:
mInfo.mVideo.mStereoMode = STEREO_MODE_BOTTOM_TOP;
mInfo.mVideo.mStereoMode = StereoMode::BOTTOM_TOP;
break;
case NESTEGG_VIDEO_STEREO_TOP_BOTTOM:
mInfo.mVideo.mStereoMode = STEREO_MODE_TOP_BOTTOM;
mInfo.mVideo.mStereoMode = StereoMode::TOP_BOTTOM;
break;
case NESTEGG_VIDEO_STEREO_RIGHT_LEFT:
mInfo.mVideo.mStereoMode = STEREO_MODE_RIGHT_LEFT;
mInfo.mVideo.mStereoMode = StereoMode::RIGHT_LEFT;
break;
}
}

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

@ -103,7 +103,7 @@ static void AllocateSolidColorFrame(layers::PlanarYCbCrData& aData,
aData.mPicX = 0;
aData.mPicY = 0;
aData.mPicSize = IntSize(aWidth, aHeight);
aData.mStereoMode = STEREO_MODE_MONO;
aData.mStereoMode = StereoMode::MONO;
}
static void ReleaseFrame(layers::PlanarYCbCrData& aData)
@ -207,8 +207,7 @@ MediaEngineDefaultVideoSource::Notify(nsITimer* aTimer)
}
// Allocate a single solid color image
ImageFormat format = PLANAR_YCBCR;
nsRefPtr<layers::Image> image = mImageContainer->CreateImage(&format, 1);
nsRefPtr<layers::Image> image = mImageContainer->CreateImage(ImageFormat::PLANAR_YCBCR);
nsRefPtr<layers::PlanarYCbCrImage> ycbcr_image =
static_cast<layers::PlanarYCbCrImage*>(image.get());
layers::PlanarYCbCrData data;

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

@ -67,9 +67,7 @@ MediaEngineWebRTCVideoSource::DeliverFrame(
}
// Create a video frame and append it to the track.
ImageFormat format = PLANAR_YCBCR;
nsRefPtr<layers::Image> image = mImageContainer->CreateImage(&format, 1);
nsRefPtr<layers::Image> image = mImageContainer->CreateImage(ImageFormat::PLANAR_YCBCR);
layers::PlanarYCbCrImage* videoImage = static_cast<layers::PlanarYCbCrImage*>(image.get());
@ -88,7 +86,7 @@ MediaEngineWebRTCVideoSource::DeliverFrame(
data.mPicX = 0;
data.mPicY = 0;
data.mPicSize = IntSize(mWidth, mHeight);
data.mStereoMode = STEREO_MODE_MONO;
data.mStereoMode = StereoMode::MONO;
videoImage->SetData(data);

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

@ -154,10 +154,9 @@ D3D9DXVA2Manager::CopyToImage(IMFSample* aSample,
getter_AddRefs(surface));
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
ImageFormat format = D3D9_RGB32_TEXTURE;
nsRefPtr<Image> image = aImageContainer->CreateImage(&format, 1);
nsRefPtr<Image> image = aImageContainer->CreateImage(ImageFormat::D3D9_RGB32_TEXTURE);
NS_ENSURE_TRUE(image, E_FAIL);
NS_ASSERTION(image->GetFormat() == D3D9_RGB32_TEXTURE,
NS_ASSERTION(image->GetFormat() == ImageFormat::D3D9_RGB32_TEXTURE,
"Wrong format?");
D3D9SurfaceImage* videoImage = static_cast<D3D9SurfaceImage*>(image.get());

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

@ -9,6 +9,7 @@
#include "WMFUtils.h"
#include "WMFByteStream.h"
#include "WMFSourceReaderCallback.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/dom/TimeRanges.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/Preferences.h"
@ -359,7 +360,7 @@ WMFReader::ConfigureVideoDecoder()
MF_SOURCE_READER_FIRST_VIDEO_STREAM,
mUseHwAccel ? MFVideoFormat_NV12 : MFVideoFormat_YV12,
MP4VideoTypes,
NS_ARRAY_LENGTH(MP4VideoTypes));
ArrayLength(MP4VideoTypes));
if (FAILED(hr)) {
DECODER_LOG("Failed to configured video output");
return hr;
@ -400,13 +401,13 @@ WMFReader::GetSupportedAudioCodecs(const GUID** aCodecs, uint32_t* aNumCodecs)
aacOrMp3
};
*aCodecs = codecs;
*aNumCodecs = NS_ARRAY_LENGTH(codecs);
*aNumCodecs = ArrayLength(codecs);
} else {
static const GUID codecs[] = {
MFAudioFormat_AAC
};
*aCodecs = codecs;
*aNumCodecs = NS_ARRAY_LENGTH(codecs);
*aNumCodecs = ArrayLength(codecs);
}
}

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

@ -6,6 +6,7 @@
#include "WMFUtils.h"
#include <stdint.h>
#include "mozilla/ArrayUtils.h"
#include "mozilla/RefPtr.h"
#include "mozilla/WindowsVersion.h"
#include "prlog.h"
@ -184,7 +185,7 @@ GuidToName GuidToNameTable[] = {
nsCString GetGUIDName(const GUID& guid)
{
unsigned numTypes = NS_ARRAY_LENGTH(GuidToNameTable);
const unsigned numTypes = ArrayLength(GuidToNameTable);
for (unsigned i = 0; i < numTypes; i++) {
if (guid == GuidToNameTable[i].guid) {
return nsDependentCString(GuidToNameTable[i].name);
@ -446,7 +447,7 @@ LoadDLLs()
}
// Try to load all the required DLLs.
uint32_t dllLength = NS_ARRAY_LENGTH(sDLLs);
const uint32_t dllLength = ArrayLength(sDLLs);
for (uint32_t i = 0; i < dllLength; i++) {
sDLLs[i].handle = LoadLibrarySystem32(sDLLs[i].name);
if (!sDLLs[i].handle) {
@ -476,7 +477,7 @@ UnloadDLLs()
{
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
uint32_t length = NS_ARRAY_LENGTH(sDLLs);
const uint32_t length = ArrayLength(sDLLs);
for (uint32_t i = 0; i < length; i++) {
if (sDLLs[i].handle) {
FreeLibrary(sDLLs[i].handle);

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

@ -7,9 +7,9 @@
#define MOZILLA_SVGPATHSEGUTILS_H__
#include "gfxPoint.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/gfx/Point.h"
#include "nsDebug.h"
#include "nsMemory.h"
namespace mozilla {
@ -152,7 +152,7 @@ public:
char16_t('T'), // 18 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS
char16_t('t') // 19 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL
};
static_assert(NS_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT, "Unexpected table size");
static_assert(MOZ_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT, "Unexpected table size");
return table[aType];
}
@ -182,7 +182,7 @@ public:
2, // 18 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS
2 // 19 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL
};
static_assert(NS_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT, "Unexpected table size");
static_assert(MOZ_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT, "Unexpected table size");
return table[aType];
}

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

@ -0,0 +1,53 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=872273
-->
<head>
<bindings xmlns="http://www.mozilla.org/xbl">
<binding id="foo">
<implementation>
<method name="throwSomething" exposeToUntrustedContent="true">
<body>
throw new Error("foopy");
</body>
</method>
</implementation>
</binding>
</bindings>
<title>Test for Bug 872273</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=872273">Mozilla Bug 872273</a>
<p id="display" style="-moz-binding: url(#foo)"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
<![CDATA[
/** Test for Bug 872273 **/
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
// Prevent the test from failing when the exception hits onerror.
SimpleTest.expectUncaughtException();
// Tell the test to expect exactly one console error with the given parameters,
// with SimpleTest.finish as a continuation function.
SimpleTest.monitorConsole(SimpleTest.finish, [{errorMessage: new RegExp('foopy')}]);
// Schedule the console accounting (and continuation) to run next, right
// after we throw (below).
SimpleTest.executeSoon(SimpleTest.endMonitorConsole);
// Throw.
$('display').throwSomething();
});
]]>
</script>
</pre>
</body>
</html>

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

@ -7,6 +7,7 @@
#include "nsAboutRedirector.h"
#include "nsNetUtil.h"
#include "nsAboutProtocolUtils.h"
#include "mozilla/ArrayUtils.h"
NS_IMPL_ISUPPORTS1(nsAboutRedirector, nsIAboutModule)
@ -73,7 +74,7 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT }
};
static const int kRedirTotal = NS_ARRAY_LENGTH(kRedirMap);
static const int kRedirTotal = mozilla::ArrayLength(kRedirMap);
NS_IMETHODIMP
nsAboutRedirector::NewChannel(nsIURI *aURI, nsIChannel **result)

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

@ -211,6 +211,9 @@ static bool gAddedPreferencesVarCache = false;
bool nsDocShell::sUseErrorPages = false;
// Number of documents currently loading
static int32_t gNumberOfDocumentsLoading = 0;
// Global count of existing docshells.
static int32_t gDocShellCount = 0;
@ -241,6 +244,17 @@ static PRLogModuleInfo* gDocShellLeakLog;
const char kBrandBundleURL[] = "chrome://branding/locale/brand.properties";
const char kAppstringsBundleURL[] = "chrome://global/locale/appstrings.properties";
static void
FavorPerformanceHint(bool perfOverStarvation)
{
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
if (appShell) {
appShell->FavorPerformanceHint(perfOverStarvation,
Preferences::GetUint("docshell.event_starvation_delay_hint",
NS_EVENT_STARVATION_DELAY_HINT));
}
}
//*****************************************************************************
// <a ping> support
//*****************************************************************************
@ -6852,6 +6866,14 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress,
mIsExecutingOnLoadHandler = false;
mEODForCurrentDocument = true;
// If all documents have completed their loading
// favor native event dispatch priorities
// over performance
if (--gNumberOfDocumentsLoading == 0) {
// Hint to use normal native event dispatch priorities
FavorPerformanceHint(false);
}
}
/* Check if the httpChannel has any cache-control related response headers,
* like no-store, no-cache. If so, update SHEntry so that
@ -7855,6 +7877,12 @@ nsDocShell::RestoreFromHistory()
mSavingOldViewer = false;
mEODForCurrentDocument = false;
// Tell the event loop to favor plevents over user events, see comments
// in CreateContentViewer.
if (++gNumberOfDocumentsLoading == 1)
FavorPerformanceHint(true);
if (oldMUDV && newMUDV) {
newMUDV->SetMinFontSize(minFontSize);
newMUDV->SetTextZoom(textZoom);
@ -8251,6 +8279,16 @@ nsDocShell::CreateContentViewer(const char *aContentType,
}
}
// Give hint to native plevent dispatch mechanism. If a document
// is loading the native plevent dispatch mechanism should favor
// performance over normal native event dispatch priorities.
if (++gNumberOfDocumentsLoading == 1) {
// Hint to favor performance for the plevent notification mechanism.
// We want the pages to load as fast as possible even if its means
// native messages might be starved.
FavorPerformanceHint(true);
}
if (onLocationChangeNeeded) {
FireOnLocationChange(this, request, mCurrentURI, 0);
}

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

@ -46,44 +46,7 @@ this.ObjectWrapper = {
},
wrap: function objWrapper_wrap(aObject, aCtxt) {
// First check wich kind of object we have.
let kind = this.getObjectKind(aObject);
if (kind == "array") {
let res = Cu.createArrayIn(aCtxt);
aObject.forEach(function(aObj) {
res.push(this.wrap(aObj, aCtxt));
}, this);
return res;
} else if (TypedArrayThings.indexOf(kind) !== -1) {
// This is slow, because from the perspective of the constructor in aCtxt
// aObject is a CCW, and it gets the indexed properties one by one rather
// instead of realizing that this is already a typed array thing.
return new aCtxt[kind](aObject);
} else if (kind == "file") {
return new aCtxt.File(aObject,
{ name: aObject.name,
type: aObject.type });
} else if (kind == "blob") {
return new aCtxt.Blob([aObject], { type: aObject.type });
} else if (kind == "date") {
return Cu.createDateIn(aCtxt, aObject.getTime());
} else if (kind == "primitive") {
return aObject;
}
// Fall-through, we now have a dictionnary object.
let res = Cu.createObjectIn(aCtxt);
let propList = { };
for (let prop in aObject) {
propList[prop] = {
enumerable: true,
configurable: true,
writable: true,
value: this.wrap(aObject[prop], aCtxt)
}
}
Object.defineProperties(res, propList);
Cu.makeObjectPropsNormal(res);
return res;
dump("-*- ObjectWrapper is deprecated. Use Components.utils.cloneInto() instead.\n");
return Cu.cloneInto(aObject, aCtxt, { cloneFunctions: true });
}
}

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

@ -1382,7 +1382,7 @@ public:
NS_ConvertUTF16toUTF8(sAdapterPath).get(),
DBUS_ADAPTER_IFACE, "AddReservedServiceRecords",
DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32,
&services, NS_ARRAY_LENGTH(sServices), DBUS_TYPE_INVALID);
&services, ArrayLength(sServices), DBUS_TYPE_INVALID);
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);

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

@ -186,6 +186,11 @@ BrowserElementChild.prototype = {
/* useCapture = */ true,
/* wantsUntrusted = */ false);
addEventListener('DOMMetaAdded',
this._metaAddedHandler.bind(this),
/* useCapture = */ true,
/* wantsUntrusted = */ false);
// This listens to unload events from our message manager, but /not/ from
// the |content| window. That's because the window's unload event doesn't
// bubble, and we're not using a capturing listener. If we'd used
@ -501,6 +506,54 @@ BrowserElementChild.prototype = {
}, this);
},
_metaAddedHandler: function(e) {
let win = e.target.ownerDocument.defaultView;
// Ignore metas which don't come from the top-level
// <iframe mozbrowser> window.
if (win != content) {
debug('Not top level!');
return;
}
if (!e.target.name) {
return;
}
debug('Got metaAdded: (' + e.target.name + ') ' + e.target.content);
if (e.target.name == 'application-name') {
let meta = { name: e.target.name,
content: e.target.content };
let lang;
let elm;
for (elm = e.target;
!lang && elm && elm.nodeType == e.target.ELEMENT_NODE;
elm = elm.parentNode) {
if (elm.hasAttribute('lang')) {
lang = elm.getAttribute('lang');
continue;
}
if (elm.hasAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang')) {
lang = elm.getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang');
continue;
}
}
// No lang has been detected.
if (!lang && elm.nodeType == e.target.DOCUMENT_NODE) {
lang = elm.contentLanguage;
}
if (lang) {
meta.lang = lang;
}
sendAsyncMsg('metachange', meta);
}
},
_addMozAfterPaintHandler: function(callback) {
function onMozAfterPaint() {
let uri = docShell.QueryInterface(Ci.nsIWebNavigation).currentURI;

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

@ -258,6 +258,7 @@ BrowserElementParent.prototype = {
"loadend": this._fireEventFromMsg,
"titlechange": this._fireEventFromMsg,
"iconchange": this._fireEventFromMsg,
"metachange": this._fireEventFromMsg,
"close": this._fireEventFromMsg,
"resize": this._fireEventFromMsg,
"activitydone": this._fireEventFromMsg,

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

@ -34,8 +34,11 @@ MOCHITEST_FILES = \
test_browserElement_inproc_BrowserWindowNamespace.html \
file_browserElement_BrowserWindowNamespace.html \
browserElement_Iconchange.js \
browserElement_Metachange.js \
file_browserElement_Metachange.sjs \
browserElement_Opensearch.js \
test_browserElement_inproc_Iconchange.html \
test_browserElement_inproc_Metachange.html \
test_browserElement_inproc_Opensearch.html \
browserElement_GetScreenshot.js \
test_browserElement_inproc_GetScreenshot.html \
@ -206,6 +209,7 @@ MOCHITEST_FILES += \
test_browserElement_oop_BrowserWindowNamespace.html \
test_browserElement_oop_TopBarrier.html \
test_browserElement_oop_Iconchange.html \
test_browserElement_oop_Metachange.html \
test_browserElement_oop_Opensearch.html \
test_browserElement_oop_GetScreenshot.html \
test_browserElement_oop_BadScreenshot.html \

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

@ -0,0 +1,153 @@
/* Any copyright is dedicated to the public domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test that the onmozbrowsermetachange event works.
"use strict";
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
function createHtml(meta) {
return 'data:text/html,<html xmlns:xml="http://www.w3.org/XML/1998/namespace"><head>' + meta + '<body></body></html>';
}
function createHtmlWithLang(meta, lang) {
return 'data:text/html,<html xmlns:xml="http://www.w3.org/XML/1998/namespace" lang="' + lang + '"><head>' + meta + '<body></body></html>';
}
function createMeta(name, content) {
return '<meta name="' + name + '" content="' + content + '">';
}
function createMetaWithLang(name, content, lang) {
return '<meta name="' + name + '" content="' + content + '" lang="' + lang + '">';
}
function runTest() {
var iframe1 = document.createElement('iframe');
SpecialPowers.wrap(iframe1).mozbrowser = true;
document.body.appendChild(iframe1);
// iframe2 is a red herring; we modify its meta elements but don't listen for
// metachanges; we want to make sure that its metachange events aren't
// picked up by the listener on iframe1.
var iframe2 = document.createElement('iframe');
SpecialPowers.wrap(iframe2).mozbrowser = true;
document.body.appendChild(iframe2);
// iframe3 is another red herring. It's not a mozbrowser, so we shouldn't
// get any metachange events on it.
var iframe3 = document.createElement('iframe');
document.body.appendChild(iframe3);
var numMetaChanges = 0;
iframe1.addEventListener('mozbrowsermetachange', function(e) {
numMetaChanges++;
if (numMetaChanges == 1) {
is(e.detail.name, 'application-name');
is(e.detail.content, 'foobar');
// We should recieve metachange events when the user creates new metas
SpecialPowers.getBrowserFrameMessageManager(iframe1)
.loadFrameScript("data:,content.document.title='New title';",
/* allowDelayedLoad = */ false);
SpecialPowers.getBrowserFrameMessageManager(iframe1)
.loadFrameScript("data:,content.document.head.insertAdjacentHTML('beforeend', '<meta name=application-name content=new_foobar>')",
/* allowDelayedLoad = */ false);
SpecialPowers.getBrowserFrameMessageManager(iframe2)
.loadFrameScript("data:,content.document.head.insertAdjacentHTML('beforeend', '<meta name=application-name content=new_foobar>')",
/* allowDelayedLoad = */ false);
}
else if (numMetaChanges == 2) {
is(e.detail.name, 'application-name', 'name matches');
is(e.detail.content, 'new_foobar', 'content matches');
ok(!("lang" in e.detail), 'lang not present');
// Full new pages should trigger metachange events
iframe1.src = createHtml(createMeta('application-name', '3rd_foobar'));
}
else if (numMetaChanges == 3) {
is(e.detail.name, 'application-name', 'name matches');
is(e.detail.content, '3rd_foobar', 'content matches');
ok(!("lang" in e.detail), 'lang not present');
// Test setting a page with multiple meta elements
iframe1.src = createHtml(createMeta('application-name', 'foobar_1') + createMeta('application-name', 'foobar_2'));
}
else if (numMetaChanges == 4) {
is(e.detail.name, 'application-name', 'name matches');
is(e.detail.content, 'foobar_1', 'content matches');
ok(!("lang" in e.detail), 'lang not present');
// 2 events will be triggered by previous test, wait for next
}
else if (numMetaChanges == 5) {
is(e.detail.name, 'application-name', 'name matches');
is(e.detail.content, 'foobar_2', 'content matches');
ok(!("lang" in e.detail), 'lang not present');
// Test the language
iframe1.src = createHtml(createMetaWithLang('application-name', 'foobar_lang_1', 'en'));
}
else if (numMetaChanges == 6) {
is(e.detail.name, 'application-name', 'name matches');
is(e.detail.content, 'foobar_lang_1', 'content matches');
is(e.detail.lang, 'en', 'language matches');
// Test the language in the ancestor element
iframe1.src = createHtmlWithLang(createMeta('application-name', 'foobar_lang_2'), 'es');
}
else if (numMetaChanges == 7) {
is(e.detail.name, 'application-name', 'name matches');
is(e.detail.content, 'foobar_lang_2', 'content matches');
is(e.detail.lang, 'es', 'language matches');
// Test the language in the ancestor element
iframe1.src = createHtmlWithLang(createMetaWithLang('application-name', 'foobar_lang_3', 'it'), 'fi');
}
else if (numMetaChanges == 8) {
is(e.detail.name, 'application-name', 'name matches');
is(e.detail.content, 'foobar_lang_3', 'content matches');
is(e.detail.lang, 'it', 'language matches');
// Test the content-language
iframe1.src = "http://test/tests/dom/browser-element/mochitest/file_browserElement_Metachange.sjs?ru";
}
else if (numMetaChanges == 9) {
is(e.detail.name, 'application-name', 'name matches');
is(e.detail.content, 'sjs', 'content matches');
is(e.detail.lang, 'ru', 'language matches');
// Test the content-language
iframe1.src = "http://test/tests/dom/browser-element/mochitest/file_browserElement_Metachange.sjs?ru|dk";
}
else if (numMetaChanges == 10) {
is(e.detail.name, 'application-name', 'name matches');
is(e.detail.content, 'sjs', 'content matches');
is(e.detail.lang, 'dk', 'language matches');
// Test the language
SimpleTest.finish();
} else {
ok(false, 'Too many metachange events.');
}
});
iframe3.addEventListener('mozbrowsermetachange', function(e) {
ok(false, 'Should not get a metachange event for iframe3.');
});
iframe1.src = createHtml(createMeta('application-name', 'foobar'));
// We should not recieve meta change events for either of the below iframes
iframe2.src = createHtml(createMeta('application-name', 'foobar'));
iframe3.src = createHtml(createMeta('application-name', 'foobar'));
}
addEventListener('testready', runTest);

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

@ -0,0 +1,7 @@
function handleRequest(request, response)
{
var p = request.queryString.split('|');
response.setHeader('Content-Language', p[0], false);
response.write('<html><head><meta name="application-name" content="sjs"' +
(p.length > 1 ? (' lang="' + p[1] + '"') : '') + '></head><body></body></html>');
}

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

@ -0,0 +1,19 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=962626
-->
<head>
<title>Test for Bug 962626</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=962626">Mozilla Bug 962626</a>
<script type="application/javascript;version=1.7" src="browserElement_Metachange.js">
</script>
</body>
</html>

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

@ -0,0 +1,19 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=962626
-->
<head>
<title>Test for Bug 962626</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=962626">Mozilla Bug 962626</a>
<script type="application/javascript;version=1.7" src="browserElement_Metachange.js">
</script>
</body>
</html>

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

@ -191,8 +191,7 @@ DOMCameraPreview::ReceiveFrame(void* aBuffer, ImageFormat aFormat, FrameBuilder
return false;
}
ImageFormat format = aFormat;
nsRefPtr<Image> image = mImageContainer->CreateImage(&format, 1);
nsRefPtr<Image> image = mImageContainer->CreateImage(aFormat);
aBuilder(image, aBuffer, mWidth, mHeight);
mInput->SetCurrentFrame(gfxIntSize(mWidth, mHeight), image);

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

@ -26,7 +26,6 @@
{ "type": "webapps-manage", "allow": 1, "context": document }],
function() {
SpecialPowers.pushPrefEnv({"set": [["dom.datastore.enabled", true],
["dom.promise.enabled", true],
["dom.testing.ignore_ipc_principal", true],
["dom.testing.datastore_enabled_for_hosted_apps", true]]}, function() {
gGenerator.next(); });

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

@ -76,8 +76,7 @@
// Preferences
function() {
SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true],
["dom.datastore.enabled", true],
SpecialPowers.pushPrefEnv({"set": [["dom.datastore.enabled", true],
["dom.testing.ignore_ipc_principal", true],
["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest);
},

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

@ -76,8 +76,7 @@
// Preferences
function() {
SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true],
["dom.datastore.enabled", true],
SpecialPowers.pushPrefEnv({"set": [["dom.datastore.enabled", true],
["dom.testing.ignore_ipc_principal", true],
["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest);
},

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

@ -76,8 +76,7 @@
// Preferences
function() {
SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true],
["dom.datastore.enabled", true],
SpecialPowers.pushPrefEnv({"set": [["dom.datastore.enabled", true],
["dom.testing.ignore_ipc_principal", true],
["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest);
},

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

@ -76,8 +76,7 @@
// Preferences
function() {
SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true],
["dom.datastore.enabled", true],
SpecialPowers.pushPrefEnv({"set": [["dom.datastore.enabled", true],
["dom.testing.ignore_ipc_principal", true],
["dom.testing.datastore_enabled_for_hosted_apps", false]]}, runTest);
},

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

@ -120,8 +120,7 @@
// Preferences
function() {
SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true],
["dom.datastore.enabled", true],
SpecialPowers.pushPrefEnv({"set": [["dom.datastore.enabled", true],
["dom.testing.ignore_ipc_principal", true],
["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest);
},

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

@ -76,8 +76,7 @@
// Preferences
function() {
SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true],
["dom.datastore.enabled", true],
SpecialPowers.pushPrefEnv({"set": [["dom.datastore.enabled", true],
["dom.testing.ignore_ipc_principal", true],
["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest);
},

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

@ -76,8 +76,7 @@
// Preferences
function() {
SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true],
["dom.datastore.enabled", true],
SpecialPowers.pushPrefEnv({"set": [["dom.datastore.enabled", true],
["dom.testing.ignore_ipc_principal", true],
["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest);
},

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

@ -76,8 +76,7 @@
// Preferences
function() {
SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true],
["dom.datastore.enabled", true],
SpecialPowers.pushPrefEnv({"set": [["dom.datastore.enabled", true],
["dom.ipc.browser_frames.oop_by_default", true],
["dom.testing.ignore_ipc_principal", true],
["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest);

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

@ -100,8 +100,7 @@
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true],
["dom.datastore.enabled", true],
SpecialPowers.pushPrefEnv({"set": [["dom.datastore.enabled", true],
["dom.testing.ignore_ipc_principal", true],
["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest);
</script>

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

@ -76,8 +76,7 @@
// Preferences
function() {
SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true],
["dom.datastore.enabled", true],
SpecialPowers.pushPrefEnv({"set": [["dom.datastore.enabled", true],
["dom.testing.ignore_ipc_principal", true],
["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest);
},

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

@ -58,4 +58,3 @@ PERR_GFX_PRINTER_ENDDOC=Printing failed while completing the print job.
PERR_GFX_PRINTER_STARTPAGE=Printing failed while starting a new page.
PERR_GFX_PRINTER_DOC_IS_BUSY=Cannot print this document yet, it is still being loaded.
PERR_GFX_PRINTER_DOC_IS_BUSY_PP=Cannot print-preview this document yet, it is still being loaded.
PERR_GFX_PRINTER_NO_XUL=Printing XUL documents is not supported.

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

@ -179,8 +179,7 @@ nsPluginInstanceOwner::GetImageContainer()
container = LayerManager::CreateImageContainer();
ImageFormat format = ImageFormat::SHARED_TEXTURE;
nsRefPtr<Image> img = container->CreateImage(&format, 1);
nsRefPtr<Image> img = container->CreateImage(ImageFormat::SHARED_TEXTURE);
SharedTextureImage::Data data;
data.mSize = gfx::IntSize(r.width, r.height);
@ -1499,8 +1498,7 @@ already_AddRefed<ImageContainer> nsPluginInstanceOwner::GetImageContainerForVide
{
nsRefPtr<ImageContainer> container = LayerManager::CreateImageContainer();
ImageFormat format = ImageFormat::SHARED_TEXTURE;
nsRefPtr<Image> img = container->CreateImage(&format, 1);
nsRefPtr<Image> img = container->CreateImage(ImageFormat::SHARED_TEXTURE);
SharedTextureImage::Data data;

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

@ -638,9 +638,8 @@ PluginInstanceParent::RecvShow(const NPRect& updatedRect,
surface->MarkDirty(ur);
ImageContainer *container = GetImageContainer();
ImageFormat format = CAIRO_SURFACE;
nsRefPtr<Image> image = container->CreateImage(&format, 1);
NS_ASSERTION(image->GetFormat() == CAIRO_SURFACE, "Wrong format?");
nsRefPtr<Image> image = container->CreateImage(ImageFormat::CAIRO_SURFACE);
NS_ASSERTION(image->GetFormat() == ImageFormat::CAIRO_SURFACE, "Wrong format?");
CairoImage* cairoImage = static_cast<CairoImage*>(image.get());
CairoImage::Data cairoData;
cairoData.mDeprecatedSurface = surface;
@ -719,13 +718,12 @@ PluginInstanceParent::GetImageContainer(ImageContainer** aContainer)
#ifdef XP_MACOSX
if (ioSurface) {
ImageFormat format = MAC_IOSURFACE;
nsRefPtr<Image> image = container->CreateImage(&format, 1);
nsRefPtr<Image> image = container->CreateImage(ImageFormat::MAC_IOSURFACE);
if (!image) {
return NS_ERROR_FAILURE;
}
NS_ASSERTION(image->GetFormat() == MAC_IOSURFACE, "Wrong format?");
NS_ASSERTION(image->GetFormat() == ImageFormat::MAC_IOSURFACE, "Wrong format?");
MacIOSurfaceImage* pluginImage = static_cast<MacIOSurfaceImage*>(image.get());
pluginImage->SetSurface(ioSurface);

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

@ -244,28 +244,6 @@ Promise::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
return PromiseBinding::Wrap(aCx, aScope, this);
}
/* static */ bool
Promise::EnabledForScope(JSContext* aCx, JSObject* /* unused */)
{
if (NS_IsMainThread()) {
// No direct return so the chrome/certified app checks happen below.
if (Preferences::GetBool("dom.promise.enabled", false)) {
return true;
}
} else {
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
return workerPrivate->PromiseEnabled() || workerPrivate->UsesSystemPrincipal();
}
// Enable if the pref is enabled or if we're chrome or if we're a
// certified app.
// Note that we have no concept of a certified app in workers.
// XXXbz well, why not?
// FIXME(nsm): Remove these checks once promises are enabled by default.
nsIPrincipal* prin = nsContentUtils::GetSubjectPrincipal();
return nsContentUtils::IsSystemPrincipal(prin) ||
prin->GetAppStatus() == nsIPrincipal::APP_STATUS_CERTIFIED;
}
void
Promise::MaybeResolve(JSContext* aCx,
JS::Handle<JS::Value> aValue)
@ -894,21 +872,28 @@ Promise::MaybeReportRejected()
return;
}
JSErrorReport* report = js::ErrorFromException(mResult);
// Technically we should push this JSContext, but in reality the JS engine
// just uses it for string allocation here, so we can get away without it.
if (!mResult.isObject()) {
return;
}
JSContext* cx = nsContentUtils::GetDefaultJSContextForThread();
JSAutoRequest ar(cx);
JS::Rooted<JSObject*> obj(cx, &mResult.toObject());
JSAutoCompartment ac(cx, obj);
JSErrorReport* report = JS_ErrorFromException(cx, obj);
if (!report) {
return;
}
MOZ_ASSERT(mResult.isObject(), "How did we get a JSErrorReport?");
// Remains null in case of worker.
nsCOMPtr<nsPIDOMWindow> win;
bool isChromeError = false;
if (MOZ_LIKELY(NS_IsMainThread())) {
win =
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(&mResult.toObject()));
nsIPrincipal* principal = nsContentUtils::GetObjectPrincipal(&mResult.toObject());
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(obj));
nsIPrincipal* principal = nsContentUtils::GetObjectPrincipal(obj);
isChromeError = nsContentUtils::IsSystemPrincipal(principal);
} else {
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
@ -921,7 +906,7 @@ Promise::MaybeReportRejected()
// AsyncErrorReporter, otherwise if the call to DispatchToMainThread fails, it
// will leak. See Bug 958684.
nsRefPtr<AsyncErrorReporter> r =
new AsyncErrorReporter(JS_GetObjectRuntime(&mResult.toObject()),
new AsyncErrorReporter(JS_GetObjectRuntime(obj),
report,
nullptr,
isChromeError,

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

@ -45,8 +45,6 @@ public:
Promise(nsPIDOMWindow* aWindow);
~Promise();
static bool EnabledForScope(JSContext* aCx, JSObject* /* unused */);
void MaybeResolve(JSContext* aCx,
JS::Handle<JS::Value> aValue);
void MaybeReject(JSContext* aCx,

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

@ -33,7 +33,7 @@ function runTest() {
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true]]}, runTest);
runTest();
// -->
</script>
</pre>

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

@ -611,13 +611,8 @@ function runTest() {
test();
}
var p = SpecialPowers.getBoolPref("dom.promise.enabled");
SpecialPowers.setBoolPref("dom.promise.enabled", false);
ok(!("Promise" in window), "Promise object should not exist if disabled by pref");
SpecialPowers.setBoolPref("dom.promise.enabled", p);
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true]]}, runTest);
runTest();
// -->
</script>
</pre>

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

@ -316,7 +316,7 @@ function runTest() {
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true]]}, runTest);
runTest();
// -->
</script>
</pre>

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

@ -58,7 +58,7 @@ function runTest() {
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true]]}, runTest);
runTest();
// -->
</script>
</pre>

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

@ -89,7 +89,6 @@ let emulator = (function() {
function _startTest(permissions, test) {
function permissionSetUp() {
SpecialPowers.setBoolPref("dom.mozSettings.enabled", true);
SpecialPowers.setBoolPref("dom.promise.enabled", true);
for (let per of permissions) {
SpecialPowers.addPermission(per, true, document);
}
@ -97,7 +96,6 @@ function _startTest(permissions, test) {
function permissionTearDown() {
SpecialPowers.clearUserPref("dom.mozSettings.enabled");
SpecialPowers.clearUserPref("dom.promise.enabled");
for (let per of permissions) {
SpecialPowers.removePermission(per, document);
}

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

@ -50,9 +50,7 @@
}
function nativeCallback() {
SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true]]}, function() {
new Promise(function(resolve, reject) { resolve(42); }).then(console.log);
});
new Promise(function(resolve, reject) { resolve(42); }).then(console.log);
}
</script>
</head>

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

@ -757,7 +757,7 @@ var interfaceNamesInGlobalScope =
// IMPORTANT: Do not change this list without review from a DOM peer!
"ProgressEvent",
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "Promise", b2g: false, release: false},
"Promise",
// IMPORTANT: Do not change this list without review from a DOM peer!
"PropertyNodeList",
// IMPORTANT: Do not change this list without review from a DOM peer!

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

@ -57,7 +57,7 @@ function testSuccesses() {
expectSuccess([1000, 1000.1]);
// The following loop shouldn't cause us to crash. See bug 701716.
for (var i = 0; i < 1000; i++) {
for (var i = 0; i < 10000; i++) {
navigator.vibrate([100, 100]);
}
ok(true, "Didn't crash after issuing a lot of vibrate() calls.");

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

@ -51,9 +51,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
var firstCall = !unLockedCoords;
if (!firstCall) {
todo(false, "mousemove is fired twice.");
} else {
isUnlocked = !document.mozPointerLockElement;
}
isUnlocked = !document.mozPointerLockElement;
unLockedCoords = {
screenX: e.screenX,
screenY: e.screenY,

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

@ -341,6 +341,8 @@ partial interface Document {
void obsoleteSheet(DOMString sheetURI);
[ChromeOnly] readonly attribute nsIDocShell? docShell;
[ChromeOnly] readonly attribute DOMString contentLanguage;
};
// Extension to give chrome JS the ability to determine when a document was

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

@ -15,7 +15,8 @@ callback PromiseInit = void (object resolve, object reject);
[TreatNonCallableAsNull]
callback AnyCallback = any (any value);
[Func="mozilla::dom::Promise::EnabledForScope", Constructor(PromiseInit init)]
// REMOVE THE RELEVANT ENTRY FROM test_interfaces.html WHEN THIS IS IMPLEMENTED IN JS.
[Constructor(PromiseInit init)]
interface Promise {
// TODO bug 875289 - static Promise fulfill(any value);
@ -24,9 +25,9 @@ interface Promise {
// the proto of a promise object or someone screws up and manages to create a
// Promise object in this scope without having resolved the interface object
// first.
[NewObject, Throws, Func="mozilla::dom::Promise::EnabledForScope"]
[NewObject, Throws]
static Promise resolve(optional any value);
[NewObject, Throws, Func="mozilla::dom::Promise::EnabledForScope"]
[NewObject, Throws]
static Promise reject(optional any value);
// The [TreatNonCallableAsNull] annotation is required since then() should do
@ -38,12 +39,12 @@ interface Promise {
[NewObject]
Promise catch([TreatNonCallableAsNull] optional AnyCallback? rejectCallback = null);
[NewObject, Throws, Func="mozilla::dom::Promise::EnabledForScope"]
[NewObject, Throws]
static Promise all(sequence<any> iterable);
[NewObject, Throws, Func="mozilla::dom::Promise::EnabledForScope"]
[NewObject, Throws]
static Promise cast(optional any value);
[NewObject, Throws, Func="mozilla::dom::Promise::EnabledForScope"]
[NewObject, Throws]
static Promise race(sequence<any> iterable);
};

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