merge mozilla-central to autoland. r=merge a=merge

This commit is contained in:
Sebastian Hengst 2017-05-20 18:53:36 +02:00
Родитель 54f1632a24 79f625ac56
Коммит af0f9643cf
53 изменённых файлов: 1567 добавлений и 13683 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -149,6 +149,8 @@ module.exports = createClass({
let { value } = this.state;
let divClassList = ["devtools-searchbox", "has-clear-btn"];
let inputClassList = [`devtools-${type}input`];
let showAutocomplete =
autocompleteList.length > 0 && this.state.focused && value !== "";
if (value !== "") {
inputClassList.push("filled");
@ -170,8 +172,7 @@ module.exports = createClass({
hidden: value == "",
onClick: this.onClearButtonClick
}),
autocompleteList.length > 0 && this.state.focused &&
AutocompletePopup({
showAutocomplete && AutocompletePopup({
list: autocompleteList,
filter: value,
ref: "autocomplete",

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

@ -51,6 +51,11 @@ window.onload = async function () {
"pqr",
"xyz",
"ABC",
"a1",
"a2",
"a3",
"a4",
"a5",
],
onChange: () => null,
});
@ -61,15 +66,19 @@ window.onload = async function () {
$(".devtools-searchinput").focus();
await forceRender(component); // Wait for state update
ok(!$(".devtools-autocomplete-popup"), "Autocomplete list not visible");
sendString("a");
await forceRender(component);
compareAutocompleteList($(".devtools-autocomplete-listbox"), [
"ABC",
"BAR",
"a1",
"a2",
"a3",
"a4",
"a5",
"abc",
"baZ",
"foo",
"pqr",
"xyz",
]);
is(refs.autocomplete.state.selectedIndex, -1, "Initialised selectedIndex is -1");
@ -82,16 +91,8 @@ window.onload = async function () {
}
async function testKeyEventsWithAutocomplete() {
// Filtering of list
$(".devtools-searchinput").focus();
await forceRender(component);
sendString("aB");
await forceRender(component);
compareAutocompleteList($(".devtools-autocomplete-listbox"), ["ABC", "abc"]);
// Clear the initial input
synthesizeKey("VK_BACK_SPACE", {});
synthesizeKey("VK_BACK_SPACE", {});
$(".devtools-searchinput").focus();
// ArrowDown
synthesizeKey("VK_DOWN", {});

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

@ -341,9 +341,15 @@ void
Element::Focus(mozilla::ErrorResult& aError)
{
nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(this);
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
nsFocusManager* fm = nsFocusManager::GetFocusManager();
// Also other browsers seem to have the hack to not re-focus (and flush) when
// the element is already focused.
if (fm && domElement) {
aError = fm->SetFocus(domElement, 0);
if (fm->CanSkipFocus(this)) {
fm->NeedsFlushBeforeEventHandling(this);
} else {
aError = fm->SetFocus(domElement, 0);
}
}
}

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

@ -22,7 +22,7 @@ Timeout::Timeout()
mReason(Reason::eTimeoutOrInterval),
mTimeoutId(0),
mInterval(0),
mFiringDepth(0),
mFiringId(TimeoutManager::InvalidFiringId),
mNestingLevel(0),
mPopupState(openAllowed)
{
@ -43,13 +43,11 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(Timeout)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Timeout)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPrincipal)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mScriptHandler)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Timeout)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPrincipal)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mScriptHandler)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END

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

@ -90,11 +90,9 @@ public:
// Interval in milliseconds
uint32_t mInterval;
// Principal with which to execute
nsCOMPtr<nsIPrincipal> mPrincipal;
// stack depth at which timeout is firing
uint32_t mFiringDepth;
// Identifies which firing level this Timeout is being processed in
// when sync loops trigger nested firing.
uint32_t mFiringId;
uint32_t mNestingLevel;

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

@ -139,12 +139,73 @@ static int32_t gMinTrackingBackgroundTimeoutValue = 0;
static int32_t gTrackingTimeoutThrottlingDelay = 0;
static bool gAnnotateTrackingChannels = false;
// static
const uint32_t TimeoutManager::InvalidFiringId = 0;
bool
TimeoutManager::IsBackground() const
{
return !mWindow.AsInner()->IsPlayingAudio() && mWindow.IsBackgroundInternal();
}
uint32_t
TimeoutManager::CreateFiringId()
{
uint32_t id = mNextFiringId;
mNextFiringId += 1;
if (mNextFiringId == InvalidFiringId) {
mNextFiringId += 1;
}
mFiringIdStack.AppendElement(id);
return id;
}
void
TimeoutManager::DestroyFiringId(uint32_t aFiringId)
{
MOZ_DIAGNOSTIC_ASSERT(!mFiringIdStack.IsEmpty());
MOZ_DIAGNOSTIC_ASSERT(mFiringIdStack.LastElement() == aFiringId);
mFiringIdStack.RemoveElementAt(mFiringIdStack.Length() - 1);
}
bool
TimeoutManager::IsInvalidFiringId(uint32_t aFiringId) const
{
// Check the most common ways to invalidate a firing id first.
// These should be quite fast.
if (aFiringId == InvalidFiringId ||
mFiringIdStack.IsEmpty() ||
(mFiringIdStack.Length() == 1 && mFiringIdStack[0] != aFiringId)) {
return true;
}
// Next do a range check on the first and last items in the stack
// of active firing ids. This is a bit slower.
uint32_t low = mFiringIdStack[0];
uint32_t high = mFiringIdStack.LastElement();
MOZ_DIAGNOSTIC_ASSERT(low != high);
if (low > high) {
// If the first element is bigger than the last element in the
// stack, that means mNextFiringId wrapped around to zero at
// some point.
Swap(low, high);
}
MOZ_DIAGNOSTIC_ASSERT(low < high);
if (aFiringId < low || aFiringId > high) {
return true;
}
// Finally, fall back to verifying the firing id is not anywhere
// in the stack. This could be slow for a large stack, but that
// should be rare. It can only happen with deeply nested event
// loop spinning. For example, a page that does a lot of timers
// and a lot of sync XHRs within those timers could be slow here.
return !mFiringIdStack.Contains(aFiringId);
}
int32_t
TimeoutManager::DOMMinTimeoutValue(bool aIsTracking) const {
// First apply any back pressure delay that might be in effect.
@ -184,10 +245,10 @@ uint32_t TimeoutManager::sNestingLevel = 0;
namespace {
// The maximum number of timer callbacks we will try to run in a single event
// loop runnable.
#define DEFAULT_TARGET_MAX_CONSECUTIVE_CALLBACKS 5
uint32_t gTargetMaxConsecutiveCallbacks;
// The maximum number of milliseconds to allow consecutive timer callbacks
// to run in a single event loop runnable.
#define DEFAULT_MAX_CONSECUTIVE_CALLBACKS_MILLISECONDS 4
uint32_t gMaxConsecutiveCallbacksMilliseconds;
// The number of queued runnables within the TabGroup ThrottledEventQueue
// at which to begin applying back pressure to the window.
@ -241,7 +302,7 @@ CalculateNewBackPressureDelayMS(uint32_t aBacklogDepth)
TimeoutManager::TimeoutManager(nsGlobalWindow& aWindow)
: mWindow(aWindow),
mTimeoutIdCounter(1),
mTimeoutFiringDepth(0),
mNextFiringId(InvalidFiringId + 1),
mRunningTimeout(nullptr),
mIdleCallbackTimeoutCounter(1),
mBackPressureDelayMS(0),
@ -302,9 +363,9 @@ TimeoutManager::Initialize()
"dom.timeout.back_pressure_delay_minimum_ms",
DEFAULT_BACK_PRESSURE_DELAY_MINIMUM_MS);
Preferences::AddUintVarCache(&gTargetMaxConsecutiveCallbacks,
"dom.timeout.max_consecutive_callbacks",
DEFAULT_TARGET_MAX_CONSECUTIVE_CALLBACKS);
Preferences::AddUintVarCache(&gMaxConsecutiveCallbacksMilliseconds,
"dom.timeout.max_consecutive_callbacks_ms",
DEFAULT_MAX_CONSECUTIVE_CALLBACKS_MILLISECONDS);
}
uint32_t
@ -319,6 +380,12 @@ TimeoutManager::GetTimeoutId(Timeout::Reason aReason)
}
}
bool
TimeoutManager::IsRunningTimeout() const
{
return mRunningTimeout;
}
nsresult
TimeoutManager::SetTimeout(nsITimeoutHandler* aHandler,
int32_t interval, bool aIsInterval,
@ -522,12 +589,33 @@ TimeoutManager::RunTimeout(Timeout* aTimeout)
NS_ASSERTION(!mWindow.IsFrozen(), "Timeout running on a window in the bfcache!");
// Limit the overall time spent in RunTimeout() to reduce jank.
uint32_t totalTimeLimitMS = std::max(1u, gMaxConsecutiveCallbacksMilliseconds);
const TimeDuration totalTimeLimit = TimeDuration::FromMilliseconds(totalTimeLimitMS);
// Allow up to 25% of our total time budget to be used figuring out which
// timers need to run. This is the initial loop in this method.
const TimeDuration initalTimeLimit =
TimeDuration::FromMilliseconds(totalTimeLimit.ToMilliseconds() / 4);
// Ammortize overhead from from calling TimeStamp::Now() in the initial
// loop, though, by only checking for an elapsed limit every N timeouts.
const uint32_t kNumTimersPerInitialElapsedCheck = 100;
// Start measuring elapsed time immediately. We won't potentially expire
// the time budget until at least one Timeout has run, though.
TimeStamp start = TimeStamp::Now();
Timeout* last_expired_normal_timeout = nullptr;
Timeout* last_expired_tracking_timeout = nullptr;
bool last_expired_timeout_is_normal = false;
Timeout* last_normal_insertion_point = nullptr;
Timeout* last_tracking_insertion_point = nullptr;
uint32_t firingDepth = mTimeoutFiringDepth + 1;
uint32_t firingId = CreateFiringId();
auto guard = MakeScopeExit([&] {
DestroyFiringId(firingId);
});
// Make sure that the window and the script context don't go away as
// a result of running timeouts
@ -577,10 +665,10 @@ TimeoutManager::RunTimeout(Timeout* aTimeout)
break;
}
if (timeout->mFiringDepth == 0) {
if (IsInvalidFiringId(timeout->mFiringId)) {
// Mark any timeouts that are on the list to be fired with the
// firing depth so that we can reentrantly run timeouts
timeout->mFiringDepth = firingDepth;
timeout->mFiringId = firingId;
last_expired_timeout_is_normal = expiredIter.PickedNormalIter();
if (last_expired_timeout_is_normal) {
last_expired_normal_timeout = timeout;
@ -600,16 +688,13 @@ TimeoutManager::RunTimeout(Timeout* aTimeout)
// maximum. Note, we must always run our target timer however.
// Further timers that are ready will get picked up by their own
// nsITimer runnables when they execute.
//
// For chrome windows, however, we do coalesce all timers and
// do not yield the main thread. This is partly because we
// trust chrome windows not to misbehave and partly because a
// number of browser chrome tests have races that depend on this
// coalescing.
if (targetTimerSeen &&
numTimersToRun >= gTargetMaxConsecutiveCallbacks &&
!mWindow.IsChromeWindow()) {
break;
if (targetTimerSeen) {
if (numTimersToRun % kNumTimersPerInitialElapsedCheck == 0) {
TimeDuration elapsed(TimeStamp::Now() - start);
if (elapsed >= initalTimeLimit) {
break;
}
}
}
}
@ -630,14 +715,14 @@ TimeoutManager::RunTimeout(Timeout* aTimeout)
// win_run_timeout(). This dummy timeout serves as the head of the
// list for any timeouts inserted as a result of running a timeout.
RefPtr<Timeout> dummy_normal_timeout = new Timeout();
dummy_normal_timeout->mFiringDepth = firingDepth;
dummy_normal_timeout->mFiringId = firingId;
dummy_normal_timeout->SetDummyWhen(now);
if (last_expired_timeout_is_normal) {
last_expired_normal_timeout->setNext(dummy_normal_timeout);
}
RefPtr<Timeout> dummy_tracking_timeout = new Timeout();
dummy_tracking_timeout->mFiringDepth = firingDepth;
dummy_tracking_timeout->mFiringId = firingId;
dummy_tracking_timeout->SetDummyWhen(now);
if (!last_expired_timeout_is_normal) {
last_expired_tracking_timeout->setNext(dummy_tracking_timeout);
@ -663,6 +748,8 @@ TimeoutManager::RunTimeout(Timeout* aTimeout)
mTrackingTimeouts.SetInsertionPoint(dummy_tracking_timeout);
}
bool targetTimeoutSeen = false;
// We stop iterating each list when we go past the last expired timeout from
// that list that we have observed above. That timeout will either be the
// dummy timeout for the list that the last expired timeout came from, or it
@ -680,7 +767,7 @@ TimeoutManager::RunTimeout(Timeout* aTimeout)
last_expired_tracking_timeout ?
last_expired_tracking_timeout->getNext() :
nullptr);
while (!mWindow.IsFrozen()) {
while (true) {
Timeout* timeout = runIter.Next();
MOZ_ASSERT(timeout != dummy_normal_timeout &&
timeout != dummy_tracking_timeout,
@ -691,17 +778,15 @@ TimeoutManager::RunTimeout(Timeout* aTimeout)
}
runIter.UpdateIterator();
if (timeout->mFiringDepth != firingDepth) {
if (timeout->mFiringId != firingId) {
// We skip the timeout since it's on the list to run at another
// depth.
continue;
}
MOZ_ASSERT_IF(mWindow.IsFrozen(), mWindow.IsSuspended());
if (mWindow.IsSuspended()) {
// Some timer did suspend us. Make sure the
// rest of the timers get executed later.
timeout->mFiringDepth = 0;
continue;
break;
}
// The timeout is on the list to run at this depth, go ahead and
@ -713,10 +798,17 @@ TimeoutManager::RunTimeout(Timeout* aTimeout)
if (!scx) {
// No context means this window was closed or never properly
// initialized for this language.
// initialized for this language. This timer will never fire
// so just remove it.
timeout->remove();
timeout->Release();
continue;
}
if (timeout == aTimeout) {
targetTimeoutSeen = true;
}
// This timeout is good to run
bool timeout_was_cleared = mWindow.RunTimeoutHandler(timeout, scx);
MOZ_LOG(gLog, LogLevel::Debug,
@ -750,6 +842,9 @@ TimeoutManager::RunTimeout(Timeout* aTimeout)
mNormalTimeouts.SetInsertionPoint(last_normal_insertion_point);
mTrackingTimeouts.SetInsertionPoint(last_tracking_insertion_point);
// Since ClearAllTimeouts() was called the lists should be empty.
MOZ_DIAGNOSTIC_ASSERT(!HasTimeouts());
return;
}
@ -779,6 +874,18 @@ TimeoutManager::RunTimeout(Timeout* aTimeout)
// Release the timeout struct since it's possibly out of the list
timeout->Release();
// Check to see if we have run out of time to execute timeout handlers.
// If we've exceeded our time budget then terminate the loop immediately.
//
// Note, we only do this if we have seen the Timeout object explicitly
// passed to RunTimeout(). The target timeout must always be executed.
if (targetTimeoutSeen) {
TimeDuration elapsed = TimeStamp::Now() - start;
if (elapsed >= totalTimeLimit) {
break;
}
}
}
}
@ -1100,11 +1207,11 @@ TimeoutManager::Timeouts::ResetTimersForThrottleReduction(int32_t aPreviousThrot
NS_ASSERTION(!nextTimeout ||
timeout->When() < nextTimeout->When(), "How did that happen?");
timeout->remove();
// Insert() will addref |timeout| and reset mFiringDepth. Make sure to
// Insert() will addref |timeout| and reset mFiringId. Make sure to
// undo that after calling it.
uint32_t firingDepth = timeout->mFiringDepth;
uint32_t firingId = timeout->mFiringId;
Insert(timeout, aSortBy);
timeout->mFiringDepth = firingDepth;
timeout->mFiringId = firingId;
timeout->Release();
}
@ -1198,7 +1305,7 @@ TimeoutManager::Timeouts::Insert(Timeout* aTimeout, SortBy aSortBy)
InsertFront(aTimeout);
}
aTimeout->mFiringDepth = 0;
aTimeout->mFiringId = InvalidFiringId;
// Increment the timeout's reference count since it's now held on to
// by the list
@ -1212,7 +1319,6 @@ TimeoutManager::BeginRunningTimeout(Timeout* aTimeout)
mRunningTimeout = aTimeout;
++gRunningTimeoutDepth;
++mTimeoutFiringDepth;
if (!mWindow.IsChromeWindow()) {
TimeStamp now = TimeStamp::Now();
@ -1233,7 +1339,6 @@ TimeoutManager::BeginRunningTimeout(Timeout* aTimeout)
void
TimeoutManager::EndRunningTimeout(Timeout* aTimeout)
{
--mTimeoutFiringDepth;
--gRunningTimeoutDepth;
if (!mWindow.IsChromeWindow()) {

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

@ -8,6 +8,7 @@
#define mozilla_dom_TimeoutManager_h__
#include "mozilla/dom/Timeout.h"
#include "nsTArray.h"
class nsIEventTarget;
class nsITimeoutHandler;
@ -27,7 +28,7 @@ public:
TimeoutManager(const TimeoutManager& rhs) = delete;
void operator=(const TimeoutManager& rhs) = delete;
bool IsRunningTimeout() const { return mTimeoutFiringDepth > 0; }
bool IsRunningTimeout() const;
static uint32_t GetNestingLevel() { return sNestingLevel; }
static void SetNestingLevel(uint32_t aLevel) { sNestingLevel = aLevel; }
@ -117,11 +118,24 @@ public:
void BeginSyncOperation();
void EndSyncOperation();
static const uint32_t InvalidFiringId;
private:
nsresult ResetTimersForThrottleReduction(int32_t aPreviousThrottleDelayMS);
void MaybeStartThrottleTrackingTimout();
bool IsBackground() const;
uint32_t
CreateFiringId();
void
DestroyFiringId(uint32_t aFiringId);
bool
IsInvalidFiringId(uint32_t aFiringId) const;
private:
struct Timeouts {
Timeouts()
@ -209,7 +223,8 @@ private:
// The list of timeouts coming from scripts on the tracking protection list.
Timeouts mTrackingTimeouts;
uint32_t mTimeoutIdCounter;
uint32_t mTimeoutFiringDepth;
uint32_t mNextFiringId;
AutoTArray<uint32_t, 2> mFiringIdStack;
mozilla::dom::Timeout* mRunningTimeout;
// The current idle request callback timeout handle

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

@ -181,6 +181,7 @@ static const char* kObservedPrefs[] = {
};
nsFocusManager::nsFocusManager()
: mEventHandlingNeedsFlush(false)
{ }
nsFocusManager::~nsFocusManager()
@ -1567,6 +1568,7 @@ nsFocusManager::CheckIfFocusable(nsIContent* aContent, uint32_t aFlags)
}
// Make sure that our frames are up to date
mEventHandlingNeedsFlush = false;
doc->FlushPendingNotifications(FlushType::Layout);
nsIPresShell *shell = doc->GetShell();

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

@ -8,6 +8,7 @@
#define nsFocusManager_h___
#include "nsCycleCollectionParticipant.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIFocusManager.h"
#include "nsIObserver.h"
@ -93,6 +94,29 @@ public:
return handlingDocument.forget();
}
void NeedsFlushBeforeEventHandling(nsIContent* aContent)
{
if (mFocusedContent == aContent) {
mEventHandlingNeedsFlush = true;
}
}
bool CanSkipFocus(nsIContent* aContent)
{
return mFocusedContent == aContent;
}
void FlushBeforeEventHandlingIfNeeded(nsIContent* aContent)
{
if (mEventHandlingNeedsFlush) {
nsCOMPtr<nsIDocument> doc = aContent->GetComposedDoc();
if (doc) {
mEventHandlingNeedsFlush = false;
doc->FlushPendingNotifications(mozilla::FlushType::Layout);
}
}
}
/**
* Update the caret with current mode (whether in caret browsing mode or not).
*/
@ -561,6 +585,10 @@ private:
// moving focus.
nsCOMPtr<nsIDocument> mMouseButtonEventHandlingDocument;
// If set to true, layout of the document of the event target should be
// flushed before handling focus depending events.
bool mEventHandlingNeedsFlush;
static bool sTestMode;
// the single focus manager

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

@ -4925,6 +4925,14 @@ HTMLInputElement::HandleTypeChange(uint8_t aNewType, bool aNotify)
uint8_t oldType = mType;
MOZ_ASSERT(oldType != aNewType);
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
// Input element can represent very different kinds of UIs, and we may
// need to flush styling even when focusing the already focused input
// element.
fm->NeedsFlushBeforeEventHandling(this);
}
if (aNewType == NS_FORM_INPUT_FILE || oldType == NS_FORM_INPUT_FILE) {
if (aNewType == NS_FORM_INPUT_FILE) {
mFileData.reset(new FileData());

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

@ -14,6 +14,10 @@ UNIFIED_SOURCES += [
'nsPopupWindowManager.cpp',
]
LOCAL_INCLUDES += [
'/caps',
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'

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

@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=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/. */
@ -41,6 +42,7 @@
#include "nsIObserverService.h"
#include "nsPrintfCString.h"
#include "mozilla/AbstractThread.h"
#include "ContentPrincipal.h"
static nsPermissionManager *gPermissionManager = nullptr;
@ -238,6 +240,37 @@ GetNextSubDomainForHost(const nsACString& aHost)
return subDomain;
}
// This function produces a nsIURI which is identical to the current
// nsIURI, except that it has one less subdomain segment. It returns
// `nullptr` if there are no more segments to remove.
already_AddRefed<nsIURI>
GetNextSubDomainURI(nsIURI* aURI)
{
nsAutoCString host;
nsresult rv = aURI->GetHost(host);
if (NS_FAILED(rv)) {
return nullptr;
}
nsCString domain = GetNextSubDomainForHost(host);
if (domain.IsEmpty()) {
return nullptr;
}
nsCOMPtr<nsIURI> uri;
rv = aURI->Clone(getter_AddRefs(uri));
if (NS_FAILED(rv) || !uri) {
return nullptr;
}
rv = uri->SetHost(domain);
if (NS_FAILED(rv)) {
return nullptr;
}
return uri.forget();
}
// This function produces a nsIPrincipal which is identical to the current
// nsIPrincipal, except that it has one less subdomain segment. It returns
// `nullptr` if there are no more segments to remove.
@ -250,26 +283,9 @@ GetNextSubDomainPrincipal(nsIPrincipal* aPrincipal)
return nullptr;
}
nsAutoCString host;
rv = uri->GetHost(host);
if (NS_FAILED(rv)) {
return nullptr;
}
nsCString domain = GetNextSubDomainForHost(host);
if (domain.IsEmpty()) {
return nullptr;
}
// Create a new principal which is identical to the current one, but with the new host
nsCOMPtr<nsIURI> newURI;
rv = uri->Clone(getter_AddRefs(newURI));
if (NS_FAILED(rv)) {
return nullptr;
}
rv = newURI->SetHost(domain);
if (NS_FAILED(rv)) {
nsCOMPtr<nsIURI> newURI = GetNextSubDomainURI(uri);
if (!newURI) {
return nullptr;
}
@ -711,6 +727,18 @@ nsPermissionManager::PermissionKey::CreateFromPrincipal(nsIPrincipal* aPrincipal
return new PermissionKey(origin);
}
nsPermissionManager::PermissionKey*
nsPermissionManager::PermissionKey::CreateFromURI(nsIURI* aURI, nsresult& aResult)
{
nsAutoCString origin;
aResult = ContentPrincipal::GenerateOriginNoSuffixFromURI(aURI, origin);
if (NS_WARN_IF(NS_FAILED(aResult))) {
return nullptr;
}
return new PermissionKey(origin);
}
/**
* Simple callback used by |AsyncClose| to trigger a treatment once
* the database is closed.
@ -2069,11 +2097,7 @@ nsPermissionManager::TestExactPermission(nsIURI *aURI,
const char *aType,
uint32_t *aPermission)
{
nsCOMPtr<nsIPrincipal> principal;
nsresult rv = GetPrincipal(aURI, getter_AddRefs(principal));
NS_ENSURE_SUCCESS(rv, rv);
return TestExactPermissionFromPrincipal(principal, aType, aPermission);
return CommonTestPermission(aURI, aType, aPermission, true, true);
}
NS_IMETHODIMP
@ -2097,11 +2121,7 @@ nsPermissionManager::TestPermission(nsIURI *aURI,
const char *aType,
uint32_t *aPermission)
{
nsCOMPtr<nsIPrincipal> principal;
nsresult rv = GetPrincipal(aURI, getter_AddRefs(principal));
NS_ENSURE_SUCCESS(rv, rv);
return TestPermissionFromPrincipal(principal, aType, aPermission);
return CommonTestPermission(aURI, aType, aPermission, false, true);
}
NS_IMETHODIMP
@ -2198,16 +2218,19 @@ nsPermissionManager::GetPermissionObject(nsIPrincipal* aPrincipal,
}
nsresult
nsPermissionManager::CommonTestPermission(nsIPrincipal* aPrincipal,
const char *aType,
uint32_t *aPermission,
bool aExactHostMatch,
bool aIncludingSession)
nsPermissionManager::CommonTestPermissionInternal(nsIPrincipal* aPrincipal,
nsIURI * aURI,
const char * aType,
uint32_t * aPermission,
bool aExactHostMatch,
bool aIncludingSession)
{
NS_ENSURE_ARG_POINTER(aPrincipal);
MOZ_ASSERT(aPrincipal || aURI);
MOZ_ASSERT_IF(aPrincipal, !aURI);
NS_ENSURE_ARG_POINTER(aPrincipal || aURI);
NS_ENSURE_ARG_POINTER(aType);
if (nsContentUtils::IsSystemPrincipal(aPrincipal)) {
if (aPrincipal && nsContentUtils::IsSystemPrincipal(aPrincipal)) {
*aPermission = nsIPermissionManager::ALLOW_ACTION;
return NS_OK;
}
@ -2225,8 +2248,8 @@ nsPermissionManager::CommonTestPermission(nsIPrincipal* aPrincipal,
for (size_t i = 0; i < whitelist->Length(); ++i) {
uint32_t perm;
rv = CommonTestPermission(whitelist->ElementAt(i), aType, &perm, aExactHostMatch,
aIncludingSession);
rv = CommonTestPermission(whitelist->ElementAt(i), aType, &perm,
aExactHostMatch, aIncludingSession);
NS_ENSURE_SUCCESS(rv, rv);
if (perm == nsIPermissionManager::ALLOW_ACTION) {
*aPermission = perm;
@ -2240,14 +2263,24 @@ nsPermissionManager::CommonTestPermission(nsIPrincipal* aPrincipal,
return NS_OK;
}
MOZ_ASSERT(PermissionAvaliable(aPrincipal, aType));
#ifdef DEBUG
{
nsCOMPtr<nsIPrincipal> prin = aPrincipal;
if (!prin) {
prin = mozilla::BasePrincipal::CreateCodebasePrincipal(aURI, OriginAttributes());
}
MOZ_ASSERT(PermissionAvaliable(prin, aType));
}
#endif
int32_t typeIndex = GetTypeIndex(aType, false);
// If type == -1, the type isn't known,
// so just return NS_OK
if (typeIndex == -1) return NS_OK;
PermissionHashKey* entry = GetPermissionHashKey(aPrincipal, typeIndex, aExactHostMatch);
PermissionHashKey* entry = aPrincipal ?
GetPermissionHashKey(aPrincipal, typeIndex, aExactHostMatch) :
GetPermissionHashKey(aURI, typeIndex, aExactHostMatch);
if (!entry ||
(!aIncludingSession &&
entry->GetPermission(typeIndex).mNonSessionExpireType ==
@ -2317,6 +2350,74 @@ nsPermissionManager::GetPermissionHashKey(nsIPrincipal* aPrincipal,
return nullptr;
}
// Returns PermissionHashKey for a given { host, appId, isInBrowserElement } tuple.
// This is not simply using PermissionKey because we will walk-up domains in
// case of |host| contains sub-domains.
// Returns null if nothing found.
// Also accepts host on the format "<foo>". This will perform an exact match
// lookup as the string doesn't contain any dots.
nsPermissionManager::PermissionHashKey*
nsPermissionManager::GetPermissionHashKey(nsIURI* aURI,
uint32_t aType,
bool aExactHostMatch)
{
#ifdef DEBUG
{
nsCOMPtr<nsIPrincipal> principal;
nsresult rv = GetPrincipal(aURI, getter_AddRefs(principal));
MOZ_ASSERT_IF(NS_SUCCEEDED(rv),
PermissionAvaliable(principal, mTypeArray[aType].get()));
}
#endif
nsresult rv;
RefPtr<PermissionKey> key =
PermissionKey::CreateFromURI(aURI, rv);
if (!key) {
return nullptr;
}
PermissionHashKey* entry = mPermissionTable.GetEntry(key);
if (entry) {
PermissionEntry permEntry = entry->GetPermission(aType);
// if the entry is expired, remove and keep looking for others.
// Note that EXPIRE_SESSION only honors expireTime if it is nonzero.
if ((permEntry.mExpireType == nsIPermissionManager::EXPIRE_TIME ||
(permEntry.mExpireType == nsIPermissionManager::EXPIRE_SESSION &&
permEntry.mExpireTime != 0)) &&
permEntry.mExpireTime <= (PR_Now() / 1000)) {
entry = nullptr;
// If we need to remove a permission we mint a principal. This is a bit
// inefficient, but hopefully this code path isn't super common.
nsCOMPtr<nsIPrincipal> principal;
nsresult rv = GetPrincipal(aURI, getter_AddRefs(principal));
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
RemoveFromPrincipal(principal, mTypeArray[aType].get());
} else if (permEntry.mPermission == nsIPermissionManager::UNKNOWN_ACTION) {
entry = nullptr;
}
}
if (entry) {
return entry;
}
// If aExactHostMatch wasn't true, we can check if the base domain has a permission entry.
if (!aExactHostMatch) {
nsCOMPtr<nsIURI> uri = GetNextSubDomainURI(aURI);
if (uri) {
return GetPermissionHashKey(uri, aType, aExactHostMatch);
}
}
// No entry, really...
return nullptr;
}
NS_IMETHODIMP nsPermissionManager::GetEnumerator(nsISimpleEnumerator **aEnum)
{
if (XRE_IsContentProcess()) {

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

@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=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/. */
@ -76,6 +77,8 @@ public:
public:
static PermissionKey* CreateFromPrincipal(nsIPrincipal* aPrincipal,
nsresult& aResult);
static PermissionKey* CreateFromURI(nsIURI* aURI,
nsresult& aResult);
explicit PermissionKey(const nsACString& aOrigin)
: mOrigin(aOrigin)
@ -273,12 +276,36 @@ private:
PermissionHashKey* GetPermissionHashKey(nsIPrincipal* aPrincipal,
uint32_t aType,
bool aExactHostMatch);
PermissionHashKey* GetPermissionHashKey(nsIURI* aURI,
uint32_t aType,
bool aExactHostMatch);
nsresult CommonTestPermission(nsIPrincipal* aPrincipal,
const char *aType,
uint32_t *aPermission,
const char * aType,
uint32_t * aPermission,
bool aExactHostMatch,
bool aIncludingSession)
{
return CommonTestPermissionInternal(aPrincipal, nullptr, aType,
aPermission, aExactHostMatch,
aIncludingSession);
}
nsresult CommonTestPermission(nsIURI * aURI,
const char* aType,
uint32_t * aPermission,
bool aExactHostMatch,
bool aIncludingSession);
bool aIncludingSession)
{
return CommonTestPermissionInternal(nullptr, aURI, aType, aPermission,
aExactHostMatch, aIncludingSession);
}
// Only one of aPrincipal or aURI is allowed to be passed in.
nsresult CommonTestPermissionInternal(nsIPrincipal* aPrincipal,
nsIURI * aURI,
const char * aType,
uint32_t * aPermission,
bool aExactHostMatch,
bool aIncludingSession);
nsresult OpenDatabase(nsIFile* permissionsFile);
nsresult InitDB(bool aRemoveFile);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -13,11 +13,11 @@
#include <d3d11.h>
#include <dxgi1_2.h>
struct ShaderBytes;
namespace mozilla {
namespace layers {
struct ShaderBytes;
class DeviceAttachmentsD3D11
{
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(DeviceAttachmentsD3D11);

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

@ -0,0 +1,153 @@
# 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/.
import argparse
import codecs
import locale
import os
import re
import subprocess
import sys
import tempfile
import yaml
def shell_main():
parser = argparse.ArgumentParser()
parser.add_argument('-o', '--output', type=str, required=True,
help='Output file')
parser.add_argument('manifest', type=str,
help='Manifest source file')
args = parser.parse_args()
with open(args.output, 'w') as out_file:
process_manifest(out_file, args.manifest)
def main(output_fp, input_filename):
return process_manifest(output_fp, input_filename)
HEADER = """// AUTOGENERATED - DO NOT EDIT
namespace mozilla {
namespace layers {
struct ShaderBytes { const void* mData; size_t mLength; };
"""
FOOTER = """
} // namespace layers
} // namespace mozilla"""
def process_manifest(output_fp, manifest_filename):
with codecs.open(manifest_filename, 'r', 'UTF-8') as in_fp:
manifest = yaml.load(in_fp)
shader_folder, _ = os.path.split(manifest_filename)
output_fp.write(HEADER)
deps = set()
for block in manifest:
if 'type' not in block:
raise Exception("Expected 'type' key with shader mode")
if 'file' not in block:
raise Exception("Expected 'file' key with shader file")
if 'shaders' not in block:
raise Exception("Expected 'shaders' key with shader name list")
shader_file = os.path.join(shader_folder, block['file'])
deps.add(shader_file)
shader_model = block['type']
for shader_name in block['shaders']:
new_deps = run_fxc(
shader_model = shader_model,
shader_file = shader_file,
shader_name = shader_name,
output_fp = output_fp)
deps |= new_deps
output_fp.write(FOOTER)
return deps
def run_fxc(shader_model,
shader_file,
shader_name,
output_fp):
argv = [
'fxc',
'-nologo',
'-T{0}'.format(shader_model),
shader_file,
'-E{0}'.format(shader_name),
'-Vn{0}'.format(shader_name),
'-Vi',
]
if shader_model.startswith('vs_'):
argv += ['-DVERTEX_SHADER']
elif shader_model.startswith('ps_'):
argv += ['-DPIXEL_SHADER']
deps = None
with ScopedTempFilename() as temp_filename:
argv += ['-Fh{0}'.format(temp_filename)]
sys.stdout.write('{0}\n'.format(' '.join(argv)))
proc_stdout = subprocess.check_output(argv)
proc_stdout = decode_console_text(sys.stdout, proc_stdout)
deps = find_dependencies(proc_stdout)
assert len(deps) > 0
with open(temp_filename, 'r') as temp_fp:
output_fp.write(temp_fp.read())
output_fp.write("ShaderBytes s{0} = {{ {0}, sizeof({0}) }};\n".format(
shader_name))
return deps
def find_dependencies(fxc_output):
# Dependencies look like this:
# Resolved to [<path>]
#
# Microsoft likes to change output strings based on the user's language, so
# instead of pattern matching on that string, we take everything in between
# brackets. We filter out potentially bogus strings later.
deps = set()
for line in fxc_output.split('\n'):
m = re.search(r"\[([^\]]+)\]", line)
if m is None:
continue
dep_path = m.group(1)
dep_path = os.path.normpath(dep_path)
if os.path.isfile(dep_path):
deps.add(dep_path)
return deps
# Python reads the raw bytes from stdout, so we need to try our best to
# capture that as a valid Python string.
def decode_console_text(pipe, text):
try:
if pipe.encoding:
return text.decode(pipe.encoding, 'replace')
except:
pass
try:
return text.decode(locale.getpreferredencoding(), 'replace')
except:
return text.decode('utf8', 'replace')
# Allocate a temporary file name and delete it when done. We need an extra
# wrapper for this since TemporaryNamedFile holds the file open.
class ScopedTempFilename(object):
def __init__(self):
self.name = None
def __enter__(self):
with tempfile.NamedTemporaryFile(delete = False) as tmp:
self.name = tmp.name
return self.name
def __exit__(self, type, value, traceback):
if not self.name:
return
try:
os.unlink(self.name)
except:
pass
if __name__ == '__main__':
shell_main()

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

@ -1,56 +0,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/.
tempfile=tmpShaderHeader
FXC_DEBUG_FLAGS="-Zi -Fd shaders.pdb"
FXC_FLAGS=""
# If DEBUG is in the environment, then rebuild with debug info
if [ "$DEBUG" != "" ] ; then
FXC_FLAGS="$FXC_DEBUG_FLAGS"
fi
makeShaderVS() {
fxc -nologo $FXC_FLAGS -Tvs_4_0_level_9_3 $SRC -E$1 -Vn$1 -Fh$tempfile
echo "ShaderBytes s$1 = { $1, sizeof($1) };" >> $tempfile;
cat $tempfile >> $DEST
}
makeShaderPS() {
fxc -nologo $FXC_FLAGS -Tps_4_0_level_9_3 $SRC -E$1 -Vn$1 -Fh$tempfile
echo "ShaderBytes s$1 = { $1, sizeof($1) };" >> $tempfile;
cat $tempfile >> $DEST
}
SRC=CompositorD3D11.hlsl
DEST=CompositorD3D11Shaders.h
rm -f $DEST
echo "struct ShaderBytes { const void* mData; size_t mLength; };" >> $DEST;
makeShaderVS LayerQuadVS
makeShaderVS LayerDynamicVS
makeShaderPS SolidColorShader
makeShaderPS RGBShader
makeShaderPS RGBAShader
makeShaderPS ComponentAlphaShader
makeShaderPS YCbCrShader
makeShaderPS NV12Shader
makeShaderVS LayerQuadMaskVS
makeShaderVS LayerDynamicMaskVS
makeShaderPS SolidColorShaderMask
makeShaderPS RGBShaderMask
makeShaderPS RGBAShaderMask
makeShaderPS YCbCrShaderMask
makeShaderPS NV12ShaderMask
makeShaderPS ComponentAlphaShaderMask
# Mix-blend shaders
makeShaderVS LayerQuadBlendVS
makeShaderVS LayerQuadBlendMaskVS
makeShaderVS LayerDynamicBlendVS
makeShaderVS LayerDynamicBlendMaskVS
makeShaderPS BlendShader
rm $tempfile

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

@ -0,0 +1,28 @@
- type: vs_4_0_level_9_3
file: CompositorD3D11.hlsl
shaders:
- LayerQuadVS
- LayerDynamicVS
- LayerQuadMaskVS
- LayerDynamicMaskVS
- LayerQuadBlendVS
- LayerQuadBlendMaskVS
- LayerDynamicBlendVS
- LayerDynamicBlendMaskVS
- type: ps_4_0_level_9_3
file: CompositorD3D11.hlsl
shaders:
- SolidColorShader
- RGBShader
- RGBAShader
- ComponentAlphaShader
- YCbCrShader
- NV12Shader
- SolidColorShaderMask
- RGBShaderMask
- RGBAShaderMask
- YCbCrShaderMask
- NV12ShaderMask
- ComponentAlphaShaderMask
- BlendShader

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

@ -464,6 +464,15 @@ IPDL_SOURCES += [
include('/ipc/chromium/chromium-config.mozbuild')
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
GENERATED_FILES = [
'CompositorD3D11Shaders.h',
]
d3d11_shaders = GENERATED_FILES['CompositorD3D11Shaders.h']
d3d11_shaders.script = 'd3d11/genshaders.py'
d3d11_shaders.inputs = ['d3d11/shaders.manifest']
LOCAL_INCLUDES += [
'/docshell/base', # for nsDocShell.h
'/layout/base', # for TouchManager.h

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

@ -42,9 +42,13 @@
*/
// See CompositorD3D11Shaders.h
namespace mozilla {
namespace layers {
struct ShaderBytes { const void* mData; size_t mLength; };
extern ShaderBytes sRGBShader;
extern ShaderBytes sLayerQuadVS;
} // namespace layers
} // namespace mozilla
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
@ -1504,4 +1508,4 @@ VRSystemManagerOculus::RemoveControllers()
mOculusController.Clear();
mControllerCount = 0;
}
}

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

@ -774,6 +774,7 @@ MessageChannel::Open(Transport* aTransport, MessageLoop* aIOLoop, Side aSide)
mWorkerLoop = MessageLoop::current();
mWorkerLoopID = mWorkerLoop->id();
mWorkerLoop->AddDestructionObserver(this);
mListener->SetIsMainThreadProtocol();
if (!AbstractThread::GetCurrent()) {
mWorkerLoop->AddDestructionObserver(
@ -859,6 +860,7 @@ MessageChannel::CommonThreadOpenInit(MessageChannel *aTargetChan, Side aSide)
mWorkerLoop = MessageLoop::current();
mWorkerLoopID = mWorkerLoop->id();
mWorkerLoop->AddDestructionObserver(this);
mListener->SetIsMainThreadProtocol();
if (!AbstractThread::GetCurrent()) {
mWorkerLoop->AddDestructionObserver(

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

@ -19,6 +19,7 @@
#include "mozilla/ipc/MessageChannel.h"
#include "mozilla/ipc/Transport.h"
#include "mozilla/StaticMutex.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/Unused.h"
#include "nsPrintfCString.h"
@ -815,6 +816,13 @@ IToplevelProtocol::ShmemDestroyed(const Message& aMsg)
already_AddRefed<nsIEventTarget>
IToplevelProtocol::GetMessageEventTarget(const Message& aMsg)
{
if (IsMainThreadProtocol() && SystemGroup::Initialized()) {
if (aMsg.type() == SHMEM_CREATED_MESSAGE_TYPE ||
aMsg.type() == SHMEM_DESTROYED_MESSAGE_TYPE) {
return do_AddRef(SystemGroup::EventTargetFor(TaskCategory::Other));
}
}
int32_t route = aMsg.routing_id();
Maybe<MutexAutoLock> lock;

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

@ -386,6 +386,10 @@ public:
GetActorEventTarget();
virtual void OnChannelReceivedMessage(const Message& aMsg) {}
bool IsMainThreadProtocol() const { return mIsMainThreadProtocol; }
void SetIsMainThreadProtocol() { mIsMainThreadProtocol = NS_IsMainThread(); }
protected:
// Override this method in top-level protocols to change the event target
// for a new actor (and its sub-actors).
@ -413,6 +417,7 @@ protected:
int32_t mLastRouteId;
IDMap<Shmem::SharedMemory*> mShmemMap;
Shmem::id_t mLastShmemId;
bool mIsMainThreadProtocol;
Mutex mEventTargetMutex;
IDMap<nsCOMPtr<nsIEventTarget>> mEventTargetMap;

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

@ -1080,8 +1080,6 @@ description =
description =
[PCookieService::GetCookieString]
description =
[PPrinting::ShowProgress]
description =
[PPrinting::SavePrintSettings]
description =
[PHandlerService::FillHandlerInfo]

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

@ -432,13 +432,8 @@ if args.variant in ('tsan', 'msan'):
print >> outfh, "%d %s" % (count, location)
print(open(summary_filename, 'rb').read())
max_allowed = None
if 'max-errors' in variant:
max_allowed = variant['max-errors']
elif 'expect-errors' in variant:
max_allowed = len(variant['expect-errors'])
if max_allowed is not None:
print("Found %d errors out of %d allowed" % (len(sites), max_allowed))
if len(sites) > max_allowed:
results.append(1)
@ -467,12 +462,18 @@ if args.variant in ('tsan', 'msan'):
# expect-errors is an array of (filename, function) tuples.
expect = tuple(expect)
if remaining[expect] == 0:
print("Did not see expected error in %s function %s" % expect)
print("Did not see known error in %s function %s" % expect)
else:
remaining[expect] -= 1
status = 0
for filename, function in (e for e, c in remaining.items() if c > 0):
print("*** tsan error in %s function %s" % (filename, function))
if AUTOMATION:
print("TinderboxPrint: tsan error<br/>%s function %s" % (filename, function))
status = 1
else:
print("*** tsan error in %s function %s" % (filename, function))
results.append(status)
# Gather individual results into a tarball. Note that these are
# distinguished only by pid of the JS process running within each test, so

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

@ -1,10 +1,14 @@
# Skip tests that rely on wasm signal handlers.
asm.js/testTimeout1.js
asm.js/testTimeout2.js
asm.js/testTimeout3.js
asm.js/testTimeout4.js
asm.js/testTimeout5.js
asm.js/testTimeout6.js
basic/spread-call-maxarg.js
basic/spread-call-near-maxarg.js
ion/iloop.js
wasm/timeout
# Skip tests that run too slowly under tsan.
basic/spread-call-maxarg.js
basic/spread-call-near-maxarg.js
arrays/too-long-array-splice.js

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

@ -9,27 +9,36 @@
"JSTESTS_EXTRA_ARGS": "--exclude-file={DIR}/cgc-jstests-slow.txt",
"TSAN_OPTIONS": "exitcode=0 log_path={OUTDIR}/sanitize_log"
},
"[comment on expect-errors]": "Note that expect-errors may contain duplicates. These indicate that tsan reports errors as two distinct line numbers. We cannot just insert line numbers, because they will shift around between versions.",
"[comment on expect-errors]": "Note that expect-errors may contain duplicates. These indicate that tsan reports errors as two distinct line numbers in the same function. (Line number shift around, so we cannot just include them here.)",
"expect-errors": [
[ "Shape.h", "inDictionary" ],
[ "jsfriendapi.h", "GetObjectClass" ],
[ "Shape.h", "maybeSlot" ],
[ "Barrier.h", "set" ],
[ "jitprofiling.c", "iJIT_GetNewMethodID" ],
[ "Statistics.h", "count" ],
[ "Shape.h", "slotSpan" ],
[ "Shape.h", "setSlotWithType" ],
[ "Shape.h", "search<js::MaybeAdding::NotAdding>" ],
[ "Shape.h", "setOverwritten" ],
[ "TestingFunctions.cpp", "js::DefineTestingFunctions(JSContext*, JS::Handle<JSObject*>, bool, bool)" ],
[ "TestingFunctions.cpp", "js::DefineTestingFunctions(JSContext*, JS::Handle<JSObject*>, bool, bool)" ],
[ "OSObject.cpp", "js::shell::DefineOS(JSContext*, JS::Handle<JSObject*>, bool, js::shell::RCFile**, js::shell::RCFile**)" ],
[ "OSObject.cpp", "js::shell::DefineOS(JSContext*, JS::Handle<JSObject*>, bool, js::shell::RCFile**, js::shell::RCFile**)" ],
[ "ObjectGroup.h", "addendumKind" ],
[ "jsfriendapi.h", "numFixedSlots" ],
[ "Marking.cpp", "js::GCMarker::reset()" ],
[ "jsfun.h", "setResolvedLength" ],
[ "Shape.h", "incrementNumLinearSearches" ],
[ "Shape.h", "isBigEnoughForAShapeTable" ],
[ "Shape.h", "js::jit::CodeGenerator::emitGetPropertyPolymorphic(js::jit::LInstruction*, js::jit::Register, js::jit::Register, js::jit::TypedOrValueRegister const&)" ],
[ "ProtectedData.h", "operator=<js::CooperatingContext>" ],
[ "ProtectedData.h", "js::ZoneGroup::leave()" ],
[ "jsfriendapi.h", "GetObjectClass" ],
[ "jsfriendapi.h", "numFixedSlots" ],
[ "jsfriendapi.h", "numDynamicSlots" ],
[ "jsfriendapi.h", "EmulatesUndefined" ],
[ "jitprofiling.c", "iJIT_GetNewMethodID" ],
[ "Marking.cpp", "js::GCMarker::reset()" ],
[ "Statistics.h", "js::gc::GCRuntime::pickChunk(js::AutoLockGC const&, js::gc::AutoMaybeStartBackgroundAllocation&)" ],
[ "jsfun.h", "needsSomeEnvironmentObject" ],
[ "Statistics.h", "js::gc::GCRuntime::getOrAllocChunk(js::AutoLockGC const&, js::gc::AutoMaybeStartBackgroundAllocation&)" ],
[ "Barrier.h", "set" ],
[ "Stack.h", "context" ],
[ "Stack.h", "js::HelperThread::handleIonWorkload(js::AutoLockHelperThreadState&)" ],
[ "ObjectGroup.h", "addendumKind" ],
[ "ObjectGroup.h", "generation" ],
[ "ObjectGroup.h", "js::jit::MObjectState::New(js::jit::TempAllocator&, js::jit::MDefinition*)" ],
[ "TypeInference-inl.h", "setBasePropertyCount" ],
[ "Statistics.h", "js::gc::GCRuntime::getOrAllocChunk(js::AutoLockGC const&, js::gc::AutoMaybeStartBackgroundAllocation&)" ]
[ "jsscript.h", "decref" ],
[ "jsfun.h", "setResolvedLength" ],
[ "jsfun.h", "needsSomeEnvironmentObject" ]
]
}

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

@ -5422,7 +5422,14 @@ BytecodeEmitter::emitIteratorClose(IteratorKind iterKind /* = IteratorKind::Sync
checkTypeSet(JSOP_CALL);
if (iterKind == IteratorKind::Async) {
if (!emitAwait()) // ... ... RESULT
if (completionKind != CompletionKind::Throw) {
// Await clobbers rval, so save the current rval.
if (!emit1(JSOP_GETRVAL)) // ... ... RESULT RVAL
return false;
if (!emit1(JSOP_SWAP)) // ... ... RVAL RESULT
return false;
}
if (!emitAwait()) // ... ... RVAL? RESULT
return false;
}
@ -5450,8 +5457,15 @@ BytecodeEmitter::emitIteratorClose(IteratorKind iterKind /* = IteratorKind::Sync
if (!emitPopN(2)) // ... RESULT
return false;
} else {
if (!emitCheckIsObj(CheckIsObjectKind::IteratorReturn)) // ... RESULT
if (!emitCheckIsObj(CheckIsObjectKind::IteratorReturn)) // ... RVAL? RESULT
return false;
if (iterKind == IteratorKind::Async) {
if (!emit1(JSOP_SWAP)) // ... RESULT RVAL
return false;
if (!emit1(JSOP_SETRVAL)) // ... RESULT
return false;
}
}
if (!ifReturnMethodIsDefined.emitElse())

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

@ -241,7 +241,10 @@ def main(argv):
if options.exclude_from:
with open(options.exclude_from) as fh:
options.exclude += [_.strip() for _ in fh]
for line in fh:
line = line.strip()
if not line.startswith("#") and len(line):
options.exclude.append(line)
if options.exclude:
exclude_list = []

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

@ -507,17 +507,11 @@ skip script test262/language/statements/for-await-of/async-func-dstr-let-ary-ptr
skip script test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-iter-step-err.js
skip script test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision-step-err.js
skip script test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-iter-step-err.js
skip script test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-iter-close.js
skip script test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-step-err.js
skip script test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-iter-close.js
skip script test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-iter-step-err.js
skip script test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-iter-close.js
skip script test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-step-err.js
skip script test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-iter-step-err.js
skip script test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-iter-close.js
skip script test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-iter-close.js
skip script test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-step-err.js
skip script test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-iter-close.js
skip script test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-iter-step-err.js
# Missing expression statement restriction for "async function"

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

@ -8006,6 +8006,13 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent,
bool touchIsNew = false;
bool isHandlingUserInput = false;
if (mCurrentEventContent && aEvent->IsTargetedAtFocusedWindow()) {
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
fm->FlushBeforeEventHandlingIfNeeded(mCurrentEventContent);
}
}
// XXX How about IME events and input events for plugins?
if (aEvent->IsTrusted()) {
switch (aEvent->mMessage) {

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

@ -879,10 +879,6 @@ pref("dom.push.maxRecentMessageIDsPerSubscription", 0);
pref("dom.push.enabled", true);
#endif
// Maximum number of setTimeout()/setInterval() callbacks to run in a single
// event loop runnable. Minimum value of 1.
pref("dom.timeout.max_consecutive_callbacks", 3);
// The remote content URL where FxAccountsWebChannel messages originate. Must use HTTPS.
pref("identity.fxaccounts.remote.webchannel.uri", "https://accounts.firefox.com");

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

@ -4824,6 +4824,7 @@ pref("xpinstall.signatures.required", false);
pref("extensions.alwaysUnpack", false);
pref("extensions.minCompatiblePlatformVersion", "2.0");
pref("extensions.webExtensionsMinPlatformVersion", "42.0a1");
pref("extensions.legacy.enabled", true);
pref("extensions.allow-non-mpc-extensions", true);
// Other webextensions prefs
@ -5716,9 +5717,9 @@ pref("dom.IntersectionObserver.enabled", true);
// Whether module scripts (<script type="module">) are enabled for content.
pref("dom.moduleScripts.enabled", false);
// Maximum number of setTimeout()/setInterval() callbacks to run in a single
// event loop runnable. Minimum value of 1.
pref("dom.timeout.max_consecutive_callbacks", 5);
// Maximum amount of time in milliseconds consecutive setTimeout()/setInterval()
// callback are allowed to run before yielding the event loop.
pref("dom.timeout.max_consecutive_callbacks_ms", 4);
#ifdef FUZZING
pref("fuzzing.enabled", false);

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

@ -21,12 +21,10 @@ sync protocol PPrinting
manages PRemotePrintJob;
parent:
sync ShowProgress(PBrowser browser,
PPrintProgressDialog printProgressDialog,
nullable PRemotePrintJob remotePrintJob,
bool isForPrinting)
returns(bool notifyOnOpen,
nsresult rv);
async ShowProgress(PBrowser browser,
PPrintProgressDialog printProgressDialog,
nullable PRemotePrintJob remotePrintJob,
bool isForPrinting);
async ShowPrintDialog(PPrintSettingsDialog dialog,
nullable PBrowser browser,

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

@ -33,24 +33,13 @@ mozilla::ipc::IPCResult
PrintingParent::RecvShowProgress(PBrowserParent* parent,
PPrintProgressDialogParent* printProgressDialog,
PRemotePrintJobParent* remotePrintJob,
const bool& isForPrinting,
bool* notifyOnOpen,
nsresult* result)
const bool& isForPrinting)
{
*result = NS_ERROR_FAILURE;
*notifyOnOpen = false;
bool notifyOnOpen = false;
nsCOMPtr<nsPIDOMWindowOuter> parentWin = DOMWindowFromBrowserParent(parent);
if (!parentWin) {
return IPC_OK();
}
nsCOMPtr<nsIPrintingPromptService> pps(do_GetService("@mozilla.org/embedcomp/printingprompt-service;1"));
if (!pps) {
return IPC_OK();
}
PrintProgressDialogParent* dialogParent =
static_cast<PrintProgressDialogParent*>(printProgressDialog);
nsCOMPtr<nsIObserver> observer = do_QueryInterface(dialogParent);
@ -58,24 +47,42 @@ PrintingParent::RecvShowProgress(PBrowserParent* parent,
nsCOMPtr<nsIWebProgressListener> printProgressListener;
nsCOMPtr<nsIPrintProgressParams> printProgressParams;
*result = pps->ShowProgress(parentWin, nullptr, nullptr, observer,
isForPrinting,
getter_AddRefs(printProgressListener),
getter_AddRefs(printProgressParams),
notifyOnOpen);
NS_ENSURE_SUCCESS(*result, IPC_OK());
if (remotePrintJob) {
// If we have a RemotePrintJob use that as a more general forwarder for
// print progress listeners.
static_cast<RemotePrintJobParent*>(remotePrintJob)
->RegisterListener(printProgressListener);
} else {
dialogParent->SetWebProgressListener(printProgressListener);
nsresult rv = NS_ERROR_INVALID_ARG;
if (parentWin && pps) {
rv = pps->ShowProgress(parentWin, nullptr, nullptr, observer,
isForPrinting,
getter_AddRefs(printProgressListener),
getter_AddRefs(printProgressParams),
&notifyOnOpen);
}
dialogParent->SetPrintProgressParams(printProgressParams);
if (NS_SUCCEEDED(rv)) {
if (remotePrintJob) {
// If we have a RemotePrintJob use that as a more general forwarder for
// print progress listeners.
static_cast<RemotePrintJobParent*>(remotePrintJob)
->RegisterListener(printProgressListener);
} else {
dialogParent->SetWebProgressListener(printProgressListener);
}
dialogParent->SetPrintProgressParams(printProgressParams);
}
// NOTE: If we aren't going to observe an event on our observer, we need to
// fake one. This takes the form of sending the SendDialogOpened message. This
// is safe because the child process proxy will always return `true` for
// notifyOnOpen, as the request will always be async when performed across
// process boundaries.
//
// We can pass nullptr for all of the arguments, as all consumers of this
// observer don't care about the subject, topic, or data.
//
// If notifyOnOpen is true, then the ShowProgress call will handle notifying
// our observer for us.
if (!notifyOnOpen) {
observer->Observe(nullptr, nullptr, nullptr);
}
return IPC_OK();
}

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

@ -33,9 +33,7 @@ public:
RecvShowProgress(PBrowserParent* parent,
PPrintProgressDialogParent* printProgressDialog,
PRemotePrintJobParent* remotePrintJob,
const bool& isForPrinting,
bool* notifyOnOpen,
nsresult* result);
const bool& isForPrinting);
virtual mozilla::ipc::IPCResult
RecvShowPrintDialog(PPrintSettingsDialogParent* aDialog,
PBrowserParent* aParent,

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

@ -166,12 +166,12 @@ nsPrintingProxy::ShowProgress(mozIDOMWindowProxy* parent,
}
}
nsresult rv = NS_OK;
// NOTE: We set notifyOnOpen to true unconditionally. If the parent process
// would get `false` for notifyOnOpen, then it will synthesize a notification
// which will be sent asynchronously down to the child.
*notifyOnOpen = true;
mozilla::Unused << SendShowProgress(pBrowser, dialogChild, remotePrintJob,
isForPrinting, notifyOnOpen, &rv);
if (NS_FAILED(rv)) {
return rv;
}
isForPrinting);
// If we have a RemotePrintJob that will be being used as a more general
// forwarder for print progress listeners. Once we always have one we can

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

@ -246,6 +246,13 @@ this.AppConstants = Object.freeze({
false,
#endif
MOZ_ADDON_SIGNING:
#ifdef MOZ_ADDON_SIGNING
true,
#else
false,
#endif
MOZ_REQUIRE_SIGNING:
#ifdef MOZ_REQUIRE_SIGNING
true,
@ -253,6 +260,13 @@ this.AppConstants = Object.freeze({
false,
#endif
MOZ_ALLOW_LEGACY_EXTENSIONS:
#ifdef MOZ_ALLOW_LEGACY_EXTENSIONS
true,
#else
false,
#endif
INSTALL_COMPACT_THEMES:
#ifdef INSTALL_COMPACT_THEMES
true,

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

@ -538,6 +538,10 @@ project_flag('MOZ_ANDROID_HISTORY',
help='Enable Android History instead of Places',
set_as_define=True)
project_flag('MOZ_ALLOW_LEGACY_EXTENSIONS',
help='Allow legacy browser extensions',
default=True, set_as_define=True)
option(env='MOZ_PHOTON_ANIMATIONS',
help='Enable Photon UI animations',
default=milestone.is_nightly)

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

@ -19,6 +19,7 @@ Cu.import("resource://gre/modules/DownloadUtils.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/addons/AddonRepository.jsm");
Cu.import("resource://gre/modules/addons/AddonSettings.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "E10SUtils", "resource:///modules/E10SUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Extension",
@ -28,11 +29,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "ExtensionParent",
XPCOMUtils.defineLazyModuleGetter(this, "Preferences",
"resource://gre/modules/Preferences.jsm");
const CONSTANTS = {};
Cu.import("resource://gre/modules/addons/AddonConstants.jsm", CONSTANTS);
const SIGNING_REQUIRED = CONSTANTS.REQUIRE_SIGNING ?
true :
Services.prefs.getBoolPref("xpinstall.signatures.required");
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm");
@ -2916,7 +2912,7 @@ var gListView = {
filterDisabledUnsigned(aFilter = true) {
let foundDisabledUnsigned = false;
if (SIGNING_REQUIRED) {
if (AddonSettings.REQUIRE_SIGNING) {
for (let item of this._listBox.childNodes) {
if (!isCorrectlySigned(item.mAddon))
foundDisabledUnsigned = true;
@ -3396,7 +3392,7 @@ var gDetailView = {
errorLink.value = gStrings.ext.GetStringFromName("details.notification.blocked.link");
errorLink.href = this._addon.blocklistURL;
errorLink.hidden = false;
} else if (!isCorrectlySigned(this._addon) && SIGNING_REQUIRED) {
} else if (!isCorrectlySigned(this._addon) && AddonSettings.REQUIRE_SIGNING) {
this.node.setAttribute("notification", "error");
document.getElementById("detail-error").textContent = gStrings.ext.formatStringFromName(
"details.notification.unsignedAndDisabled", [this._addon.name, gStrings.brandShortName], 2

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

@ -1302,7 +1302,8 @@
this._errorLink.value = gStrings.ext.GetStringFromName("notification.blocked.link");
this._errorLink.href = this.mAddon.blocklistURL;
this._errorLink.hidden = false;
} else if (!isUpgrade && !isCorrectlySigned(this.mAddon) && SIGNING_REQUIRED) {
} else if (!isUpgrade && !isCorrectlySigned(this.mAddon) &&
AddonSettings.REQUIRE_SIGNING) {
this.setAttribute("notification", "error");
this._error.textContent = gStrings.ext.formatStringFromName(
"notification.unsignedAndDisabled", [this.mAddon.name, gStrings.brandShortName], 2

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

@ -1,31 +0,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/. */
"use strict";
this.EXPORTED_SYMBOLS = [ "ADDON_SIGNING", "REQUIRE_SIGNING" ];
// Make these non-changable properties so they can't be manipulated from other
// code in the app.
Object.defineProperty(this, "ADDON_SIGNING", {
configurable: false,
enumerable: false,
writable: false,
#ifdef MOZ_ADDON_SIGNING
value: true,
#else
value: false,
#endif
});
Object.defineProperty(this, "REQUIRE_SIGNING", {
configurable: false,
enumerable: false,
writable: false,
#ifdef MOZ_REQUIRE_SIGNING
value: true,
#else
value: false,
#endif
});

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

@ -0,0 +1,44 @@
/* 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 {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
this.EXPORTED_SYMBOLS = [ "AddonSettings" ];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
const PREF_SIGNATURES_REQUIRED = "xpinstall.signatures.required";
const PREF_ALLOW_LEGACY = "extensions.legacy.enabled";
this.AddonSettings = {};
// Make a non-changable property that can't be manipulated from other
// code in the app.
function makeConstant(name, value) {
Object.defineProperty(AddonSettings, name, {
configurable: false,
enumerable: false,
writable: false,
value,
});
}
makeConstant("ADDON_SIGNING", AppConstants.MOZ_ADDON_SIGNING);
if (AppConstants.MOZ_REQUIRE_SIGNING && !Cu.isInAutomation) {
makeConstant("REQUIRE_SIGNING", true);
} else {
XPCOMUtils.defineLazyPreferenceGetter(AddonSettings, "REQUIRE_SIGNING",
PREF_SIGNATURES_REQUIRED, false);
}
if (AppConstants.MOZ_ALLOW_LEGACY_EXTENSIONS || Cu.isInAutomation) {
XPCOMUtils.defineLazyPreferenceGetter(AddonSettings, "ALLOW_LEGACY_EXTENSIONS",
PREF_ALLOW_LEGACY, true);
} else {
makeConstant("ALLOW_LEGACY_EXTENSIONS", false);
}

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

@ -11,10 +11,6 @@ const Cu = Components.utils;
this.EXPORTED_SYMBOLS = ["XPIProvider"];
const CONSTANTS = {};
Cu.import("resource://gre/modules/addons/AddonConstants.jsm", CONSTANTS);
const { ADDON_SIGNING, REQUIRE_SIGNING } = CONSTANTS
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm");
@ -22,6 +18,10 @@ Cu.import("resource://gre/modules/Preferences.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository",
"resource://gre/modules/addons/AddonRepository.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AddonSettings",
"resource://gre/modules/addons/AddonSettings.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
"resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ChromeManifestParser",
"resource://gre/modules/ChromeManifestParser.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
@ -229,6 +229,7 @@ const PREF_E10S_BLOCK_ENABLE = "extensions.e10sBlocksEnabling";
const PREF_E10S_ADDON_BLOCKLIST = "extensions.e10s.rollout.blocklist";
const PREF_E10S_ADDON_POLICY = "extensions.e10s.rollout.policy";
const PREF_E10S_HAS_NONEXEMPT_ADDON = "extensions.e10s.rollout.hasAddon";
const PREF_ALLOW_LEGACY = "extensions.legacy.enabled";
const PREF_ALLOW_NON_MPC = "extensions.allow-non-mpc-extensions";
const PREF_EM_MIN_COMPAT_APP_VERSION = "extensions.minCompatibleAppVersion";
@ -415,8 +416,7 @@ function mustSign(aType) {
if (!SIGNED_TYPES.has(aType))
return false;
return ((REQUIRE_SIGNING && !Cu.isInAutomation) ||
Preferences.get(PREF_XPI_SIGNATURES_REQUIRED, false));
return AddonSettings.REQUIRE_SIGNING;
}
// Keep track of where we are in startup for telemetry
@ -465,7 +465,7 @@ function loadLazyObjects() {
});
Object.assign(scope, {
ADDON_SIGNING,
ADDON_SIGNING: AddonSettings.ADDON_SIGNING,
SIGNED_TYPES,
BOOTSTRAP_REASONS,
DB_SCHEMA,
@ -937,6 +937,13 @@ function isUsableAddon(aAddon) {
return false;
}
if (!AddonSettings.ALLOW_LEGACY_EXTENSIONS &&
aAddon.type == "extension" && !aAddon.isSystem &&
aAddon.signedState !== AddonManager.SIGNEDSTATE_PRIVILEGED) {
logger.warn(`disabling legacy extension ${aAddon.id}`);
return false;
}
if (!ALLOW_NON_MPC && aAddon.type == "extension" &&
aAddon.multiprocessCompatible !== true) {
logger.warn(`disabling ${aAddon.id} since it is not multiprocess compatible`);
@ -1963,7 +1970,7 @@ function shouldVerifySignedState(aAddon) {
// Otherwise only check signatures if signing is enabled and the add-on is one
// of the signed types.
return ADDON_SIGNING && SIGNED_TYPES.has(aAddon.type);
return AddonSettings.ADDON_SIGNING && SIGNED_TYPES.has(aAddon.type);
}
/**
@ -1986,7 +1993,7 @@ function verifyZipSignedState(aFile, aAddon) {
});
let root = Ci.nsIX509CertDB.AddonsPublicRoot;
if (!REQUIRE_SIGNING && Preferences.get(PREF_XPI_SIGNATURES_DEV_ROOT, false))
if (!AppConstants.MOZ_REQUIRE_SIGNING && Preferences.get(PREF_XPI_SIGNATURES_DEV_ROOT, false))
root = Ci.nsIX509CertDB.AddonsStageRoot;
return new Promise(resolve => {
@ -2028,7 +2035,7 @@ function verifyDirSignedState(aDir, aAddon) {
});
let root = Ci.nsIX509CertDB.AddonsPublicRoot;
if (!REQUIRE_SIGNING && Preferences.get(PREF_XPI_SIGNATURES_DEV_ROOT, false))
if (!AppConstants.MOZ_REQUIRE_SIGNING && Preferences.get(PREF_XPI_SIGNATURES_DEV_ROOT, false))
root = Ci.nsIX509CertDB.AddonsStageRoot;
return new Promise(resolve => {
@ -3253,8 +3260,9 @@ this.XPIProvider = {
Services.prefs.addObserver(PREF_EM_MIN_COMPAT_PLATFORM_VERSION, this);
Services.prefs.addObserver(PREF_E10S_ADDON_BLOCKLIST, this);
Services.prefs.addObserver(PREF_E10S_ADDON_POLICY, this);
if (!REQUIRE_SIGNING || Cu.isInAutomation)
if (!AppConstants.MOZ_REQUIRE_SIGNING || Cu.isInAutomation)
Services.prefs.addObserver(PREF_XPI_SIGNATURES_REQUIRED, this);
Services.prefs.addObserver(PREF_ALLOW_LEGACY, this);
Services.prefs.addObserver(PREF_ALLOW_NON_MPC, this);
Services.obs.addObserver(this, NOTIFICATION_FLUSH_PERMISSIONS);
@ -4993,6 +5001,7 @@ this.XPIProvider = {
this.updateAddonAppDisabledStates();
break;
case PREF_XPI_SIGNATURES_REQUIRED:
case PREF_ALLOW_LEGACY:
case PREF_ALLOW_NON_MPC:
this.updateAddonAppDisabledStates();
break;

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

@ -7,6 +7,7 @@
EXTRA_JS_MODULES.addons += [
'AddonRepository.jsm',
'AddonRepository_SQLiteMigrator.jsm',
'AddonSettings.jsm',
'AddonUpdateChecker.jsm',
'APIExtensionBootstrap.js',
'Content.js',
@ -29,7 +30,3 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
EXTRA_JS_MODULES.addons += [
'PluginProvider.jsm',
]
EXTRA_PP_JS_MODULES.addons += [
'AddonConstants.jsm',
]

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

@ -4,7 +4,7 @@
// Tests various aspects of the details view
const { REQUIRE_SIGNING } = Components.utils.import("resource://gre/modules/addons/AddonConstants.jsm", {});
Components.utils.import("resource://gre/modules/AppConstants.jsm");
const PREF_AUTOUPDATE_DEFAULT = "extensions.update.autoUpdateDefault";
const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
@ -710,7 +710,7 @@ add_test(function() {
});
// These tests are only appropriate when signing can be turned off
if (!REQUIRE_SIGNING) {
if (!AppConstants.MOZ_REQUIRE_SIGNING) {
// Opens and tests the details view for add-on 9
add_test(function() {
open_details("addon9@tests.mozilla.org", "extension", function() {
@ -774,7 +774,7 @@ add_test(function() {
});
// These tests are only appropriate when signing can be turned off
if (!REQUIRE_SIGNING) {
if (!AppConstants.REQUIRE_SIGNING) {
// Opens and tests the details view for add-on 10
add_test(function() {
open_details("addon10@tests.mozilla.org", "extension", function() {

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

@ -7,7 +7,7 @@
var tempScope = {};
Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", tempScope);
var LightweightThemeManager = tempScope.LightweightThemeManager;
const { REQUIRE_SIGNING } = Components.utils.import("resource://gre/modules/addons/AddonConstants.jsm", {});
Components.utils.import("resource://gre/modules/AppConstants.jsm");
var gProvider;
var gManagerWindow;
@ -418,7 +418,7 @@ add_task(async function() {
is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
// These tests are only appropriate when signing can be turned off
if (!REQUIRE_SIGNING) {
if (!AppConstants.MOZ_REQUIRE_SIGNING) {
info("Addon 10");
addon = items["Test add-on 10"];
addon.parentNode.ensureElementIsVisible(addon);

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

@ -3,7 +3,7 @@ gUseRealCertChecks = true;
// Disable update security
Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
const {REQUIRE_SIGNING} = AM_Cu.import("resource://gre/modules/addons/AddonConstants.jsm", {});
Components.utils.import("resource://gre/modules/AppConstants.jsm");
const PREF_XPI_SIGNATURES_DEV_ROOT = "xpinstall.signatures.dev-root";
const DATA = "data/signing_checks/";
@ -226,7 +226,7 @@ add_task(async function() {
// Try to install an add-on with the "Mozilla Extensions" OU
add_task(async function() {
// Remove the REQUIRE_SIGNING and DEV_ROOT stuff when bug 1357948 is fixed.
if (REQUIRE_SIGNING) {
if (AppConstants.MOZ_REQUIRE_SIGNING) {
return;
}
Services.prefs.setBoolPref(PREF_XPI_SIGNATURES_DEV_ROOT, true);

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

@ -1,5 +1,5 @@
const {ADDON_SIGNING} = AM_Cu.import("resource://gre/modules/addons/AddonConstants.jsm", {});
Components.utils.import("resource://gre/modules/addons/AddonSettings.jsm")
function run_test() {
run_next_test();
@ -26,7 +26,7 @@ const IMPLICIT_ID_ID = "webext_implicit_id@tests.mozilla.org";
add_task(async function test_implicit_id() {
// This test needs to read the xpi certificate which only works
// if signing is enabled.
ok(ADDON_SIGNING, "Add-on signing is enabled");
ok(AddonSettings.ADDON_SIGNING, "Add-on signing is enabled");
let addon = await promiseAddonByID(IMPLICIT_ID_ID);
equal(addon, null, "Add-on is not installed");
@ -49,7 +49,7 @@ add_task(async function test_implicit_id() {
add_task(async function test_implicit_id_temp() {
// This test needs to read the xpi certificate which only works
// if signing is enabled.
ok(ADDON_SIGNING, "Add-on signing is enabled");
ok(AddonSettings.ADDON_SIGNING, "Add-on signing is enabled");
let addon = await promiseAddonByID(IMPLICIT_ID_ID);
equal(addon, null, "Add-on is not installed");

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

@ -57,10 +57,19 @@ public:
SchedulerGroup* mPrevRunningDispatcher;
};
// This function returns true if it's currently safe to run code associated
// with this SchedulerGroup. It will return true either if we're inside an
// unlabeled runnable or if we're inside a runnable labeled with this
// SchedulerGroup.
bool IsSafeToRun() const
{
return !sRunningDispatcher || mAccessValid;
}
// Ensure that it's valid to access the TabGroup at this time.
void ValidateAccess() const
{
MOZ_ASSERT(!sRunningDispatcher || mAccessValid);
MOZ_ASSERT(IsSafeToRun());
}
class Runnable final : public mozilla::Runnable

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

@ -22,6 +22,8 @@ public:
static void ShutdownStatic();
static SystemGroupImpl* Get();
static bool Initialized() { return !!sSingleton; }
NS_METHOD_(MozExternalRefCountType) AddRef(void)
{
return 2;
@ -76,6 +78,12 @@ SystemGroup::Shutdown()
SystemGroupImpl::ShutdownStatic();
}
bool
SystemGroup::Initialized()
{
return SystemGroupImpl::Initialized();
}
/* static */ nsresult
SystemGroup::Dispatch(const char* aName,
TaskCategory aCategory,

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

@ -34,6 +34,9 @@ class SystemGroup
static void InitStatic();
static void Shutdown();
// Returns true if SystemGroup has been initialized.
static bool Initialized();
};
} // namespace mozilla