mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-13 19:41:49 +00:00
Bug 1046420 - Part 1: Make MozSelfSupport a Window property instead of a global property. r=bz,wchen
This commit is contained in:
parent
2f94456fa7
commit
775a16fc82
@ -27,18 +27,12 @@ MozSelfSupportInterface.prototype = {
|
|||||||
classDescription: "MozSelfSupport",
|
classDescription: "MozSelfSupport",
|
||||||
classID: Components.ID("{d30aae8b-f352-4de3-b936-bb9d875df0bb}"),
|
classID: Components.ID("{d30aae8b-f352-4de3-b936-bb9d875df0bb}"),
|
||||||
contractID: "@mozilla.org/mozselfsupport;1",
|
contractID: "@mozilla.org/mozselfsupport;1",
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer,
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer]),
|
||||||
Ci.nsIObserver]),
|
|
||||||
|
|
||||||
_window: null,
|
_window: null,
|
||||||
|
|
||||||
init: function (window) {
|
init: function (window) {
|
||||||
this._window = window;
|
this._window = window;
|
||||||
|
|
||||||
// FIXME: Remove this hack after static attributes work for JS-implemented
|
|
||||||
// WebIDL (see bug 863952). For a detailed description of how this works,
|
|
||||||
// see the comment accompanying the init function of amInstallTrigger.js.
|
|
||||||
return window.MozSelfSupportImpl._create(this._window, this);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
get healthReportDataSubmissionEnabled() {
|
get healthReportDataSubmissionEnabled() {
|
||||||
|
@ -1,4 +1,2 @@
|
|||||||
component {d30aae8b-f352-4de3-b936-bb9d875df0bb} SelfSupportService.js
|
component {d30aae8b-f352-4de3-b936-bb9d875df0bb} SelfSupportService.js
|
||||||
contract @mozilla.org/mozselfsupport;1 {d30aae8b-f352-4de3-b936-bb9d875df0bb}
|
contract @mozilla.org/mozselfsupport;1 {d30aae8b-f352-4de3-b936-bb9d875df0bb}
|
||||||
|
|
||||||
category JavaScript-global-privileged-property MozSelfSupport @mozilla.org/mozselfsupport;1
|
|
||||||
|
@ -213,6 +213,7 @@
|
|||||||
#include "mozilla/dom/Console.h"
|
#include "mozilla/dom/Console.h"
|
||||||
#include "mozilla/dom/FunctionBinding.h"
|
#include "mozilla/dom/FunctionBinding.h"
|
||||||
#include "mozilla/dom/HashChangeEvent.h"
|
#include "mozilla/dom/HashChangeEvent.h"
|
||||||
|
#include "mozilla/dom/MozSelfSupportBinding.h"
|
||||||
#include "mozilla/dom/PopStateEvent.h"
|
#include "mozilla/dom/PopStateEvent.h"
|
||||||
#include "mozilla/dom/PopupBlockedEvent.h"
|
#include "mozilla/dom/PopupBlockedEvent.h"
|
||||||
#include "mozilla/dom/WindowBinding.h"
|
#include "mozilla/dom/WindowBinding.h"
|
||||||
@ -1467,6 +1468,8 @@ nsGlobalWindow::CleanUp()
|
|||||||
|
|
||||||
mExternal = nullptr;
|
mExternal = nullptr;
|
||||||
|
|
||||||
|
mMozSelfSupport = nullptr;
|
||||||
|
|
||||||
mPerformance = nullptr;
|
mPerformance = nullptr;
|
||||||
|
|
||||||
#ifdef MOZ_WEBSPEECH
|
#ifdef MOZ_WEBSPEECH
|
||||||
@ -1786,6 +1789,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindow)
|
|||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCrypto)
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCrypto)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mConsole)
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mConsole)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mExternal)
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mExternal)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMozSelfSupport)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||||
|
|
||||||
@ -1846,6 +1850,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
|
|||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCrypto)
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCrypto)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mConsole)
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mConsole)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mExternal)
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mExternal)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mMozSelfSupport)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||||
|
|
||||||
@ -4065,6 +4070,19 @@ nsGlobalWindow::GetContent(nsIDOMWindow** aContent)
|
|||||||
return rv.ErrorCode();
|
return rv.ErrorCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MozSelfSupport*
|
||||||
|
nsGlobalWindow::GetMozSelfSupport(ErrorResult& aError)
|
||||||
|
{
|
||||||
|
if (mMozSelfSupport) {
|
||||||
|
return mMozSelfSupport;
|
||||||
|
}
|
||||||
|
|
||||||
|
AutoSafeJSContext cx;
|
||||||
|
GlobalObject global(cx, FastGetGlobalJSObject());
|
||||||
|
mMozSelfSupport = MozSelfSupport::Constructor(global, cx, aError);
|
||||||
|
return mMozSelfSupport;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGlobalWindow::GetScriptableContent(JSContext* aCx, JS::MutableHandle<JS::Value> aVal)
|
nsGlobalWindow::GetScriptableContent(JSContext* aCx, JS::MutableHandle<JS::Value> aVal)
|
||||||
{
|
{
|
||||||
|
@ -114,6 +114,7 @@ class External;
|
|||||||
class Function;
|
class Function;
|
||||||
class Gamepad;
|
class Gamepad;
|
||||||
class MediaQueryList;
|
class MediaQueryList;
|
||||||
|
class MozSelfSupport;
|
||||||
class Navigator;
|
class Navigator;
|
||||||
class OwningExternalOrWindowProxy;
|
class OwningExternalOrWindowProxy;
|
||||||
class Selection;
|
class Selection;
|
||||||
@ -1016,6 +1017,9 @@ public:
|
|||||||
bool aWrapAround, bool aWholeWord, bool aSearchInFrames,
|
bool aWrapAround, bool aWholeWord, bool aSearchInFrames,
|
||||||
bool aShowDialog, mozilla::ErrorResult& aError);
|
bool aShowDialog, mozilla::ErrorResult& aError);
|
||||||
uint64_t GetMozPaintCount(mozilla::ErrorResult& aError);
|
uint64_t GetMozPaintCount(mozilla::ErrorResult& aError);
|
||||||
|
|
||||||
|
mozilla::dom::MozSelfSupport* GetMozSelfSupport(mozilla::ErrorResult& aError);
|
||||||
|
|
||||||
already_AddRefed<nsIDOMWindow> OpenDialog(JSContext* aCx,
|
already_AddRefed<nsIDOMWindow> OpenDialog(JSContext* aCx,
|
||||||
const nsAString& aUrl,
|
const nsAString& aUrl,
|
||||||
const nsAString& aName,
|
const nsAString& aName,
|
||||||
@ -1562,6 +1566,8 @@ protected:
|
|||||||
// it wouldn't see the ~External function's declaration.
|
// it wouldn't see the ~External function's declaration.
|
||||||
nsCOMPtr<nsISupports> mExternal;
|
nsCOMPtr<nsISupports> mExternal;
|
||||||
|
|
||||||
|
nsRefPtr<mozilla::dom::MozSelfSupport> mMozSelfSupport;
|
||||||
|
|
||||||
nsRefPtr<mozilla::dom::DOMStorage> mLocalStorage;
|
nsRefPtr<mozilla::dom::DOMStorage> mLocalStorage;
|
||||||
nsRefPtr<mozilla::dom::DOMStorage> mSessionStorage;
|
nsRefPtr<mozilla::dom::DOMStorage> mSessionStorage;
|
||||||
|
|
||||||
|
@ -11,8 +11,9 @@
|
|||||||
* specific Mozilla domains to access it directly.
|
* specific Mozilla domains to access it directly.
|
||||||
*/
|
*/
|
||||||
[ChromeOnly,
|
[ChromeOnly,
|
||||||
JSImplementation="@mozilla.org/mozselfsupport;1"]
|
JSImplementation="@mozilla.org/mozselfsupport;1",
|
||||||
interface MozSelfSupportImpl
|
Constructor()]
|
||||||
|
interface MozSelfSupport
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Controls whether uploading FHR data is allowed.
|
* Controls whether uploading FHR data is allowed.
|
||||||
|
@ -328,6 +328,14 @@ partial interface Window {
|
|||||||
*/
|
*/
|
||||||
[Throws] readonly attribute unsigned long long mozPaintCount;
|
[Throws] readonly attribute unsigned long long mozPaintCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This property exists because static attributes don't yet work for
|
||||||
|
* JS-implemented WebIDL (see bugs 1058606 and 863952). With this hack, we
|
||||||
|
* can use `MozSelfSupport.something(...)`, which will continue to work
|
||||||
|
* after we ditch this property and switch to static attributes. See
|
||||||
|
*/
|
||||||
|
[ChromeOnly, Throws] readonly attribute MozSelfSupport MozSelfSupport;
|
||||||
|
|
||||||
[Pure]
|
[Pure]
|
||||||
attribute EventHandler onwheel;
|
attribute EventHandler onwheel;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user