Backed out 2 changesets (bug 1362800) for eslint failures a=backout

Backed out changeset 0492e6f16df1 (bug 1362800)
Backed out changeset 785cf0c4b67b (bug 1362800)

MozReview-Commit-ID: EY2RYz7lwtI
This commit is contained in:
Wes Kocher 2017-05-10 14:42:49 -07:00
Родитель 55520dcce6
Коммит cc7a1f5b9b
5 изменённых файлов: 4 добавлений и 96 удалений

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

@ -295,22 +295,13 @@ this.geckoProfiler = class extends ExtensionAPI {
async getProfile() {
if (!Services.profiler.IsActive()) {
throw new ExtensionError("The profiler is stopped. " +
throw new Error("The profiler is stopped. " +
"You need to start the profiler before you can capture a profile.");
}
return Services.profiler.getProfileDataAsync();
},
async getProfileAsArrayBuffer() {
if (!Services.profiler.IsActive()) {
throw new ExtensionError("The profiler is stopped. " +
"You need to start the profiler before you can capture a profile.");
}
return Services.profiler.getProfileDataAsArrayBuffer();
},
async getSymbols(debugName, breakpadId) {
if (symbolCache.size === 0) {
primeSymbolStore(Services.profiler.sharedLibraries);

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

@ -92,13 +92,6 @@
"async": true,
"parameters": []
},
{
"name": "getProfileAsArrayBuffer",
"type": "function",
"description": "Gathers the profile data from the current profiling session. The returned promise resolves to an array buffer that contains a JSON string.",
"async": true,
"parameters": []
},
{
"name": "getSymbols",
"type": "function",

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

@ -48,18 +48,6 @@ let getExtension = () => {
"The profile contains a GeckoMain thread.");
browser.test.sendMessage("tested profile");
break;
case "test profile as array buffer":
let arrayBuffer = await browser.geckoProfiler.getProfileAsArrayBuffer();
browser.test.assertTrue(arrayBuffer.byteLength >= 2, "The profile array buffer contains data.");
let textDecoder = new TextDecoder();
let profile = JSON.parse(textDecoder.decode(arrayBuffer));
browser.test.assertTrue("libs" in profile, "The profile contains libs.");
browser.test.assertTrue("meta" in profile, "The profile contains meta.");
browser.test.assertTrue("threads" in profile, "The profile contains threads.");
browser.test.assertTrue(profile.threads.some(t => t.name == "GeckoMain"),
"The profile contains a GeckoMain thread.");
browser.test.sendMessage("tested profile as array buffer");
break;
case "remove runningListener":
browser.geckoProfiler.onRunning.removeListener(runningListener);
browser.test.sendMessage("removed runningListener");
@ -98,9 +86,6 @@ add_task(async function testProfilerControl() {
extension.sendMessage("test profile");
await extension.awaitMessage("tested profile");
extension.sendMessage("test profile as array buffer");
await extension.awaitMessage("tested profile as array buffer");
extension.sendMessage("pause");
await extension.awaitMessage("paused");

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

@ -57,9 +57,6 @@ interface nsIProfiler : nsISupports
[implicit_jscontext]
nsISupports getProfileDataAsync([optional] in double aSinceTime);
[implicit_jscontext]
nsISupports getProfileDataAsArrayBuffer([optional] in double aSinceTime);
void dumpProfileToFileAsync(in ACString aFilename,
[optional] in double aSinceTime);

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

@ -22,7 +22,6 @@
#include "js/Value.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/TypedArray.h"
#include "ProfileGatherer.h"
#include "nsLocalFile.h"
#include "platform.h"
@ -261,15 +260,14 @@ nsProfiler::GetProfileDataAsync(double aSinceTime, JSContext* aCx,
return NS_ERROR_FAILURE;
}
nsIGlobalObject* globalObject =
xpc::NativeGlobal(JS::CurrentGlobalOrNull(aCx));
nsIGlobalObject* go = xpc::NativeGlobal(JS::CurrentGlobalOrNull(aCx));
if (NS_WARN_IF(!globalObject)) {
if (NS_WARN_IF(!go)) {
return NS_ERROR_FAILURE;
}
ErrorResult result;
RefPtr<Promise> promise = Promise::Create(globalObject, result);
RefPtr<Promise> promise = Promise::Create(go, result);
if (NS_WARN_IF(result.Failed())) {
return result.StealNSResult();
}
@ -315,62 +313,6 @@ nsProfiler::GetProfileDataAsync(double aSinceTime, JSContext* aCx,
return NS_OK;
}
NS_IMETHODIMP
nsProfiler::GetProfileDataAsArrayBuffer(double aSinceTime, JSContext* aCx,
nsISupports** aPromise)
{
MOZ_ASSERT(NS_IsMainThread());
if (!mGatherer) {
return NS_ERROR_FAILURE;
}
if (NS_WARN_IF(!aCx)) {
return NS_ERROR_FAILURE;
}
nsIGlobalObject* globalObject =
xpc::NativeGlobal(JS::CurrentGlobalOrNull(aCx));
if (NS_WARN_IF(!globalObject)) {
return NS_ERROR_FAILURE;
}
ErrorResult result;
RefPtr<Promise> promise = Promise::Create(globalObject, result);
if (NS_WARN_IF(result.Failed())) {
return result.StealNSResult();
}
mGatherer->Start(aSinceTime)->Then(
AbstractThread::MainThread(), __func__,
[promise](nsCString aResult) {
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.Init(promise->GlobalJSObject()))) {
// We're really hosed if we can't get a JS context for some reason.
promise->MaybeReject(NS_ERROR_DOM_UNKNOWN_ERR);
return;
}
JSContext* cx = jsapi.cx();
JSObject* typedArray =
dom::ArrayBuffer::Create(cx, aResult.Length(),
reinterpret_cast<const uint8_t*>(aResult.Data()));
if (typedArray) {
JS::RootedValue val(cx, JS::ObjectValue(*typedArray));
promise->MaybeResolve(val);
} else {
promise->MaybeReject(NS_ERROR_OUT_OF_MEMORY);
}
},
[promise](nsresult aRv) {
promise->MaybeReject(aRv);
});
promise.forget(aPromise);
return NS_OK;
}
NS_IMETHODIMP
nsProfiler::DumpProfileToFileAsync(const nsACString& aFilename,
double aSinceTime)