CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2014-12-15 13:45:30 -05:00
Родитель ae8326f2db daacbbd44a
Коммит 9239a38d0e
336 изменённых файлов: 6897 добавлений и 3059 удалений

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

@ -9,7 +9,9 @@
#include "ARIAMap.h"
#include "DocAccessible-inl.h"
#include "DocAccessibleChild.h"
#include "DocAccessibleParent.h"
#include "nsAccessibilityService.h"
#include "Platform.h"
#include "RootAccessibleWrap.h"
#include "xpcAccessibleDocument.h"
@ -36,6 +38,8 @@ using namespace mozilla;
using namespace mozilla::a11y;
using namespace mozilla::dom;
StaticAutoPtr<nsTArray<DocAccessibleParent*>> DocManager::sRemoteDocuments;
////////////////////////////////////////////////////////////////////////////////
// DocManager
////////////////////////////////////////////////////////////////////////////////
@ -533,3 +537,17 @@ DocManager::SearchIfDocIsRefreshing(const nsIDocument* aKey,
return PL_DHASH_NEXT;
}
#endif
void
DocManager::RemoteDocAdded(DocAccessibleParent* aDoc)
{
if (!sRemoteDocuments) {
sRemoteDocuments = new nsTArray<DocAccessibleParent*>;
ClearOnShutdown(&sRemoteDocuments);
}
MOZ_ASSERT(!sRemoteDocuments->Contains(aDoc),
"How did we already have the doc!");
sRemoteDocuments->AppendElement(aDoc);
ProxyCreated(aDoc);
}

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

@ -5,12 +5,14 @@
#ifndef mozilla_a11_DocManager_h_
#define mozilla_a11_DocManager_h_
#include "mozilla/ClearOnShutdown.h"
#include "nsIDocument.h"
#include "nsIDOMEventListener.h"
#include "nsRefPtrHashtable.h"
#include "nsIWebProgressListener.h"
#include "nsWeakReference.h"
#include "nsIPresShell.h"
#include "mozilla/StaticPtr.h"
namespace mozilla {
namespace a11y {
@ -74,21 +76,16 @@ public:
/*
* Notification that a top level document in a content process has gone away.
*/
void RemoteDocShutdown(DocAccessibleParent* aDoc)
static void RemoteDocShutdown(DocAccessibleParent* aDoc)
{
DebugOnly<bool> result = mRemoteDocuments.RemoveElement(aDoc);
DebugOnly<bool> result = sRemoteDocuments->RemoveElement(aDoc);
MOZ_ASSERT(result, "Why didn't we find the document!");
}
/*
* Notify of a new top level document in a content process.
*/
void RemoteDocAdded(DocAccessibleParent* aDoc)
{
MOZ_ASSERT(!mRemoteDocuments.Contains(aDoc),
"How did we already have the doc!");
mRemoteDocuments.AppendElement(aDoc);
}
static void RemoteDocAdded(DocAccessibleParent* aDoc);
#ifdef DEBUG
bool IsProcessingRefreshDriverNotification() const;
@ -176,7 +173,7 @@ private:
/*
* The list of remote top level documents.
*/
nsTArray<DocAccessibleParent*> mRemoteDocuments;
static StaticAutoPtr<nsTArray<DocAccessibleParent*>> sRemoteDocuments;
};
/**

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

@ -130,5 +130,30 @@ DocAccessibleParent::RecvEvent(const uint64_t& aID, const uint32_t& aEventType)
ProxyEvent(e->mProxy, aEventType);
return true;
}
bool
DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
uint64_t aParentID)
{
ProxyAccessible* outerDoc = mAccessibles.GetEntry(aParentID)->mProxy;
if (!outerDoc)
return false;
aChildDoc->mParent = outerDoc;
outerDoc->SetChildDoc(aChildDoc);
mChildDocs.AppendElement(aChildDoc);
aChildDoc->mParentDoc = this;
ProxyCreated(aChildDoc);
return true;
}
void
DocAccessibleParent::ActorDestroy(ActorDestroyReason aWhy)
{
ProxyDestroyed(this);
MOZ_ASSERT(mChildDocs.IsEmpty(),
"why wheren't the child docs destroyed already?");
mParentDoc ? mParentDoc->RemoveChildDoc(this)
: GetAccService()->RemoteDocShutdown(this);
}
}
}

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

@ -26,7 +26,7 @@ class DocAccessibleParent : public ProxyAccessible,
{
public:
DocAccessibleParent() :
mParentDoc(nullptr)
ProxyAccessible(this), mParentDoc(nullptr)
{ MOZ_COUNT_CTOR_INHERITED(DocAccessibleParent, ProxyAccessible); }
~DocAccessibleParent()
{
@ -45,13 +45,7 @@ public:
virtual bool RecvShowEvent(const ShowEventData& aData) MOZ_OVERRIDE;
virtual bool RecvHideEvent(const uint64_t& aRootID) MOZ_OVERRIDE;
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE
{
MOZ_ASSERT(mChildDocs.IsEmpty(),
"why wheren't the child docs destroyed already?");
mParentDoc ? mParentDoc->RemoveChildDoc(this)
: GetAccService()->RemoteDocShutdown(this);
}
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
/*
* Return the main processes representation of the parent document (if any)
@ -63,18 +57,7 @@ public:
* Called when a document in a content process notifies the main process of a
* new child document.
*/
bool AddChildDoc(DocAccessibleParent* aChildDoc, uint64_t aParentID)
{
ProxyAccessible* outerDoc = mAccessibles.GetEntry(aParentID)->mProxy;
if (!outerDoc)
return false;
aChildDoc->mParent = outerDoc;
outerDoc->SetChildDoc(aChildDoc);
mChildDocs.AppendElement(aChildDoc);
aChildDoc->mParentDoc = this;
return true;
}
bool AddChildDoc(DocAccessibleParent* aChildDoc, uint64_t aParentID);
/*
* Called when the document in the content process this object represents

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

@ -86,8 +86,9 @@ public:
uint64_t ID() const { return mID; }
protected:
ProxyAccessible() :
mParent(nullptr), mDoc(nullptr), mWrapper(0), mID(0)
explicit ProxyAccessible(DocAccessibleParent* aThisAsDoc) :
mParent(nullptr), mDoc(aThisAsDoc), mWrapper(0), mID(0),
mRole(roles::DOCUMENT)
{ MOZ_COUNT_CTOR(ProxyAccessible); }
protected:

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

@ -2,72 +2,87 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that the Web Console shows SHA-1 Certificate warnings
// Tests that the Web Console shows weak crypto warnings (SHA-1 Certificate, SSLv3, and RC4)
const TEST_BAD_URI = "https://sha1ee.example.com/browser/browser/devtools/webconsole/test/test-certificate-messages.html";
const TEST_GOOD_URI = "https://sha256ee.example.com/browser/browser/devtools/webconsole/test/test-certificate-messages.html";
const TEST_URI_PATH = "/browser/browser/devtools/webconsole/test/test-certificate-messages.html";
let gWebconsoleTests = [
{url: "https://sha1ee.example.com" + TEST_URI_PATH,
name: "SHA1 warning displayed successfully",
warning: ["SHA-1"], nowarning: ["SSL 3.0", "RC4"]},
{url: "https://ssl3.example.com" + TEST_URI_PATH,
name: "SSL3 warning displayed successfully",
pref: [["security.tls.version.min", 0]],
warning: ["SSL 3.0"], nowarning: ["SHA-1", "RC4"]},
{url: "https://rc4.example.com" + TEST_URI_PATH,
name: "RC4 warning displayed successfully",
warning: ["RC4"], nowarning: ["SHA-1", "SSL 3.0"]},
{url: "https://ssl3rc4.example.com" + TEST_URI_PATH,
name: "SSL3 and RC4 warning displayed successfully",
pref: [["security.tls.version.min", 0]],
warning: ["SSL 3.0", "RC4"], nowarning: ["SHA-1"]},
{url: "https://sha256ee.example.com" + TEST_URI_PATH,
name: "SSL warnings appropriately not present",
warning: [], nowarning: ["SHA-1", "SSL 3.0", "RC4"]},
];
const TRIGGER_MSG = "If you haven't seen ssl warnings yet, you won't";
let gHud = undefined;
let gCurrentTest;
function test() {
registerCleanupFunction(function () {
gHud = null;
});
addTab("data:text/html;charset=utf8,Web Console SHA-1 warning test");
addTab("data:text/html;charset=utf8,Web Console weak crypto warnings test");
browser.addEventListener("load", function _onLoad() {
browser.removeEventListener("load", _onLoad, true);
openConsole(null, loadBadDocument);
openConsole(null, runTestLoop);
}, true);
}
function loadBadDocument(theHud) {
gHud = theHud;
browser.addEventListener("load", onBadLoad, true);
content.location = TEST_BAD_URI;
function runTestLoop(theHud) {
gCurrentTest = gWebconsoleTests.shift();
if (!gCurrentTest) {
finishTest();
}
if (!gHud) {
gHud = theHud;
}
gHud.jsterm.clearOutput();
browser.addEventListener("load", onLoad, true);
if (gCurrentTest.pref) {
SpecialPowers.pushPrefEnv({"set": gCurrentTest.pref},
function() {
content.location = gCurrentTest.url;
});
} else {
content.location = gCurrentTest.url;
}
}
function onBadLoad(aEvent) {
browser.removeEventListener("load", onBadLoad, true);
testForWarningMessage();
}
function loadGoodDocument(theHud) {
gHud.jsterm.clearOutput()
browser.addEventListener("load", onGoodLoad, true);
content.location = TEST_GOOD_URI;
}
function onGoodLoad(aEvent) {
browser.removeEventListener("load", onGoodLoad, true);
testForNoWarning();
}
function testForWarningMessage() {
function onLoad(aEvent) {
browser.removeEventListener("load", onLoad, true);
let aOutputNode = gHud.outputNode;
waitForSuccess({
name: "SHA1 warning displayed successfully",
name: gCurrentTest.name,
validatorFn: function() {
return gHud.outputNode.textContent.indexOf("SHA-1") > -1;
},
successFn: loadGoodDocument,
failureFn: finishTest,
});
}
function testForNoWarning() {
let aOutputNode = gHud.outputNode;
waitForSuccess({
name: "SHA1 warning appropriately missed",
validatorFn: function() {
if (gHud.outputNode.textContent.indexOf(TRIGGER_MSG) > -1) {
return gHud.outputNode.textContent.indexOf("SHA-1") == -1;
if (gHud.outputNode.textContent.indexOf(TRIGGER_MSG) >= 0) {
for (let warning of gCurrentTest.warning) {
if (gHud.outputNode.textContent.indexOf(warning) < 0) {
return false;
}
}
for (let nowarning of gCurrentTest.nowarning) {
if (gHud.outputNode.textContent.indexOf(nowarning) >= 0) {
return false;
}
}
return true;
}
},
successFn: finishTest,
successFn: runTestLoop,
failureFn: finishTest,
});
}

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

@ -12,6 +12,8 @@
#include "clang/Frontend/MultiplexConsumer.h"
#include "clang/Sema/Sema.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include <memory>
#define CLANG_VERSION_FULL (CLANG_VERSION_MAJOR * 100 + CLANG_VERSION_MINOR)
@ -54,6 +56,66 @@ private:
MatchFinder astMatcher;
};
namespace {
bool isInIgnoredNamespace(const Decl *decl) {
const DeclContext *DC = decl->getDeclContext()->getEnclosingNamespaceContext();
const NamespaceDecl *ND = dyn_cast<NamespaceDecl>(DC);
if (!ND) {
return false;
}
while (const DeclContext *ParentDC = ND->getParent()) {
if (!isa<NamespaceDecl>(ParentDC)) {
break;
}
ND = cast<NamespaceDecl>(ParentDC);
}
// namespace std and icu are ignored for now
return ND->getName() == "std" || // standard C++ lib
ND->getName() == "__gnu_cxx" || // gnu C++ lib
ND->getName() == "boost" || // boost
ND->getName() == "webrtc" || // upstream webrtc
ND->getName() == "icu_52" || // icu
ND->getName() == "google" || // protobuf
ND->getName() == "google_breakpad" || // breakpad
ND->getName() == "soundtouch" || // libsoundtouch
ND->getName() == "stagefright" || // libstagefright
ND->getName() == "MacFileUtilities" || // MacFileUtilities
ND->getName() == "dwarf2reader" || // dwarf2reader
ND->getName() == "arm_ex_to_module" || // arm_ex_to_module
ND->getName() == "testing"; // gtest
}
bool isIgnoredPath(const Decl *decl) {
decl = decl->getCanonicalDecl();
SourceLocation Loc = decl->getLocation();
const SourceManager &SM = decl->getASTContext().getSourceManager();
SmallString<1024> FileName = SM.getFilename(Loc);
llvm::sys::fs::make_absolute(FileName);
llvm::sys::path::reverse_iterator begin = llvm::sys::path::rbegin(FileName),
end = llvm::sys::path::rend(FileName);
for (; begin != end; ++begin) {
if (begin->compare_lower(StringRef("skia")) == 0 ||
begin->compare_lower(StringRef("angle")) == 0 ||
begin->compare_lower(StringRef("harfbuzz")) == 0 ||
begin->compare_lower(StringRef("hunspell")) == 0 ||
begin->compare_lower(StringRef("scoped_ptr.h")) == 0 ||
begin->compare_lower(StringRef("graphite2")) == 0) {
return true;
}
}
return false;
}
bool isInterestingDecl(const Decl *decl) {
return !isInIgnoredNamespace(decl) &&
!isIgnoredPath(decl);
}
}
class MozChecker : public ASTConsumer, public RecursiveASTVisitor<MozChecker> {
DiagnosticsEngine &Diag;
const CompilerInstance &CI;
@ -126,6 +188,32 @@ public:
Diag.Report((*it)->getLocation(), overrideNote);
}
}
if (isInterestingDecl(d)) {
for (CXXRecordDecl::ctor_iterator ctor = d->ctor_begin(),
e = d->ctor_end(); ctor != e; ++ctor) {
// Ignore non-converting ctors
if (!ctor->isConvertingConstructor(false)) {
continue;
}
// Ignore copy or move constructors
if (ctor->isCopyOrMoveConstructor()) {
continue;
}
// Ignore deleted constructors
if (ctor->isDeleted()) {
continue;
}
// Ignore whitelisted constructors
if (MozChecker::hasCustomAnnotation(*ctor, "moz_implicit")) {
continue;
}
unsigned ctorID = Diag.getDiagnosticIDs()->getCustomDiagID(
DiagnosticIDs::Error, "bad implicit conversion constructor for %0");
Diag.Report(ctor->getLocation(), ctorID) << d->getDeclName();
}
}
return true;
}
};

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

@ -0,0 +1,34 @@
#define MOZ_IMPLICIT __attribute__((annotate("moz_implicit")))
struct Foo {
Foo(int); // expected-error {{bad implicit conversion constructor for 'Foo'}}
Foo(int, char=0); // expected-error {{bad implicit conversion constructor for 'Foo'}}
Foo(...); // expected-error {{bad implicit conversion constructor for 'Foo'}}
Foo(int, unsigned);
Foo(Foo&);
Foo(const Foo&);
Foo(volatile Foo&);
Foo(const volatile Foo&);
Foo(Foo&&);
Foo(const Foo&&);
Foo(volatile Foo&&);
Foo(const volatile Foo&&);
};
struct Bar {
explicit Bar(int);
explicit Bar(int, char=0);
explicit Bar(...);
};
struct Baz {
MOZ_IMPLICIT Baz(int);
MOZ_IMPLICIT Baz(int, char=0);
MOZ_IMPLICIT Baz(...);
};
struct Barn {
Barn(int) = delete;
Barn(int, char=0) = delete;
Barn(...) = delete;
};

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

@ -5,6 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
SOURCES += [
'TestBadImplicitConversionCtor.cpp',
'TestCustomHeap.cpp',
'TestMustOverride.cpp',
'TestNonHeapClass.cpp',

Двоичные данные
build/pgo/certs/cert8.db

Двоичный файл не отображается.

Двоичные данные
build/pgo/certs/key3.db

Двоичный файл не отображается.

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

@ -233,3 +233,8 @@ https://include-subdomains.pinning.example.com:443 privileged,cer
# Hosts for sha1 console warning tests
https://sha1ee.example.com:443 privileged,cert=sha1_end_entity
https://sha256ee.example.com:443 privileged,cert=sha256_end_entity
# Hosts for ssl3/rc4 console warning tests
https://ssl3.example.com:443 privileged,ssl3
https://rc4.example.com:443 privileged,rc4
https://ssl3rc4.example.com:443 privileged,ssl3,rc4

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

@ -15,9 +15,6 @@ leak:nsComponentManagerImpl
leak:mozJSComponentLoader::LoadModule
leak:nsNativeModuleLoader::LoadModule
# Bug 980109 - Freeing this properly on shutdown is hard.
leak:profiler_init
# Bug 981220 - Pixman fails to free TLS memory.
leak:pixman_implementation_lookup_composite

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

@ -80,7 +80,7 @@ public:
: mWebSocket(aWebSocket)
, mOnCloseScheduled(false)
, mFailed(false)
, mDisconnected(false)
, mDisconnectingOrDisconnected(false)
, mCloseEventWasClean(false)
, mCloseEventCode(nsIWebSocketChannel::CLOSE_ABNORMAL)
, mScriptLine(0)
@ -89,10 +89,13 @@ public:
#ifdef DEBUG
, mHasFeatureRegistered(false)
#endif
, mIsMainThread(true)
, mWorkerShuttingDown(false)
{
if (!NS_IsMainThread()) {
mWorkerPrivate = GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(mWorkerPrivate);
mIsMainThread = false;
}
}
@ -152,7 +155,7 @@ public:
void AddRefObject();
void ReleaseObject();
void RegisterFeature();
bool RegisterFeature();
void UnregisterFeature();
nsresult CancelInternal();
@ -166,7 +169,7 @@ public:
bool mOnCloseScheduled;
bool mFailed;
bool mDisconnected;
bool mDisconnectingOrDisconnected;
// Set attributes of DOM 'onclose' message
bool mCloseEventWasClean;
@ -218,11 +221,14 @@ public:
nsWeakPtr mWeakLoadGroup;
bool mIsMainThread;
bool mWorkerShuttingDown;
private:
~WebSocketImpl()
{
// If we threw during Init we never called disconnect
if (!mDisconnected) {
if (!mDisconnectingOrDisconnected) {
Disconnect();
}
}
@ -313,6 +319,8 @@ WebSocketImpl::PrintErrorOnConsole(const char *aBundleURI,
// This method must run on the main thread.
if (!NS_IsMainThread()) {
MOZ_ASSERT(mWorkerPrivate);
nsRefPtr<PrintErrorOnConsoleRunnable> runnable =
new PrintErrorOnConsoleRunnable(this, aBundleURI, aError, aFormatStrings,
aFormatStringsLen);
@ -404,6 +412,25 @@ private:
nsresult mRv;
};
class MOZ_STACK_CLASS MaybeDisconnect
{
public:
explicit MaybeDisconnect(WebSocketImpl* aImpl)
: mImpl(aImpl)
{
}
~MaybeDisconnect()
{
if (mImpl->mWorkerShuttingDown) {
mImpl->Disconnect();
}
}
private:
WebSocketImpl* mImpl;
};
} // anonymous namespace
nsresult
@ -412,6 +439,15 @@ WebSocketImpl::CloseConnection(uint16_t aReasonCode,
{
AssertIsOnTargetThread();
if (mDisconnectingOrDisconnected) {
return NS_OK;
}
// If this method is called because the worker is going away, we will not
// receive the OnStop() method and we have to disconnect the WebSocket and
// release the WorkerFeature.
MaybeDisconnect md(this);
uint16_t readyState = mWebSocket->ReadyState();
if (readyState == WebSocket::CLOSING ||
readyState == WebSocket::CLOSED) {
@ -484,6 +520,10 @@ WebSocketImpl::FailConnection(uint16_t aReasonCode,
{
AssertIsOnTargetThread();
if (mDisconnectingOrDisconnected) {
return;
}
ConsoleError();
mFailed = true;
CloseConnection(aReasonCode, aReasonString);
@ -515,12 +555,18 @@ private:
nsresult
WebSocketImpl::Disconnect()
{
if (mDisconnected) {
if (mDisconnectingOrDisconnected) {
return NS_OK;
}
AssertIsOnTargetThread();
// Disconnect can be called from some control event (such as Notify() of
// WorkerFeature). This will be schedulated before any other sync/async
// runnable. In order to prevent some double Disconnect() calls, we use this
// boolean.
mDisconnectingOrDisconnected = true;
// DisconnectInternal touches observers and nsILoadGroup and it must run on
// the main thread.
@ -536,20 +582,19 @@ WebSocketImpl::Disconnect()
// until the end of the method.
nsRefPtr<WebSocketImpl> kungfuDeathGrip = this;
if (mWorkerPrivate && mWorkerFeature) {
UnregisterFeature();
}
nsCOMPtr<nsIThread> mainThread;
if (NS_FAILED(NS_GetMainThread(getter_AddRefs(mainThread))) ||
NS_FAILED(NS_ProxyRelease(mainThread, mChannel))) {
NS_WARNING("Failed to proxy release of channel, leaking instead!");
}
mDisconnected = true;
mWebSocket->DontKeepAliveAnyMore();
mWebSocket->mImpl = nullptr;
if (mWorkerPrivate && mWorkerFeature) {
UnregisterFeature();
}
// We want to release the WebSocket in the correct thread.
mWebSocket = nullptr;
@ -585,6 +630,10 @@ WebSocketImpl::DoOnMessageAvailable(const nsACString& aMsg, bool isBinary)
{
AssertIsOnTargetThread();
if (mDisconnectingOrDisconnected) {
return NS_OK;
}
int16_t readyState = mWebSocket->ReadyState();
if (readyState == WebSocket::CLOSED) {
NS_ERROR("Received message after CLOSED");
@ -612,6 +661,11 @@ WebSocketImpl::OnMessageAvailable(nsISupports* aContext,
const nsACString& aMsg)
{
AssertIsOnTargetThread();
if (mDisconnectingOrDisconnected) {
return NS_OK;
}
return DoOnMessageAvailable(aMsg, false);
}
@ -620,6 +674,11 @@ WebSocketImpl::OnBinaryMessageAvailable(nsISupports* aContext,
const nsACString& aMsg)
{
AssertIsOnTargetThread();
if (mDisconnectingOrDisconnected) {
return NS_OK;
}
return DoOnMessageAvailable(aMsg, true);
}
@ -628,6 +687,10 @@ WebSocketImpl::OnStart(nsISupports* aContext)
{
AssertIsOnTargetThread();
if (mDisconnectingOrDisconnected) {
return NS_OK;
}
int16_t readyState = mWebSocket->ReadyState();
// This is the only function that sets OPEN, and should be called only once
@ -671,6 +734,10 @@ WebSocketImpl::OnStop(nsISupports* aContext, nsresult aStatusCode)
{
AssertIsOnTargetThread();
if (mDisconnectingOrDisconnected) {
return NS_OK;
}
// We can be CONNECTING here if connection failed.
// We can be OPEN if we have encountered a fatal protocol error
// We can be CLOSING if close() was called and/or server initiated close.
@ -719,6 +786,10 @@ WebSocketImpl::OnAcknowledge(nsISupports *aContext, uint32_t aSize)
{
AssertIsOnTargetThread();
if (mDisconnectingOrDisconnected) {
return NS_OK;
}
if (aSize > mWebSocket->mOutgoingBufferedAmount) {
return NS_ERROR_UNEXPECTED;
}
@ -733,6 +804,10 @@ WebSocketImpl::OnServerClose(nsISupports *aContext, uint16_t aCode,
{
AssertIsOnTargetThread();
if (mDisconnectingOrDisconnected) {
return NS_OK;
}
int16_t readyState = mWebSocket->ReadyState();
MOZ_ASSERT(readyState != WebSocket::CONNECTING,
@ -802,7 +877,7 @@ WebSocketImpl::GetInterface(const nsIID& aIID, void** aResult)
WebSocket::WebSocket(nsPIDOMWindow* aOwnerWindow)
: DOMEventTargetHelper(aOwnerWindow)
, mWorkerPrivate(nullptr)
, mIsMainThread(true)
, mKeepingAlive(false)
, mCheckMustKeepAlive(true)
, mOutgoingBufferedAmount(0)
@ -811,7 +886,7 @@ WebSocket::WebSocket(nsPIDOMWindow* aOwnerWindow)
, mReadyState(CONNECTING)
{
mImpl = new WebSocketImpl(this);
mWorkerPrivate = mImpl->mWorkerPrivate;
mIsMainThread = mImpl->mIsMainThread;
}
WebSocket::~WebSocket()
@ -1058,6 +1133,13 @@ WebSocket::Constructor(const GlobalObject& aGlobal,
webSocket->mImpl->Init(aGlobal.Context(), principal, aUrl, protocolArray,
EmptyCString(), 0, aRv, &connectionFailed);
} else {
// In workers we have to keep the worker alive using a feature in order to
// dispatch messages correctly.
if (!webSocket->mImpl->RegisterFeature()) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
unsigned lineno;
JS::AutoFilename file;
if (!JS::DescribeScriptedCaller(aGlobal.Context(), &file, &lineno)) {
@ -1075,6 +1157,13 @@ WebSocket::Constructor(const GlobalObject& aGlobal,
return nullptr;
}
// It can be that we have been already disconnected because the WebSocket is
// gone away while we where initializing the webSocket.
if (!webSocket->mImpl) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
// We don't return an error if the connection just failed. Instead we dispatch
// an event.
if (connectionFailed) {
@ -1087,12 +1176,6 @@ WebSocket::Constructor(const GlobalObject& aGlobal,
return webSocket.forget();
}
if (webSocket->mWorkerPrivate) {
// In workers we have to keep the worker alive using a feature in order to
// dispatch messages correctly.
webSocket->mImpl->RegisterFeature();
}
class MOZ_STACK_CLASS ClearWebSocket
{
public:
@ -1140,6 +1223,13 @@ WebSocket::Constructor(const GlobalObject& aGlobal,
return nullptr;
}
// It can be that we have been already disconnected because the WebSocket is
// gone away while we where initializing the webSocket.
if (!webSocket->mImpl) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
cws.Done();
return webSocket.forget();
}
@ -1499,6 +1589,11 @@ void
WebSocketImpl::DispatchConnectionCloseEvents()
{
AssertIsOnTargetThread();
if (mDisconnectingOrDisconnected) {
return;
}
mWebSocket->SetReadyState(WebSocket::CLOSED);
// Call 'onerror' if needed
@ -1559,8 +1654,9 @@ WebSocket::CreateAndDispatchMessageEvent(const nsACString& aData,
return NS_ERROR_FAILURE;
}
} else {
MOZ_ASSERT(mWorkerPrivate);
if (NS_WARN_IF(!jsapi.Init(mWorkerPrivate->GlobalScope()))) {
MOZ_ASSERT(!mIsMainThread);
MOZ_ASSERT(mImpl->mWorkerPrivate);
if (NS_WARN_IF(!jsapi.Init(mImpl->mWorkerPrivate->GlobalScope()))) {
return NS_ERROR_FAILURE;
}
}
@ -1796,7 +1892,7 @@ void
WebSocket::UpdateMustKeepAlive()
{
// Here we could not have mImpl.
MOZ_ASSERT(NS_IsMainThread() == !mWorkerPrivate);
MOZ_ASSERT(NS_IsMainThread() == mIsMainThread);
if (!mCheckMustKeepAlive || !mImpl) {
return;
@ -1805,9 +1901,7 @@ WebSocket::UpdateMustKeepAlive()
bool shouldKeepAlive = false;
uint16_t readyState = ReadyState();
if (mWorkerPrivate && readyState != CLOSED) {
shouldKeepAlive = true;
} else if (mListenerManager) {
if (mListenerManager) {
switch (readyState)
{
case CONNECTING:
@ -1853,7 +1947,7 @@ void
WebSocket::DontKeepAliveAnyMore()
{
// Here we could not have mImpl.
MOZ_ASSERT(NS_IsMainThread() == !mWorkerPrivate);
MOZ_ASSERT(NS_IsMainThread() == mIsMainThread);
if (mKeepingAlive) {
MOZ_ASSERT(mImpl);
@ -1880,6 +1974,7 @@ public:
MOZ_ASSERT(aStatus > workers::Running);
if (aStatus >= Canceling) {
mWebSocketImpl->mWorkerShuttingDown = true;
mWebSocketImpl->CloseConnection(nsIWebSocketChannel::CLOSE_GOING_AWAY);
}
@ -1888,6 +1983,7 @@ public:
bool Suspend(JSContext* aCx)
{
mWebSocketImpl->mWorkerShuttingDown = true;
mWebSocketImpl->CloseConnection(nsIWebSocketChannel::CLOSE_GOING_AWAY);
return true;
}
@ -1903,25 +1999,16 @@ WebSocketImpl::AddRefObject()
{
AssertIsOnTargetThread();
AddRef();
if (mWorkerPrivate && !mWorkerFeature) {
RegisterFeature();
}
}
void
WebSocketImpl::ReleaseObject()
{
AssertIsOnTargetThread();
if (mWorkerPrivate && mWorkerFeature) {
UnregisterFeature();
}
Release();
}
void
bool
WebSocketImpl::RegisterFeature()
{
mWorkerPrivate->AssertIsOnWorkerThread();
@ -1932,17 +2019,20 @@ WebSocketImpl::RegisterFeature()
if (!mWorkerPrivate->AddFeature(cx, mWorkerFeature)) {
NS_WARNING("Failed to register a feature.");
mWorkerFeature = nullptr;
return;
return false;
}
#ifdef DEBUG
SetHasFeatureRegistered(true);
#endif
return true;
}
void
WebSocketImpl::UnregisterFeature()
{
MOZ_ASSERT(mDisconnectingOrDisconnected);
MOZ_ASSERT(mWorkerPrivate);
mWorkerPrivate->AssertIsOnWorkerThread();
MOZ_ASSERT(mWorkerFeature);
@ -1950,6 +2040,7 @@ WebSocketImpl::UnregisterFeature()
JSContext* cx = GetCurrentThreadJSContext();
mWorkerPrivate->RemoveFeature(cx, mWorkerFeature);
mWorkerFeature = nullptr;
mWorkerPrivate = nullptr;
#ifdef DEBUG
SetHasFeatureRegistered(false);
@ -2333,7 +2424,8 @@ WebSocketImpl::Cancel(nsresult aStatus)
{
AssertIsOnMainThread();
if (mWorkerPrivate) {
if (!mIsMainThread) {
MOZ_ASSERT(mWorkerPrivate);
nsRefPtr<CancelRunnable> runnable =
new CancelRunnable(mWorkerPrivate, this);
if (!runnable->Dispatch(nullptr)) {
@ -2353,7 +2445,7 @@ WebSocketImpl::CancelInternal()
// If CancelInternal is called by a runnable, we may already be disconnected
// by the time it runs.
if (mDisconnected) {
if (mDisconnectingOrDisconnected) {
return NS_OK;
}
@ -2388,7 +2480,7 @@ WebSocketImpl::GetLoadGroup(nsILoadGroup** aLoadGroup)
*aLoadGroup = nullptr;
if (!mWorkerPrivate) {
if (mIsMainThread) {
nsresult rv;
nsIScriptContext* sc = mWebSocket->GetContextForEventHandlers(&rv);
nsCOMPtr<nsIDocument> doc =
@ -2401,6 +2493,8 @@ WebSocketImpl::GetLoadGroup(nsILoadGroup** aLoadGroup)
return NS_OK;
}
MOZ_ASSERT(mWorkerPrivate);
// Walk up to our containing page
WorkerPrivate* wp = mWorkerPrivate;
while (wp->GetParent()) {
@ -2490,10 +2584,22 @@ NS_IMETHODIMP
WebSocketImpl::Dispatch(nsIRunnable* aEvent, uint32_t aFlags)
{
// If the target is the main-thread we can just dispatch the runnable.
if (!mWorkerPrivate) {
if (mIsMainThread) {
return NS_DispatchToMainThread(aEvent);
}
// No messages when disconnected.
if (mDisconnectingOrDisconnected) {
NS_WARNING("Dispatching a WebSocket event after the disconnection!");
return NS_OK;
}
if (mWorkerShuttingDown) {
return NS_OK;
}
MOZ_ASSERT(mWorkerPrivate);
#ifdef DEBUG
MOZ_ASSERT(HasFeatureRegistered());
#endif
@ -2519,13 +2625,13 @@ WebSocketImpl::IsOnCurrentThread(bool* aResult)
bool
WebSocketImpl::IsTargetThread() const
{
return NS_IsMainThread() == !mWorkerPrivate;
return NS_IsMainThread() == mIsMainThread;
}
void
WebSocket::AssertIsOnTargetThread() const
{
MOZ_ASSERT(NS_IsMainThread() == !mWorkerPrivate);
MOZ_ASSERT(NS_IsMainThread() == mIsMainThread);
}
} // dom namespace

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

@ -173,7 +173,7 @@ private:
// WebSocket.
WebSocketImpl* mImpl;
workers::WorkerPrivate* mWorkerPrivate;
bool mIsMainThread;
bool mKeepingAlive;
bool mCheckMustKeepAlive;

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

@ -6265,7 +6265,13 @@ nsDocument::RegisterElement(JSContext* aCx, const nsAString& aType,
return;
}
aRetval.set(JS_GetFunctionObject(constructor));
JS::Rooted<JSObject*> constructorObj(aCx, JS_GetFunctionObject(constructor));
if (!JS_LinkConstructorAndPrototype(aCx, constructorObj, protoObject)) {
rv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return;
}
aRetval.set(constructorObj);
}
void

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

@ -185,6 +185,7 @@ static uint32_t sForgetSkippableBeforeCC = 0;
static uint32_t sPreviousSuspectedCount = 0;
static uint32_t sCleanupsSinceLastGC = UINT32_MAX;
static bool sNeedsFullCC = false;
static bool sNeedsFullGC = false;
static bool sNeedsGCAfterCC = false;
static bool sIncrementalCC = false;
static bool sDidPaintAfterPreviousICCSlice = false;
@ -1462,7 +1463,13 @@ nsJSContext::GarbageCollectNow(JS::gcreason::Reason aReason,
return;
}
JS::PrepareForFullGC(sRuntime);
if (sNeedsFullGC || aReason != JS::gcreason::CC_WAITING) {
sNeedsFullGC = false;
JS::PrepareForFullGC(sRuntime);
} else {
CycleCollectedJSRuntime::Get()->PrepareWaitingZonesForGC();
}
if (aIncremental == IncrementalGC) {
MOZ_ASSERT(aShrinking == NonShrinkingGC);
JS::IncrementalGC(sRuntime, aReason, aSliceMillis);
@ -2149,6 +2156,8 @@ nsJSContext::RunNextCollectorTimer()
void
nsJSContext::PokeGC(JS::gcreason::Reason aReason, int aDelay)
{
sNeedsFullGC = sNeedsFullGC || aReason != JS::gcreason::CC_WAITING;
if (sGCTimer || sInterSliceGCTimer || sShuttingDown) {
// There's already a timer for GC'ing, just return
return;
@ -2458,6 +2467,7 @@ mozilla::dom::StartupJSEnvironment()
sLikelyShortLivingObjectsNeedingGC = 0;
sPostGCEventsToConsole = false;
sNeedsFullCC = false;
sNeedsFullGC = false;
sNeedsGCAfterCC = false;
gNameSpaceManager = nullptr;
sRuntimeService = nullptr;

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

@ -151,7 +151,7 @@ BluetoothService::ToggleBtAck::Run()
return NS_OK;
}
class BluetoothService::StartupTask : public nsISettingsServiceCallback
class BluetoothService::StartupTask MOZ_FINAL : public nsISettingsServiceCallback
{
public:
NS_DECL_ISUPPORTS

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

@ -71,7 +71,7 @@ IsSupportedChld(const int aChld) {
return (aChld >= 0 && aChld <= 3);
}
class BluetoothHfpManager::GetVolumeTask : public nsISettingsServiceCallback
class BluetoothHfpManager::GetVolumeTask MOZ_FINAL : public nsISettingsServiceCallback
{
public:
NS_DECL_ISUPPORTS

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

@ -862,7 +862,7 @@ static int
FindProperty(const InfallibleTArray<BluetoothNamedValue>& aProperties,
const char* aPropertyType)
{
for (int i = 0; i < aProperties.Length(); ++i) {
for (size_t i = 0; i < aProperties.Length(); ++i) {
if (aProperties[i].name().EqualsASCII(aPropertyType)) {
return i;
}
@ -4086,7 +4086,7 @@ BluetoothDBusService::SendMetaData(const nsAString& aTitle,
a2dp->GetTitle(prevTitle);
a2dp->GetAlbum(prevAlbum);
if (aMediaNumber != a2dp->GetMediaNumber() ||
if (aMediaNumber < 0 || (uint64_t)aMediaNumber != a2dp->GetMediaNumber() ||
!aTitle.Equals(prevTitle) ||
!aAlbum.Equals(prevAlbum)) {
UpdateNotification(ControlEventId::EVENT_TRACK_CHANGED, aMediaNumber);

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

@ -25,7 +25,7 @@ template<class T>
class CameraClosedMessage : public nsRunnable
{
public:
CameraClosedMessage(nsMainThreadPtrHandle<T> aListener)
explicit CameraClosedMessage(nsMainThreadPtrHandle<T> aListener)
: mListener(aListener)
{
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
@ -56,7 +56,7 @@ template<class T>
class CameraClosedListenerProxy : public CameraControlListener
{
public:
CameraClosedListenerProxy(T* aListener)
explicit CameraClosedListenerProxy(T* aListener)
: mListener(new nsMainThreadPtrHolder<T>(aListener))
{
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);

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

@ -32,10 +32,9 @@ namespace android {
class GonkCameraSource;
struct MOZ_EXPORT MediaSource;
struct MOZ_EXPORT MediaWriter;
struct MediaWriter;
class MOZ_EXPORT MetaData;
struct MOZ_EXPORT AudioSource;
class MOZ_EXPORT MediaProfiles;
class GonkCameraHardware;
struct GonkRecorder {

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

@ -50,4 +50,10 @@ LOCAL_INCLUDES += [
include('/ipc/chromium/chromium-config.mozbuild')
# Suppress some GCC warnings being treated as errors:
# - about attributes on forward declarations for types that are already
# defined, which complains about an important MOZ_EXPORT for android::AString
if CONFIG['GNU_CC']:
CXXFLAGS += ['-Wno-error=attributes']
FINAL_LIBRARY = 'xul'

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

@ -18,12 +18,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1096146
<pre id="test">
<script type="application/javascript">
SimpleTest.requestFlakyTimeout("untriaged");
const kKeydownEvent = 0x1;
const kScrollEvent = 0x2;
var gCurrentTest = 0;
var gNumEvents = 0;
var kTests = [
{
description: "no preventDefault at 'mozbrowserbeforekeydown'",
@ -48,19 +47,29 @@ function frameScript()
addEventListener('scroll', handler);
}
function waitAndVerifyResult(count) {
if (gNumEvents >= 3 || count > 10) {
is(kTests[gCurrentTest].resultEvents,
kTests[gCurrentTest].expectedEvents,
"verify result");
runTests();
} else {
SimpleTest.requestFlakyTimeout("We must delay to wait for scroll/keydown events.");
setTimeout(function () waitAndVerifyResult(count + 1), 100);
}
}
function testDefaultAction()
{
synthesizeKey('VK_END', {}, document.getElementById("embedded").contentWindow);
setTimeout(function () {
is(kTests[gCurrentTest].expectedEvents,
kTests[gCurrentTest].resultEvents,
"verify result");
runTests();
}, 500);
waitAndVerifyResult(0);
}
function prepareTest()
{
gNumEvents = 0;
var handler;
if (kTests[gCurrentTest].doPreventDefault) {
handler = preventDefaultHandler;
@ -83,9 +92,11 @@ function prepareTest()
var value = 0;
switch(msg.json.type) {
case "scroll":
++gNumEvents;
value = kScrollEvent;
break;
case "keydown":
++gNumEvents;
value = kKeydownEvent;
break;
default:
@ -106,12 +117,14 @@ function prepareTest()
function preventDefaultHandler(evt)
{
ok(true, "receive " + evt.type + " and do preventDefault.");
++gNumEvents;
evt.preventDefault();
}
function noPreventDefaultHandler(evt)
{
ok(true, "receive " + evt.type + ".");
++gNumEvents;
}
function teardownHandler()
@ -123,6 +136,7 @@ function teardownHandler()
handler = noPreventDefaultHandler;
}
window.removeEventListener("mozbrowserbeforekeydown", handler);
document.body.removeChild(document.getElementById("embedded"));
runTests();
}

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

@ -893,20 +893,12 @@ nsHTMLDocument::GetDomainURI()
NS_IMETHODIMP
nsHTMLDocument::GetDomain(nsAString& aDomain)
{
ErrorResult rv;
GetDomain(aDomain, rv);
return rv.ErrorCode();
}
void
nsHTMLDocument::GetDomain(nsAString& aDomain, ErrorResult& rv)
{
nsCOMPtr<nsIURI> uri = GetDomainURI();
if (!uri) {
SetDOMStringToNull(aDomain);
return;
return NS_OK;
}
nsAutoCString hostName;
@ -918,6 +910,7 @@ nsHTMLDocument::GetDomain(nsAString& aDomain, ErrorResult& rv)
// etc), just return an null string.
SetDOMStringToNull(aDomain);
}
return NS_OK;
}
NS_IMETHODIMP

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

@ -168,7 +168,6 @@ public:
// WebIDL API
virtual JSObject* WrapNode(JSContext* aCx)
MOZ_OVERRIDE;
void GetDomain(nsAString& aDomain, mozilla::ErrorResult& rv);
void SetDomain(const nsAString& aDomain, mozilla::ErrorResult& rv);
void GetCookie(nsAString& aCookie, mozilla::ErrorResult& rv);
void SetCookie(const nsAString& aCookie, mozilla::ErrorResult& rv);

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

@ -578,4 +578,5 @@ skip-if = buildapp == 'b2g' || e10s
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || e10s #Bug 931116, b2g desktop specific, initial triage
support-files = file_bug871161-1.html file_bug871161-2.html
[test_bug1013316.html]
[test_bug1081037.html]

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

@ -0,0 +1,142 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1081037
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1081037</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 1081037 **/
function shouldThrow(fun, msg, ex, todo) {
try {
fun();
ok(todo, msg);
} catch (e) {
ok(new RegExp(ex).test(e), msg + " (thrown:" + e + ")")
}
}
var Foo = document.registerElement('x-foo', {
prototype: {bar: 5}
});
Foo.prototype.bar = 6;
var foo = new Foo();
is(foo.bar, 6, "prototype of the ctor returned from registerElement works");
var protoDesc = Object.getOwnPropertyDescriptor(Foo, "prototype");
is(protoDesc.configurable, false, "proto should be non-configurable");
is(protoDesc.enumerable, false, "proto should be non-enumerable");
is(protoDesc.writable, false, "proto should be non-writable");
// TODO: FIXME!
shouldThrow(function() {
document.registerElement('x-foo2', {
prototype: Foo.prototype
});
},
"if proto is an interface prototype object, registerElement should throw",
"not supported",
/* todo = */ true);
var nonConfigReadonlyProto = Object.create(HTMLElement.prototype,
{ constructor: { configurable: false, writable: false, value: 42 } });
shouldThrow(function() {
document.registerElement('x-nonconfig-readonly', {
prototype: nonConfigReadonlyProto
});
},
"non-configurable and not-writable constructor property",
"not supported");
// this is not defined in current spec:
var readonlyProto = Object.create(HTMLElement.prototype,
{ constructor: { configurable: true, writable: false, value: 42 } });
var Readonly = document.registerElement('x-nonconfig-readonly', {
prototype: readonlyProto
});
is(Readonly.prototype, readonlyProto, "configurable readonly constructor property");
var handler = {
getOwnPropertyDescriptor: function(target, name) {
return name == "constructor" ? undefined : Object.getOwnPropertyDescriptor(target,name);
},
defineProperty: function(target, name, propertyDescriptor) {
if (name == "constructor") {
throw "spec this";
}
return Object.defineProperty(target, name, propertyDescriptor);
},
has: function(target, name) {
if (name == "constructor") {
return false;
}
return name in target;
}
};
var proxy = new Proxy({}, handler);
shouldThrow(function() {
document.registerElement('x-proxymagic', {
prototype: proxy
});
},
"proxy magic",
"spec this");
var getOwn = 0;
var defineProp = 0;
var _has = 0;
var handler2 = {
getOwnPropertyDescriptor: function(target, name) {
if (name == "constructor") {
getOwn++;
}
return Object.getOwnPropertyDescriptor(target,name);
},
defineProperty: function(target, name, propertyDescriptor) {
if (name == "constructor") {
defineProp++;
}
return Object.defineProperty(target, name, propertyDescriptor);
},
has: function(target, name) {
if (name == "constructor") {
_has++;
}
return name in target;
}
};
var proxy2 = new Proxy({}, handler2);
document.registerElement('x-proxymagic2', {
prototype: proxy2
});
is(getOwn, 1, "number of getOwnPropertyDescriptor calls from registerElement: " + getOwn);
is(defineProp, 1, "number of defineProperty calls from registerElement: " + defineProp);
is(_has, 1, "number of 'has' calls from registerElement: " + _has);
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1081037">Mozilla Bug 1081037</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

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

@ -59,7 +59,7 @@ public:
IsDisplaySpnRequired() const;
protected:
~IccInfo() {}
virtual ~IccInfo() {}
protected:
nsCOMPtr<nsPIDOMWindow> mWindow;

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

@ -125,7 +125,7 @@ public:
}
private:
ThreadLocal(const nsID& aBackgroundChildLoggingId);
explicit ThreadLocal(const nsID& aBackgroundChildLoggingId);
~ThreadLocal();
ThreadLocal() MOZ_DELETE;

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

