Bug 1029866 - Rename InitUsingWin(...) to Init(...), r=bobowencode

--HG--
extra : rebase_source : e04aac99fe64270f283cf49ed52b8f7512a2fa3b
This commit is contained in:
Olli Pettay 2014-06-25 13:17:17 +03:00
parent eff7f162b1
commit 2091da9022
19 changed files with 55 additions and 31 deletions

View File

@ -1238,7 +1238,7 @@ EventSource::DispatchAllMessageEvents()
}
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitUsingWin(GetOwner()))) {
if (NS_WARN_IF(!jsapi.Init(GetOwner()))) {
return;
}
JSContext* cx = jsapi.cx();

View File

@ -866,7 +866,7 @@ WebSocket::CreateAndDispatchMessageEvent(const nsACString& aData,
return NS_OK;
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitUsingWin(GetOwner()))) {
if (NS_WARN_IF(!jsapi.Init(GetOwner()))) {
return NS_ERROR_FAILURE;
}
JSContext* cx = jsapi.cx();

View File

@ -6323,7 +6323,7 @@ nsContentUtils::IsPatternMatching(nsAString& aValue, nsAString& aPattern,
NS_ASSERTION(aDocument, "aDocument should be a valid pointer (not null)");
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitUsingWin(aDocument->GetWindow()))) {
if (NS_WARN_IF(!jsapi.Init(aDocument->GetWindow()))) {
return true;
}
JSContext* cx = jsapi.cx();

View File

@ -384,7 +384,7 @@ nsDOMDataChannel::DoOnMessageAvailable(const nsACString& aData,
}
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitUsingWin(GetOwner()))) {
if (NS_WARN_IF(!jsapi.Init(GetOwner()))) {
return NS_ERROR_FAILURE;
}
JSContext* cx = jsapi.cx();

View File

@ -127,7 +127,7 @@ public:
// AudioDestinationNode::FireOfflineCompletionEvent.
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitUsingWin(aNode->GetOwner()))) {
if (NS_WARN_IF(!jsapi.Init(aNode->GetOwner()))) {
return;
}
JSContext* cx = jsapi.cx();

View File

@ -42,7 +42,7 @@ AudioProcessingEvent::LazilyCreateBuffer(uint32_t aNumberOfChannels,
ErrorResult& aRv)
{
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitUsingWin(mNode->GetOwner()))) {
if (NS_WARN_IF(!jsapi.Init(mNode->GetOwner()))) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}

View File

@ -414,7 +414,7 @@ WebAudioDecodeJob::AllocateBuffer()
MOZ_ASSERT(NS_IsMainThread());
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitUsingWin(mContext->GetOwner()))) {
if (NS_WARN_IF(!jsapi.Init(mContext->GetOwner()))) {
return false;
}
JSContext* cx = jsapi.cx();

View File

@ -403,7 +403,7 @@ private:
}
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitUsingWin(node->GetOwner()))) {
if (NS_WARN_IF(!jsapi.Init(node->GetOwner()))) {
return NS_OK;
}
JSContext* cx = jsapi.cx();

View File

@ -132,7 +132,7 @@ ArchiveRequest::ReaderReady(nsTArray<nsCOMPtr<nsIDOMFile> >& aFileList,
nsresult rv;
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitUsingWin(GetOwner()))) {
if (NS_WARN_IF(!jsapi.Init(GetOwner()))) {
return NS_ERROR_UNEXPECTED;
}
JSContext* cx = jsapi.cx();

View File

@ -294,23 +294,41 @@ AutoJSAPI::InitWithLegacyErrorReporting(nsIGlobalObject* aGlobalObject)
}
bool
AutoJSAPI::InitUsingWin(nsPIDOMWindow* aWindow, JSContext* aCx)
AutoJSAPI::Init(nsPIDOMWindow* aWindow, JSContext* aCx)
{
return Init(static_cast<nsGlobalWindow*>(aWindow), aCx);
}
bool
AutoJSAPI::InitUsingWin(nsPIDOMWindow* aWindow)
AutoJSAPI::Init(nsPIDOMWindow* aWindow)
{
return Init(static_cast<nsGlobalWindow*>(aWindow));
}
bool
AutoJSAPI::InitWithLegacyErrorReportingUsingWin(nsPIDOMWindow* aWindow)
AutoJSAPI::Init(nsGlobalWindow* aWindow, JSContext* aCx)
{
return Init(static_cast<nsIGlobalObject*>(aWindow), aCx);
}
bool
AutoJSAPI::Init(nsGlobalWindow* aWindow)
{
return Init(static_cast<nsIGlobalObject*>(aWindow));
}
bool
AutoJSAPI::InitWithLegacyErrorReporting(nsPIDOMWindow* aWindow)
{
return InitWithLegacyErrorReporting(static_cast<nsGlobalWindow*>(aWindow));
}
bool
AutoJSAPI::InitWithLegacyErrorReporting(nsGlobalWindow* aWindow)
{
return InitWithLegacyErrorReporting(static_cast<nsIGlobalObject*>(aWindow));
}
AutoEntryScript::AutoEntryScript(nsIGlobalObject* aGlobalObject,
bool aIsMainThread,
JSContext* aCx)

