mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 22:04:36 +00:00
Bug 1257355: Remove the worker descriptor for WorkerNavigator. r=bz
--HG-- rename : dom/workers/Navigator.cpp => dom/workers/WorkerNavigator.cpp rename : dom/workers/Navigator.h => dom/workers/WorkerNavigator.h
This commit is contained in:
parent
31aa749f1f
commit
2fc599905e
@ -152,6 +152,10 @@ public:
|
||||
|
||||
// The XPCOM GetProduct is OK
|
||||
// The XPCOM GetLanguage is OK
|
||||
void GetUserAgent(nsString& aUserAgent, ErrorResult& /* unused */)
|
||||
{
|
||||
GetUserAgent(aUserAgent);
|
||||
}
|
||||
bool OnLine();
|
||||
void RegisterProtocolHandler(const nsAString& aScheme, const nsAString& aURL,
|
||||
const nsAString& aTitle, ErrorResult& aRv);
|
||||
|
@ -1612,8 +1612,6 @@ DOMInterfaces = {
|
||||
},
|
||||
|
||||
'WorkerNavigator': {
|
||||
'headerFile': 'mozilla/dom/workers/bindings/Navigator.h',
|
||||
'workers': True,
|
||||
'implicitJSContext': ['getDataStores'],
|
||||
},
|
||||
|
||||
|
@ -43,7 +43,7 @@ interface NavigatorID {
|
||||
readonly attribute DOMString appVersion;
|
||||
[Constant, Cached]
|
||||
readonly attribute DOMString platform;
|
||||
[Pure, Cached, Throws=Workers]
|
||||
[Pure, Cached, Throws]
|
||||
readonly attribute DOMString userAgent;
|
||||
[Constant, Cached]
|
||||
readonly attribute DOMString product; // constant "Gecko"
|
||||
|
@ -56,6 +56,47 @@
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::dom::workers;
|
||||
|
||||
namespace {
|
||||
|
||||
void
|
||||
AsyncLog(nsIInterceptedChannel *aInterceptedChannel,
|
||||
const nsACString& aRespondWithScriptSpec,
|
||||
uint32_t aRespondWithLineNumber, uint32_t aRespondWithColumnNumber,
|
||||
const nsACString& aMessageName, const nsTArray<nsString>& aParams)
|
||||
{
|
||||
MOZ_ASSERT(aInterceptedChannel);
|
||||
nsCOMPtr<nsIConsoleReportCollector> reporter =
|
||||
aInterceptedChannel->GetConsoleReportCollector();
|
||||
if (reporter) {
|
||||
reporter->AddConsoleReport(nsIScriptError::errorFlag,
|
||||
NS_LITERAL_CSTRING("Service Worker Interception"),
|
||||
nsContentUtils::eDOM_PROPERTIES,
|
||||
aRespondWithScriptSpec,
|
||||
aRespondWithLineNumber,
|
||||
aRespondWithColumnNumber,
|
||||
aMessageName, aParams);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename... Params>
|
||||
void
|
||||
AsyncLog(nsIInterceptedChannel* aInterceptedChannel,
|
||||
const nsACString& aRespondWithScriptSpec,
|
||||
uint32_t aRespondWithLineNumber, uint32_t aRespondWithColumnNumber,
|
||||
// We have to list one explicit string so that calls with an
|
||||
// nsTArray of params won't end up in here.
|
||||
const nsACString& aMessageName, const nsAString& aFirstParam,
|
||||
Params&&... aParams)
|
||||
{
|
||||
nsTArray<nsString> paramsList(sizeof...(Params) + 1);
|
||||
StringArrayAppender::Append(paramsList, sizeof...(Params) + 1,
|
||||
aFirstParam, Forward<Params>(aParams)...);
|
||||
AsyncLog(aInterceptedChannel, aRespondWithScriptSpec, aRespondWithLineNumber,
|
||||
aRespondWithColumnNumber, aMessageName, paramsList);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
|
||||
CancelChannelRunnable::CancelChannelRunnable(nsMainThreadPtrHandle<nsIInterceptedChannel>& aChannel,
|
||||
@ -115,43 +156,6 @@ FetchEvent::Constructor(const GlobalObject& aGlobal,
|
||||
|
||||
namespace {
|
||||
|
||||
void
|
||||
AsyncLog(nsIInterceptedChannel *aInterceptedChannel,
|
||||
const nsACString& aRespondWithScriptSpec,
|
||||
uint32_t aRespondWithLineNumber, uint32_t aRespondWithColumnNumber,
|
||||
const nsACString& aMessageName, const nsTArray<nsString>& aParams)
|
||||
{
|
||||
MOZ_ASSERT(aInterceptedChannel);
|
||||
nsCOMPtr<nsIConsoleReportCollector> reporter =
|
||||
aInterceptedChannel->GetConsoleReportCollector();
|
||||
if (reporter) {
|
||||
reporter->AddConsoleReport(nsIScriptError::errorFlag,
|
||||
NS_LITERAL_CSTRING("Service Worker Interception"),
|
||||
nsContentUtils::eDOM_PROPERTIES,
|
||||
aRespondWithScriptSpec,
|
||||
aRespondWithLineNumber,
|
||||
aRespondWithColumnNumber,
|
||||
aMessageName, aParams);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename... Params>
|
||||
void
|
||||
AsyncLog(nsIInterceptedChannel* aInterceptedChannel,
|
||||
const nsACString& aRespondWithScriptSpec,
|
||||
uint32_t aRespondWithLineNumber, uint32_t aRespondWithColumnNumber,
|
||||
// We have to list one explicit string so that calls with an
|
||||
// nsTArray of params won't end up in here.
|
||||
const nsACString& aMessageName, const nsAString& aFirstParam,
|
||||
Params&&... aParams)
|
||||
{
|
||||
nsTArray<nsString> paramsList(sizeof...(Params) + 1);
|
||||
StringArrayAppender::Append(paramsList, sizeof...(Params) + 1,
|
||||
aFirstParam, Forward<Params>(aParams)...);
|
||||
AsyncLog(aInterceptedChannel, aRespondWithScriptSpec, aRespondWithLineNumber,
|
||||
aRespondWithColumnNumber, aMessageName, paramsList);
|
||||
}
|
||||
|
||||
class FinishResponse final : public nsRunnable
|
||||
{
|
||||
nsMainThreadPtrHandle<nsIInterceptedChannel> mChannel;
|
||||
|
@ -11,9 +11,9 @@
|
||||
#include "mozilla/dom/DataStoreBinding.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/PromiseWorkerProxy.h"
|
||||
#include "mozilla/dom/WorkerNavigator.h"
|
||||
#include "mozilla/dom/WorkerNavigatorBinding.h"
|
||||
|
||||
#include "Navigator.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "RuntimeService.h"
|
||||
|
||||
@ -23,7 +23,8 @@
|
||||
#include "WorkerRunnable.h"
|
||||
#include "WorkerScope.h"
|
||||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WorkerNavigator)
|
||||
|
||||
@ -48,7 +49,7 @@ WorkerNavigator::Create(bool aOnLine)
|
||||
JSObject*
|
||||
WorkerNavigator::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return WorkerNavigatorBinding_workers::Wrap(aCx, this, aGivenProto);
|
||||
return WorkerNavigatorBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
// A WorkerMainThreadRunnable to synchronously add DataStoreChangeEventProxy on
|
||||
@ -300,7 +301,7 @@ WorkerNavigator::GetDataStores(JSContext* aCx,
|
||||
void
|
||||
WorkerNavigator::SetLanguages(const nsTArray<nsString>& aLanguages)
|
||||
{
|
||||
WorkerNavigatorBinding_workers::ClearCachedLanguagesValue(this);
|
||||
WorkerNavigatorBinding::ClearCachedLanguagesValue(this);
|
||||
mProperties.mLanguages = aLanguages;
|
||||
}
|
||||
|
||||
@ -408,4 +409,5 @@ WorkerNavigator::HardwareConcurrency() const
|
||||
return rts->ClampedHardwareConcurrency();
|
||||
}
|
||||
|
||||
END_WORKERS_NAMESPACE
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
@ -4,8 +4,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_workers_navigator_h__
|
||||
#define mozilla_dom_workers_navigator_h__
|
||||
#ifndef mozilla_dom_workernavigator_h__
|
||||
#define mozilla_dom_workernavigator_h__
|
||||
|
||||
#include "Workers.h"
|
||||
#include "RuntimeService.h"
|
||||
@ -19,14 +19,10 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Promise;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
|
||||
class WorkerNavigator final : public nsWrapperCache
|
||||
{
|
||||
typedef struct RuntimeService::NavigatorProperties NavigatorProperties;
|
||||
typedef struct workers::RuntimeService::NavigatorProperties NavigatorProperties;
|
||||
|
||||
NavigatorProperties mProperties;
|
||||
bool mOnline;
|
||||
@ -116,6 +112,7 @@ public:
|
||||
uint64_t HardwareConcurrency() const;
|
||||
};
|
||||
|
||||
END_WORKERS_NAMESPACE
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_workers_navigator_h__
|
||||
#endif // mozilla_dom_workernavigator_h__
|
@ -22,6 +22,7 @@
|
||||
#include "mozilla/dom/WorkerDebuggerGlobalScopeBinding.h"
|
||||
#include "mozilla/dom/WorkerGlobalScopeBinding.h"
|
||||
#include "mozilla/dom/WorkerLocation.h"
|
||||
#include "mozilla/dom/WorkerNavigator.h"
|
||||
#include "mozilla/dom/cache/CacheStorage.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
@ -33,7 +34,6 @@
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
#include "Navigator.h"
|
||||
#include "Principal.h"
|
||||
#include "RuntimeService.h"
|
||||
#include "ScriptLoader.h"
|
||||
|
@ -24,6 +24,7 @@ class Promise;
|
||||
class RequestOrUSVString;
|
||||
class ServiceWorkerRegistrationWorkerThread;
|
||||
class WorkerLocation;
|
||||
class WorkerNavigator;
|
||||
|
||||
namespace cache {
|
||||
|
||||
@ -37,7 +38,6 @@ BEGIN_WORKERS_NAMESPACE
|
||||
|
||||
class ServiceWorkerClients;
|
||||
class WorkerPrivate;
|
||||
class WorkerNavigator;
|
||||
class Performance;
|
||||
|
||||
class WorkerGlobalScope : public DOMEventTargetHelper,
|
||||
|
@ -14,6 +14,7 @@ EXPORTS.mozilla.dom += [
|
||||
'ServiceWorkerRegistrar.h',
|
||||
'ServiceWorkerRegistration.h',
|
||||
'WorkerLocation.h',
|
||||
'WorkerNavigator.h',
|
||||
'WorkerPrefs.h',
|
||||
'WorkerPrivate.h',
|
||||
'WorkerRunnable.h',
|
||||
@ -31,7 +32,6 @@ EXPORTS.mozilla.dom.workers += [
|
||||
EXPORTS.mozilla.dom.workers.bindings += [
|
||||
'DataStore.h',
|
||||
'DataStoreCursor.h',
|
||||
'Navigator.h',
|
||||
'Performance.h',
|
||||
'ServiceWorker.h',
|
||||
'ServiceWorkerClient.h',
|
||||
@ -56,7 +56,6 @@ UNIFIED_SOURCES += [
|
||||
'DataStore.cpp',
|
||||
'DataStoreCursor.cpp',
|
||||
'FileReaderSync.cpp',
|
||||
'Navigator.cpp',
|
||||
'Performance.cpp',
|
||||
'Principal.cpp',
|
||||
'RegisterBindings.cpp',
|
||||
@ -81,6 +80,7 @@ UNIFIED_SOURCES += [
|
||||
'URL.cpp',
|
||||
'WorkerDebuggerManager.cpp',
|
||||
'WorkerLocation.cpp',
|
||||
'WorkerNavigator.cpp',
|
||||
'WorkerPrivate.cpp',
|
||||
'WorkerRunnable.cpp',
|
||||
'WorkerScope.cpp',
|
||||
|
Loading…
x
Reference in New Issue
Block a user