mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-07 21:43:24 +00:00
Bug 921496 part 1. Remove the one consumer of NavigatorProperty. r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D40110 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
9913672588
commit
3c20a5844b
@ -156,6 +156,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaDevices)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mServiceWorkerContainer)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaCapabilities)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAddonManager)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaKeySystemAccessManager)
|
||||
@ -226,6 +227,7 @@ void Navigator::Invalidate() {
|
||||
}
|
||||
|
||||
mMediaCapabilities = nullptr;
|
||||
mAddonManager = nullptr;
|
||||
}
|
||||
|
||||
void Navigator::GetUserAgent(nsAString& aUserAgent, CallerType aCallerType,
|
||||
@ -1828,6 +1830,24 @@ Clipboard* Navigator::Clipboard() {
|
||||
return mClipboard;
|
||||
}
|
||||
|
||||
AddonManager* Navigator::GetMozAddonManager(ErrorResult& aRv) {
|
||||
if (!mAddonManager) {
|
||||
nsPIDOMWindowInner* win = GetWindow();
|
||||
if (!win) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
mAddonManager = ConstructJSImplementation<AddonManager>(
|
||||
"@mozilla.org/addon-web-api/manager;1", win->AsGlobal(), aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return mAddonManager;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool Navigator::Webdriver() {
|
||||
return Preferences::GetBool("marionette.enabled", false);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define mozilla_dom_Navigator_h
|
||||
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/dom/AddonManagerBinding.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/Fetch.h"
|
||||
#include "mozilla/dom/Nullable.h"
|
||||
@ -28,6 +29,7 @@ class nsIURI;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class AddonManager;
|
||||
class BodyExtractorBase;
|
||||
class Geolocation;
|
||||
class systemMessageCallback;
|
||||
@ -208,6 +210,8 @@ class Navigator final : public nsISupports, public nsWrapperCache {
|
||||
|
||||
dom::MediaCapabilities* MediaCapabilities();
|
||||
|
||||
AddonManager* GetMozAddonManager(ErrorResult& aRv);
|
||||
|
||||
// WebIDL helper methods
|
||||
static bool HasUserMediaSupport(JSContext* /* unused */,
|
||||
JSObject* /* unused */);
|
||||
@ -266,6 +270,7 @@ class Navigator final : public nsISupports, public nsWrapperCache {
|
||||
nsTArray<uint32_t> mRequestedVibrationPattern;
|
||||
RefPtr<StorageManager> mStorageManager;
|
||||
RefPtr<dom::MediaCapabilities> mMediaCapabilities;
|
||||
RefPtr<AddonManager> mAddonManager;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -56,7 +56,6 @@ dictionary addonInstallOptions {
|
||||
|
||||
[HeaderFile="mozilla/AddonManagerWebAPI.h",
|
||||
Func="mozilla::AddonManagerWebAPI::IsAPIEnabled",
|
||||
NavigatorProperty="mozAddonManager",
|
||||
JSImplementation="@mozilla.org/addon-web-api/manager;1",
|
||||
WantsEventListenerHooks]
|
||||
interface AddonManager : EventTarget {
|
||||
|
@ -194,6 +194,12 @@ partial interface Navigator {
|
||||
boolean javaEnabled();
|
||||
};
|
||||
|
||||
// Addon manager bits
|
||||
partial interface Navigator {
|
||||
[Throws, Func="mozilla::AddonManagerWebAPI::IsAPIEnabled"]
|
||||
readonly attribute AddonManager mozAddonManager;
|
||||
};
|
||||
|
||||
// NetworkInformation
|
||||
partial interface Navigator {
|
||||
[Throws, Pref="dom.netinfo.enabled"]
|
||||
|
Loading…
Reference in New Issue
Block a user