mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Bug 683262 - window.crypto throws if MOZ_DISABLE_DOMCRYPTO is turned on - revert nsIWindowCrypto patch r=jst
This commit is contained in:
parent
a29fc61d9f
commit
52c440b803
@ -481,12 +481,6 @@ static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
|||||||
static const char kDOMStringBundleURL[] =
|
static const char kDOMStringBundleURL[] =
|
||||||
"chrome://global/locale/dom/dom.properties";
|
"chrome://global/locale/dom/dom.properties";
|
||||||
|
|
||||||
#ifdef MOZ_DISABLE_CRYPTOLEGACY
|
|
||||||
static const bool domCryptoEnabled = false;
|
|
||||||
#else
|
|
||||||
static const bool domCryptoEnabled = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// NOTE: DEFAULT_SCRIPTABLE_FLAGS and DOM_DEFAULT_SCRIPTABLE_FLAGS
|
// NOTE: DEFAULT_SCRIPTABLE_FLAGS and DOM_DEFAULT_SCRIPTABLE_FLAGS
|
||||||
// are defined in nsIDOMClassInfo.h.
|
// are defined in nsIDOMClassInfo.h.
|
||||||
|
|
||||||
@ -2067,8 +2061,7 @@ nsDOMClassInfo::RegisterExternalClasses()
|
|||||||
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMWindowPerformance, \
|
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMWindowPerformance, \
|
||||||
nsGlobalWindow::HasPerformanceSupport()) \
|
nsGlobalWindow::HasPerformanceSupport()) \
|
||||||
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsITouchEventReceiver, \
|
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsITouchEventReceiver, \
|
||||||
nsDOMTouchEvent::PrefEnabled()) \
|
nsDOMTouchEvent::PrefEnabled())
|
||||||
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIWindowCrypto, domCryptoEnabled)
|
|
||||||
#else // !MOZ_B2G
|
#else // !MOZ_B2G
|
||||||
#define DOM_CLASSINFO_WINDOW_MAP_ENTRIES(_support_indexed_db) \
|
#define DOM_CLASSINFO_WINDOW_MAP_ENTRIES(_support_indexed_db) \
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow) \
|
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow) \
|
||||||
@ -2080,8 +2073,7 @@ nsDOMClassInfo::RegisterExternalClasses()
|
|||||||
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMWindowPerformance, \
|
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMWindowPerformance, \
|
||||||
nsGlobalWindow::HasPerformanceSupport()) \
|
nsGlobalWindow::HasPerformanceSupport()) \
|
||||||
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsITouchEventReceiver, \
|
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsITouchEventReceiver, \
|
||||||
nsDOMTouchEvent::PrefEnabled()) \
|
nsDOMTouchEvent::PrefEnabled())
|
||||||
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIWindowCrypto, domCryptoEnabled)
|
|
||||||
#endif // MOZ_B2G
|
#endif // MOZ_B2G
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -1453,7 +1453,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindow)
|
|||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMWindowPerformance)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMWindowPerformance)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsITouchEventReceiver)
|
NS_INTERFACE_MAP_ENTRY(nsITouchEventReceiver)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIInlineEventHandlers)
|
NS_INTERFACE_MAP_ENTRY(nsIInlineEventHandlers)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIWindowCrypto)
|
|
||||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Window)
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Window)
|
||||||
OUTER_WINDOW_ONLY
|
OUTER_WINDOW_ONLY
|
||||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||||
|
@ -260,8 +260,7 @@ class nsGlobalWindow : public mozilla::dom::EventTarget,
|
|||||||
public PRCListStr,
|
public PRCListStr,
|
||||||
public nsIDOMWindowPerformance,
|
public nsIDOMWindowPerformance,
|
||||||
public nsITouchEventReceiver,
|
public nsITouchEventReceiver,
|
||||||
public nsIInlineEventHandlers,
|
public nsIInlineEventHandlers
|
||||||
public nsIWindowCrypto
|
|
||||||
#ifdef MOZ_B2G
|
#ifdef MOZ_B2G
|
||||||
, public nsIDOMWindowB2G
|
, public nsIDOMWindowB2G
|
||||||
#endif // MOZ_B2G
|
#endif // MOZ_B2G
|
||||||
@ -332,9 +331,6 @@ public:
|
|||||||
// nsIInlineEventHandlers
|
// nsIInlineEventHandlers
|
||||||
NS_DECL_NSIINLINEEVENTHANDLERS
|
NS_DECL_NSIINLINEEVENTHANDLERS
|
||||||
|
|
||||||
// nsIWindowCrypto
|
|
||||||
NS_DECL_NSIWINDOWCRYPTO
|
|
||||||
|
|
||||||
// nsPIDOMWindow
|
// nsPIDOMWindow
|
||||||
virtual NS_HIDDEN_(nsPIDOMWindow*) GetPrivateRoot();
|
virtual NS_HIDDEN_(nsPIDOMWindow*) GetPrivateRoot();
|
||||||
virtual NS_HIDDEN_(void) ActivateOrDeactivate(bool aActivate);
|
virtual NS_HIDDEN_(void) ActivateOrDeactivate(bool aActivate);
|
||||||
|
@ -25,7 +25,7 @@ interface nsIVariant;
|
|||||||
* @see <http://www.whatwg.org/html/#window>
|
* @see <http://www.whatwg.org/html/#window>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[scriptable, uuid(8d86d6b2-fc2c-416a-8085-f670d5a35832)]
|
[scriptable, uuid(39cb59d4-fba9-48a9-b70b-570a7ec2ebfa)]
|
||||||
interface nsIDOMWindow : nsISupports
|
interface nsIDOMWindow : nsISupports
|
||||||
{
|
{
|
||||||
// the current browsing context
|
// the current browsing context
|
||||||
@ -360,6 +360,9 @@ interface nsIDOMWindow : nsISupports
|
|||||||
|
|
||||||
readonly attribute boolean closed;
|
readonly attribute boolean closed;
|
||||||
|
|
||||||
|
readonly attribute nsIDOMCrypto crypto;
|
||||||
|
readonly attribute nsIDOMPkcs11 pkcs11;
|
||||||
|
|
||||||
// XXX Shouldn't this be in nsIDOMChromeWindow?
|
// XXX Shouldn't this be in nsIDOMChromeWindow?
|
||||||
/* [replaceable] controllers */
|
/* [replaceable] controllers */
|
||||||
readonly attribute nsIControllers controllers;
|
readonly attribute nsIControllers controllers;
|
||||||
@ -499,17 +502,6 @@ interface nsIDOMWindowPerformance : nsISupports
|
|||||||
readonly attribute nsISupports performance;
|
readonly attribute nsISupports performance;
|
||||||
};
|
};
|
||||||
|
|
||||||
[scriptable, uuid(2ed9ace1-172c-443f-b92f-c4f74bf8f2c5)]
|
|
||||||
interface nsIWindowCrypto : nsISupports
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A namespace to hold crypto related data and statistics.
|
|
||||||
* http://wiki.whatwg.org/wiki/Crypto
|
|
||||||
*/
|
|
||||||
readonly attribute nsIDOMCrypto crypto;
|
|
||||||
readonly attribute nsIDOMPkcs11 pkcs11;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty interface for compatibility with older versions.
|
* Empty interface for compatibility with older versions.
|
||||||
* @deprecated Use nsIDOMWindow instead
|
* @deprecated Use nsIDOMWindow instead
|
||||||
|
@ -18,8 +18,6 @@ MOZ_SERVICES_CRYPTO=1
|
|||||||
MOZ_SERVICES_METRICS=1
|
MOZ_SERVICES_METRICS=1
|
||||||
MOZ_SERVICES_SYNC=1
|
MOZ_SERVICES_SYNC=1
|
||||||
|
|
||||||
MOZ_DISABLE_DOMCRYPTO=1
|
|
||||||
|
|
||||||
if test "$LIBXUL_SDK"; then
|
if test "$LIBXUL_SDK"; then
|
||||||
MOZ_XULRUNNER=1
|
MOZ_XULRUNNER=1
|
||||||
else
|
else
|
||||||
|
@ -478,52 +478,47 @@ nsNSSComponent::DispatchEvent(const nsAString &eventType,
|
|||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsNSSComponent::DispatchEventToWindow(nsIDOMWindow *domWin,
|
nsNSSComponent::DispatchEventToWindow(nsIDOMWindow *domWin,
|
||||||
const nsAString &eventType, const nsAString &tokenName)
|
const nsAString &eventType,
|
||||||
|
const nsAString &tokenName)
|
||||||
{
|
{
|
||||||
// first walk the children and dispatch their events
|
if (!domWin) {
|
||||||
{
|
return NS_OK;
|
||||||
nsresult rv;
|
}
|
||||||
nsCOMPtr<nsIDOMWindowCollection> frames;
|
|
||||||
rv = domWin->GetFrames(getter_AddRefs(frames));
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t length;
|
// first walk the children and dispatch their events
|
||||||
frames->GetLength(&length);
|
nsresult rv;
|
||||||
uint32_t i;
|
nsCOMPtr<nsIDOMWindowCollection> frames;
|
||||||
for (i = 0; i < length; i++) {
|
rv = domWin->GetFrames(getter_AddRefs(frames));
|
||||||
nsCOMPtr<nsIDOMWindow> childWin;
|
if (NS_FAILED(rv)) {
|
||||||
frames->Item(i, getter_AddRefs(childWin));
|
return rv;
|
||||||
DispatchEventToWindow(childWin, eventType, tokenName);
|
}
|
||||||
}
|
|
||||||
|
uint32_t length;
|
||||||
|
frames->GetLength(&length);
|
||||||
|
uint32_t i;
|
||||||
|
for (i = 0; i < length; i++) {
|
||||||
|
nsCOMPtr<nsIDOMWindow> childWin;
|
||||||
|
frames->Item(i, getter_AddRefs(childWin));
|
||||||
|
DispatchEventToWindow(childWin, eventType, tokenName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if we've enabled smart card events on this window
|
// check if we've enabled smart card events on this window
|
||||||
// NOTE: it's not an error to say that we aren't going to dispatch
|
// NOTE: it's not an error to say that we aren't going to dispatch
|
||||||
// the event.
|
// the event.
|
||||||
{
|
nsCOMPtr<nsIDOMCrypto> crypto;
|
||||||
nsCOMPtr<nsIWindowCrypto> domWindow = do_QueryInterface(domWin);
|
domWin->GetCrypto(getter_AddRefs(crypto));
|
||||||
if (!domWindow) {
|
if (!crypto) {
|
||||||
return NS_OK; // nope, it's not an internal window
|
return NS_OK; // nope, it doesn't have a crypto property
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMCrypto> crypto;
|
bool boolrv;
|
||||||
domWindow->GetCrypto(getter_AddRefs(crypto));
|
crypto->GetEnableSmartCardEvents(&boolrv);
|
||||||
if (!crypto) {
|
if (!boolrv) {
|
||||||
return NS_OK; // nope, it doesn't have a crypto property
|
return NS_OK; // nope, it's not enabled.
|
||||||
}
|
|
||||||
|
|
||||||
bool boolrv;
|
|
||||||
crypto->GetEnableSmartCardEvents(&boolrv);
|
|
||||||
if (!boolrv) {
|
|
||||||
return NS_OK; // nope, it's not enabled.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// dispatch the event ...
|
// dispatch the event ...
|
||||||
|
|
||||||
nsresult rv;
|
|
||||||
// find the document
|
// find the document
|
||||||
nsCOMPtr<nsIDOMDocument> doc;
|
nsCOMPtr<nsIDOMDocument> doc;
|
||||||
rv = domWin->GetDocument(getter_AddRefs(doc));
|
rv = domWin->GetDocument(getter_AddRefs(doc));
|
||||||
@ -545,9 +540,7 @@ nsNSSComponent::DispatchEventToWindow(nsIDOMWindow *domWin,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool boolrv;
|
return target->DispatchEvent(smartCardEvent, &boolrv);
|
||||||
rv = target->DispatchEvent(smartCardEvent, &boolrv);
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
#endif // MOZ_DISABLE_CRYPTOLEGACY
|
#endif // MOZ_DISABLE_CRYPTOLEGACY
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user