View File

@ -17,6 +17,7 @@
#include "mozilla/Maybe.h"
class nsPIDOMWindow;
class nsGlobalWindow;
namespace mozilla {
namespace dom {
@ -154,11 +155,16 @@ public:
// false and use of cx() will cause an assertion.
bool InitWithLegacyErrorReporting(nsIGlobalObject* aGlobalObject);
// Convenience functions to take an nsPIDOMWindow*, when it is more easily
// available than an nsIGlobalObject.
bool InitUsingWin(nsPIDOMWindow* aWindow);
bool InitUsingWin(nsPIDOMWindow* aWindow, JSContext* aCx);
bool InitWithLegacyErrorReportingUsingWin(nsPIDOMWindow* aWindow);
// Convenience functions to take an nsPIDOMWindow* or nsGlobalWindow*,
// when it is more easily available than an nsIGlobalObject.
bool Init(nsPIDOMWindow* aWindow);
bool Init(nsPIDOMWindow* aWindow, JSContext* aCx);
bool Init(nsGlobalWindow* aWindow);
bool Init(nsGlobalWindow* aWindow, JSContext* aCx);
bool InitWithLegacyErrorReporting(nsPIDOMWindow* aWindow);
bool InitWithLegacyErrorReporting(nsGlobalWindow* aWindow);
JSContext* cx() const {
MOZ_ASSERT(mCx, "Must call Init before using an AutoJSAPI");

View File

@ -96,7 +96,7 @@ public:
}
AutoJSAPI jsapi;
if (!jsapi.InitUsingWin(mAdapterPtr->GetOwner())) {
if (!jsapi.Init(mAdapterPtr->GetOwner())) {
BT_WARNING("Failed to initialise AutoJSAPI!");
SetError(NS_LITERAL_STRING("BluetoothAutoJSAPIInitError"));
return false;
@ -252,7 +252,7 @@ BluetoothAdapter::SetPropertyByValue(const BluetoothNamedValue& aValue)
mUuids = value.get_ArrayOfnsString();
AutoJSAPI jsapi;
if (!jsapi.InitUsingWin(GetOwner())) {
if (!jsapi.Init(GetOwner())) {
BT_WARNING("Failed to initialise AutoJSAPI!");
return;
}
@ -268,7 +268,7 @@ BluetoothAdapter::SetPropertyByValue(const BluetoothNamedValue& aValue)
mDeviceAddresses = value.get_ArrayOfnsString();
AutoJSAPI jsapi;
if (!jsapi.InitUsingWin(GetOwner())) {
if (!jsapi.Init(GetOwner())) {
BT_WARNING("Failed to initialise AutoJSAPI!");
return;
}

View File

@ -132,7 +132,7 @@ BluetoothDevice::SetPropertyByValue(const BluetoothNamedValue& aValue)
mUuids = value.get_ArrayOfnsString();
AutoJSAPI jsapi;
if (!jsapi.InitUsingWin(GetOwner())) {
if (!jsapi.Init(GetOwner())) {
BT_WARNING("Failed to initialise AutoJSAPI!");
return;
}
@ -148,7 +148,7 @@ BluetoothDevice::SetPropertyByValue(const BluetoothNamedValue& aValue)
mServices = value.get_ArrayOfnsString();
AutoJSAPI jsapi;
if (!jsapi.InitUsingWin(GetOwner())) {
if (!jsapi.Init(GetOwner())) {
BT_WARNING("Failed to initialise AutoJSAPI!");
return;
}

View File

@ -69,7 +69,7 @@ public:
BluetoothAdapter::Create(mManagerPtr->GetOwner(), values);
dom::AutoJSAPI jsapi;
if (!jsapi.InitUsingWin(mManagerPtr->GetOwner())) {
if (!jsapi.Init(mManagerPtr->GetOwner())) {
BT_WARNING("Failed to initialise AutoJSAPI!");
SetError(NS_LITERAL_STRING("BluetoothAutoJSAPIInitError"));
return false;

View File

@ -95,7 +95,7 @@ public:
}
AutoJSAPI jsapi;
if (!jsapi.InitUsingWin(mAdapterPtr->GetOwner())) {
if (!jsapi.Init(mAdapterPtr->GetOwner())) {
BT_WARNING("Failed to initialise AutoJSAPI!");
SetError(NS_LITERAL_STRING("BluetoothAutoJSAPIInitError"));
return false;
@ -254,7 +254,7 @@ BluetoothAdapter::SetPropertyByValue(const BluetoothNamedValue& aValue)
mUuids = value.get_ArrayOfnsString();
AutoJSAPI jsapi;
if (!jsapi.InitUsingWin(GetOwner())) {
if (!jsapi.Init(GetOwner())) {
BT_WARNING("Failed to initialise AutoJSAPI!");
return;
}
@ -270,7 +270,7 @@ BluetoothAdapter::SetPropertyByValue(const BluetoothNamedValue& aValue)
mDeviceAddresses = value.get_ArrayOfnsString();
AutoJSAPI jsapi;
if (!jsapi.InitUsingWin(GetOwner())) {
if (!jsapi.Init(GetOwner())) {
BT_WARNING("Failed to initialise AutoJSAPI!");
return;
}

View File

@ -126,7 +126,7 @@ BluetoothDevice::SetPropertyByValue(const BluetoothNamedValue& aValue)
mUuids = value.get_ArrayOfnsString();
AutoJSAPI jsapi;
if (!jsapi.InitUsingWin(GetOwner())) {
if (!jsapi.Init(GetOwner())) {
BT_WARNING("Failed to initialise AutoJSAPI!");
return;
}
@ -142,7 +142,7 @@ BluetoothDevice::SetPropertyByValue(const BluetoothNamedValue& aValue)
mServices = value.get_ArrayOfnsString();
AutoJSAPI jsapi;
if (!jsapi.InitUsingWin(GetOwner())) {
if (!jsapi.Init(GetOwner())) {
BT_WARNING("Failed to initialise AutoJSAPI!");
return;
}

View File

@ -1726,7 +1726,7 @@ JS::Value StringToJsval(nsPIDOMWindow* aWindow, nsAString& aString)
MOZ_ASSERT(aWindow);
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitUsingWin(aWindow))) {
if (NS_WARN_IF(!jsapi.Init(aWindow))) {
return JSVAL_NULL;
}
JSContext* cx = jsapi.cx();

View File

@ -49,7 +49,7 @@ nsresult
Icc::NotifyStkEvent(const nsAString& aName, const nsAString& aMessage)
{
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitWithLegacyErrorReportingUsingWin(GetOwner()))) {
if (NS_WARN_IF(!jsapi.InitWithLegacyErrorReporting(GetOwner()))) {
return NS_ERROR_UNEXPECTED;
}
JSContext* cx = jsapi.cx();

View File

@ -3138,7 +3138,7 @@ WorkerPrivateParent<Derived>::BroadcastErrorToSharedWorkers(
size_t actionsIndex = windowActions.LastIndexOf(WindowAction(window));
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitWithLegacyErrorReportingUsingWin(sharedWorker->GetOwner()))) {
if (NS_WARN_IF(!jsapi.InitWithLegacyErrorReporting(sharedWorker->GetOwner()))) {
continue;
}
JSContext* cx = jsapi.cx();