зеркало из https://github.com/mozilla/gecko-dev.git
Bug 794407 - Web Activites should only be started by a user interaction. r=fabrice a=blocking-basecamp
This commit is contained in:
Родитель
904540f41d
Коммит
4984f8063e
|
@ -6,6 +6,7 @@
|
||||||
#include "nsDOMClassInfo.h"
|
#include "nsDOMClassInfo.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsIDOMActivityOptions.h"
|
#include "nsIDOMActivityOptions.h"
|
||||||
|
#include "nsEventStateManager.h"
|
||||||
|
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
|
||||||
|
@ -47,6 +48,14 @@ Activity::Initialize(nsISupports* aOwner,
|
||||||
|
|
||||||
Init(window);
|
Init(window);
|
||||||
|
|
||||||
|
if (!nsEventStateManager::IsHandlingUserInput()) {
|
||||||
|
nsCOMPtr<nsIDOMRequestService> rs =
|
||||||
|
do_GetService("@mozilla.org/dom/dom-request-service;1");
|
||||||
|
rs->FireErrorAsync(static_cast<DOMRequest*>(this),
|
||||||
|
NS_LITERAL_STRING("NotUserInput"));
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// We expect a single argument, which is a nsIDOMMozActivityOptions.
|
// We expect a single argument, which is a nsIDOMMozActivityOptions.
|
||||||
if (aArgc != 1 || !aArgv[0].isObject()) {
|
if (aArgc != 1 || !aArgv[0].isObject()) {
|
||||||
return NS_ERROR_INVALID_ARG;
|
return NS_ERROR_INVALID_ARG;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче