зеркало из https://github.com/mozilla/gecko-dev.git
Merge inbound to mozilla-central r=merge a=merge
This commit is contained in:
Коммит
a63fdbeabb
|
@ -1554,8 +1554,10 @@ AccessibleWrap::GetRemoteIAccessibleFor(const VARIANT& aVarChild)
|
|||
|
||||
RefPtr<IAccessible> result;
|
||||
|
||||
size_t docCount = remoteDocs->Length();
|
||||
for (size_t i = 0; i < docCount; i++) {
|
||||
// We intentionally leave the call to remoteDocs->Length() inside the loop
|
||||
// condition because it is possible for reentry to occur in the call to
|
||||
// GetProxiedAccessibleInSubtree() such that remoteDocs->Length() is mutated.
|
||||
for (size_t i = 0; i < remoteDocs->Length(); i++) {
|
||||
DocAccessibleParent* remoteDoc = remoteDocs->ElementAt(i);
|
||||
|
||||
uint32_t remoteDocMsaaId = WrapperFor(remoteDoc)->GetExistingID();
|
||||
|
|
|
@ -2565,6 +2565,9 @@
|
|||
tab.removeAttribute("linkedpanel");
|
||||
|
||||
this._createLazyBrowser(tab);
|
||||
|
||||
let evt = new CustomEvent("TabBrowserDiscarded", { bubbles: true });
|
||||
tab.dispatchEvent(evt);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
|
|
@ -268,6 +268,8 @@ this.tabs = class extends ExtensionAPI {
|
|||
} else if (event.type == "TabBrowserInserted" &&
|
||||
!event.detail.insertedOnTabCreation) {
|
||||
needed.push("discarded");
|
||||
} else if (event.type == "TabBrowserDiscarded") {
|
||||
needed.push("discarded");
|
||||
}
|
||||
|
||||
let tab = tabManager.getWrapper(event.originalTarget);
|
||||
|
@ -307,6 +309,7 @@ this.tabs = class extends ExtensionAPI {
|
|||
windowTracker.addListener("TabPinned", listener);
|
||||
windowTracker.addListener("TabUnpinned", listener);
|
||||
windowTracker.addListener("TabBrowserInserted", listener);
|
||||
windowTracker.addListener("TabBrowserDiscarded", listener);
|
||||
|
||||
tabTracker.on("tab-isarticle", isArticleChangeListener);
|
||||
|
||||
|
@ -316,6 +319,7 @@ this.tabs = class extends ExtensionAPI {
|
|||
windowTracker.removeListener("TabPinned", listener);
|
||||
windowTracker.removeListener("TabUnpinned", listener);
|
||||
windowTracker.removeListener("TabBrowserInserted", listener);
|
||||
windowTracker.removeListener("TabBrowserDiscarded", listener);
|
||||
tabTracker.off("tab-isarticle", isArticleChangeListener);
|
||||
};
|
||||
}).api(),
|
||||
|
@ -446,6 +450,17 @@ this.tabs = class extends ExtensionAPI {
|
|||
}
|
||||
},
|
||||
|
||||
async discard(tabIds) {
|
||||
if (!Array.isArray(tabIds)) {
|
||||
tabIds = [tabIds];
|
||||
}
|
||||
let tabs = tabIds.map(tabId => tabTracker.getTab(tabId));
|
||||
|
||||
for (let tab of tabs) {
|
||||
tab.ownerGlobal.gBrowser.discardBrowser(tab.linkedBrowser);
|
||||
}
|
||||
},
|
||||
|
||||
async update(tabId, updateProperties) {
|
||||
let nativeTab = getTabOrActive(tabId);
|
||||
|
||||
|
|
|
@ -879,6 +879,22 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "discard",
|
||||
"type": "function",
|
||||
"description": "discards one or more tabs.",
|
||||
"async": true,
|
||||
"parameters": [
|
||||
{
|
||||
"name": "tabIds",
|
||||
"description": "The tab or list of tabs to discard.",
|
||||
"choices": [
|
||||
{"type": "integer", "minimum": 0},
|
||||
{"type": "array", "items": {"type": "integer", "minimum": 0}}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "detectLanguage",
|
||||
"type": "function",
|
||||
|
|
|
@ -138,6 +138,8 @@ skip-if = !e10s || debug || asan
|
|||
skip-if = os == "linux" && debug && bits == 32 # Bug 1350189
|
||||
[browser_ext_tabs_create_invalid_url.js]
|
||||
[browser_ext_tabs_detectLanguage.js]
|
||||
[browser_ext_tabs_discard.js]
|
||||
skip-if = !e10s
|
||||
[browser_ext_tabs_discarded.js]
|
||||
[browser_ext_tabs_duplicate.js]
|
||||
[browser_ext_tabs_events.js]
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* global gBrowser SessionStore */
|
||||
"use strict";
|
||||
|
||||
add_task(async function test_discarded() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["tabs"],
|
||||
},
|
||||
|
||||
background: async function() {
|
||||
let tabs = await browser.tabs.query({currentWindow: true});
|
||||
tabs.sort((tab1, tab2) => tab1.index - tab2.index);
|
||||
|
||||
async function finishTest() {
|
||||
try {
|
||||
await browser.tabs.discard(tabs[0].id);
|
||||
await browser.tabs.discard(tabs[2].id);
|
||||
browser.test.succeed("attempting to discard an already discarded tab or the active tab should not throw error");
|
||||
} catch (e) {
|
||||
browser.test.fail("attempting to discard an already discarded tab or the active tab should not throw error");
|
||||
}
|
||||
let discardedTab = await browser.tabs.get(tabs[2].id);
|
||||
browser.test.assertEq(false, discardedTab.discarded, "attempting to discard the active tab should not have succeeded");
|
||||
|
||||
await browser.test.assertRejects(browser.tabs.discard(999999999), /Invalid tab ID/, "attempt to discard invalid tabId should throw");
|
||||
await browser.test.assertRejects(browser.tabs.discard([999999999, tabs[1].id]), /Invalid tab ID/, "attempt to discard a valid and invalid tabId should throw");
|
||||
discardedTab = await browser.tabs.get(tabs[1].id);
|
||||
browser.test.assertEq(false, discardedTab.discarded, "tab is still not discarded");
|
||||
|
||||
browser.test.notifyPass("test-finished");
|
||||
}
|
||||
|
||||
browser.tabs.onUpdated.addListener(async function(tabId, updatedInfo) {
|
||||
if ("discarded" in updatedInfo) {
|
||||
browser.test.assertEq(tabId, tabs[0].id, "discarding tab triggered onUpdated");
|
||||
let discardedTab = await browser.tabs.get(tabs[0].id);
|
||||
browser.test.assertEq(true, discardedTab.discarded, "discarded tab discard property");
|
||||
|
||||
await finishTest();
|
||||
}
|
||||
});
|
||||
|
||||
browser.tabs.discard(tabs[0].id);
|
||||
},
|
||||
});
|
||||
|
||||
BrowserTestUtils.loadURI(gBrowser.browsers[0], "http://example.com");
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.browsers[0]);
|
||||
let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com");
|
||||
let tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com");
|
||||
|
||||
await extension.startup();
|
||||
|
||||
await extension.awaitFinish("test-finished");
|
||||
await extension.unload();
|
||||
|
||||
await BrowserTestUtils.removeTab(tab1);
|
||||
await BrowserTestUtils.removeTab(tab2);
|
||||
});
|
||||
|
|
@ -26,6 +26,7 @@ let expectedBackgroundApisTargetSpecific = [
|
|||
"tabs.create",
|
||||
"tabs.detectLanguage",
|
||||
"tabs.duplicate",
|
||||
"tabs.discard",
|
||||
"tabs.executeScript",
|
||||
"tabs.get",
|
||||
"tabs.getCurrent",
|
||||
|
|
|
@ -1341,15 +1341,7 @@ var gMainPane = {
|
|||
|
||||
// nsISupports
|
||||
|
||||
QueryInterface(aIID) {
|
||||
if (aIID.equals(Ci.nsIObserver) ||
|
||||
aIID.equals(Ci.nsIDOMEventListener ||
|
||||
aIID.equals(Ci.nsISupports)))
|
||||
return this;
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsIDOMEventListener]),
|
||||
|
||||
// nsIObserver
|
||||
|
||||
|
|
|
@ -5829,6 +5829,14 @@ nsContentUtils::RunInMetastableState(already_AddRefed<nsIRunnable> aRunnable)
|
|||
CycleCollectedJSContext::Get()->RunInMetastableState(Move(aRunnable));
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
nsContentUtils::IsInStableOrMetaStableState()
|
||||
{
|
||||
MOZ_ASSERT(CycleCollectedJSContext::Get(), "Must be on a script thread!");
|
||||
return CycleCollectedJSContext::Get()->IsInStableOrMetaStableState();
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsISerialEventTarget*
|
||||
nsContentUtils::GetStableStateEventTarget()
|
||||
|
|
|
@ -1972,6 +1972,11 @@ public:
|
|||
*/
|
||||
static void RunInMetastableState(already_AddRefed<nsIRunnable> aRunnable);
|
||||
|
||||
/**
|
||||
* Returns true if we are doing StableState/MetastableState.
|
||||
*/
|
||||
static bool IsInStableOrMetaStableState();
|
||||
|
||||
/**
|
||||
* Returns a nsISerialEventTarget which will run any event dispatched to it
|
||||
* once the event loop has reached a "stable state". Runnables dispatched to
|
||||
|
|
|
@ -601,6 +601,10 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
|
|||
NS_ENSURE_TRUE(aEvent->mMessage || !aDOMEvent || aTargets,
|
||||
NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
|
||||
// Events shall not be fired while we are in stable state to prevent anything
|
||||
// visible from the scripts.
|
||||
MOZ_ASSERT(!nsContentUtils::IsInStableOrMetaStableState());
|
||||
|
||||
#ifdef MOZ_TASK_TRACER
|
||||
if (MOZ_UNLIKELY(mozilla::tasktracer::IsStartLogging())) {
|
||||
nsAutoCString eventType;
|
||||
|
|
|
@ -464,6 +464,11 @@ MutableBlobStorage::Append(const void* aData, uint32_t aLength)
|
|||
// If we are already in the temporaryFile mode, we have to dispatch a
|
||||
// runnable.
|
||||
if (mStorageState == eInTemporaryFile) {
|
||||
// If a previous operation failed, let's return that error now.
|
||||
if (NS_FAILED(mErrorResult)) {
|
||||
return mErrorResult;
|
||||
}
|
||||
|
||||
RefPtr<WriteRunnable> runnable =
|
||||
WriteRunnable::CopyBuffer(this, aData, aLength);
|
||||
if (NS_WARN_IF(!runnable)) {
|
||||
|
@ -590,6 +595,7 @@ MutableBlobStorage::TemporaryFileCreated(PRFileDesc* aFD)
|
|||
}
|
||||
|
||||
mFD = aFD;
|
||||
MOZ_ASSERT(NS_SUCCEEDED(mErrorResult));
|
||||
|
||||
// This runnable takes the ownership of mData and it will write this buffer
|
||||
// into the temporary file.
|
||||
|
|
|
@ -3121,8 +3121,7 @@ ContentChild::RecvSetAudioSessionData(const nsID& aId,
|
|||
mozilla::widget::StartAudioSession();
|
||||
return IPC_OK();
|
||||
#else
|
||||
NS_RUNTIMEABORT("Not Reached!");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
MOZ_CRASH("Not Reached!");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -3580,8 +3579,7 @@ ContentChild::RecvShareCodeCoverageMutex(const CrossProcessMutexHandle& aHandle)
|
|||
CodeCoverageHandler::Init(aHandle);
|
||||
return IPC_OK();
|
||||
#else
|
||||
NS_RUNTIMEABORT("Shouldn't receive this message in non-code coverage builds!");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
MOZ_CRASH("Shouldn't receive this message in non-code coverage builds!");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -3592,8 +3590,7 @@ ContentChild::RecvDumpCodeCoverageCounters()
|
|||
CodeCoverageHandler::DumpCounters(0);
|
||||
return IPC_OK();
|
||||
#else
|
||||
NS_RUNTIMEABORT("Shouldn't receive this message in non-code coverage builds!");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
MOZ_CRASH("Shouldn't receive this message in non-code coverage builds!");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -3604,8 +3601,7 @@ ContentChild::RecvResetCodeCoverageCounters()
|
|||
CodeCoverageHandler::ResetCounters(0);
|
||||
return IPC_OK();
|
||||
#else
|
||||
NS_RUNTIMEABORT("Shouldn't receive this message in non-code coverage builds!");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
MOZ_CRASH("Shouldn't receive this message in non-code coverage builds!");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1063,8 +1063,7 @@ mozilla::ipc::IPCResult
|
|||
ContentParent::RecvUngrabPointer(const uint32_t& aTime)
|
||||
{
|
||||
#if !defined(MOZ_WIDGET_GTK)
|
||||
NS_RUNTIMEABORT("This message only makes sense on GTK platforms");
|
||||
return IPC_OK();
|
||||
MOZ_CRASH("This message only makes sense on GTK platforms");
|
||||
#else
|
||||
gdk_pointer_ungrab(aTime);
|
||||
return IPC_OK();
|
||||
|
|
|
@ -158,9 +158,20 @@ class MediaDecoder::BackgroundVideoDecodingPermissionObserver final :
|
|||
if (observerService) {
|
||||
observerService->AddObserver(this, "unselected-tab-hover", false);
|
||||
mIsRegisteredForEvent = true;
|
||||
if (nsContentUtils::IsInStableOrMetaStableState()) {
|
||||
// Events shall not be fired synchronously to prevent anything visible
|
||||
// from the scripts while we are in stable state.
|
||||
if (nsCOMPtr<nsIDocument> doc = GetOwnerDoc()) {
|
||||
doc->Dispatch(TaskCategory::Other,
|
||||
NewRunnableMethod(
|
||||
"MediaDecoder::BackgroundVideoDecodingPermissionObserver::EnableEvent",
|
||||
this, &MediaDecoder::BackgroundVideoDecodingPermissionObserver::EnableEvent));
|
||||
}
|
||||
} else {
|
||||
EnableEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UnregisterEvent() {
|
||||
MOZ_ASSERT(mIsRegisteredForEvent);
|
||||
|
@ -170,9 +181,20 @@ class MediaDecoder::BackgroundVideoDecodingPermissionObserver final :
|
|||
mIsRegisteredForEvent = false;
|
||||
mDecoder->mIsBackgroundVideoDecodingAllowed = false;
|
||||
mDecoder->UpdateVideoDecodeMode();
|
||||
if (nsContentUtils::IsInStableOrMetaStableState()) {
|
||||
// Events shall not be fired synchronously to prevent anything visible
|
||||
// from the scripts while we are in stable state.
|
||||
if (nsCOMPtr<nsIDocument> doc = GetOwnerDoc()) {
|
||||
doc->Dispatch(TaskCategory::Other,
|
||||
NewRunnableMethod(
|
||||
"MediaDecoder::BackgroundVideoDecodingPermissionObserver::DisableEvent",
|
||||
this, &MediaDecoder::BackgroundVideoDecodingPermissionObserver::DisableEvent));
|
||||
}
|
||||
} else {
|
||||
DisableEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
private:
|
||||
~BackgroundVideoDecodingPermissionObserver() {
|
||||
MOZ_ASSERT(!mIsRegisteredForEvent);
|
||||
|
|
|
@ -61,18 +61,35 @@ public:
|
|||
switch (event) {
|
||||
case MediaStreamGraphEvent::EVENT_FINISHED:
|
||||
{
|
||||
RefPtr<SynthStreamListener> self = this;
|
||||
if (!mStarted) {
|
||||
mStarted = true;
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(
|
||||
NewRunnableMethod("dom::SynthStreamListener::DoNotifyStarted",
|
||||
this,
|
||||
NS_NewRunnableFunction(
|
||||
"dom::SynthStreamListener::NotifyEvent",
|
||||
[self] {
|
||||
// "start" event will be fired in DoNotifyStarted() which is
|
||||
// not allowed in stable state, so we do it asynchronously in
|
||||
// next run.
|
||||
NS_DispatchToMainThread(NewRunnableMethod(
|
||||
"dom::SynthStreamListener::DoNotifyStarted",
|
||||
self,
|
||||
&SynthStreamListener::DoNotifyStarted));
|
||||
}));
|
||||
}
|
||||
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(
|
||||
NewRunnableMethod("dom::SynthStreamListener::DoNotifyFinished",
|
||||
this,
|
||||
NS_NewRunnableFunction(
|
||||
"dom::SynthStreamListener::NotifyEvent",
|
||||
[self] {
|
||||
// "end" event will be fired in DoNotifyFinished() which is
|
||||
// not allowed in stable state, so we do it asynchronously in
|
||||
// next run.
|
||||
NS_DispatchToMainThread(NewRunnableMethod(
|
||||
"dom::SynthStreamListener::DoNotifyFinished",
|
||||
self,
|
||||
&SynthStreamListener::DoNotifyFinished));
|
||||
}));
|
||||
}
|
||||
break;
|
||||
case MediaStreamGraphEvent::EVENT_REMOVED:
|
||||
|
@ -89,10 +106,19 @@ public:
|
|||
{
|
||||
if (aBlocked == MediaStreamListener::UNBLOCKED && !mStarted) {
|
||||
mStarted = true;
|
||||
RefPtr<SynthStreamListener> self = this;
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(
|
||||
NewRunnableMethod("dom::SynthStreamListener::DoNotifyStarted",
|
||||
this,
|
||||
NS_NewRunnableFunction(
|
||||
"dom::SynthStreamListener::NotifyBlockingChanged",
|
||||
[self] {
|
||||
// "start" event will be fired in DoNotifyStarted() which is
|
||||
// not allowed in stable state, so we do it asynchronously in
|
||||
// next run.
|
||||
NS_DispatchToMainThread(NewRunnableMethod(
|
||||
"dom::SynthStreamListener::DoNotifyStarted",
|
||||
self,
|
||||
&SynthStreamListener::DoNotifyStarted));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -755,8 +755,7 @@ PluginInstanceChild::AnswerNPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId(
|
|||
|
||||
#else
|
||||
|
||||
NS_RUNTIMEABORT("shouldn't be called on non-ATK platforms");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
MOZ_CRASH("shouldn't be called on non-ATK platforms");
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -1075,8 +1074,7 @@ PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event,
|
|||
const uint32_t &surfaceid,
|
||||
int16_t* handled)
|
||||
{
|
||||
NS_RUNTIMEABORT("NPP_HandleEvent_IOSurface is a OSX-only message");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
MOZ_CRASH("NPP_HandleEvent_IOSurface is a OSX-only message");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1090,8 +1088,7 @@ PluginInstanceChild::RecvWindowPosChanged(const NPRemoteEvent& event)
|
|||
int16_t dontcare;
|
||||
return AnswerNPP_HandleEvent(event, &dontcare);
|
||||
#else
|
||||
NS_RUNTIMEABORT("WindowPosChanged is a windows-only message");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
MOZ_CRASH("WindowPosChanged is a windows-only message");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1110,8 +1107,7 @@ PluginInstanceChild::RecvContentsScaleFactorChanged(const double& aContentsScale
|
|||
#endif
|
||||
return IPC_OK();
|
||||
#else
|
||||
NS_RUNTIMEABORT("ContentsScaleFactorChanged is an Windows or OSX only message");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
MOZ_CRASH("ContentsScaleFactorChanged is an Windows or OSX only message");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -728,8 +728,7 @@ PluginModuleChild::RecvSetAudioSessionData(const nsID& aId,
|
|||
const nsString& aIconPath)
|
||||
{
|
||||
#if !defined XP_WIN
|
||||
NS_RUNTIMEABORT("Not Reached!");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
MOZ_CRASH("Not Reached!");
|
||||
#else
|
||||
nsresult rv = mozilla::widget::RecvAudioSessionData(aId, aDisplayName, aIconPath);
|
||||
NS_ENSURE_SUCCESS(rv, IPC_OK()); // Bail early if this fails
|
||||
|
@ -2616,7 +2615,7 @@ PluginModuleChild::RecvProcessNativeEventsInInterruptCall()
|
|||
ProcessNativeEventsInInterruptCall();
|
||||
return IPC_OK();
|
||||
#else
|
||||
NS_RUNTIMEABORT(
|
||||
MOZ_CRASH(
|
||||
"PluginModuleChild::RecvProcessNativeEventsInInterruptCall not implemented!");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
#endif
|
||||
|
@ -2663,8 +2662,7 @@ PluginModuleChild::PluginRequiresAudioDeviceChanges(
|
|||
}
|
||||
return rv;
|
||||
#else
|
||||
NS_RUNTIMEABORT("PluginRequiresAudioDeviceChanges is not available on this platform.");
|
||||
return NPERR_GENERIC_ERROR;
|
||||
MOZ_CRASH("PluginRequiresAudioDeviceChanges is not available on this platform.");
|
||||
#endif // XP_WIN
|
||||
}
|
||||
|
||||
|
@ -2683,7 +2681,6 @@ PluginModuleChild::RecvNPP_SetValue_NPNVaudioDeviceChangeDetails(
|
|||
}
|
||||
return IPC_OK();
|
||||
#else
|
||||
NS_RUNTIMEABORT("NPP_SetValue_NPNVaudioDeviceChangeDetails is a Windows-only message");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
MOZ_CRASH("NPP_SetValue_NPNVaudioDeviceChangeDetails is a Windows-only message");
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1845,9 +1845,7 @@ PluginModuleChromeParent::AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChange
|
|||
}
|
||||
return IPC_OK();
|
||||
#else
|
||||
NS_RUNTIMEABORT("NPPVpluginRequiresAudioDeviceChanges is not valid on this platform.");
|
||||
*result = NPERR_GENERIC_ERROR;
|
||||
return IPC_OK();
|
||||
MOZ_CRASH("NPPVpluginRequiresAudioDeviceChanges is not valid on this platform.");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2582,8 +2580,7 @@ PluginModuleParent::AnswerProcessSomeEvents()
|
|||
mozilla::ipc::IPCResult
|
||||
PluginModuleParent::AnswerProcessSomeEvents()
|
||||
{
|
||||
NS_RUNTIMEABORT("unreached");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
MOZ_CRASH("unreached");
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -2812,10 +2809,8 @@ mozilla::ipc::IPCResult
|
|||
PluginModuleParent::AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges(
|
||||
const bool& shouldRegister,
|
||||
NPError* result) {
|
||||
NS_RUNTIMEABORT("SetValue_NPPVpluginRequiresAudioDeviceChanges is only valid "
|
||||
MOZ_CRASH("SetValue_NPPVpluginRequiresAudioDeviceChanges is only valid "
|
||||
"with PluginModuleChromeParent");
|
||||
*result = NPERR_GENERIC_ERROR;
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER_INJECTOR
|
||||
|
|
|
@ -577,8 +577,7 @@ PresentationConnection::DoReceiveMessage(const nsACString& aData, bool aIsBinary
|
|||
}
|
||||
jsData.setObject(*arrayBuf);
|
||||
} else {
|
||||
NS_RUNTIMEABORT("Unknown binary type!");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
MOZ_CRASH("Unknown binary type!");
|
||||
}
|
||||
} else {
|
||||
NS_ConvertUTF8toUTF16 utf16Data(aData);
|
||||
|
|
|
@ -5188,7 +5188,7 @@ HTMLEditRules::CheckForEmptyBlock(nsINode* aStartNode,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
} else if (aAction != nsIEditor::eNone) {
|
||||
NS_RUNTIMEABORT("CheckForEmptyBlock doesn't support this action yet");
|
||||
MOZ_CRASH("CheckForEmptyBlock doesn't support this action yet");
|
||||
}
|
||||
}
|
||||
NS_ENSURE_STATE(htmlEditor);
|
||||
|
|
|
@ -418,16 +418,17 @@ ScaledFontFontconfig::CreateFromInstanceData(const InstanceData& aInstanceData,
|
|||
// Bug 1362117 - Cairo may keep the font face alive after the owning NativeFontResource
|
||||
// was freed. To prevent this, we must bind the NativeFontResource to the font face so that
|
||||
// it stays alive at least as long as the font face.
|
||||
aNativeFontResource->AddRef();
|
||||
if (cairo_font_face_set_user_data(font,
|
||||
&sNativeFontResourceKey,
|
||||
aNativeFontResource,
|
||||
ReleaseNativeFontResource) != CAIRO_STATUS_SUCCESS) {
|
||||
gfxWarning() << "Failed binding NativeFontResource to Cairo font face";
|
||||
aNativeFontResource->Release();
|
||||
cairo_font_face_destroy(font);
|
||||
FcPatternDestroy(pattern);
|
||||
return nullptr;
|
||||
}
|
||||
aNativeFontResource->AddRef();
|
||||
}
|
||||
|
||||
cairo_matrix_t sizeMatrix;
|
||||
|
|
|
@ -278,6 +278,7 @@ GLContext::GLContext(CreateContextFlags flags, const SurfaceCaps& caps,
|
|||
mTopError(LOCAL_GL_NO_ERROR),
|
||||
mDebugFlags(ChooseDebugFlags(flags)),
|
||||
mSharedContext(sharedContext),
|
||||
mSymbols{},
|
||||
mCaps(caps),
|
||||
mScreen(nullptr),
|
||||
mLockedSurface(nullptr),
|
||||
|
@ -348,7 +349,7 @@ GLContext::InitWithPrefix(const char* prefix, bool trygl)
|
|||
|
||||
if (!InitWithPrefixImpl(prefix, trygl)) {
|
||||
// If initialization fails, zero the symbols to avoid hard-to-understand bugs.
|
||||
mSymbols.Zero();
|
||||
mSymbols = {};
|
||||
NS_WARNING("GLContext::InitWithPrefix failed!");
|
||||
return false;
|
||||
}
|
||||
|
@ -2140,7 +2141,7 @@ GLContext::MarkDestroyed()
|
|||
NS_WARNING("MakeCurrent() failed during MarkDestroyed! Skipping GL object teardown.");
|
||||
}
|
||||
|
||||
mSymbols.Zero();
|
||||
mSymbols = {};
|
||||
}
|
||||
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
|
|
|
@ -25,15 +25,9 @@
|
|||
namespace mozilla {
|
||||
namespace gl {
|
||||
|
||||
struct GLContextSymbols
|
||||
struct GLContextSymbols final
|
||||
{
|
||||
GLContextSymbols() {
|
||||
Zero();
|
||||
}
|
||||
|
||||
void Zero() {
|
||||
memset(this, 0, sizeof(GLContextSymbols));
|
||||
}
|
||||
GLContextSymbols() = delete; // Initialize with {}.
|
||||
|
||||
void (GLAPIENTRY * fActiveTexture)(GLenum);
|
||||
void (GLAPIENTRY * fAttachShader)(GLuint, GLuint);
|
||||
|
|
|
@ -105,7 +105,7 @@ ReadbackManagerD3D11::~ReadbackManagerD3D11()
|
|||
::CloseHandle(mTaskSemaphore);
|
||||
::CloseHandle(mTaskThread);
|
||||
} else {
|
||||
NS_RUNTIMEABORT("ReadbackManager: Task thread did not shutdown in 5 seconds.");
|
||||
MOZ_CRASH("ReadbackManager: Task thread did not shutdown in 5 seconds.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ ReadbackManagerD3D11::ProcessTasks()
|
|||
|
||||
::EnterCriticalSection(&mTaskMutex);
|
||||
if (mPendingReadbackTasks.Length() == 0) {
|
||||
NS_RUNTIMEABORT("Trying to read from an empty array, bad bad bad");
|
||||
MOZ_CRASH("Trying to read from an empty array, bad bad bad");
|
||||
}
|
||||
ReadbackTask *nextReadbackTask = mPendingReadbackTasks[0].forget();
|
||||
mPendingReadbackTasks.RemoveElementAt(0);
|
||||
|
|
|
@ -975,7 +975,7 @@ DestroySurfaceDescriptor(IShmemAllocator* aAllocator, SurfaceDescriptor* aSurfac
|
|||
break;
|
||||
}
|
||||
default:
|
||||
NS_RUNTIMEABORT("surface type not implemented!");
|
||||
MOZ_CRASH("surface type not implemented!");
|
||||
}
|
||||
*aSurface = SurfaceDescriptor();
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ GLBlitTextureImageHelper::SetBlitFramebufferForDestTexture(GLuint aTexture)
|
|||
// your texture is not texture complete -- that is, you
|
||||
// allocated a texture name, but didn't actually define its
|
||||
// size via a call to TexImage2D.
|
||||
NS_RUNTIMEABORT(msg.get());
|
||||
MOZ_CRASH_UNSAFE_OOL(msg.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,29 +68,24 @@ public:
|
|||
virtual bool BeginTransaction() { return true; }
|
||||
virtual already_AddRefed<ImageLayer> CreateImageLayer() {
|
||||
MOZ_CRASH("Not implemented.");
|
||||
return nullptr;
|
||||
}
|
||||
virtual already_AddRefed<PaintedLayer> CreatePaintedLayer() {
|
||||
RefPtr<PaintedLayer> layer = new TestPaintedLayer(this);
|
||||
return layer.forget();
|
||||
}
|
||||
virtual already_AddRefed<ColorLayer> CreateColorLayer() {
|
||||
NS_RUNTIMEABORT("Not implemented.");
|
||||
return nullptr;
|
||||
MOZ_CRASH("Not implemented.");
|
||||
}
|
||||
virtual already_AddRefed<TextLayer> CreateTextLayer() {
|
||||
NS_RUNTIMEABORT("Not implemented.");
|
||||
return nullptr;
|
||||
MOZ_CRASH("Not implemented.");
|
||||
}
|
||||
virtual already_AddRefed<BorderLayer> CreateBorderLayer() {
|
||||
NS_RUNTIMEABORT("Not implemented.");
|
||||
return nullptr;
|
||||
MOZ_CRASH("Not implemented.");
|
||||
}
|
||||
virtual void SetRoot(Layer* aLayer) {}
|
||||
virtual bool BeginTransactionWithTarget(gfxContext* aTarget) { return true; }
|
||||
virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() {
|
||||
NS_RUNTIMEABORT("Not implemented.");
|
||||
return nullptr;
|
||||
MOZ_CRASH("Not implemented.");
|
||||
}
|
||||
virtual void EndTransaction(DrawPaintedLayerCallback aCallback,
|
||||
void* aCallbackData,
|
||||
|
|
|
@ -690,15 +690,16 @@ gfxFontconfigFontEntry::CreateScaledFont(FcPattern* aRenderPattern,
|
|||
// so that it gets deleted whenever cairo decides
|
||||
NS_ASSERTION(mFTFace, "FT_Face is null when setting user data");
|
||||
NS_ASSERTION(mUserFontData, "user font data is null when setting user data");
|
||||
mUserFontData.get()->AddRef();
|
||||
if (cairo_font_face_set_user_data(face,
|
||||
&sFcFontlistUserFontDataKey,
|
||||
mUserFontData,
|
||||
ReleaseFTUserFontData) != CAIRO_STATUS_SUCCESS) {
|
||||
NS_WARNING("Failed binding FTUserFontData to Cairo font face");
|
||||
mUserFontData.get()->Release();
|
||||
cairo_font_face_destroy(face);
|
||||
return nullptr;
|
||||
}
|
||||
mUserFontData.get()->AddRef();
|
||||
}
|
||||
|
||||
cairo_scaled_font_t *scaledFont = nullptr;
|
||||
|
|
|
@ -1008,6 +1008,10 @@ gfxPlatform::Shutdown()
|
|||
|
||||
gfx::Factory::ShutDown();
|
||||
|
||||
if (gfxConfig::IsEnabled(Feature::WEBRENDER)) {
|
||||
mozilla::wr::wr_shutdown_external_log_handler();
|
||||
}
|
||||
|
||||
delete gGfxPlatformPrefsLock;
|
||||
|
||||
gfxVars::Shutdown();
|
||||
|
@ -1016,8 +1020,6 @@ gfxPlatform::Shutdown()
|
|||
|
||||
gfxConfig::Shutdown();
|
||||
|
||||
mozilla::wr::wr_shutdown_external_log_handler();
|
||||
|
||||
gPlatform->WillShutdown();
|
||||
|
||||
delete gPlatform;
|
||||
|
|
|
@ -2095,7 +2095,7 @@ gfxFontGroup::GetDefaultFont()
|
|||
mFamilyList.ToString(familiesString);
|
||||
SprintfLiteral(msg, "unable to find a usable font (%.220s)",
|
||||
NS_ConvertUTF16toUTF8(familiesString).get());
|
||||
NS_RUNTIMEABORT(msg);
|
||||
MOZ_CRASH_UNSAFE_OOL(msg);
|
||||
}
|
||||
|
||||
return mDefaultFont.get();
|
||||
|
|
|
@ -93,8 +93,7 @@ VRManagerChild::InitForContent(Endpoint<PVRManagerChild>&& aEndpoint)
|
|||
|
||||
RefPtr<VRManagerChild> child(new VRManagerChild());
|
||||
if (!aEndpoint.Bind(child)) {
|
||||
NS_RUNTIMEABORT("Couldn't Open() Compositor channel.");
|
||||
return false;
|
||||
MOZ_CRASH("Couldn't Open() Compositor channel.");
|
||||
}
|
||||
sVRManagerChildSingleton = child;
|
||||
return true;
|
||||
|
@ -131,8 +130,7 @@ VRManagerChild::InitWithGPUProcess(Endpoint<PVRManagerChild>&& aEndpoint)
|
|||
|
||||
sVRManagerChildSingleton = new VRManagerChild();
|
||||
if (!aEndpoint.Bind(sVRManagerChildSingleton)) {
|
||||
NS_RUNTIMEABORT("Couldn't Open() Compositor channel.");
|
||||
return;
|
||||
MOZ_CRASH("Couldn't Open() Compositor channel.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,8 +71,8 @@ void
|
|||
DeleteFontData(WrFontKey aKey) {
|
||||
auto i = sFontDataTable.find(aKey);
|
||||
if (i != sFontDataTable.end()) {
|
||||
sFontDataTable.erase(i);
|
||||
wr_dec_ref_arc(i->second.mVec);
|
||||
sFontDataTable.erase(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -219,47 +219,44 @@ DisableSwitchNotifications(SwitchDevice aDevice)
|
|||
bool
|
||||
EnableAlarm()
|
||||
{
|
||||
NS_RUNTIMEABORT("Alarms can't be programmed from sandboxed contexts. Yet.");
|
||||
return false;
|
||||
MOZ_CRASH("Alarms can't be programmed from sandboxed contexts. Yet.");
|
||||
}
|
||||
|
||||
void
|
||||
DisableAlarm()
|
||||
{
|
||||
NS_RUNTIMEABORT("Alarms can't be programmed from sandboxed contexts. Yet.");
|
||||
MOZ_CRASH("Alarms can't be programmed from sandboxed contexts. Yet.");
|
||||
}
|
||||
|
||||
bool
|
||||
SetAlarm(int32_t aSeconds, int32_t aNanoseconds)
|
||||
{
|
||||
NS_RUNTIMEABORT("Alarms can't be programmed from sandboxed contexts. Yet.");
|
||||
return false;
|
||||
MOZ_CRASH("Alarms can't be programmed from sandboxed contexts. Yet.");
|
||||
}
|
||||
|
||||
void
|
||||
SetProcessPriority(int aPid, ProcessPriority aPriority)
|
||||
{
|
||||
NS_RUNTIMEABORT("Only the main process may set processes' priorities.");
|
||||
MOZ_CRASH("Only the main process may set processes' priorities.");
|
||||
}
|
||||
|
||||
bool
|
||||
SetProcessPrioritySupported()
|
||||
{
|
||||
NS_RUNTIMEABORT("Only the main process may call SetProcessPrioritySupported().");
|
||||
return false;
|
||||
MOZ_CRASH("Only the main process may call SetProcessPrioritySupported().");
|
||||
}
|
||||
|
||||
void
|
||||
SetCurrentThreadPriority(ThreadPriority aThreadPriority)
|
||||
{
|
||||
NS_RUNTIMEABORT("Setting current thread priority cannot be called from sandboxed contexts.");
|
||||
MOZ_CRASH("Setting current thread priority cannot be called from sandboxed contexts.");
|
||||
}
|
||||
|
||||
void
|
||||
SetThreadPriority(PlatformThreadId aThreadId,
|
||||
ThreadPriority aThreadPriority)
|
||||
{
|
||||
NS_RUNTIMEABORT("Setting thread priority cannot be called from sandboxed contexts.");
|
||||
MOZ_CRASH("Setting thread priority cannot be called from sandboxed contexts.");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -2784,7 +2784,7 @@ MessageChannel::DebugAbort(const char* file, int line, const char* cond,
|
|||
pending.popFirst();
|
||||
}
|
||||
|
||||
NS_RUNTIMEABORT(why);
|
||||
MOZ_CRASH_UNSAFE_OOL(why);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -303,14 +303,14 @@ FatalError(const char* aProtocolName, const char* aMsg, bool aIsParent)
|
|||
MOZ_CRASH("IPC FatalError in the parent process!");
|
||||
} else {
|
||||
formattedMessage.AppendLiteral("\". abort()ing as a result.");
|
||||
NS_RUNTIMEABORT(formattedMessage.get());
|
||||
MOZ_CRASH_UNSAFE_OOL(formattedMessage.get());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LogicError(const char* aMsg)
|
||||
{
|
||||
NS_RUNTIMEABORT(aMsg);
|
||||
MOZ_CRASH_UNSAFE_OOL(aMsg);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -107,10 +107,8 @@ mozilla::ipc::IPCResult
|
|||
TestCrashCleanupChild::AnswerDIEDIEDIE()
|
||||
{
|
||||
_exit(0);
|
||||
NS_RUNTIMEABORT("unreached");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
MOZ_CRASH("unreached");
|
||||
}
|
||||
|
||||
|
||||
} // namespace _ipdltest
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -146,10 +146,8 @@ mozilla::ipc::IPCResult
|
|||
TestInterruptErrorCleanupChild::AnswerError()
|
||||
{
|
||||
_exit(0);
|
||||
NS_RUNTIMEABORT("unreached");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
MOZ_CRASH("unreached");
|
||||
}
|
||||
|
||||
|
||||
} // namespace _ipdltest
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -126,10 +126,8 @@ mozilla::ipc::IPCResult
|
|||
TestInterruptShutdownRaceChild::AnswerExit()
|
||||
{
|
||||
_exit(0);
|
||||
NS_RUNTIMEABORT("unreached");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
MOZ_CRASH("unreached");
|
||||
}
|
||||
|
||||
|
||||
} // namespace _ipdltest
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -251,16 +251,6 @@ elif platform.system() == 'Windows':
|
|||
['PATH', 'INCLUDE', 'LIB', 'LIBPATH', 'CC', 'CXX',
|
||||
'WINDOWSSDKDIR'])
|
||||
|
||||
# Compiler flags, based on word length
|
||||
if word_bits == 32:
|
||||
if compiler == 'clang':
|
||||
env['CC'] = '{CC} -arch i386'.format(**env)
|
||||
env['CXX'] = '{CXX} -arch i386'.format(**env)
|
||||
elif compiler == 'gcc':
|
||||
env['CC'] = '{CC} -m32'.format(**env)
|
||||
env['CXX'] = '{CXX} -m32'.format(**env)
|
||||
env['AR'] = 'ar'
|
||||
|
||||
# Configure flags, based on word length and cross-compilation
|
||||
if word_bits == 32:
|
||||
if platform.system() == 'Windows':
|
||||
|
|
|
@ -376,6 +376,11 @@ URLPreloader::BackgroundReadFiles()
|
|||
}
|
||||
|
||||
RefPtr<nsZipArchive> zip = entry->Archive();
|
||||
if (!zip) {
|
||||
MOZ_CRASH_UNSAFE_PRINTF(
|
||||
"Failed to get Omnijar %s archive for entry (path: \"%s\")",
|
||||
entry->TypeString(), entry->mPath.get());
|
||||
}
|
||||
|
||||
auto item = zip->GetItem(entry->mPath.get());
|
||||
if (!item) {
|
||||
|
|
|
@ -127,10 +127,11 @@ class Watchdog
|
|||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mLock = PR_NewLock();
|
||||
if (!mLock)
|
||||
NS_RUNTIMEABORT("PR_NewLock failed.");
|
||||
MOZ_CRASH("PR_NewLock failed.");
|
||||
|
||||
mWakeup = PR_NewCondVar(mLock);
|
||||
if (!mWakeup)
|
||||
NS_RUNTIMEABORT("PR_NewCondVar failed.");
|
||||
MOZ_CRASH("PR_NewCondVar failed.");
|
||||
|
||||
{
|
||||
AutoLockWatchdog lock(this);
|
||||
|
@ -142,7 +143,7 @@ class Watchdog
|
|||
PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
|
||||
PR_JOINABLE_THREAD, 0);
|
||||
if (!mThread)
|
||||
NS_RUNTIMEABORT("PR_CreateThread failed!");
|
||||
MOZ_CRASH("PR_CreateThread failed!");
|
||||
|
||||
// WatchdogMain acquires the lock and then asserts mInitialized. So
|
||||
// make sure to set mInitialized before releasing the lock here so
|
||||
|
@ -1148,16 +1149,13 @@ XPCJSContext::NewXPCJSContext(XPCJSContext* aPrimaryContext)
|
|||
XPCJSContext* self = new XPCJSContext();
|
||||
nsresult rv = self->Initialize(aPrimaryContext);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RUNTIMEABORT("new XPCJSContext failed to initialize.");
|
||||
delete self;
|
||||
return nullptr;
|
||||
MOZ_CRASH("new XPCJSContext failed to initialize.");
|
||||
}
|
||||
|
||||
if (self->Context())
|
||||
return self;
|
||||
|
||||
NS_RUNTIMEABORT("new XPCJSContext failed to initialize.");
|
||||
return nullptr;
|
||||
MOZ_CRASH("new XPCJSContext failed to initialize.");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -73,7 +73,7 @@ nsXPConnect::nsXPConnect()
|
|||
|
||||
XPCJSContext* xpccx = XPCJSContext::NewXPCJSContext(nullptr);
|
||||
if (!xpccx) {
|
||||
NS_RUNTIMEABORT("Couldn't create XPCJSContext.");
|
||||
MOZ_CRASH("Couldn't create XPCJSContext.");
|
||||
}
|
||||
gPrimaryContext = xpccx;
|
||||
mRuntime = xpccx->Runtime();
|
||||
|
|
|
@ -243,7 +243,7 @@ StyleSheetInfo::StyleSheetInfo(CORSMode aCORSMode,
|
|||
#endif
|
||||
{
|
||||
if (!mPrincipal) {
|
||||
NS_RUNTIMEABORT("NullPrincipal::Init failed");
|
||||
MOZ_CRASH("NullPrincipal::Init failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -840,30 +840,25 @@ nsComputedDOMStyle::GetPresShellForContent(const nsIContent* aContent)
|
|||
DeclarationBlock*
|
||||
nsComputedDOMStyle::GetCSSDeclaration(Operation)
|
||||
{
|
||||
NS_RUNTIMEABORT("called nsComputedDOMStyle::GetCSSDeclaration");
|
||||
return nullptr;
|
||||
MOZ_CRASH("called nsComputedDOMStyle::GetCSSDeclaration");
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::SetCSSDeclaration(DeclarationBlock*)
|
||||
{
|
||||
NS_RUNTIMEABORT("called nsComputedDOMStyle::SetCSSDeclaration");
|
||||
return NS_ERROR_FAILURE;
|
||||
MOZ_CRASH("called nsComputedDOMStyle::SetCSSDeclaration");
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
nsComputedDOMStyle::DocToUpdate()
|
||||
{
|
||||
NS_RUNTIMEABORT("called nsComputedDOMStyle::DocToUpdate");
|
||||
return nullptr;
|
||||
MOZ_CRASH("called nsComputedDOMStyle::DocToUpdate");
|
||||
}
|
||||
|
||||
void
|
||||
nsComputedDOMStyle::GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv)
|
||||
{
|
||||
NS_RUNTIMEABORT("called nsComputedDOMStyle::GetCSSParsingEnvironment");
|
||||
// Just in case NS_RUNTIMEABORT ever stops killing us for some reason
|
||||
aCSSParseEnv.mPrincipal = nullptr;
|
||||
MOZ_CRASH("called nsComputedDOMStyle::GetCSSParsingEnvironment");
|
||||
}
|
||||
|
||||
nsDOMCSSDeclaration::ServoCSSParsingEnvironment
|
||||
|
|
|
@ -773,7 +773,8 @@ ErrorLoadingSheet(nsIURI* aURI, const char* aMsg, FailureAction aFailureAction)
|
|||
#ifdef MOZ_CRASHREPORTER
|
||||
AnnotateCrashReport(aURI);
|
||||
#endif
|
||||
NS_RUNTIMEABORT(errorMessage.get());
|
||||
|
||||
MOZ_CRASH_UNSAFE_OOL(errorMessage.get());
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -56,9 +56,14 @@ NSSDialogs.prototype = {
|
|||
escapedArgList.length);
|
||||
},
|
||||
|
||||
getPrompt: function(aTitle, aText, aButtons, aWindow) {
|
||||
getPrompt: function(aTitle, aText, aButtons, aCtx) {
|
||||
let win = null;
|
||||
try {
|
||||
win = aCtx.getInterface(Ci.nsIDOMWindow);
|
||||
} catch (e) {
|
||||
}
|
||||
return new Prompt({
|
||||
window: aWindow,
|
||||
window: win,
|
||||
title: aTitle,
|
||||
text: aText,
|
||||
buttons: aButtons,
|
||||
|
@ -203,10 +208,10 @@ NSSDialogs.prototype = {
|
|||
return detailLines.join("<br/>");
|
||||
},
|
||||
|
||||
viewCertDetails: function(details, window) {
|
||||
viewCertDetails: function(details, ctx) {
|
||||
let p = this.getPrompt(this.getString("clientAuthAsk.message3"),
|
||||
"",
|
||||
[ this.getString("nssdialogs.ok.label") ], window);
|
||||
[ this.getString("nssdialogs.ok.label") ], ctx);
|
||||
p.addLabel({ label: details });
|
||||
this.showPrompt(p);
|
||||
},
|
||||
|
|
|
@ -20,21 +20,13 @@ function log(msg) {
|
|||
Services.console.logStringMessage(msg);
|
||||
}
|
||||
|
||||
function getRootWindow(win) {
|
||||
// Get the root xul window.
|
||||
return win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDocShell).QueryInterface(Ci.nsIDocShellTreeItem)
|
||||
.rootTreeItem.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindow);
|
||||
}
|
||||
|
||||
function Prompt(aOptions) {
|
||||
this.window = "window" in aOptions ? aOptions.window : null;
|
||||
|
||||
this.msg = { async: true };
|
||||
|
||||
if (this.window) {
|
||||
let window = getRootWindow(this.window);
|
||||
let window = GeckoViewUtils.getChromeWindow(this.window);
|
||||
let tab = window &&
|
||||
window.document.documentElement
|
||||
.getAttribute("windowtype") === "navigator:browser" &&
|
||||
|
@ -260,7 +252,7 @@ var DoorHanger = {
|
|||
},
|
||||
|
||||
show: function(aWindow, aMessage, aValue, aButtons, aOptions, aCategory) {
|
||||
let chromeWin = getRootWindow(aWindow);
|
||||
let chromeWin = GeckoViewUtils.getChromeWindow(aWindow);
|
||||
if (chromeWin.NativeWindow && chromeWin.NativeWindow.doorhanger) {
|
||||
// We're dealing with browser.js.
|
||||
return chromeWin.NativeWindow.doorhanger.show(
|
||||
|
@ -299,7 +291,7 @@ var DoorHanger = {
|
|||
},
|
||||
|
||||
hide: function(aWindow, aValue) {
|
||||
let chromeWin = getRootWindow(aWindow);
|
||||
let chromeWin = GeckoViewUtils.getChromeWindow(aWindow);
|
||||
if (chromeWin.NativeWindow && chromeWin.NativeWindow.doorhanger) {
|
||||
// We're dealing with browser.js.
|
||||
return chromeWin.NativeWindow.doorhanger.hide(
|
||||
|
|
|
@ -38,6 +38,9 @@ with Files('*gradle*'):
|
|||
BUG_COMPONENT = ('Firefox for Android', 'Build Config & IDE Support')
|
||||
SCHEDULES.exclusive = ['android']
|
||||
|
||||
with Files('*.json'):
|
||||
BUG_COMPONENT = ('Core', 'Build Config')
|
||||
|
||||
with Files('**/l10n.toml'):
|
||||
BUG_COMPONENT = ('Core', 'Localization')
|
||||
FINAL = True
|
||||
|
|
|
@ -37,7 +37,7 @@ class TabChild;
|
|||
if (abort) { \
|
||||
msg.AppendLiteral(" (set NECKO_ERRORS_ARE_FATAL=0 in your environment " \
|
||||
"to convert this error into a warning.)"); \
|
||||
NS_RUNTIMEABORT(msg.get()); \
|
||||
MOZ_CRASH_UNSAFE_OOL(msg.get()); \
|
||||
} else { \
|
||||
msg.AppendLiteral(" (set NECKO_ERRORS_ARE_FATAL=1 in your environment " \
|
||||
"to convert this warning into a fatal error.)"); \
|
||||
|
|
|
@ -90,7 +90,7 @@ reftest:
|
|||
chunks:
|
||||
by-test-platform:
|
||||
android-4.3-arm7-api-16/debug: 48
|
||||
android.*: 16
|
||||
android.*: 24
|
||||
macosx64.*/opt: 1
|
||||
macosx64.*/debug: 2
|
||||
windows10-64.*/opt: 1
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
with Files("*"):
|
||||
BUG_COMPONENT = ("Testing", "General")
|
||||
|
||||
with Files("awsy/**"):
|
||||
BUG_COMPONENT = ("Testing", "AWSY")
|
||||
SCHEDULES.exclusive = ["awsy"]
|
||||
|
|
|
@ -685,6 +685,8 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
|
|||
abs_res_dir = self.query_abs_res_dir()
|
||||
|
||||
max_verify_time = timedelta(minutes=60)
|
||||
max_verify_tests = 10
|
||||
verified_tests = 0
|
||||
|
||||
if suites:
|
||||
self.info('#### Running %s suites' % suite_category)
|
||||
|
@ -782,6 +784,15 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
|
|||
# Signal verify time exceeded, to break out of suites and
|
||||
# suite categories loops also.
|
||||
return False
|
||||
if verified_tests >= max_verify_tests:
|
||||
# When changesets are merged between trees or many tests are
|
||||
# otherwise updated at once, there probably is not enough time
|
||||
# to verify all tests, and attempting to do so may cause other
|
||||
# problems, such as generating too much log output.
|
||||
self.info("TinderboxPrint: Too many modified tests: Not all tests "
|
||||
"were verified.<br/>")
|
||||
return False
|
||||
verified_tests = verified_tests + 1
|
||||
|
||||
final_cmd = copy.copy(cmd)
|
||||
final_cmd.extend(verify_args)
|
||||
|
|
|
@ -30,6 +30,9 @@ with Files("**"):
|
|||
'web-platform-tests-wdspec',
|
||||
]
|
||||
|
||||
with Files("moz.build"):
|
||||
BUG_COMPONENT = ("Testing", "web-platform-tests")
|
||||
|
||||
with Files("README.md"):
|
||||
BUG_COMPONENT = ("Testing", "web-platform-tests")
|
||||
|
||||
|
@ -273,6 +276,9 @@ with Files("tests/encoding/**"):
|
|||
with Files("tests/encrypted-media/**"):
|
||||
BUG_COMPONENT = ("Core", "Audio/Video: Playback")
|
||||
|
||||
with Files("tests/entries-api/**"):
|
||||
BUG_COMPONENT = ("Core", "DOM")
|
||||
|
||||
with Files("tests/eventsource/**"):
|
||||
BUG_COMPONENT = ("Core", "DOM")
|
||||
|
||||
|
@ -428,9 +434,8 @@ with Files("tests/orientation-sensor/**"):
|
|||
with Files("tests/page-visibility/**"):
|
||||
BUG_COMPONENT = ("Core", "DOM")
|
||||
|
||||
# TODO: not sure what component to use here
|
||||
#with Files("tests/paint-timing/**"):
|
||||
# BUG_COMPONENT = ("", "")
|
||||
with Files("tests/paint-timing/**"):
|
||||
BUG_COMPONENT = ("Core", "DOM")
|
||||
|
||||
# No tests in here
|
||||
with Files("tests/payment-handler/**"):
|
||||
|
@ -538,6 +543,9 @@ with Files("tests/touch-events/**"):
|
|||
with Files("tests/tools/**"):
|
||||
BUG_COMPONENT = ("Testing", "web-platform-tests")
|
||||
|
||||
with Files("tests/trusted-types/**"):
|
||||
BUG_COMPONENT = ("Core", "DOM: Security")
|
||||
|
||||
with Files("tests/uievents/**"):
|
||||
BUG_COMPONENT = ("Core", "DOM: Events")
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ if CONFIG['MOZ_ENABLE_GCONF']:
|
|||
SOURCES += [
|
||||
'nsGIOService.cpp',
|
||||
'nsGSettingsService.cpp',
|
||||
'nsPackageKitService.cpp'
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
|
@ -14,10 +14,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGConfService, Init)
|
|||
#endif
|
||||
#include "nsGIOService.h"
|
||||
#include "nsGSettingsService.h"
|
||||
#include "nsPackageKitService.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsGIOService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGSettingsService, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPackageKitService, Init)
|
||||
#include "nsSystemAlertsService.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemAlertsService, Init)
|
||||
|
||||
|
@ -26,7 +24,6 @@ NS_DEFINE_NAMED_CID(NS_GCONFSERVICE_CID);
|
|||
#endif
|
||||
NS_DEFINE_NAMED_CID(NS_GIOSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_GSETTINGSSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_PACKAGEKITSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_SYSTEMALERTSSERVICE_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kGnomeCIDs[] = {
|
||||
|
@ -35,7 +32,6 @@ static const mozilla::Module::CIDEntry kGnomeCIDs[] = {
|
|||
#endif
|
||||
{ &kNS_GIOSERVICE_CID, false, nullptr, nsGIOServiceConstructor },
|
||||
{ &kNS_GSETTINGSSERVICE_CID, false, nullptr, nsGSettingsServiceConstructor },
|
||||
{ &kNS_PACKAGEKITSERVICE_CID, false, nullptr, nsPackageKitServiceConstructor },
|
||||
{ &kNS_SYSTEMALERTSSERVICE_CID, false, nullptr, nsSystemAlertsServiceConstructor },
|
||||
{ nullptr }
|
||||
};
|
||||
|
@ -46,7 +42,6 @@ static const mozilla::Module::ContractIDEntry kGnomeContracts[] = {
|
|||
#endif
|
||||
{ NS_GIOSERVICE_CONTRACTID, &kNS_GIOSERVICE_CID },
|
||||
{ NS_GSETTINGSSERVICE_CONTRACTID, &kNS_GSETTINGSSERVICE_CID },
|
||||
{ NS_PACKAGEKITSERVICE_CONTRACTID, &kNS_PACKAGEKITSERVICE_CID },
|
||||
{ NS_SYSTEMALERTSERVICE_CONTRACTID, &kNS_SYSTEMALERTSSERVICE_CID },
|
||||
{ nullptr }
|
||||
};
|
||||
|
|
|
@ -1,267 +0,0 @@
|
|||
/* -*- 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 "nsArrayUtils.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsPackageKitService.h"
|
||||
#include "nsString.h"
|
||||
#include "prlink.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <limits>
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
typedef struct _GAsyncResult GAsyncResult;
|
||||
typedef enum {
|
||||
G_BUS_TYPE_STARTER = -1,
|
||||
G_BUS_TYPE_NONE = 0,
|
||||
G_BUS_TYPE_SYSTEM = 1,
|
||||
G_BUS_TYPE_SESSION = 2
|
||||
} GBusType;
|
||||
typedef struct _GCancellable GCancellable;
|
||||
typedef enum {
|
||||
G_DBUS_CALL_FLAGS_NONE = 0,
|
||||
G_DBUS_CALL_FLAGS_NO_AUTO_START = (1<<0)
|
||||
} GDBusCallFlags;
|
||||
typedef struct _GDBusInterfaceInfo GDBusInterfaceInfo;
|
||||
typedef struct _GDBusProxy GDBusProxy;
|
||||
typedef enum {
|
||||
G_DBUS_PROXY_FLAGS_NONE = 0,
|
||||
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES = (1<<0),
|
||||
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS = (1<<1),
|
||||
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START = (1<<2),
|
||||
G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES = (1<<3)
|
||||
} GDBusProxyFlags;
|
||||
typedef struct _GVariant GVariant;
|
||||
typedef void (*GAsyncReadyCallback) (GObject *source_object,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data);
|
||||
|
||||
#define GDBUS_FUNCTIONS \
|
||||
FUNC(g_dbus_proxy_call, void, (GDBusProxy *proxy, const gchar *method_name, GVariant *parameters, GDBusCallFlags flags, gint timeout_msec, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)) \
|
||||
FUNC(g_dbus_proxy_call_finish, GVariant*, (GDBusProxy *proxy, GAsyncResult *res, GError **error)) \
|
||||
FUNC(g_dbus_proxy_new_finish, GDBusProxy*, (GAsyncResult *res, GError **error)) \
|
||||
FUNC(g_dbus_proxy_new_for_bus, void, (GBusType bus_type, GDBusProxyFlags flags, GDBusInterfaceInfo *info, const gchar *name, const gchar *object_path, const gchar *interface_name, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)) \
|
||||
FUNC(g_variant_is_floating, gboolean, (GVariant *value)) \
|
||||
FUNC(g_variant_new, GVariant*, (const gchar *format_string, ...)) \
|
||||
FUNC(g_variant_unref, void, (GVariant* value))
|
||||
|
||||
#define FUNC(name, type, params) \
|
||||
typedef type (*_##name##_fn) params; \
|
||||
static _##name##_fn _##name;
|
||||
|
||||
GDBUS_FUNCTIONS
|
||||
|
||||
#undef FUNC
|
||||
|
||||
#define g_dbus_proxy_call _g_dbus_proxy_call
|
||||
#define g_dbus_proxy_call_finish _g_dbus_proxy_call_finish
|
||||
#define g_dbus_proxy_new_finish _g_dbus_proxy_new_finish
|
||||
#define g_dbus_proxy_new_for_bus _g_dbus_proxy_new_for_bus
|
||||
#define g_variant_is_floating _g_variant_is_floating
|
||||
#define g_variant_new _g_variant_new
|
||||
#define g_variant_unref _g_variant_unref
|
||||
|
||||
static PRLibrary *gioLib = nullptr;
|
||||
|
||||
typedef void (*nsGDBusFunc)();
|
||||
struct nsGDBusDynamicFunction {
|
||||
const char *functionName;
|
||||
nsGDBusFunc *function;
|
||||
};
|
||||
|
||||
nsresult
|
||||
nsPackageKitService::Init()
|
||||
{
|
||||
#define FUNC(name, type, params) { #name, (nsGDBusFunc *)&_##name },
|
||||
const nsGDBusDynamicFunction kGDBusSymbols[] = {
|
||||
GDBUS_FUNCTIONS
|
||||
};
|
||||
#undef FUNC
|
||||
|
||||
if (!gioLib) {
|
||||
gioLib = PR_LoadLibrary("libgio-2.0.so.0");
|
||||
if (!gioLib)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
for (auto GDBusSymbol : kGDBusSymbols) {
|
||||
*GDBusSymbol.function =
|
||||
PR_FindFunctionSymbol(gioLib, GDBusSymbol.functionName);
|
||||
if (!*GDBusSymbol.function) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsPackageKitService, nsIPackageKitService)
|
||||
|
||||
nsPackageKitService::~nsPackageKitService()
|
||||
{
|
||||
if (gioLib) {
|
||||
PR_UnloadLibrary(gioLib);
|
||||
gioLib = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
static const char* InstallPackagesMethods[] = {
|
||||
"InstallPackageNames",
|
||||
"InstallMimeTypes",
|
||||
"InstallFontconfigResources",
|
||||
"InstallGStreamerResources"
|
||||
};
|
||||
|
||||
struct InstallPackagesProxyNewData {
|
||||
nsCOMPtr<nsIObserver> observer;
|
||||
uint32_t method;
|
||||
GVariant* parameters;
|
||||
};
|
||||
|
||||
static void
|
||||
InstallPackagesNotifyObserver(nsIObserver* aObserver,
|
||||
gchar* aErrorMessage)
|
||||
{
|
||||
if (aObserver) {
|
||||
aObserver->Observe(nullptr, "packagekit-install",
|
||||
aErrorMessage ?
|
||||
NS_ConvertUTF8toUTF16(aErrorMessage).get() :
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
InstallPackagesProxyCallCallback(GObject *aSourceObject,
|
||||
GAsyncResult *aResult,
|
||||
gpointer aUserData)
|
||||
{
|
||||
nsCOMPtr<nsIObserver> observer = static_cast<nsIObserver*>(aUserData);
|
||||
GDBusProxy* proxy = reinterpret_cast<GDBusProxy*>(aSourceObject);
|
||||
|
||||
GError* error = nullptr;
|
||||
GVariant* result = g_dbus_proxy_call_finish(proxy, aResult, &error);
|
||||
if (result) {
|
||||
InstallPackagesNotifyObserver(observer, nullptr);
|
||||
g_variant_unref(result);
|
||||
} else {
|
||||
NS_ASSERTION(error, "g_dbus_proxy_call_finish should set error when it returns NULL");
|
||||
InstallPackagesNotifyObserver(observer, error->message);
|
||||
g_error_free(error);
|
||||
}
|
||||
|
||||
g_object_unref(proxy);
|
||||
Unused << observer.forget().take();
|
||||
}
|
||||
|
||||
static void
|
||||
InstallPackagesProxyNewCallback(GObject *aSourceObject,
|
||||
GAsyncResult *aResult,
|
||||
gpointer aUserData)
|
||||
{
|
||||
InstallPackagesProxyNewData* userData =
|
||||
static_cast<InstallPackagesProxyNewData*>(aUserData);
|
||||
|
||||
NS_ASSERTION(g_variant_is_floating(userData->parameters),
|
||||
"userData->parameters should be a floating reference.");
|
||||
|
||||
GError* error = nullptr;
|
||||
GDBusProxy* proxy = g_dbus_proxy_new_finish(aResult, &error);
|
||||
|
||||
if (proxy) {
|
||||
// Send the asynchronous request to install the packages
|
||||
// This call will consume the floating reference userData->parameters so we
|
||||
// don't need to release it explicitly.
|
||||
nsIObserver* observer;
|
||||
userData->observer.forget(&observer);
|
||||
g_dbus_proxy_call(proxy,
|
||||
InstallPackagesMethods[userData->method],
|
||||
userData->parameters,
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
G_MAXINT,
|
||||
nullptr,
|
||||
&InstallPackagesProxyCallCallback,
|
||||
static_cast<gpointer>(observer));
|
||||
} else {
|
||||
NS_ASSERTION(error, "g_dbus_proxy_new_finish should set error when it returns NULL");
|
||||
InstallPackagesNotifyObserver(userData->observer, error->message);
|
||||
g_error_free(error);
|
||||
g_variant_unref(userData->parameters);
|
||||
}
|
||||
delete userData;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPackageKitService::InstallPackages(uint32_t aInstallMethod,
|
||||
nsIArray* aPackageArray,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
NS_ENSURE_ARG(aPackageArray);
|
||||
|
||||
uint32_t arrayLength;
|
||||
aPackageArray->GetLength(&arrayLength);
|
||||
if (arrayLength == 0 ||
|
||||
arrayLength == std::numeric_limits<uint32_t>::max() ||
|
||||
aInstallMethod >= PK_INSTALL_METHOD_COUNT) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
// Create the GVariant* parameter from the list of packages.
|
||||
GVariant* parameters = nullptr;
|
||||
auto packages = MakeUnique<gchar*[]>(arrayLength + 1);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
for (uint32_t i = 0; i < arrayLength; i++) {
|
||||
nsCOMPtr<nsISupportsString> package =
|
||||
do_QueryElementAt(aPackageArray, i);
|
||||
if (!package) {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
break;
|
||||
}
|
||||
nsString data;
|
||||
package->GetData(data);
|
||||
packages[i] = g_strdup(NS_ConvertUTF16toUTF8(data).get());
|
||||
if (!packages[i]) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
packages[arrayLength] = nullptr;
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// We create a new GVariant object to send parameters to PackageKit.
|
||||
parameters = g_variant_new("(u^ass)", static_cast<guint32>(0),
|
||||
packages.get(), "hide-finished");
|
||||
if (!parameters) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < arrayLength; i++) {
|
||||
g_free(packages[i]);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Send the asynchronous request to load the bus proxy
|
||||
InstallPackagesProxyNewData* data = new InstallPackagesProxyNewData;
|
||||
data->observer = aObserver;
|
||||
data->method = aInstallMethod;
|
||||
data->parameters = parameters;
|
||||
g_dbus_proxy_new_for_bus(G_BUS_TYPE_SESSION,
|
||||
G_DBUS_PROXY_FLAGS_NONE,
|
||||
nullptr,
|
||||
"org.freedesktop.PackageKit",
|
||||
"/org/freedesktop/PackageKit",
|
||||
"org.freedesktop.PackageKit.Modify",
|
||||
nullptr,
|
||||
&InstallPackagesProxyNewCallback,
|
||||
static_cast<gpointer>(data));
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
/* -*- 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 nsPackageKitService_h_
|
||||
#define nsPackageKitService_h_
|
||||
|
||||
#include "nsIPackageKitService.h"
|
||||
|
||||
#define NS_PACKAGEKITSERVICE_CID \
|
||||
{0x9c95515e, 0x611d, 0x11e4, {0xb9, 0x7e, 0x60, 0xa4, 0x4c, 0x71, 0x70, 0x42}}
|
||||
|
||||
class nsPackageKitService final : public nsIPackageKitService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPACKAGEKITSERVICE
|
||||
|
||||
nsresult Init();
|
||||
|
||||
private:
|
||||
~nsPackageKitService();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -131,7 +131,7 @@ namespace mozilla {
|
|||
AutoSQLiteLifetime::AutoSQLiteLifetime()
|
||||
{
|
||||
if (++AutoSQLiteLifetime::sSingletonEnforcer != 1) {
|
||||
NS_RUNTIMEABORT("multiple instances of AutoSQLiteLifetime constructed!");
|
||||
MOZ_CRASH("multiple instances of AutoSQLiteLifetime constructed!");
|
||||
}
|
||||
|
||||
#ifdef MOZ_STORAGE_MEMORY
|
||||
|
|
|
@ -40,42 +40,42 @@ GdkErrorHandler(const gchar *log_domain, GLogLevelFlags log_level,
|
|||
NS_NAMED_LITERAL_CSTRING(serialString, "(Details: serial ");
|
||||
int32_t start = buffer.Find(serialString);
|
||||
if (start == kNotFound)
|
||||
NS_RUNTIMEABORT(message);
|
||||
MOZ_CRASH_UNSAFE_OOL(message);
|
||||
|
||||
start += serialString.Length();
|
||||
errno = 0;
|
||||
event.serial = strtol(buffer.BeginReading() + start, &endptr, 10);
|
||||
if (errno)
|
||||
NS_RUNTIMEABORT(message);
|
||||
MOZ_CRASH_UNSAFE_OOL(message);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(errorCodeString, " error_code ");
|
||||
if (!StringBeginsWith(Substring(endptr, buffer.EndReading()), errorCodeString))
|
||||
NS_RUNTIMEABORT(message);
|
||||
MOZ_CRASH_UNSAFE_OOL(message);
|
||||
|
||||
errno = 0;
|
||||
event.error_code = strtol(endptr + errorCodeString.Length(), &endptr, 10);
|
||||
if (errno)
|
||||
NS_RUNTIMEABORT(message);
|
||||
MOZ_CRASH_UNSAFE_OOL(message);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(requestCodeString, " request_code ");
|
||||
if (!StringBeginsWith(Substring(endptr, buffer.EndReading()), requestCodeString))
|
||||
NS_RUNTIMEABORT(message);
|
||||
MOZ_CRASH_UNSAFE_OOL(message);
|
||||
|
||||
errno = 0;
|
||||
event.request_code = strtol(endptr + requestCodeString.Length(), &endptr, 10);
|
||||
if (errno)
|
||||
NS_RUNTIMEABORT(message);
|
||||
MOZ_CRASH_UNSAFE_OOL(message);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(minorCodeString, " minor_code ");
|
||||
start = buffer.Find(minorCodeString, /* aIgnoreCase = */ false,
|
||||
endptr - buffer.BeginReading());
|
||||
if (!start)
|
||||
NS_RUNTIMEABORT(message);
|
||||
MOZ_CRASH_UNSAFE_OOL(message);
|
||||
|
||||
errno = 0;
|
||||
event.minor_code = strtol(buffer.BeginReading() + start + minorCodeString.Length(), nullptr, 10);
|
||||
if (errno)
|
||||
NS_RUNTIMEABORT(message);
|
||||
MOZ_CRASH_UNSAFE_OOL(message);
|
||||
|
||||
event.display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
|
||||
// Gdk does not provide resource ID
|
||||
|
@ -84,7 +84,7 @@ GdkErrorHandler(const gchar *log_domain, GLogLevelFlags log_level,
|
|||
X11Error(event.display, &event);
|
||||
} else {
|
||||
g_log_default_handler(log_domain, log_level, message, user_data);
|
||||
NS_RUNTIMEABORT(message);
|
||||
MOZ_CRASH_UNSAFE_OOL(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -144,8 +144,7 @@ X11Error(Display *display, XErrorEvent *event) {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
NS_RUNTIMEABORT(notes.get());
|
||||
return 0; // not reached
|
||||
MOZ_CRASH_UNSAFE_OOL(notes.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -888,8 +888,8 @@ nsCocoaWindow::Show(bool bState)
|
|||
if (nativeParentWindow && mPopupLevel == ePopupLevelParent) {
|
||||
[nativeParentWindow addChildWindow:mWindow
|
||||
ordered:NSWindowAbove];
|
||||
[mWindow setLevel:NSPopUpMenuWindowLevel];
|
||||
}
|
||||
SetPopupWindowLevel();
|
||||
}
|
||||
else {
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
@ -1377,7 +1377,6 @@ nsCocoaWindow::HideWindowChrome(bool aShouldHide)
|
|||
enumerator = [childWindows objectEnumerator];
|
||||
while ((child = [enumerator nextObject])) {
|
||||
[mWindow addChildWindow:child ordered:NSWindowAbove];
|
||||
[mWindow setLevel:NSPopUpMenuWindowLevel];
|
||||
}
|
||||
|
||||
// Show the new window.
|
||||
|
@ -2505,14 +2504,12 @@ void nsCocoaWindow::SetPopupWindowLevel()
|
|||
// deactivated.
|
||||
if (mPopupLevel == ePopupLevelFloating) {
|
||||
[mWindow setLevel:NSFloatingWindowLevel];
|
||||
[mWindow setHidesOnDeactivate:YES];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Otherwise, this is a top-level or parent popup. Parent popups always
|
||||
// appear just above their parent and essentially ignore the level.
|
||||
[mWindow setLevel:NSPopUpMenuWindowLevel];
|
||||
[mWindow setHidesOnDeactivate:NO];
|
||||
}
|
||||
[mWindow setHidesOnDeactivate:YES];
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -242,6 +242,11 @@ public:
|
|||
|
||||
void DispatchMicroTaskRunnable(already_AddRefed<MicroTaskRunnable> aRunnable);
|
||||
|
||||
bool IsInStableOrMetaStableState()
|
||||
{
|
||||
return mDoingStableStates;
|
||||
}
|
||||
|
||||
// Storage for watching rejected promises waiting for some client to
|
||||
// consume their rejection.
|
||||
// Promises in this list have been rejected in the last turn of the
|
||||
|
|
|
@ -21,7 +21,6 @@ XPIDL_SOURCES += [
|
|||
'nsIMessageLoop.idl',
|
||||
'nsIMutable.idl',
|
||||
'nsISecurityConsoleMessage.idl',
|
||||
'nsIStatusReporter.idl',
|
||||
'nsISupports.idl',
|
||||
'nsIUUIDGenerator.idl',
|
||||
'nsIVersionComparator.idl',
|
||||
|
@ -160,7 +159,6 @@ UNIFIED_SOURCES += [
|
|||
'nsMessageLoop.cpp',
|
||||
'NSPRLogModulesParser.cpp',
|
||||
'nsSecurityConsoleMessage.cpp',
|
||||
'nsStatusReporterManager.cpp',
|
||||
'nsSystemInfo.cpp',
|
||||
'nsTraceRefcnt.cpp',
|
||||
'nsUUIDGenerator.cpp',
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISimpleEnumerator;
|
||||
|
||||
/*
|
||||
* Status reporters show Firefox's service status.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(ffcb716c-deeb-44ea-9d9d-ab25dc6980a8)]
|
||||
interface nsIStatusReporter : nsISupports
|
||||
{
|
||||
readonly attribute ACString name;
|
||||
/*
|
||||
* The name of the process containing this reporter. Each reporter initially
|
||||
* has "" in this field, indicating that it applies to the current process.
|
||||
*/
|
||||
readonly attribute ACString process;
|
||||
/*
|
||||
* A human-readable status description.
|
||||
*/
|
||||
readonly attribute AUTF8String description;
|
||||
};
|
||||
|
||||
[scriptable, uuid(fd531273-3319-4fcd-90f2-9f53876c3828)]
|
||||
interface nsIStatusReporterManager : nsISupports
|
||||
{
|
||||
|
||||
/*
|
||||
* Return an enumerator of nsIStatusReporters that are currently registered.
|
||||
*/
|
||||
nsISimpleEnumerator enumerateReporters();
|
||||
|
||||
/*
|
||||
* Register the given nsIStatusReporter. After a reporter is registered,
|
||||
* it will be available via enumerateReporters(). The Manager service
|
||||
* will hold a strong reference to the given reporter.
|
||||
*/
|
||||
void registerReporter(in nsIStatusReporter reporter);
|
||||
|
||||
/*
|
||||
* Unregister the given status reporter.
|
||||
*/
|
||||
void unregisterReporter(in nsIStatusReporter reporter);
|
||||
|
||||
/*
|
||||
* Initialize.
|
||||
*/
|
||||
void init();
|
||||
|
||||
/*
|
||||
* Dump service status as a json file
|
||||
*/
|
||||
void dumpReports();
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
/*
|
||||
* Note that this defaults 'process' to "", which is usually what's desired.
|
||||
*/
|
||||
#define NS_STATUS_REPORTER_IMPLEMENT(_classname, _name, _desc_Function) \
|
||||
class StatusReporter_##_classname final : public nsIStatusReporter { \
|
||||
~StatusReporter_##_classname() {} \
|
||||
public: \
|
||||
NS_DECL_ISUPPORTS \
|
||||
NS_IMETHOD GetName(nsACString &name) override \
|
||||
{ name.AssignLiteral(_name); return NS_OK; } \
|
||||
NS_IMETHOD GetProcess(nsACString &process) override \
|
||||
{ process.Truncate(); return NS_OK; } \
|
||||
NS_IMETHOD GetDescription(nsACString &desc) override \
|
||||
{ _desc_Function(desc); return NS_OK; } \
|
||||
}; \
|
||||
NS_IMPL_ISUPPORTS(StatusReporter_##_classname, nsIStatusReporter)
|
||||
|
||||
#define NS_STATUS_REPORTER_NAME(_classname) StatusReporter_##_classname
|
||||
|
||||
nsresult NS_RegisterStatusReporter(nsIStatusReporter *reporter);
|
||||
nsresult NS_UnregisterStatusReporter(nsIStatusReporter *reporter);
|
||||
nsresult NS_DumpStatusReporter();
|
||||
|
||||
#define NS_STATUS_REPORTER_MANAGER_CID \
|
||||
{ 0xe8eb4e7e, 0xf2cf, 0x45e5, \
|
||||
{ 0xb8, 0xa4, 0x6a, 0x0f, 0x50, 0x18, 0x84, 0x63 } }
|
||||
%}
|
|
@ -1,321 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsStatusReporterManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsArrayEnumerator.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsDumpUtils.h"
|
||||
#include "nsIFileStreams.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include <process.h>
|
||||
#define getpid _getpid
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#define DO_STATUS_REPORT 1
|
||||
#endif
|
||||
|
||||
#ifdef DO_STATUS_REPORT // {
|
||||
namespace {
|
||||
|
||||
class DumpStatusInfoToTempDirRunnable : public mozilla::Runnable
|
||||
{
|
||||
public:
|
||||
DumpStatusInfoToTempDirRunnable()
|
||||
: mozilla::Runnable("DumpStatusInfoToTempDirRunnable")
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD Run() override
|
||||
{
|
||||
nsCOMPtr<nsIStatusReporterManager> mgr =
|
||||
do_GetService("@mozilla.org/status-reporter-manager;1");
|
||||
mgr->DumpReports();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
doStatusReport(const nsCString& aInputStr)
|
||||
{
|
||||
LOG("FifoWatcher(%s) dispatching status report runnable.", aInputStr.get());
|
||||
RefPtr<DumpStatusInfoToTempDirRunnable> runnable =
|
||||
new DumpStatusInfoToTempDirRunnable();
|
||||
NS_DispatchToMainThread(runnable);
|
||||
}
|
||||
|
||||
} //anonymous namespace
|
||||
#endif // DO_STATUS_REPORT }
|
||||
|
||||
static bool gStatusReportProgress = 0;
|
||||
static int gNumReporters = 0;
|
||||
|
||||
nsresult
|
||||
getStatus(nsACString& aDesc)
|
||||
{
|
||||
if (!gStatusReportProgress) {
|
||||
aDesc.AssignLiteral("Init");
|
||||
} else {
|
||||
aDesc.AssignLiteral("Running: There are ");
|
||||
aDesc.AppendInt(gNumReporters);
|
||||
aDesc.AppendLiteral(" reporters");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_STATUS_REPORTER_IMPLEMENT(StatusReporter, "StatusReporter State", getStatus)
|
||||
|
||||
#define DUMP(o, s) \
|
||||
do { \
|
||||
const char* s2 = (s); \
|
||||
uint32_t dummy; \
|
||||
nsresult rvDump = (o)->Write((s2), strlen(s2), &dummy); \
|
||||
if (NS_WARN_IF(NS_FAILED(rvDump))) \
|
||||
return rvDump; \
|
||||
} while (0)
|
||||
|
||||
static nsresult
|
||||
DumpReport(nsIFileOutputStream* aOStream, const nsCString& aProcess,
|
||||
const nsCString& aName, const nsCString& aDescription)
|
||||
{
|
||||
if (aProcess.IsEmpty()) {
|
||||
int pid = getpid();
|
||||
nsPrintfCString pidStr("PID %u", pid);
|
||||
DUMP(aOStream, "\n {\n \"Process\": \"");
|
||||
DUMP(aOStream, pidStr.get());
|
||||
} else {
|
||||
DUMP(aOStream, "\n { \"Unknown Process\": \"");
|
||||
}
|
||||
|
||||
DUMP(aOStream, "\",\n \"Reporter name\": \"");
|
||||
DUMP(aOStream, aName.get());
|
||||
|
||||
DUMP(aOStream, "\",\n \"Status Description\": [\"");
|
||||
nsCString desc = aDescription;
|
||||
desc.ReplaceSubstring("|", "\",\"");
|
||||
DUMP(aOStream, desc.get());
|
||||
|
||||
DUMP(aOStream, "\"]\n }");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
** nsStatusReporterManager implementation
|
||||
**/
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsStatusReporterManager, nsIStatusReporterManager)
|
||||
|
||||
nsStatusReporterManager::nsStatusReporterManager()
|
||||
{
|
||||
}
|
||||
|
||||
nsStatusReporterManager::~nsStatusReporterManager()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStatusReporterManager::Init()
|
||||
{
|
||||
RegisterReporter(new NS_STATUS_REPORTER_NAME(StatusReporter));
|
||||
gStatusReportProgress = 1;
|
||||
|
||||
#ifdef DO_STATUS_REPORT
|
||||
if (FifoWatcher::MaybeCreate()) {
|
||||
FifoWatcher* fw = FifoWatcher::GetSingleton();
|
||||
fw->RegisterCallback(NS_LITERAL_CSTRING("status report"), doStatusReport);
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStatusReporterManager::DumpReports()
|
||||
{
|
||||
static unsigned number = 1;
|
||||
nsresult rv;
|
||||
|
||||
nsCString filename("status-reports-");
|
||||
filename.AppendInt((uint32_t)getpid());
|
||||
filename.Append('-');
|
||||
filename.AppendInt(number++);
|
||||
filename.AppendLiteral(".json");
|
||||
|
||||
// Open a file in NS_OS_TEMP_DIR for writing.
|
||||
// The file is initialized as "incomplete-status-reports-pid-number.json" in the
|
||||
// begining, it will be rename as "status-reports-pid-number.json" in the end.
|
||||
nsCOMPtr<nsIFile> tmpFile;
|
||||
rv = nsDumpUtils::OpenTempFile(NS_LITERAL_CSTRING("incomplete-") +
|
||||
filename,
|
||||
getter_AddRefs(tmpFile),
|
||||
NS_LITERAL_CSTRING("status-reports"));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFileOutputStream> ostream =
|
||||
do_CreateInstance("@mozilla.org/network/file-output-stream;1");
|
||||
rv = ostream->Init(tmpFile, -1, -1, 0);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
//Write the reports to the file
|
||||
|
||||
DUMP(ostream, "{\n\"subject\":\"about:service reports\",\n");
|
||||
DUMP(ostream, "\"reporters\": [ ");
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> e;
|
||||
bool more, first = true;
|
||||
EnumerateReporters(getter_AddRefs(e));
|
||||
while (NS_SUCCEEDED(e->HasMoreElements(&more)) && more) {
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
e->GetNext(getter_AddRefs(supports));
|
||||
nsCOMPtr<nsIStatusReporter> r = do_QueryInterface(supports);
|
||||
|
||||
nsCString process;
|
||||
rv = r->GetProcess(process);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCString name;
|
||||
rv = r->GetName(name);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCString description;
|
||||
rv = r->GetDescription(description);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
DUMP(ostream, ",");
|
||||
}
|
||||
|
||||
rv = DumpReport(ostream, process, name, description);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
DUMP(ostream, "\n]\n}\n");
|
||||
|
||||
rv = ostream->Close();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Rename the status reports file
|
||||
nsCOMPtr<nsIFile> srFinalFile;
|
||||
rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(srFinalFile));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
rv = srFinalFile->AppendNative(NS_LITERAL_CSTRING("status-reports"));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
rv = srFinalFile->AppendNative(filename);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = srFinalFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0600);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsAutoString srActualFinalFilename;
|
||||
rv = srFinalFile->GetLeafName(srActualFinalFilename);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = tmpFile->MoveTo(/* directory */ nullptr, srActualFinalFilename);
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStatusReporterManager::EnumerateReporters(nsISimpleEnumerator** aResult)
|
||||
{
|
||||
return NS_NewArrayEnumerator(aResult, mReporters);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStatusReporterManager::RegisterReporter(nsIStatusReporter* aReporter)
|
||||
{
|
||||
if (mReporters.IndexOf(aReporter) != -1) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mReporters.AppendObject(aReporter);
|
||||
gNumReporters++;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStatusReporterManager::UnregisterReporter(nsIStatusReporter* aReporter)
|
||||
{
|
||||
if (!mReporters.RemoveObject(aReporter)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
gNumReporters--;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_RegisterStatusReporter(nsIStatusReporter* aReporter)
|
||||
{
|
||||
nsCOMPtr<nsIStatusReporterManager> mgr =
|
||||
do_GetService("@mozilla.org/status-reporter-manager;1");
|
||||
if (!mgr) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return mgr->RegisterReporter(aReporter);
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_UnregisterStatusReporter(nsIStatusReporter* aReporter)
|
||||
{
|
||||
nsCOMPtr<nsIStatusReporterManager> mgr =
|
||||
do_GetService("@mozilla.org/status-reporter-manager;1");
|
||||
if (!mgr) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return mgr->UnregisterReporter(aReporter);
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_DumpStatusReporter()
|
||||
{
|
||||
nsCOMPtr<nsIStatusReporterManager> mgr =
|
||||
do_GetService("@mozilla.org/status-reporter-manager;1");
|
||||
if (!mgr) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return mgr->DumpReports();
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
#include "nsIStatusReporter.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsStatusReporter final : public nsIStatusReporter
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISTATUSREPORTER
|
||||
|
||||
nsStatusReporter(nsACString& aProcess, nsACString& aDesc);
|
||||
|
||||
private:
|
||||
nsCString sProcess;
|
||||
nsCString sName;
|
||||
nsCString sDesc;
|
||||
|
||||
virtual ~nsStatusReporter();
|
||||
};
|
||||
|
||||
|
||||
class nsStatusReporterManager : public nsIStatusReporterManager
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISTATUSREPORTERMANAGER
|
||||
|
||||
nsStatusReporterManager();
|
||||
|
||||
private:
|
||||
nsCOMArray<nsIStatusReporter> mReporters;
|
||||
|
||||
virtual ~nsStatusReporterManager();
|
||||
};
|
|
@ -166,7 +166,7 @@ AssertActivityIsLegal()
|
|||
{
|
||||
if (gActivityTLS == BAD_TLS_INDEX || PR_GetThreadPrivate(gActivityTLS)) {
|
||||
if (PR_GetEnv("MOZ_FATAL_STATIC_XPCOM_CTORS_DTORS")) {
|
||||
NS_RUNTIMEABORT(kStaticCtorDtorWarning);
|
||||
MOZ_CRASH_UNSAFE_OOL(kStaticCtorDtorWarning);
|
||||
} else {
|
||||
NS_WARNING(kStaticCtorDtorWarning);
|
||||
}
|
||||
|
|
|
@ -104,8 +104,6 @@ extern nsresult nsStringInputStreamConstructor(nsISupports*, REFNSIID, void**);
|
|||
#include "nsSecurityConsoleMessage.h"
|
||||
#include "nsMessageLoop.h"
|
||||
|
||||
#include "nsStatusReporterManager.h"
|
||||
|
||||
#include <locale.h>
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/Omnijar.h"
|
||||
|
@ -228,8 +226,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMemoryReporterManager, Init)
|
|||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMemoryInfoDumper)
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStatusReporterManager, Init)
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsIOUtil)
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSecurityConsoleMessage)
|
||||
|
@ -675,7 +671,7 @@ NS_InitXPCOM2(nsIServiceManager** aResult,
|
|||
// Initialize the JS engine.
|
||||
const char* jsInitFailureReason = JS_InitWithFailureDiagnostic();
|
||||
if (jsInitFailureReason) {
|
||||
NS_RUNTIMEABORT(jsInitFailureReason);
|
||||
MOZ_CRASH_UNSAFE_OOL(jsInitFailureReason);
|
||||
}
|
||||
sInitializedJS = true;
|
||||
|
||||
|
|
|
@ -75,4 +75,3 @@
|
|||
COMPONENT(IOUTIL, nsIOUtilConstructor)
|
||||
COMPONENT(CYCLE_COLLECTOR_LOGGER, nsCycleCollectorLoggerConstructor)
|
||||
COMPONENT(MESSAGE_LOOP, nsMessageLoopConstructor)
|
||||
COMPONENT(STATUS_REPORTER_MANAGER, nsStatusReporterManagerConstructor)
|
||||
|
|
|
@ -76,11 +76,6 @@
|
|||
*/
|
||||
#define NS_MEMORY_INFO_DUMPER_CONTRACTID "@mozilla.org/memory-info-dumper;1"
|
||||
|
||||
/**
|
||||
* Status reporter service CID
|
||||
*/
|
||||
#define NS_STATUS_REPORTER_MANAGER_CONTRACTID "@mozilla.org/status-reporter-manager;1"
|
||||
|
||||
/**
|
||||
* Cycle collector logger contract id
|
||||
*/
|
||||
|
|
|
@ -32,11 +32,11 @@ T* DuplicateString(const T* aSrc, const CheckedInt<size_t>& aLen,
|
|||
* @param aArena The arena to allocate the string copy out of.
|
||||
* @return An arena allocated null-terminated string.
|
||||
*/
|
||||
template<size_t ArenaSize, size_t Alignment>
|
||||
char* ArenaStrdup(const char* aStr,
|
||||
template<typename T, size_t ArenaSize, size_t Alignment>
|
||||
T* ArenaStrdup(const T* aStr,
|
||||
ArenaAllocator<ArenaSize, Alignment>& aArena)
|
||||
{
|
||||
return detail::DuplicateString(aStr, strlen(aStr), aArena);
|
||||
return detail::DuplicateString(aStr, nsCharTraits<T>::length(aStr), aArena);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,23 +46,9 @@ char* ArenaStrdup(const char* aStr,
|
|||
* @param aArena The arena to allocate the string copy out of.
|
||||
* @return An arena allocated null-terminated string.
|
||||
*/
|
||||
template<size_t ArenaSize, size_t Alignment>
|
||||
nsAString::char_type* ArenaStrdup(
|
||||
const nsAString& aStr, ArenaAllocator<ArenaSize, Alignment>& aArena)
|
||||
{
|
||||
return detail::DuplicateString(aStr.BeginReading(), aStr.Length(), aArena);
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an arena allocated null-terminated copy of the source string.
|
||||
*
|
||||
* @param aSrc String to copy.
|
||||
* @param aArena The arena to allocate the string copy out of.
|
||||
* @return An arena allocated null-terminated string.
|
||||
*/
|
||||
template<size_t ArenaSize, size_t Alignment>
|
||||
nsACString::char_type* ArenaStrdup(
|
||||
const nsACString& aStr, ArenaAllocator<ArenaSize, Alignment>& aArena)
|
||||
template<typename T, size_t ArenaSize, size_t Alignment>
|
||||
T* ArenaStrdup(const detail::nsTStringRepr<T>& aStr,
|
||||
ArenaAllocator<ArenaSize, Alignment>& aArena)
|
||||
{
|
||||
return detail::DuplicateString(aStr.BeginReading(), aStr.Length(), aArena);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ XPIDL_SOURCES += [
|
|||
'nsIGIOService.idl',
|
||||
'nsIGSettingsService.idl',
|
||||
'nsIHapticFeedback.idl',
|
||||
'nsIPackageKitService.idl',
|
||||
'nsIPlatformInfo.idl',
|
||||
'nsIXULAppInfo.idl',
|
||||
'nsIXULRuntime.idl',
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
/* -*- Mode: IDL; 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 "nsISupports.idl"
|
||||
|
||||
interface nsIArray;
|
||||
interface nsIObserver;
|
||||
|
||||
[scriptable, uuid(89bb04f6-ce2a-11e3-8f4f-60a44c717042)]
|
||||
interface nsIPackageKitService : nsISupports
|
||||
{
|
||||
|
||||
/* PackageKit installation methods */
|
||||
/* See https://github.com/nekohayo/gnome-packagekit/blob/master/src/org.freedesktop.PackageKit.xml */
|
||||
const unsigned long PK_INSTALL_PACKAGE_NAMES = 0;
|
||||
const unsigned long PK_INSTALL_MIME_TYPES = 1;
|
||||
const unsigned long PK_INSTALL_FONTCONFIG_RESOURCES = 2;
|
||||
const unsigned long PK_INSTALL_GSTREAMER_RESOURCES = 3;
|
||||
const unsigned long PK_INSTALL_METHOD_COUNT = 4;
|
||||
|
||||
/* Ask to install a list of packages via PackageKit
|
||||
* @param packageKitMethod
|
||||
* The PackageKit installation method
|
||||
* @param packageArray
|
||||
* A nonempty array of strings describing the list of packages to
|
||||
* install.
|
||||
* @param An object implementing nsIObserver that will be notified with
|
||||
* a message of topic "packagekit-install". The message data
|
||||
* contains the error returned by PackageKit if the installation
|
||||
* fails and is null otherwise.
|
||||
*
|
||||
* This function may raise an NS_ERROR_INVALID_ARG, NS_ERROR_FAILURE or
|
||||
* NS_ERROR_OUT_OF_MEMORY exception. Otherwise, the observer will be notified
|
||||
* when the operation completes.
|
||||
*
|
||||
*/
|
||||
void installPackages(in unsigned long packageKitMethod,
|
||||
in nsIArray packageArray,
|
||||
in nsIObserver observer);
|
||||
};
|
||||
|
||||
%{C++
|
||||
#define NS_PACKAGEKITSERVICE_CONTRACTID "@mozilla.org/packagekit-service;1"
|
||||
%}
|
|
@ -284,10 +284,17 @@ TEST(ArenaAllocator, Clear)
|
|||
TEST(ArenaAllocator, Extensions)
|
||||
{
|
||||
ArenaAllocator<4096, 8> a;
|
||||
const char* const kTestStr = "This is a test string.";
|
||||
char* dup = mozilla::ArenaStrdup(kTestStr, a);
|
||||
EXPECT_STREQ(dup, kTestStr);
|
||||
|
||||
// Test with raw strings.
|
||||
const char* const kTestCStr = "This is a test string.";
|
||||
char* c_dup = mozilla::ArenaStrdup(kTestCStr, a);
|
||||
EXPECT_STREQ(c_dup, kTestCStr);
|
||||
|
||||
const char16_t* const kTestStr = u"This is a wide test string.";
|
||||
char16_t* dup = mozilla::ArenaStrdup(kTestStr, a);
|
||||
EXPECT_TRUE(nsString(dup).Equals(kTestStr));
|
||||
|
||||
// Make sure it works with literal strings.
|
||||
NS_NAMED_LITERAL_STRING(wideStr, "A wide string.");
|
||||
nsLiteralString::char_type* wide = mozilla::ArenaStrdup(wideStr, a);
|
||||
EXPECT_TRUE(wideStr.Equals(wide));
|
||||
|
@ -295,4 +302,13 @@ TEST(ArenaAllocator, Extensions)
|
|||
NS_NAMED_LITERAL_CSTRING(cStr, "A c-string.");
|
||||
nsLiteralCString::char_type* cstr = mozilla::ArenaStrdup(cStr, a);
|
||||
EXPECT_TRUE(cStr.Equals(cstr));
|
||||
|
||||
// Make sure it works with normal strings.
|
||||
nsAutoString x(u"testing wide");
|
||||
nsAutoString::char_type* x_copy = mozilla::ArenaStrdup(x, a);
|
||||
EXPECT_TRUE(x.Equals(x_copy));
|
||||
|
||||
nsAutoCString y("testing c-string");
|
||||
nsAutoCString::char_type* y_copy = mozilla::ArenaStrdup(y, a);
|
||||
EXPECT_TRUE(y.Equals(y_copy));
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ TEST(DeadlockDetectorScalability, DISABLED_OneLockNDeps)
|
|||
mozilla::Mutex* lock = new mozilla::Mutex("deadlockDetector.scalability.t2.master");
|
||||
mozilla::Mutex** locks = new mozilla::Mutex*[N];
|
||||
if (!locks)
|
||||
NS_RUNTIMEABORT("couldn't allocate lock array");
|
||||
MOZ_CRASH("couldn't allocate lock array");
|
||||
|
||||
for (int i = 0; i < N; ++i)
|
||||
locks[i] =
|
||||
|
@ -94,7 +94,7 @@ TEST(DeadlockDetectorScalability, MaxDepsNsq)
|
|||
|
||||
mozilla::Mutex** locks = new mozilla::Mutex*[N];
|
||||
if (!locks)
|
||||
NS_RUNTIMEABORT("couldn't allocate lock array");
|
||||
MOZ_CRASH("couldn't allocate lock array");
|
||||
|
||||
for (int i = 0; i < N; ++i)
|
||||
locks[i] = new mozilla::Mutex("deadlockDetector.scalability.t3");
|
||||
|
|
Загрузка…
Ссылка в новой задаче