@ -5080,7 +5080,7 @@ class DatabaseLoggingInfo MOZ_FINAL
LoggingInfo mLoggingInfo;
public:
DatabaseLoggingInfo(const LoggingInfo& aLoggingInfo)
explicit DatabaseLoggingInfo(const LoggingInfo& aLoggingInfo)
: mLoggingInfo(aLoggingInfo)
{
AssertIsOnBackgroundThread();

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

@ -2321,8 +2321,6 @@ public:
static void
DoNuwaFork()
{
NS_ASSERTION(NuwaSpawnPrepare != nullptr,
"NuwaSpawnPrepare() is not available!");
NuwaSpawnPrepare(); // NuwaSpawn will be blocked.
{
@ -2331,8 +2329,6 @@ DoNuwaFork()
}
// IOThread should be blocked here for waiting NuwaSpawn().
NS_ASSERTION(NuwaSpawnWait != nullptr,
"NuwaSpawnWait() is not available!");
NuwaSpawnWait(); // Now! NuwaSpawn can go.
// Here, we can make sure the spawning was finished.
}

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

@ -75,6 +75,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/Telemetry.h"
#include "mozilla/unused.h"
#include "nsAnonymousTemporaryFile.h"
#include "nsAppRunner.h"
@ -1749,6 +1750,9 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
props->SetPropertyAsUint64(NS_LITERAL_STRING("childID"), mChildID);
if (AbnormalShutdown == why) {
Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT,
NS_LITERAL_CSTRING("content"), 1);
props->SetPropertyAsBool(NS_LITERAL_STRING("abnormal"), true);
#ifdef MOZ_CRASHREPORTER
@ -2588,8 +2592,8 @@ ContentParent::RecvAddNewProcess(const uint32_t& aPid,
size_t numNuwaPrefUpdates = sNuwaPrefUpdates ?
sNuwaPrefUpdates->Length() : 0;
// Resend pref updates to the forked child.
for (int i = 0; i < numNuwaPrefUpdates; i++) {
content->SendPreferenceUpdate(sNuwaPrefUpdates->ElementAt(i));
for (size_t i = 0; i < numNuwaPrefUpdates; i++) {
mozilla::unused << content->SendPreferenceUpdate(sNuwaPrefUpdates->ElementAt(i));
}
// Update offline settings.
@ -2598,7 +2602,7 @@ ContentParent::RecvAddNewProcess(const uint32_t& aPid,
ClipboardCapabilities clipboardCaps;
RecvGetXPCOMProcessAttributes(&isOffline, &unusedDictionaries,
&clipboardCaps);
content->SendSetOffline(isOffline);
mozilla::unused << content->SendSetOffline(isOffline);
MOZ_ASSERT(!clipboardCaps.supportsSelectionClipboard() &&
!clipboardCaps.supportsFindClipboard(),
"Unexpected values");
@ -2864,7 +2868,7 @@ ContentParent::RecvPDocAccessibleConstructor(PDocAccessibleParent* aDoc, PDocAcc
return parentDoc->AddChildDoc(doc, aParentID);
} else {
MOZ_ASSERT(!aParentID);
GetAccService()->RemoteDocAdded(doc);
a11y::DocManager::RemoteDocAdded(doc);
}
#endif
return true;

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

@ -8,6 +8,8 @@
#include "nsXULAppAPI.h"
#include <time.h>
#include "mozilla/Telemetry.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#include "nsICrashService.h"
@ -171,21 +173,27 @@ CrashReporterParent::NotifyCrashService()
int32_t processType;
int32_t crashType = nsICrashService::CRASH_TYPE_CRASH;
nsCString telemetryKey;
switch (mProcessType) {
case GeckoProcessType_Content:
processType = nsICrashService::PROCESS_TYPE_CONTENT;
telemetryKey.AssignLiteral("content");
break;
case GeckoProcessType_Plugin: {
processType = nsICrashService::PROCESS_TYPE_PLUGIN;
telemetryKey.AssignLiteral("plugin");
nsAutoCString val;
if (mNotes.Get(NS_LITERAL_CSTRING("PluginHang"), &val) &&
val.Equals(NS_LITERAL_CSTRING("1"))) {
crashType = nsICrashService::CRASH_TYPE_HANG;
telemetryKey.AssignLiteral("pluginhang");
}
break;
}
case GeckoProcessType_GMPlugin:
processType = nsICrashService::PROCESS_TYPE_GMPLUGIN;
telemetryKey.AssignLiteral("gmplugin");
break;
default:
NS_ERROR("unknown process type");
@ -193,6 +201,7 @@ CrashReporterParent::NotifyCrashService()
}
crashService->AddCrash(processType, crashType, mChildDumpID);
Telemetry::Accumulate(Telemetry::SUBPROCESS_CRASHES_WITH_DUMP, telemetryKey, 1);
}
#endif

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

@ -7,6 +7,7 @@
#include "mozilla/PreallocatedProcessManager.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Preferences.h"
#include "mozilla/unused.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/ScriptSettings.h"
#include "nsIPropertyBag2.h"
@ -111,11 +112,13 @@ PreallocatedProcessManagerImpl::Singleton()
NS_IMPL_ISUPPORTS(PreallocatedProcessManagerImpl, nsIObserver)
PreallocatedProcessManagerImpl::PreallocatedProcessManagerImpl()
: mEnabled(false)
:
#ifdef MOZ_NUWA_PROCESS
, mPreallocateAppProcessTask(nullptr)
mPreallocateAppProcessTask(nullptr)
, mIsNuwaReady(false)
,
#endif
mEnabled(false)
, mShutdown(false)
{}
@ -292,7 +295,7 @@ PreallocatedProcessManagerImpl::PublishSpareProcess(ContentParent* aContent)
AutoJSContext cx;
nsCOMPtr<nsIMessageBroadcaster> ppmm =
do_GetService("@mozilla.org/parentprocessmessagemanager;1");
nsresult rv = ppmm->BroadcastAsyncMessage(
mozilla::unused << ppmm->BroadcastAsyncMessage(
NS_LITERAL_STRING("TEST-ONLY:nuwa-add-new-process"),
JS::NullHandleValue, JS::NullHandleValue, cx, 1);
}
@ -338,7 +341,7 @@ PreallocatedProcessManagerImpl::OnNuwaReady()
AutoJSContext cx;
nsCOMPtr<nsIMessageBroadcaster> ppmm =
do_GetService("@mozilla.org/parentprocessmessagemanager;1");
nsresult rv = ppmm->BroadcastAsyncMessage(
mozilla::unused << ppmm->BroadcastAsyncMessage(
NS_LITERAL_STRING("TEST-ONLY:nuwa-ready"),
JS::NullHandleValue, JS::NullHandleValue, cx, 1);
}
@ -355,7 +358,7 @@ PreallocatedProcessManagerImpl::PreallocatedProcessReady()
void
PreallocatedProcessManagerImpl::NuwaFork()
{
mPreallocatedAppProcess->SendNuwaFork();
mozilla::unused << mPreallocatedAppProcess->SendNuwaFork();
}
#endif

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

@ -19,3 +19,8 @@ LoadingMixedActiveContent=Loading mixed (insecure) active content on a secure pa
LoadingMixedDisplayContent=Loading mixed (insecure) display content on a secure page "%1$S"
# LOCALIZATION NOTE: Do not translate "allow-scripts", "allow-same-origin", "sandbox" or "iframe"
BothAllowScriptsAndSameOriginPresent=An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can remove its sandboxing.
# LOCALIZATION NOTE: Do not translate "SSL 3.0".
WeakProtocolVersionWarning=This site uses the protocol SSL 3.0 for encryption, which is deprecated and insecure.
# LOCALIZATION NOTE: Do not translate "RC4".
WeakCipherSuiteWarning=This site uses the cipher RC4 for encryption, which is deprecated and insecure.

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

@ -125,8 +125,7 @@ void MediaDecoder::SetDormantIfNecessary(bool aDormant)
if (!mDecoderStateMachine ||
!mDecoderStateMachine->IsDormantNeeded() ||
mPlayState == PLAY_STATE_SHUTDOWN ||
mIsDormant == aDormant) {
mPlayState == PLAY_STATE_SHUTDOWN) {
return;
}
@ -140,14 +139,11 @@ void MediaDecoder::SetDormantIfNecessary(bool aDormant)
mRequestedSeekTarget = SeekTarget(timeUsecs, SeekTarget::Accurate);
mNextState = mPlayState;
mIsDormant = true;
mIsExitingDormant = false;
ChangeState(PLAY_STATE_LOADING);
} else if (!aDormant && mPlayState == PLAY_STATE_LOADING) {
} else {
// exit dormant state
// trigger to state machine.
mDecoderStateMachine->SetDormant(false);
mIsExitingDormant = true;
}
}
@ -155,7 +151,7 @@ void MediaDecoder::Pause()
{
MOZ_ASSERT(NS_IsMainThread());
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
if ((mPlayState == PLAY_STATE_LOADING && mIsDormant) ||
if (mPlayState == PLAY_STATE_LOADING ||
mPlayState == PLAY_STATE_SEEKING ||
mPlayState == PLAY_STATE_ENDED) {
mNextState = PLAY_STATE_PAUSED;
@ -432,8 +428,6 @@ MediaDecoder::MediaDecoder() :
mMediaSeekable(true),
mSameOriginMedia(false),
mReentrantMonitor("media.decoder"),
mIsDormant(false),
mIsExitingDormant(false),
mPlayState(PLAY_STATE_LOADING),
mNextState(PLAY_STATE_PAUSED),
mIgnoreProgressData(false),
@ -600,12 +594,13 @@ nsresult MediaDecoder::Play()
}
nsresult res = ScheduleStateMachineThread();
NS_ENSURE_SUCCESS(res,res);
if ((mPlayState == PLAY_STATE_LOADING && mIsDormant) || mPlayState == PLAY_STATE_SEEKING) {
if (mPlayState == PLAY_STATE_LOADING || mPlayState == PLAY_STATE_SEEKING) {
mNextState = PLAY_STATE_PLAYING;
return NS_OK;
}
if (mPlayState == PLAY_STATE_ENDED)
if (mPlayState == PLAY_STATE_ENDED) {
return Seek(0, SeekTarget::PrevSyncPoint);
}
ChangeState(PLAY_STATE_PLAYING);
return NS_OK;
@ -628,7 +623,7 @@ nsresult MediaDecoder::Seek(double aTime, SeekTarget::Type aSeekType)
// If we are already in the seeking state, then setting mRequestedSeekTarget
// above will result in the new seek occurring when the current seek
// completes.
if ((mPlayState != PLAY_STATE_LOADING || !mIsDormant) && mPlayState != PLAY_STATE_SEEKING) {
if (mPlayState != PLAY_STATE_LOADING && mPlayState != PLAY_STATE_SEEKING) {
bool paused = false;
if (mOwner) {
paused = mOwner->GetPaused();
@ -703,12 +698,6 @@ void MediaDecoder::MetadataLoaded(nsAutoPtr<MediaInfo> aInfo,
{
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
if (mPlayState == PLAY_STATE_LOADING && mIsDormant && !mIsExitingDormant) {
return;
} else if (mPlayState == PLAY_STATE_LOADING && mIsDormant && mIsExitingDormant) {
mIsDormant = false;
mIsExitingDormant = false;
}
mDuration = mDecoderStateMachine ? mDecoderStateMachine->GetDuration() : -1;
// Duration has changed so we should recompute playback rate
UpdatePlaybackRate();
@ -741,10 +730,6 @@ void MediaDecoder::FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo)
aInfo->mAudio.mChannels, aInfo->mAudio.mRate,
aInfo->HasAudio(), aInfo->HasVideo());
if (mPlayState == PLAY_STATE_LOADING && mIsDormant && !mIsExitingDormant) {
return;
}
mInfo = aInfo.forget();
if (mOwner) {
@ -829,7 +814,8 @@ bool MediaDecoder::IsSameOriginMedia()
bool MediaDecoder::IsSeeking() const
{
MOZ_ASSERT(NS_IsMainThread());
return mPlayState == PLAY_STATE_SEEKING;
return mPlayState == PLAY_STATE_SEEKING ||
(mPlayState == PLAY_STATE_LOADING && mRequestedSeekTarget.IsValid());
}
bool MediaDecoder::IsEnded() const
@ -844,7 +830,7 @@ void MediaDecoder::PlaybackEnded()
if (mShuttingDown ||
mPlayState == PLAY_STATE_SEEKING ||
(mPlayState == PLAY_STATE_LOADING && mIsDormant)) {
(mPlayState == PLAY_STATE_LOADING)) {
return;
}
@ -1141,8 +1127,7 @@ void MediaDecoder::ChangeState(PlayState aState)
mNextState = PLAY_STATE_PAUSED;
}
if ((mPlayState == PLAY_STATE_LOADING && mIsDormant && aState != PLAY_STATE_SHUTDOWN) ||
mPlayState == PLAY_STATE_SHUTDOWN) {
if (mPlayState == PLAY_STATE_SHUTDOWN) {
GetReentrantMonitor().NotifyAll();
return;
}
@ -1167,11 +1152,6 @@ void MediaDecoder::ChangeState(PlayState aState)
ApplyStateToStateMachine(mPlayState);
if (aState!= PLAY_STATE_LOADING) {
mIsDormant = false;
mIsExitingDormant = false;
}
GetReentrantMonitor().NotifyAll();
}

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

@ -1124,14 +1124,6 @@ protected:
// without holding the monitor.
nsAutoPtr<DecodedStreamData> mDecodedStream;
// True if this decoder is in dormant state.
// Should be true only when PlayState is PLAY_STATE_LOADING.
bool mIsDormant;
// True if this decoder is exiting from dormant state.
// Should be true only when PlayState is PLAY_STATE_LOADING.
bool mIsExitingDormant;
// Set to one of the valid play states.
// This can only be changed on the main thread while holding the decoder
// monitor. Thus, it can be safely read while holding the decoder monitor

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

@ -1570,7 +1570,7 @@ void MediaDecoderStateMachine::Seek(const SeekTarget& aTarget)
NS_ASSERTION(mState > DECODER_STATE_DECODING_METADATA,
"We should have got duration already");
if (mState <= DECODER_STATE_DECODING_FIRSTFRAME) {
if (mState < DECODER_STATE_DECODING) {
DECODER_LOG("Seek() Not Enough Data to continue at this stage, queuing seek");
mQueuedSeekTarget = aTarget;
return;
@ -2491,10 +2491,9 @@ MediaDecoderStateMachine::ShutdownReader()
}
void
MediaDecoderStateMachine::FinishShutdown(bool aSuccess)
MediaDecoderStateMachine::FinishShutdown()
{
MOZ_ASSERT(OnStateMachineThread());
MOZ_ASSERT(aSuccess);
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
// The reader's listeners hold references to the state machine,

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

@ -163,7 +163,7 @@ public:
void SetDormant(bool aDormant);
void Shutdown();
void ShutdownReader();
void FinishShutdown(bool aSuccess);
void FinishShutdown();
// Called from the main thread to get the duration. The decoder monitor
// must be obtained before calling this. It is in units of microseconds.

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

@ -155,6 +155,32 @@ protected:
const char* mCallSite;
};
/*
* We create two overloads for invoking Resolve/Reject Methods so as to
* make the resolve/reject value argument "optional".
*/
// Avoid confusing the compiler when the callback accepts T* but the ValueType
// is nsRefPtr<T>. See bug 1109954 comment 6.
template <typename T>
struct NonDeduced
{
typedef T type;
};
template<typename ThisType, typename ValueType>
static void InvokeCallbackMethod(ThisType* aThisVal, void(ThisType::*aMethod)(ValueType),
typename NonDeduced<ValueType>::type aValue)
{
((*aThisVal).*aMethod)(aValue);
}
template<typename ThisType, typename ValueType>
static void InvokeCallbackMethod(ThisType* aThisVal, void(ThisType::*aMethod)(), ValueType aValue)
{
((*aThisVal).*aMethod)();
}
template<typename TargetType, typename ThisType,
typename ResolveMethodType, typename RejectMethodType>
class ThenValue : public ThenValueBase
@ -187,12 +213,12 @@ protected:
protected:
virtual void DoResolve(ResolveValueType aResolveValue)
{
((*mThisVal).*mResolveMethod)(aResolveValue);
InvokeCallbackMethod(mThisVal.get(), mResolveMethod, aResolveValue);
}
virtual void DoReject(RejectValueType aRejectValue)
{
((*mThisVal).*mRejectMethod)(aRejectValue);
InvokeCallbackMethod(mThisVal.get(), mRejectMethod, aRejectValue);
}
virtual ~ThenValue() {}

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

@ -1085,21 +1085,6 @@ RTCPeerConnection.prototype = {
dict.id != undefined ? dict.id : 0xFFFF
);
return channel;
},
connectDataConnection: function(localport, remoteport, numstreams) {
if (numstreams == undefined || numstreams <= 0) {
numstreams = 16;
}
this._queueOrRun({
func: this._connectDataConnection,
args: [localport, remoteport, numstreams],
wait: false
});
},
_connectDataConnection: function(localport, remoteport, numstreams) {
this._impl.connectDataConnection(localport, remoteport, numstreams);
}
};

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

@ -50,3 +50,9 @@ CXXFLAGS += [
]
include('/ipc/chromium/chromium-config.mozbuild')
# Suppress some GCC warnings being treated as errors:
# - about attributes on forward declarations for types that are already
# defined, which complains about an important MOZ_EXPORT for android::AString
if CONFIG['GNU_CC']:
CXXFLAGS += ['-Wno-error=attributes']

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

@ -68,7 +68,9 @@ public:
aSample);
mTaskQueue->Dispatch(task.forget());
} else if (GMP_FAILED(aResult)) {
mDecryptor->mCallback->Error();
if (mDecryptor->mCallback) {
mDecryptor->mCallback->Error();
}
MOZ_ASSERT(!aSample);
} else {
RefPtr<nsIRunnable> task;
@ -150,6 +152,7 @@ public:
mTaskQueue->AwaitShutdownAndIdle();
mTaskQueue = nullptr;
mProxy = nullptr;
mCallback = nullptr;
return rv;
}

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

@ -20,9 +20,8 @@
#include <stagefright/foundation/ALooper.h>
#include "media/openmax/OMX_Audio.h"
#define LOG_TAG "GonkAudioDecoderManager"
#include <android/log.h>
#define ALOG(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#define GADM_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkAudioDecoderManager", __VA_ARGS__)
#ifdef PR_LOGGING
PRLogModuleInfo* GetDemuxerLog();
@ -42,8 +41,8 @@ GonkAudioDecoderManager::GonkAudioDecoderManager(
: mAudioChannels(aConfig.channel_count)
, mAudioRate(aConfig.samples_per_second)
, mAudioProfile(aConfig.aac_profile)
, mAudioBuffer(nullptr)
, mUseAdts(true)
, mAudioBuffer(nullptr)
{
MOZ_COUNT_CTOR(GonkAudioDecoderManager);
MOZ_ASSERT(mAudioChannels);
@ -77,7 +76,7 @@ GonkAudioDecoderManager::Init(MediaDataDecoderCallback* aCallback)
}
sp<AMessage> format = new AMessage;
// Fixed values
ALOG("Init Audio channel no:%d, sample-rate:%d", mAudioChannels, mAudioRate);
GADM_LOG("Init Audio channel no:%d, sample-rate:%d", mAudioChannels, mAudioRate);
format->setString("mime", "audio/mp4a-latm");
format->setInt32("channel-count", mAudioChannels);
format->setInt32("sample-rate", mAudioRate);
@ -93,7 +92,7 @@ GonkAudioDecoderManager::Init(MediaDataDecoderCallback* aCallback)
if (rv == OK) {
return mDecoder;
} else {
ALOG("Failed to input codec specific data!");
GADM_LOG("Failed to input codec specific data!");
return nullptr;
}
}
@ -101,7 +100,7 @@ GonkAudioDecoderManager::Init(MediaDataDecoderCallback* aCallback)
nsresult
GonkAudioDecoderManager::CreateAudioData(int64_t aStreamOffset, AudioData **v) {
if (!(mAudioBuffer != nullptr && mAudioBuffer->data() != nullptr)) {
ALOG("Audio Buffer is not valid!");
GADM_LOG("Audio Buffer is not valid!");
return NS_ERROR_UNEXPECTED;
}
@ -167,7 +166,7 @@ GonkAudioDecoderManager::Output(int64_t aStreamOffset,
case android::INFO_OUTPUT_BUFFERS_CHANGED:
{
// If the format changed, update our cached info.
ALOG("Decoder format changed");
GADM_LOG("Decoder format changed");
return Output(aStreamOffset, aOutData);
}
case -EAGAIN:
@ -176,14 +175,14 @@ GonkAudioDecoderManager::Output(int64_t aStreamOffset,
}
case android::ERROR_END_OF_STREAM:
{
ALOG("Got EOS frame!");
GADM_LOG("Got EOS frame!");
nsRefPtr<AudioData> data;
nsresult rv = CreateAudioData(aStreamOffset, getter_AddRefs(data));
if (rv == NS_ERROR_NOT_AVAILABLE) {
// For EOS, no need to do any thing.
return NS_ERROR_ABORT;
} else if (rv != NS_OK || data == nullptr) {
ALOG("Failed to create audio data!");
GADM_LOG("Failed to create audio data!");
return NS_ERROR_UNEXPECTED;
}
aOutData = data;
@ -191,12 +190,12 @@ GonkAudioDecoderManager::Output(int64_t aStreamOffset,
}
case -ETIMEDOUT:
{
ALOG("Timeout. can try again next time");
GADM_LOG("Timeout. can try again next time");
return NS_ERROR_UNEXPECTED;
}
default:
{
ALOG("Decoder failed, err=%d", err);
GADM_LOG("Decoder failed, err=%d", err);
return NS_ERROR_UNEXPECTED;
}
}
@ -221,7 +220,7 @@ nsresult
GonkAudioDecoderManager::Input(mp4_demuxer::MP4Sample* aSample)
{
if (mDecoder == nullptr) {
ALOG("Decoder is not inited");
GADM_LOG("Decoder is not inited");
return NS_ERROR_UNEXPECTED;
}
if (aSample && mUseAdts) {
@ -232,7 +231,7 @@ GonkAudioDecoderManager::Input(mp4_demuxer::MP4Sample* aSample)
mAudioProfile,
aSample);
if (!rv) {
ALOG("Failed to apply ADTS header");
GADM_LOG("Failed to apply ADTS header");
return NS_ERROR_FAILURE;
}
}

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

@ -10,9 +10,8 @@
#include "MediaCodecProxy.h"
#include "prlog.h"
#define LOG_TAG "GonkMediaDataDecoder(blake)"
#include <android/log.h>
#define ALOG(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#define GMDD_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkMediaDataDecoder(blake)", __VA_ARGS__)
#ifdef PR_LOGGING
PRLogModuleInfo* GetDemuxerLog();
@ -76,7 +75,7 @@ GonkMediaDataDecoder::ProcessDecode(mp4_demuxer::MP4Sample* aSample)
nsresult rv = mManager->Input(aSample);
if (rv != NS_OK) {
NS_WARNING("GonkAudioDecoder failed to input data");
ALOG("Failed to input data err: %d",rv);
GMDD_LOG("Failed to input data err: %d",rv);
mCallback->Error();
return;
}
@ -111,7 +110,7 @@ GonkMediaDataDecoder::ProcessOutput()
}
if (rv != NS_OK) {
NS_WARNING("GonkMediaDataDecoder failed to output data");
ALOG("Failed to output data");
GMDD_LOG("Failed to output data");
// GonkDecoderManangers report NS_ERROR_ABORT when EOS is reached.
if (rv == NS_ERROR_ABORT) {
if (output) {

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

@ -29,9 +29,8 @@
#define READ_OUTPUT_BUFFER_TIMEOUT_US 3000
#define LOG_TAG "GonkVideoDecoderManager"
#include <android/log.h>
#define ALOG(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#define GVDM_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkVideoDecoderManager", __VA_ARGS__)
#ifdef PR_LOGGING
PRLogModuleInfo* GetDemuxerLog();
@ -93,7 +92,7 @@ GonkVideoDecoderManager::Init(MediaDataDecoderCallback* aCallback)
// that our video frame creation code doesn't overflow.
nsIntSize frameSize(mVideoWidth, mVideoHeight);
if (!IsValidVideoRegion(frameSize, pictureRect, displaySize)) {
ALOG("It is not a valid region");
GVDM_LOG("It is not a valid region");
return nullptr;
}
@ -175,12 +174,12 @@ GonkVideoDecoderManager::CreateVideoData(int64_t aStreamOffset, VideoData **v)
int32_t keyFrame;
if (mVideoBuffer == nullptr) {
ALOG("Video Buffer is not valid!");
GVDM_LOG("Video Buffer is not valid!");
return NS_ERROR_UNEXPECTED;
}
if (!mVideoBuffer->meta_data()->findInt64(kKeyTime, &timeUs)) {
ALOG("Decoder did not return frame time");
GVDM_LOG("Decoder did not return frame time");
return NS_ERROR_UNEXPECTED;
}
@ -234,7 +233,7 @@ GonkVideoDecoderManager::CreateVideoData(int64_t aStreamOffset, VideoData **v)
picture);
} else {
if (!mVideoBuffer->data()) {
ALOG("No data in Video Buffer!");
GVDM_LOG("No data in Video Buffer!");
return NS_ERROR_UNEXPECTED;
}
uint8_t *yuv420p_buffer = (uint8_t *)mVideoBuffer->data();
@ -252,7 +251,7 @@ GonkVideoDecoderManager::CreateVideoData(int64_t aStreamOffset, VideoData **v)
if (mColorConverter.convertDecoderOutputToI420(mVideoBuffer->data(),
mFrameInfo.mWidth, mFrameInfo.mHeight, crop, yuv420p_buffer) != OK) {
ReleaseVideoBuffer();
ALOG("Color conversion failed!");
GVDM_LOG("Color conversion failed!");
return NS_ERROR_UNEXPECTED;
}
stride = mFrameInfo.mWidth;
@ -330,7 +329,7 @@ GonkVideoDecoderManager::SetVideoFormat()
!codecFormat->findInt32("slice-height", &slice_height) ||
!codecFormat->findInt32("color-format", &color_format) ||
!codecFormat->findRect("crop", &crop_left, &crop_top, &crop_right, &crop_bottom)) {
ALOG("Failed to find values");
GVDM_LOG("Failed to find values");
return false;
}
mFrameInfo.mWidth = width;
@ -341,12 +340,12 @@ GonkVideoDecoderManager::SetVideoFormat()
nsIntSize displaySize(width, height);
if (!IsValidVideoRegion(mInitialFrame, mPicture, displaySize)) {
ALOG("It is not a valid region");
GVDM_LOG("It is not a valid region");
return false;
}
return true;
}
ALOG("Fail to get output format");
GVDM_LOG("Fail to get output format");
return false;
}
@ -358,7 +357,7 @@ GonkVideoDecoderManager::Output(int64_t aStreamOffset,
aOutData = nullptr;
status_t err;
if (mDecoder == nullptr) {
ALOG("Decoder is not inited");
GVDM_LOG("Decoder is not inited");
return NS_ERROR_UNEXPECTED;
}
err = mDecoder->Output(&mVideoBuffer, READ_OUTPUT_BUFFER_TIMEOUT_US);
@ -372,7 +371,7 @@ GonkVideoDecoderManager::Output(int64_t aStreamOffset,
// Decoder outputs a empty video buffer, try again
return NS_ERROR_NOT_AVAILABLE;
} else if (rv != NS_OK || data == nullptr) {
ALOG("Failed to create VideoData");
GVDM_LOG("Failed to create VideoData");
return NS_ERROR_UNEXPECTED;
}
aOutData = data;
@ -381,7 +380,7 @@ GonkVideoDecoderManager::Output(int64_t aStreamOffset,
case android::INFO_FORMAT_CHANGED:
{
// If the format changed, update our cached info.
ALOG("Decoder format changed");
GVDM_LOG("Decoder format changed");
if (!SetVideoFormat()) {
return NS_ERROR_UNEXPECTED;
}
@ -400,7 +399,7 @@ GonkVideoDecoderManager::Output(int64_t aStreamOffset,
}
case android::ERROR_END_OF_STREAM:
{
ALOG("Got the EOS frame!");
GVDM_LOG("Got the EOS frame!");
nsRefPtr<VideoData> data;
nsresult rv = CreateVideoData(aStreamOffset, getter_AddRefs(data));
if (rv == NS_ERROR_NOT_AVAILABLE) {
@ -408,7 +407,7 @@ GonkVideoDecoderManager::Output(int64_t aStreamOffset,
return NS_ERROR_ABORT;
}
if (rv != NS_OK || data == nullptr) {
ALOG("Failed to create video data");
GVDM_LOG("Failed to create video data");
return NS_ERROR_UNEXPECTED;
}
aOutData = data;
@ -416,12 +415,12 @@ GonkVideoDecoderManager::Output(int64_t aStreamOffset,
}
case -ETIMEDOUT:
{
ALOG("Timeout. can try again next time");
GVDM_LOG("Timeout. can try again next time");
return NS_ERROR_UNEXPECTED;
}
default:
{
ALOG("Decoder failed, err=%d", err);
GVDM_LOG("Decoder failed, err=%d", err);
return NS_ERROR_UNEXPECTED;
}
}
@ -440,7 +439,7 @@ nsresult
GonkVideoDecoderManager::Input(mp4_demuxer::MP4Sample* aSample)
{
if (mDecoder == nullptr) {
ALOG("Decoder is not inited");
GVDM_LOG("Decoder is not inited");
return NS_ERROR_UNEXPECTED;
}
status_t rv;
@ -488,7 +487,7 @@ GonkVideoDecoderManager::codecReserved()
if (mNativeWindow != nullptr) {
surface = new Surface(mNativeWindow->getBufferQueue());
}
status_t err = mDecoder->configure(format, surface, nullptr, 0);
mDecoder->configure(format, surface, nullptr, 0);
mDecoder->Prepare();
if (mHandler != nullptr) {
@ -519,7 +518,7 @@ GonkVideoDecoderManager::onMessageReceived(const sp<AMessage> &aMessage)
{
// Our decode may have acquired the hardware resource that it needs
// to start. Notify the state machine to resume loading metadata.
ALOG("CodecReserved!");
GVDM_LOG("CodecReserved!");
mReaderCallback->NotifyResourcesStatusChanged();
break;
}
@ -650,7 +649,7 @@ void GonkVideoDecoderManager::ReleaseAllPendingVideoBuffers()
}
void GonkVideoDecoderManager::ReleaseMediaResources() {
ALOG("ReleseMediaResources");
GVDM_LOG("ReleseMediaResources");
ReleaseAllPendingVideoBuffers();
mDecoder->ReleaseMediaResources();
}

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

@ -21,8 +21,8 @@
using namespace android;
namespace android {
struct MOZ_EXPORT ALooper;
class MOZ_EXPORT MediaBuffer;
struct ALooper;
class MediaBuffer;
struct MOZ_EXPORT AString;
class GonkNativeWindow;
} // namespace android

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

@ -22,6 +22,16 @@ LOCAL_INCLUDES += [
]
include('/ipc/chromium/chromium-config.mozbuild')
# Suppress some GCC/clang warnings being treated as errors:
# - about attributes on forward declarations for types that are already
# defined, which complains about an important MOZ_EXPORT for android::AString
# - about multi-character constants which are used in codec-related code
if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
CXXFLAGS += [
'-Wno-error=attributes',
'-Wno-error=multichar'
]
FINAL_LIBRARY = 'xul'
FAIL_ON_WARNINGS = True

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

@ -30,6 +30,8 @@ using CrashReporter::AnnotationTable;
using CrashReporter::GetIDFromMinidump;
#endif
#include "mozilla/Telemetry.h"
namespace mozilla {
#ifdef LOG
@ -653,6 +655,8 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy)
LOGD(("%s::%s: %p (%d)", __CLASS__, __FUNCTION__, this, (int) aWhy));
#ifdef MOZ_CRASHREPORTER
if (AbnormalShutdown == aWhy) {
Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT,
NS_LITERAL_CSTRING("gmplugin"), 1);
nsString dumpID;
GetCrashID(dumpID);
nsString id;

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

@ -299,14 +299,13 @@ MediaSourceReader::Shutdown()
MOZ_ASSERT(mMediaSourceShutdownPromise.IsEmpty());
nsRefPtr<ShutdownPromise> p = mMediaSourceShutdownPromise.Ensure(__func__);
ContinueShutdown(true);
ContinueShutdown();
return p;
}
void
MediaSourceReader::ContinueShutdown(bool aSuccess)
MediaSourceReader::ContinueShutdown()
{
MOZ_ASSERT(aSuccess);
if (mTrackBuffers.Length()) {
mTrackBuffers[0]->Shutdown()->Then(GetTaskQueue(), __func__, this,
&MediaSourceReader::ContinueShutdown,

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

@ -180,7 +180,7 @@ private:
bool mHasEssentialTrackBuffers;
void ContinueShutdown(bool aSuccess);
void ContinueShutdown();
MediaPromiseHolder<ShutdownPromise> mMediaSourceShutdownPromise;
#ifdef MOZ_FMP4
nsRefPtr<SharedDecoderManager> mSharedDecoderManager;

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

@ -112,9 +112,8 @@ TrackBuffer::Shutdown()
}
void
TrackBuffer::ContinueShutdown(bool aSuccess)
TrackBuffer::ContinueShutdown()
{
MOZ_ASSERT(aSuccess);
ReentrantMonitorAutoEnter mon(mParentDecoder->GetReentrantMonitor());
if (mDecoders.Length()) {
mDecoders[0]->GetReader()->Shutdown()
@ -349,6 +348,10 @@ TrackBuffer::NewDecoder()
bool
TrackBuffer::QueueInitializeDecoder(SourceBufferDecoder* aDecoder)
{
if (NS_WARN_IF(!mTaskQueue)) {
return false;
}
RefPtr<nsIRunnable> task =
NS_NewRunnableMethodWithArg<SourceBufferDecoder*>(this,
&TrackBuffer::InitializeDecoder,

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

@ -160,7 +160,7 @@ private:
// Protected by mParentDecoder's monitor.
MediaInfo mInfo;
void ContinueShutdown(bool aSuccess);
void ContinueShutdown();
MediaPromiseHolder<ShutdownPromise> mShutdownPromise;
};

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

@ -225,6 +225,11 @@ SOURCES += [
'DecoderTraits.cpp',
]
# Some codec-related code uses multi-character constants, which GCC and clang
# warn about. Suppress turning this warning into an error.
if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
SOURCES['DecoderTraits.cpp'].flags += ['-Wno-error=multichar']
EXTRA_COMPONENTS += [
'PeerConnection.js',
'PeerConnection.manifest',
@ -273,4 +278,10 @@ CXXFLAGS += CONFIG['GSTREAMER_CFLAGS']
include('/ipc/chromium/chromium-config.mozbuild')
# Suppress some GCC warnings being treated as errors:
# - about attributes on forward declarations for types that are already
# defined, which complains about an important MOZ_EXPORT for android::AString
if CONFIG['GNU_CC']:
CXXFLAGS += ['-Wno-error=attributes']
FINAL_LIBRARY = 'xul'

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

@ -24,7 +24,7 @@ MediaCodecDecoder::CreateReader()
}
MediaDecoderStateMachine*
MediaCodecDecoder::CreateStateMachine(MediaOmxCommonReader* aReader)
MediaCodecDecoder::CreateStateMachineFromReader(MediaOmxCommonReader* aReader)
{
return new MediaDecoderStateMachine(this, aReader);
}

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

@ -20,7 +20,7 @@ public:
virtual MediaOmxCommonReader* CreateReader();
virtual MediaDecoderStateMachine* CreateStateMachine(MediaOmxCommonReader* aReader);
virtual MediaDecoderStateMachine* CreateStateMachineFromReader(MediaOmxCommonReader* aReader);
};
} // namespace mozilla

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

@ -265,7 +265,7 @@ MediaOmxCommonDecoder::CreateStateMachine()
if (mReader != nullptr) {
mReader->SetAudioChannel(GetAudioChannel());
}
return CreateStateMachine(mReader);
return CreateStateMachineFromReader(mReader);
}
} // namespace mozilla

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

@ -41,7 +41,7 @@ public:
virtual MediaDecoderStateMachine* CreateStateMachine();
virtual MediaOmxCommonReader* CreateReader() = 0;
virtual MediaDecoderStateMachine* CreateStateMachine(MediaOmxCommonReader* aReader) = 0;
virtual MediaDecoderStateMachine* CreateStateMachineFromReader(MediaOmxCommonReader* aReader) = 0;
protected:
virtual ~MediaOmxCommonDecoder();

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

@ -25,7 +25,7 @@ MediaOmxDecoder::CreateReader()
}
MediaDecoderStateMachine*
MediaOmxDecoder::CreateStateMachine(MediaOmxCommonReader* aReader)
MediaOmxDecoder::CreateStateMachineFromReader(MediaOmxCommonReader* aReader)
{
return new MediaDecoderStateMachine(this, aReader);
}

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

@ -15,7 +15,7 @@ class MediaOmxDecoder : public MediaOmxCommonDecoder
public:
virtual MediaDecoder* Clone();
virtual MediaOmxCommonReader* CreateReader();
virtual MediaDecoderStateMachine* CreateStateMachine(MediaOmxCommonReader* aReader);
virtual MediaDecoderStateMachine* CreateStateMachineFromReader(MediaOmxCommonReader* aReader);
};
} // namespace mozilla

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

@ -184,9 +184,11 @@ MediaOmxReader::Shutdown()
nsRefPtr<ShutdownPromise> p = MediaDecoderReader::Shutdown();
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(this, &MediaOmxReader::ReleaseDecoder);
NS_DispatchToMainThread(event);
// Wait for the superclass to finish tearing things down before releasing
// the decoder on the main thread.
nsCOMPtr<nsIThread> mt;
NS_GetMainThread(getter_AddRefs(mt));
p->Then(mt.get(), __func__, this, &MediaOmxReader::ReleaseDecoder, &MediaOmxReader::ReleaseDecoder);
return p;
}

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

@ -250,9 +250,9 @@ private:
: OMXCodecWrapper(aCodecType)
, mResampler(nullptr)
, mChannels(0)
, mResamplingRatio(0)
, mTimestamp(0)
, mSampleDuration(0)
, mResamplingRatio(0) {}
, mSampleDuration(0) {}
// For creator function to access hidden constructor.
friend class OMXCodecWrapper;

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

@ -25,7 +25,7 @@ RtspMediaCodecDecoder::CreateReader()
}
MediaDecoderStateMachine*
RtspMediaCodecDecoder::CreateStateMachine(MediaOmxCommonReader* aReader)
RtspMediaCodecDecoder::CreateStateMachineFromReader(MediaOmxCommonReader* aReader)
{
return new MediaDecoderStateMachine(this, aReader,
mResource->IsRealTime());

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

@ -18,7 +18,7 @@ public:
virtual MediaOmxCommonReader* CreateReader() MOZ_OVERRIDE;
virtual MediaDecoderStateMachine* CreateStateMachine(MediaOmxCommonReader* aReader) MOZ_OVERRIDE;
virtual MediaDecoderStateMachine* CreateStateMachineFromReader(MediaOmxCommonReader* aReader) MOZ_OVERRIDE;
virtual void ApplyStateToStateMachine(PlayState aState) MOZ_OVERRIDE;
};

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

@ -367,6 +367,9 @@ MediaEngineWebRTCAudioSource::Stop(SourceMediaStream *aSource, TrackID aID)
// Already stopped - this is allowed
return NS_OK;
}
aSource->EndTrack(aID);
if (!mSources.IsEmpty()) {
return NS_OK;
}
@ -378,7 +381,6 @@ MediaEngineWebRTCAudioSource::Stop(SourceMediaStream *aSource, TrackID aID)
}
mState = kStopped;
aSource->EndTrack(aID);
}
mVoERender->DeRegisterExternalMediaProcessing(mChannel, webrtc::kRecordingPerChannel);

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

@ -433,6 +433,9 @@ MediaEngineWebRTCVideoSource::Stop(SourceMediaStream *aSource, TrackID aID)
// Already stopped - this is allowed
return NS_OK;
}
aSource->EndTrack(aID);
if (!mSources.IsEmpty()) {
return NS_OK;
}
@ -443,7 +446,6 @@ MediaEngineWebRTCVideoSource::Stop(SourceMediaStream *aSource, TrackID aID)
{
MonitorAutoLock lock(mMonitor);
mState = kStopped;
aSource->EndTrack(aID);
// Drop any cached image so we don't start with a stale image on next
// usage
mImage = nullptr;

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

@ -8,9 +8,10 @@
#include "nsDebug.h"
#include "NfcGonkMessage.h"
#include "NfcOptions.h"
#include "mozilla/unused.h"
#include <android/log.h>
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "NfcMessageHandler", args)
#define NMH_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "NfcMessageHandler", args)
using namespace android;
using namespace mozilla;
@ -74,7 +75,7 @@ bool
NfcMessageHandler::Unmarshall(const Parcel& aParcel, EventOptions& aOptions)
{
bool result;
uint32_t parcelSize = htonl(aParcel.readInt32());
mozilla::unused << htonl(aParcel.readInt32()); // parcel size
int32_t type = aParcel.readInt32();
switch (type) {
@ -132,7 +133,7 @@ NfcMessageHandler::GeneralResponse(const Parcel& aParcel, EventOptions& aOptions
type = kCloseResponse;
break;
default:
CHROMIUM_LOG("Nfcd, unknown general response %d", pendingReq);
NMH_LOG("Nfcd, unknown general response %d", pendingReq);
return false;
}
@ -253,7 +254,7 @@ NfcMessageHandler::InitializeNotification(const Parcel& aParcel, EventOptions& a
if (aOptions.mMajorVersion != NFCD_MAJOR_VERSION ||
aOptions.mMinorVersion != NFCD_MINOR_VERSION) {
CHROMIUM_LOG("NFCD version mismatched. majorVersion: %d, minorVersion: %d",
NMH_LOG("NFCD version mismatched. majorVersion: %d, minorVersion: %d",
aOptions.mMajorVersion, aOptions.mMinorVersion);
}

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

@ -88,11 +88,7 @@ else:
'nsPluginNativeWindow.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
# android_npapi.h extends the NPNVariable and NPPVariable enums
# using #defines, which results in Wswitch warnings in gcc-4.6.
# Therefore, enable FAIL_ON_WARNINGS only on non-Android platforms.
FAIL_ON_WARNINGS = True
FAIL_ON_WARNINGS = True
MSVC_ENABLE_PGO = True

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

@ -41,7 +41,7 @@
#include "nsWildCard.h"
#include "nsContentUtils.h"
#include "mozilla/dom/ScriptSettings.h"
#include "nsIXULRuntime.h"
#include "nsIXPConnect.h"
#include "nsIObserverService.h"
@ -322,11 +322,21 @@ nsNPAPIPlugin::RunPluginOOP(const nsPluginTag *aPluginTag)
prefGroupKey.AssignLiteral("dom.ipc.plugins.enabled.a11y.");
#endif
// Java plugins include a number of different file names,
// so use the mime type (mIsJavaPlugin) and a special pref.
if (aPluginTag->mIsJavaPlugin &&
!Preferences::GetBool("dom.ipc.plugins.java.enabled", true)) {
return false;
if (BrowserTabsRemoteAutostart()) {
// dom.ipc.plugins.java.enabled is obsolete in Nightly w/e10s, we've
// flipped the default to ON and now have a force-disable pref. This
// way we don't break non-e10s browsers.
if (aPluginTag->mIsJavaPlugin &&
Preferences::GetBool("dom.ipc.plugins.java.force-disable", false)) {
return false;
}
} else {
// Java plugins include a number of different file names,
// so use the mime type (mIsJavaPlugin) and a special pref.
if (aPluginTag->mIsJavaPlugin &&
!Preferences::GetBool("dom.ipc.plugins.java.enabled", true)) {
return false;
}
}
uint32_t prefCount;
@ -399,7 +409,7 @@ GetNewPluginLibrary(nsPluginTag *aPluginTag)
}
if (nsNPAPIPlugin::RunPluginOOP(aPluginTag)) {
return PluginModuleChromeParent::LoadModule(aPluginTag->mFullPath.get(), aPluginTag->mId);
return PluginModuleChromeParent::LoadModule(aPluginTag->mFullPath.get(), aPluginTag->mId, aPluginTag);
}
return new PluginPRLibrary(aPluginTag->mFullPath.get(), aPluginTag->mLibrary);
}
@ -434,13 +444,11 @@ nsNPAPIPlugin::CreatePlugin(nsPluginTag *aPluginTag, nsNPAPIPlugin** aResult)
plugin->mLibrary = pluginLib;
pluginLib->SetPlugin(plugin);
NPError pluginCallError;
nsresult rv;
// Exchange NPAPI entry points.
#if defined(XP_WIN)
// NP_GetEntryPoints must be called before NP_Initialize on Windows.
rv = pluginLib->NP_GetEntryPoints(&plugin->mPluginFuncs, &pluginCallError);
NPError pluginCallError;
nsresult rv = pluginLib->NP_GetEntryPoints(&plugin->mPluginFuncs, &pluginCallError);
if (rv != NS_OK || pluginCallError != NPERR_NO_ERROR) {
return NS_ERROR_FAILURE;
}
@ -453,7 +461,8 @@ nsNPAPIPlugin::CreatePlugin(nsPluginTag *aPluginTag, nsNPAPIPlugin** aResult)
#elif defined(XP_MACOSX)
// NP_Initialize must be called before NP_GetEntryPoints on Mac OS X.
// We need to match WebKit's behavior.
rv = pluginLib->NP_Initialize(&sBrowserFuncs, &pluginCallError);
NPError pluginCallError;
nsresult rv = pluginLib->NP_Initialize(&sBrowserFuncs, &pluginCallError);
if (rv != NS_OK || pluginCallError != NPERR_NO_ERROR) {
return NS_ERROR_FAILURE;
}
@ -464,7 +473,8 @@ nsNPAPIPlugin::CreatePlugin(nsPluginTag *aPluginTag, nsNPAPIPlugin** aResult)
}
#elif defined(MOZ_WIDGET_GONK)
#else
rv = pluginLib->NP_Initialize(&sBrowserFuncs, &plugin->mPluginFuncs, &pluginCallError);
NPError pluginCallError;
nsresult rv = pluginLib->NP_Initialize(&sBrowserFuncs, &plugin->mPluginFuncs, &pluginCallError);
if (rv != NS_OK || pluginCallError != NPERR_NO_ERROR) {
return NS_ERROR_FAILURE;
}

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

@ -45,6 +45,8 @@ both:
async ProcessNativeEventsInInterruptCall();
child:
async DisableFlashProtectedMode();
// Forces the child process to update its plugin function table.
intr NP_GetEntryPoints()
returns (NPError rv);

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

@ -76,6 +76,16 @@ static PRLibrary *sGtkLib = nullptr;
#endif
#ifdef XP_WIN
// Hooking CreateFileW for protected-mode magic
static WindowsDllInterceptor sKernel32Intercept;
typedef HANDLE (WINAPI *CreateFileWPtr)(LPCWSTR fname, DWORD access,
DWORD share,
LPSECURITY_ATTRIBUTES security,
DWORD creation, DWORD flags,
HANDLE ftemplate);
static CreateFileWPtr sCreateFileWStub = nullptr;
static WCHAR* sReplacementConfigFile;
// Used with fix for flash fullscreen window loosing focus.
static bool gDelayFlashFocusReplyUntilEval = false;
// Used to fix GetWindowInfo problems with internal flash settings dialogs
@ -219,6 +229,18 @@ PluginModuleChild::InitForContent(base::ProcessHandle aParentProcessHandle,
return true;
}
bool
PluginModuleChild::RecvDisableFlashProtectedMode()
{
MOZ_ASSERT(mIsChrome);
#ifdef XP_WIN
HookProtectedMode();
#else
MOZ_ASSERT(false, "Should not be called");
#endif
return true;
}
bool
PluginModuleChild::InitForChrome(const std::string& aPluginFilename,
base::ProcessHandle aParentProcessHandle,
@ -1887,9 +1909,99 @@ PluginModuleChild::AnswerNP_Initialize(const PluginSettings& aSettings, NPError*
#else
# error Please implement me for your platform
#endif
#ifdef XP_WIN
CleanupProtectedModeHook();
#endif
}
#if defined(XP_WIN)
HANDLE WINAPI
CreateFileHookFn(LPCWSTR fname, DWORD access, DWORD share,
LPSECURITY_ATTRIBUTES security, DWORD creation, DWORD flags,
HANDLE ftemplate)
{
static const WCHAR kConfigFile[] = L"mms.cfg";
static const size_t kConfigLength = ArrayLength(kConfigFile) - 1;
while (true) { // goto out, in sheep's clothing
size_t len = wcslen(fname);
if (len < kConfigLength) {
break;
}
if (wcscmp(fname + len - kConfigLength, kConfigFile) != 0) {
break;
}
// This is the config file we want to rewrite
WCHAR tempPath[MAX_PATH+1];
if (GetTempPathW(MAX_PATH, tempPath) == 0) {
break;
}
WCHAR tempFile[MAX_PATH+1];
if (GetTempFileNameW(tempPath, L"fx", 0, tempFile) == 0) {
break;
}
HANDLE replacement =
sCreateFileWStub(tempFile, GENERIC_READ | GENERIC_WRITE, share,
security, TRUNCATE_EXISTING,
FILE_ATTRIBUTE_TEMPORARY,
NULL);
if (replacement == INVALID_HANDLE_VALUE) {
break;
}
HANDLE original = sCreateFileWStub(fname, access, share, security,
creation, flags, ftemplate);
if (original != INVALID_HANDLE_VALUE) {
// copy original to replacement
static const size_t kBufferSize = 1024;
char buffer[kBufferSize];
DWORD bytes;
while (ReadFile(original, buffer, kBufferSize, &bytes, NULL)) {
if (bytes == 0) {
break;
}
DWORD wbytes;
WriteFile(replacement, buffer, bytes, &wbytes, NULL);
if (bytes < kBufferSize) {
break;
}
}
CloseHandle(original);
}
static const char kSettingString[] = "\nProtectedMode=0\n";
DWORD wbytes;
WriteFile(replacement, static_cast<const void*>(kSettingString),
sizeof(kSettingString) - 1, &wbytes, NULL);
SetFilePointer(replacement, 0, NULL, FILE_BEGIN);
sReplacementConfigFile = _wcsdup(tempFile);
return replacement;
}
return sCreateFileWStub(fname, access, share, security, creation, flags,
ftemplate);
}
void
PluginModuleChild::HookProtectedMode()
{
sKernel32Intercept.Init("kernel32.dll");
sKernel32Intercept.AddHook("CreateFileW",
reinterpret_cast<intptr_t>(CreateFileHookFn),
(void**) &sCreateFileWStub);
}
void
PluginModuleChild::CleanupProtectedModeHook()
{
if (sReplacementConfigFile) {
DeleteFile(sReplacementConfigFile);
free(sReplacementConfigFile);
sReplacementConfigFile = nullptr;
}
}
BOOL WINAPI
PMCGetWindowInfoHook(HWND hWnd, PWINDOWINFO pwi)
{

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

@ -75,6 +75,7 @@ protected:
virtual bool RecvSettingChanged(const PluginSettings& aSettings) MOZ_OVERRIDE;
// Implement the PPluginModuleChild interface
virtual bool RecvDisableFlashProtectedMode() MOZ_OVERRIDE;
virtual bool AnswerNP_GetEntryPoints(NPError* rv) MOZ_OVERRIDE;
virtual bool AnswerNP_Initialize(const PluginSettings& aSettings, NPError* rv) MOZ_OVERRIDE;
@ -293,6 +294,12 @@ private:
void InitQuirksModes(const nsCString& aMimeType);
bool InitGraphics();
void DeinitGraphics();
#if defined(OS_WIN)
void HookProtectedMode();
void CleanupProtectedModeHook();
#endif
#if defined(MOZ_WIDGET_GTK)
static gboolean DetectNestedEventLoop(gpointer data);
static gboolean ProcessBrowserEvents(gpointer data);

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

@ -31,6 +31,7 @@
#include "nsPrintfCString.h"
#include "prsystem.h"
#include "GeckoProfiler.h"
#include "nsPluginTags.h"
#ifdef XP_WIN
#include "PluginHangUIParent.h"
@ -153,7 +154,8 @@ PluginModuleContentParent::Create(mozilla::ipc::Transport* aTransport,
// static
PluginLibrary*
PluginModuleChromeParent::LoadModule(const char* aFilePath, uint32_t aPluginId)
PluginModuleChromeParent::LoadModule(const char* aFilePath, uint32_t aPluginId,
nsPluginTag* aPluginTag)
{
PLUGIN_LOG_DEBUG_FUNCTION;
@ -192,6 +194,13 @@ PluginModuleChromeParent::LoadModule(const char* aFilePath, uint32_t aPluginId)
#endif
#endif
#ifdef XP_WIN
if (aPluginTag->mIsFlashPlugin &&
Preferences::GetBool("dom.ipc.plugins.flash.disable-protected-mode", false)) {
parent->SendDisableFlashProtectedMode();
}
#endif
return parent.forget();
}
@ -907,6 +916,8 @@ PluginModuleChromeParent::ActorDestroy(ActorDestroyReason why)
#ifdef MOZ_CRASHREPORTER
ProcessFirstMinidump();
#endif
Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT,
NS_LITERAL_CSTRING("plugin"), 1);
}
// We can't broadcast settings changes anymore.

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

@ -28,6 +28,8 @@
#include "nsExceptionHandler.h"
#endif
class nsPluginTag;
namespace mozilla {
namespace dom {
class PCrashReporterParent;
@ -295,7 +297,8 @@ class PluginModuleChromeParent
* This may or may not launch a plugin child process,
* and may or may not be very expensive.
*/
static PluginLibrary* LoadModule(const char* aFilePath, uint32_t aPluginId);
static PluginLibrary* LoadModule(const char* aFilePath, uint32_t aPluginId,
nsPluginTag* aPluginTag);
virtual ~PluginModuleChromeParent();

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

@ -692,23 +692,17 @@ AudioManager::GetFmRadioAudioEnabled(bool *aFmRadioAudioEnabled)
NS_IMETHODIMP
AudioManager::SetFmRadioAudioEnabled(bool aFmRadioAudioEnabled)
{
if (static_cast<
status_t (*) (AudioSystem::audio_devices, AudioSystem::device_connection_state, const char *)
>(AudioSystem::setDeviceConnectionState)) {
AudioSystem::setDeviceConnectionState(AUDIO_DEVICE_OUT_FM,
aFmRadioAudioEnabled ? AUDIO_POLICY_DEVICE_STATE_AVAILABLE :
AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE, "");
InternalSetAudioRoutes(GetCurrentSwitchState(SWITCH_HEADPHONES));
// sync volume with music after powering on fm radio
if (aFmRadioAudioEnabled) {
int32_t volIndex = mCurrentStreamVolumeTbl[AUDIO_STREAM_MUSIC];
SetStreamVolumeIndex(AUDIO_STREAM_FM, volIndex);
mCurrentStreamVolumeTbl[AUDIO_STREAM_FM] = volIndex;
}
return NS_OK;
} else {
return NS_ERROR_NOT_IMPLEMENTED;
AudioSystem::setDeviceConnectionState(AUDIO_DEVICE_OUT_FM,
aFmRadioAudioEnabled ? AUDIO_POLICY_DEVICE_STATE_AVAILABLE :
AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE, "");
InternalSetAudioRoutes(GetCurrentSwitchState(SWITCH_HEADPHONES));
// sync volume with music after powering on fm radio
if (aFmRadioAudioEnabled) {
int32_t volIndex = mCurrentStreamVolumeTbl[AUDIO_STREAM_MUSIC];
SetStreamVolumeIndex(AUDIO_STREAM_FM, volIndex);
mCurrentStreamVolumeTbl[AUDIO_STREAM_FM] = volIndex;
}
return NS_OK;
}
NS_IMETHODIMP

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

@ -38,8 +38,8 @@ namespace dom {
namespace gonk {
class RecoverTask;
class AudioChannelVolInitCallback;
class AudioManager : public nsIAudioManager
, public nsIObserver
class AudioManager MOZ_FINAL : public nsIAudioManager
, public nsIObserver
{
public:
static already_AddRefed<AudioManager> GetInstance();

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

@ -33,9 +33,9 @@
#define ERROR(args...) __android_log_print(ANDROID_LOG_ERROR, "NetworkUtils", ## args)
#if _DEBUG
#define DEBUG(args...) __android_log_print(ANDROID_LOG_DEBUG, "NetworkUtils" , ## args)
#define NU_DBG(args...) __android_log_print(ANDROID_LOG_DEBUG, "NetworkUtils" , ## args)
#else
#define DEBUG(args...)
#define NU_DBG(args...)
#endif
using namespace mozilla::dom;
@ -452,7 +452,7 @@ void NetworkUtils::nextNetdCommand()
gCurrentCommand.callback = GET_CURRENT_CALLBACK;
snprintf(gCurrentCommand.command, MAX_COMMAND_SIZE - 1, "%s", GET_CURRENT_COMMAND);
DEBUG("Sending \'%s\' command to netd.", gCurrentCommand.command);
NU_DBG("Sending \'%s\' command to netd.", gCurrentCommand.command);
SendNetdCommand(GET_CURRENT_NETD_COMMAND);
gCommandQueue.RemoveElementAt(0);
@ -469,7 +469,7 @@ void NetworkUtils::nextNetdCommand()
*/
void NetworkUtils::doCommand(const char* aCommand, CommandChain* aChain, CommandCallback aCallback)
{
DEBUG("Preparing to send \'%s\' command...", aCommand);
NU_DBG("Preparing to send \'%s\' command...", aCommand);
NetdCommand* netdCommand = new NetdCommand();
@ -917,7 +917,7 @@ void NetworkUtils::setInterfaceDns(CommandChain* aChain,
continue;
}
if ((ret + written) >= sizeof(command)) {
if (((size_t)ret + written) >= sizeof(command)) {
command[written] = '\0';
break;
}
@ -1175,8 +1175,8 @@ void NetworkUtils::onNetdMessage(NetdCommand* aCommand)
char* reason = strtok(nullptr, "\0");
if (isBroadcastMessage(code)) {
DEBUG("Receiving broadcast message from netd.");
DEBUG(" ==> Code: %d Reason: %s", code, reason);
NU_DBG("Receiving broadcast message from netd.");
NU_DBG(" ==> Code: %d Reason: %s", code, reason);
sendBroadcastMessage(code, reason);
if (code == NETD_COMMAND_INTERFACE_CHANGE) {
@ -1187,7 +1187,7 @@ void NetworkUtils::onNetdMessage(NetdCommand* aCommand)
NS_ConvertUTF16toUTF8(gWifiTetheringParms->mIfname).get());
if (!strcmp(reason, linkdownReason)) {
DEBUG("Wifi link down, restarting tethering.");
NU_DBG("Wifi link down, restarting tethering.");
RUN_CHAIN(*gWifiTetheringParms, sWifiRetryChain, wifiTetheringFail)
}
}
@ -1198,8 +1198,8 @@ void NetworkUtils::onNetdMessage(NetdCommand* aCommand)
}
// Set pending to false before we handle next command.
DEBUG("Receiving \"%s\" command response from netd.", gCurrentCommand.command);
DEBUG(" ==> Code: %d Reason: %s", code, reason);
NU_DBG("Receiving \"%s\" command response from netd.", gCurrentCommand.command);
NU_DBG(" ==> Code: %d Reason: %s", code, reason);
gReason.AppendElement(nsCString(reason));
@ -1599,21 +1599,21 @@ CommandResult NetworkUtils::removeSecondaryRoute(NetworkParams& aOptions)
CommandResult NetworkUtils::setNetworkInterfaceAlarm(NetworkParams& aOptions)
{
DEBUG("setNetworkInterfaceAlarms: %s", GET_CHAR(mIfname));
NU_DBG("setNetworkInterfaceAlarms: %s", GET_CHAR(mIfname));
RUN_CHAIN(aOptions, sNetworkInterfaceSetAlarmChain, networkInterfaceAlarmFail);
return CommandResult::Pending();
}
CommandResult NetworkUtils::enableNetworkInterfaceAlarm(NetworkParams& aOptions)
{
DEBUG("enableNetworkInterfaceAlarm: %s", GET_CHAR(mIfname));
NU_DBG("enableNetworkInterfaceAlarm: %s", GET_CHAR(mIfname));
RUN_CHAIN(aOptions, sNetworkInterfaceEnableAlarmChain, networkInterfaceAlarmFail);
return CommandResult::Pending();
}
CommandResult NetworkUtils::disableNetworkInterfaceAlarm(NetworkParams& aOptions)
{
DEBUG("disableNetworkInterfaceAlarms: %s", GET_CHAR(mIfname));
NU_DBG("disableNetworkInterfaceAlarms: %s", GET_CHAR(mIfname));
RUN_CHAIN(aOptions, sNetworkInterfaceDisableAlarmChain, networkInterfaceAlarmFail);
return CommandResult::Pending();
}
@ -1623,7 +1623,7 @@ CommandResult NetworkUtils::disableNetworkInterfaceAlarm(NetworkParams& aOptions
*/
CommandResult NetworkUtils::setWifiOperationMode(NetworkParams& aOptions)
{
DEBUG("setWifiOperationMode: %s %s", GET_CHAR(mIfname), GET_CHAR(mMode));
NU_DBG("setWifiOperationMode: %s %s", GET_CHAR(mIfname), GET_CHAR(mMode));
RUN_CHAIN(aOptions, sWifiOperationModeChain, wifiOperationModeFail);
return CommandResult::Pending();
}
@ -1652,11 +1652,11 @@ CommandResult NetworkUtils::setWifiTethering(NetworkParams& aOptions)
dumpParams(aOptions, "WIFI");
if (enable) {
DEBUG("Starting Wifi Tethering on %s <-> %s",
NU_DBG("Starting Wifi Tethering on %s <-> %s",
GET_CHAR(mInternalIfname), GET_CHAR(mExternalIfname));
RUN_CHAIN(aOptions, sWifiEnableChain, wifiTetheringFail)
} else {
DEBUG("Stopping Wifi Tethering on %s <-> %s",
NU_DBG("Stopping Wifi Tethering on %s <-> %s",
GET_CHAR(mInternalIfname), GET_CHAR(mExternalIfname));
RUN_CHAIN(aOptions, sWifiDisableChain, wifiTetheringFail)
}
@ -1684,11 +1684,11 @@ CommandResult NetworkUtils::setUSBTethering(NetworkParams& aOptions)
dumpParams(aOptions, "USB");
if (enable) {
DEBUG("Starting USB Tethering on %s <-> %s",
NU_DBG("Starting USB Tethering on %s <-> %s",
GET_CHAR(mInternalIfname), GET_CHAR(mExternalIfname));
RUN_CHAIN(aOptions, sUSBEnableChain, usbTetheringFail)
} else {
DEBUG("Stopping USB Tethering on %s <-> %s",
NU_DBG("Stopping USB Tethering on %s <-> %s",
GET_CHAR(mInternalIfname), GET_CHAR(mExternalIfname));
RUN_CHAIN(aOptions, sUSBDisableChain, usbTetheringFail)
}
@ -1855,24 +1855,24 @@ inline bool NetworkUtils::isProceeding(uint32_t code)
void NetworkUtils::dumpParams(NetworkParams& aOptions, const char* aType)
{
#ifdef _DEBUG
DEBUG("Dump params:");
DEBUG(" ifname: %s", GET_CHAR(mIfname));
DEBUG(" ip: %s", GET_CHAR(mIp));
DEBUG(" link: %s", GET_CHAR(mLink));
DEBUG(" prefix: %s", GET_CHAR(mPrefix));
DEBUG(" wifiStartIp: %s", GET_CHAR(mWifiStartIp));
DEBUG(" wifiEndIp: %s", GET_CHAR(mWifiEndIp));
DEBUG(" usbStartIp: %s", GET_CHAR(mUsbStartIp));
DEBUG(" usbEndIp: %s", GET_CHAR(mUsbEndIp));
DEBUG(" dnsserver1: %s", GET_CHAR(mDns1));
DEBUG(" dnsserver2: %s", GET_CHAR(mDns2));
DEBUG(" internalIfname: %s", GET_CHAR(mInternalIfname));
DEBUG(" externalIfname: %s", GET_CHAR(mExternalIfname));
NU_DBG("Dump params:");
NU_DBG(" ifname: %s", GET_CHAR(mIfname));
NU_DBG(" ip: %s", GET_CHAR(mIp));
NU_DBG(" link: %s", GET_CHAR(mLink));
NU_DBG(" prefix: %s", GET_CHAR(mPrefix));
NU_DBG(" wifiStartIp: %s", GET_CHAR(mWifiStartIp));
NU_DBG(" wifiEndIp: %s", GET_CHAR(mWifiEndIp));
NU_DBG(" usbStartIp: %s", GET_CHAR(mUsbStartIp));
NU_DBG(" usbEndIp: %s", GET_CHAR(mUsbEndIp));
NU_DBG(" dnsserver1: %s", GET_CHAR(mDns1));
NU_DBG(" dnsserver2: %s", GET_CHAR(mDns2));
NU_DBG(" internalIfname: %s", GET_CHAR(mInternalIfname));
NU_DBG(" externalIfname: %s", GET_CHAR(mExternalIfname));
if (!strcmp(aType, "WIFI")) {
DEBUG(" wifictrlinterfacename: %s", GET_CHAR(mWifictrlinterfacename));
DEBUG(" ssid: %s", GET_CHAR(mSsid));
DEBUG(" security: %s", GET_CHAR(mSecurity));
DEBUG(" key: %s", GET_CHAR(mKey));
NU_DBG(" wifictrlinterfacename: %s", GET_CHAR(mWifictrlinterfacename));
NU_DBG(" ssid: %s", GET_CHAR(mSsid));
NU_DBG(" security: %s", GET_CHAR(mSecurity));
NU_DBG(" key: %s", GET_CHAR(mKey));
}
#endif
}

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

@ -36,9 +36,9 @@ namespace ipc {
namespace dom {
namespace gonk {
class SystemWorkerManager : public nsIObserver,
public nsIInterfaceRequestor,
public nsISystemWorkerManager
class SystemWorkerManager MOZ_FINAL : public nsIObserver,
public nsIInterfaceRequestor,
public nsISystemWorkerManager
{
public:
NS_DECL_ISUPPORTS

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

@ -16,6 +16,7 @@
#include "AutoMounter.h"
#include "VolumeManager.h"
#undef VOLUME_MANAGER_LOG_TAG
#define VOLUME_MANAGER_LOG_TAG "nsVolume"
#include "VolumeManagerLog.h"

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

@ -30,6 +30,7 @@
#include "mozilla/dom/ContentChild.h"
#include "mozilla/Services.h"
#undef VOLUME_MANAGER_LOG_TAG
#define VOLUME_MANAGER_LOG_TAG "nsVolumeService"
#include "VolumeManagerLog.h"

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

@ -12,7 +12,7 @@
namespace mozilla {
namespace system {
class nsVolumeStat : public nsIVolumeStat
class nsVolumeStat MOZ_FINAL : public nsIVolumeStat
{
public:
NS_DECL_ISUPPORTS

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

@ -6,7 +6,7 @@
[OverrideBuiltins]
interface HTMLDocument : Document {
[Throws]
[SetterThrows]
attribute DOMString? domain;
[Throws]
attribute DOMString cookie;

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

@ -86,7 +86,4 @@ interface PeerConnectionImpl {
unsigned short type, boolean outOfOrderAllowed,
unsigned short maxTime, unsigned short maxNum,
boolean externalNegotiated, unsigned short stream);
[Throws]
void connectDataConnection(unsigned short localport,
unsigned short remoteport, unsigned short numstreams);
};

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

@ -2553,8 +2553,6 @@ WorkerThreadPrimaryRunnable::Run()
#ifdef MOZ_NUWA_PROCESS
if (IsNuwaProcess()) {
NS_ASSERTION(NuwaMarkCurrentThread != nullptr,
"NuwaMarkCurrentThread is undefined!");
NuwaMarkCurrentThread(nullptr, nullptr);
NuwaFreezeCurrentThread();
}

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

@ -23,7 +23,7 @@ namespace embedding {
class MockWebBrowserPrint MOZ_FINAL : public nsIWebBrowserPrint
{
public:
MockWebBrowserPrint(PrintData aData);
explicit MockWebBrowserPrint(PrintData aData);
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBBROWSERPRINT

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

@ -815,6 +815,7 @@ struct ParamTraits<mozilla::layers::TextureFactoryIdentifier>
WriteParam(aMsg, aParam.mMaxTextureSize);
WriteParam(aMsg, aParam.mSupportsTextureBlitting);
WriteParam(aMsg, aParam.mSupportsPartialUploads);
WriteParam(aMsg, aParam.mSyncHandle);
}
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
@ -824,7 +825,8 @@ struct ParamTraits<mozilla::layers::TextureFactoryIdentifier>
ReadParam(aMsg, aIter, &supportedBlendModes) &&
ReadParam(aMsg, aIter, &aResult->mMaxTextureSize) &&
ReadParam(aMsg, aIter, &aResult->mSupportsTextureBlitting) &&
ReadParam(aMsg, aIter, &aResult->mSupportsPartialUploads);
ReadParam(aMsg, aIter, &aResult->mSupportsPartialUploads) &&
ReadParam(aMsg, aIter, &aResult->mSyncHandle);
aResult->mSupportedBlendModes.deserialize(supportedBlendModes);
return result;
}

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

@ -158,6 +158,12 @@ MOZ_BEGIN_ENUM_CLASS(DeprecatedTextureHostFlags, uint8_t)
MOZ_END_ENUM_CLASS(DeprecatedTextureHostFlags)
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(DeprecatedTextureHostFlags)
#ifdef XP_WIN
typedef void* SyncHandle;
#else
typedef uintptr_t SyncHandle;
#endif // XP_WIN
/**
* Sent from the compositor to the content-side LayerManager, includes properties
* of the compositor and should (in the future) include information about what
@ -171,18 +177,21 @@ struct TextureFactoryIdentifier
int32_t mMaxTextureSize;
bool mSupportsTextureBlitting;
bool mSupportsPartialUploads;
SyncHandle mSyncHandle;
explicit TextureFactoryIdentifier(LayersBackend aLayersBackend = LayersBackend::LAYERS_NONE,
GeckoProcessType aParentProcessId = GeckoProcessType_Default,
int32_t aMaxTextureSize = 4096,
bool aSupportsTextureBlitting = false,
bool aSupportsPartialUploads = false)
bool aSupportsPartialUploads = false,
SyncHandle aSyncHandle = 0)
: mParentBackend(aLayersBackend)
, mParentProcessId(aParentProcessId)
, mSupportedBlendModes(gfx::CompositionOp::OP_OVER)
, mMaxTextureSize(aMaxTextureSize)
, mSupportsTextureBlitting(aSupportsTextureBlitting)
, mSupportsPartialUploads(aSupportsPartialUploads)
, mSyncHandle(aSyncHandle)
{}
};

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

@ -25,7 +25,7 @@ using namespace android;
namespace mozilla {
namespace layers {
uint32_t GrallocImage::sColorIdMap[] = {
int32_t GrallocImage::sColorIdMap[] = {
HAL_PIXEL_FORMAT_YCbCr_420_P, OMX_COLOR_FormatYUV420Planar,
HAL_PIXEL_FORMAT_YCbCr_422_P, OMX_COLOR_FormatYUV422Planar,
HAL_PIXEL_FORMAT_YCbCr_420_SP, OMX_COLOR_FormatYUV420SemiPlanar,

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

@ -47,7 +47,7 @@ class GrallocImage : public PlanarYCbCrImage
, public ISharedImage
{
typedef PlanarYCbCrData Data;
static uint32_t sColorIdMap[];
static int32_t sColorIdMap[];
public:
struct GrallocData {
nsRefPtr<TextureClient> mGraphicBuffer;

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

@ -0,0 +1,38 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/layers/ChromeProcessController.h"
#include "mozilla/layers/CompositorParent.h"
#include "mozilla/layers/APZCCallbackHelper.h"
#include "nsLayoutUtils.h"
using namespace mozilla;
using namespace mozilla::layers;
using namespace mozilla::widget;
void
ChromeProcessController::RequestContentRepaint(const FrameMetrics& aFrameMetrics)
{
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIContent> targetContent = nsLayoutUtils::FindContentFor(aFrameMetrics.GetScrollId());
if (targetContent) {
FrameMetrics metrics = aFrameMetrics;
APZCCallbackHelper::UpdateSubFrame(targetContent, metrics);
}
}
void
ChromeProcessController::PostDelayedTask(Task* aTask, int aDelayMs)
{
MessageLoop::current()->PostDelayedTask(FROM_HERE, aTask, aDelayMs);
}
void
ChromeProcessController::AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
const uint32_t& aScrollGeneration)
{
APZCCallbackHelper::AcknowledgeScrollUpdate(aScrollId, aScrollGeneration);
}

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

@ -0,0 +1,46 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_layers_ChromeProcessController_h
#define mozilla_layers_ChromeProcessController_h
#include "mozilla/layers/GeckoContentController.h"
namespace mozilla {
namespace layers {
class CompositorParent;
// A ChromeProcessController is attached to the root of a compositor's layer
// tree.
class ChromeProcessController : public mozilla::layers::GeckoContentController
{
typedef mozilla::layers::FrameMetrics FrameMetrics;
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
public:
// GeckoContentController interface
virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics) MOZ_OVERRIDE;
virtual void PostDelayedTask(Task* aTask, int aDelayMs) MOZ_OVERRIDE;
virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
const uint32_t& aScrollGeneration) MOZ_OVERRIDE;
virtual void HandleDoubleTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
virtual void HandleSingleTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
virtual void HandleLongTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId) MOZ_OVERRIDE {}
virtual void HandleLongTapUp(const CSSPoint& aPoint, int32_t aModifiers,
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
virtual void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect &aContentRect,
const mozilla::CSSSize &aScrollableSize) MOZ_OVERRIDE {}
};
} // namespace layers
} // namespace mozilla
#endif /* mozilla_layers_ChromeProcessController_h */

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

@ -112,6 +112,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
if (updated) {
GetForwarder()->UpdatedTexture(this, mBuffer, nullptr);
GetForwarder()->UseTexture(this, mBuffer);
mBuffer->SyncWithObject(GetForwarder()->GetSyncObject());
}
}

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

@ -529,6 +529,10 @@ ClientLayerManager::StopFrameTimeRecording(uint32_t aStartIndex,
void
ClientLayerManager::ForwardTransaction(bool aScheduleComposite)
{
if (mForwarder->GetSyncObject()) {
mForwarder->GetSyncObject()->FinalizeFrame();
}
mPhase = PHASE_FORWARD;
mLatestTransactionId = mTransactionIdAllocator->GetTransactionId();

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

@ -255,10 +255,13 @@ ContentClientRemoteBuffer::EndPaint(nsTArray<ReadbackProcessor::Update>* aReadba
}
mTextureClient->Unlock();
mTextureClient->SyncWithObject(mForwarder->GetSyncObject());
}
if (mTextureClientOnWhite && mTextureClientOnWhite->IsLocked()) {
mTextureClientOnWhite->Unlock();
mTextureClientOnWhite->SyncWithObject(mForwarder->GetSyncObject());
}
ContentClientRemote::EndPaint(aReadbackUpdates);
}

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

@ -242,6 +242,9 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer, uint32_t aContentFlag
mLastPaintedImageSerial = image->GetSerial();
aContainer->NotifyPaintedImage(image);
texture->SyncWithObject(GetForwarder()->GetSyncObject());
return true;
}

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

@ -886,5 +886,21 @@ SharedSurfaceTextureClient::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescripto
return true;
}
TemporaryRef<SyncObject>
SyncObject::CreateSyncObject(SyncHandle aHandle)
{
if (!aHandle) {
return nullptr;
}
#ifdef XP_WIN
RefPtr<SyncObject> syncObject = new SyncObjectD3D11(aHandle);
return syncObject;
#else
MOZ_ASSERT_UNREACHABLE();
return nullptr;
#endif
}
}
}

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

@ -21,6 +21,7 @@
#include "mozilla/ipc/Shmem.h" // for Shmem
#include "mozilla/layers/AtomicRefCountedWithFinalize.h"
#include "mozilla/layers/CompositorTypes.h" // for TextureFlags, etc
#include "mozilla/layers/LayersTypes.h"
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
#include "mozilla/mozalloc.h" // for operator delete
#include "nsAutoPtr.h" // for nsRefPtr
@ -73,6 +74,31 @@ enum TextureAllocationFlags {
ALLOC_CLEAR_BUFFER_WHITE = 2
};
#ifdef XP_WIN
typedef void* SyncHandle;
#else
typedef uintptr_t SyncHandle;
#endif // XP_WIN
class SyncObject : public RefCounted<SyncObject>
{
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SyncObject)
virtual ~SyncObject() { }
static TemporaryRef<SyncObject> CreateSyncObject(SyncHandle aHandle);
MOZ_BEGIN_NESTED_ENUM_CLASS(SyncType)
D3D11,
MOZ_END_NESTED_ENUM_CLASS(SyncType)
virtual SyncType GetSyncType() = 0;
virtual void FinalizeFrame() = 0;
protected:
SyncObject() { }
};
/**
* Interface for TextureClients that can be updated using YCbCr data.
*/
@ -433,6 +459,8 @@ public:
virtual void SetReadbackSink(TextureReadbackSink* aReadbackSink) {
mReadbackSink = aReadbackSink;
}
virtual void SyncWithObject(SyncObject* aSyncObject) { }
private:
/**

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

@ -627,7 +627,7 @@ LayerManagerComposite::Render()
LayerScopeAutoFrame frame(PR_Now());
// Dump to console
if (gfxPrefs::LayersDump()) {
if (gfxPrefs::LayersDump() || profiler_feature_active("layersdump")) {
this->Dump();
}

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

@ -328,7 +328,7 @@ TextureHost::PrintInfo(std::stringstream& aStream, const char* aPrefix)
}
AppendToString(aStream, mFlags, " [flags=", "]");
#ifdef MOZ_DUMP_PAINTING
if (gfxPrefs::LayersDumpTexture()) {
if (gfxPrefs::LayersDumpTexture() || profiler_feature_active("layersdump")) {
nsAutoCString pfx(aPrefix);
pfx += " ";

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