зеркало из https://github.com/mozilla/gecko-dev.git
Back out a2e5b6d2f31a (bug 866528) for gaia-unit bustage
This commit is contained in:
Родитель
1e049545bb
Коммит
8b868c6da7
|
@ -543,6 +543,7 @@
|
|||
@BINPATH@/components/SystemMessageManager.manifest
|
||||
|
||||
@BINPATH@/components/Activities.manifest
|
||||
@BINPATH@/components/ActivityOptions.js
|
||||
@BINPATH@/components/ActivityProxy.js
|
||||
@BINPATH@/components/ActivityRequestHandler.js
|
||||
@BINPATH@/components/ActivityWrapper.js
|
||||
|
|
|
@ -544,6 +544,7 @@
|
|||
@BINPATH@/components/SystemMessageManager.manifest
|
||||
|
||||
@BINPATH@/components/Activities.manifest
|
||||
@BINPATH@/components/ActivityOptions.js
|
||||
@BINPATH@/components/ActivityProxy.js
|
||||
@BINPATH@/components/ActivityRequestHandler.js
|
||||
@BINPATH@/components/ActivityWrapper.js
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
XPIDL_SOURCES += [
|
||||
'nsIActivityProxy.idl',
|
||||
'nsIActivityUIGlue.idl',
|
||||
'nsIDOMActivityOptions.idl',
|
||||
'nsIDOMActivityRequestHandler.idl',
|
||||
]
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMMozActivityOptions;
|
||||
interface nsIDOMWindow;
|
||||
|
||||
/**
|
||||
|
@ -13,7 +14,7 @@ interface nsIDOMWindow;
|
|||
interface nsIActivityProxy : nsISupports
|
||||
{
|
||||
void startActivity(in nsISupports /* MozActivity */ activity,
|
||||
in jsval options,
|
||||
in nsIDOMMozActivityOptions options,
|
||||
in nsIDOMWindow window);
|
||||
void cleanup();
|
||||
};
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#include "domstubs.idl"
|
||||
|
||||
[scriptable, uuid(f5bf5e9b-f53f-470f-b560-0d6f4c1c98ad)]
|
||||
interface nsIDOMMozActivityOptions : nsISupports
|
||||
{
|
||||
readonly attribute DOMString name;
|
||||
// The |data| field can be null.
|
||||
readonly attribute jsval data;
|
||||
};
|
|
@ -4,10 +4,12 @@
|
|||
|
||||
#include "domstubs.idl"
|
||||
|
||||
interface nsIDOMMozActivityOptions;
|
||||
|
||||
[scriptable, uuid(e70c4181-ea3f-4aa5-a2f7-af910dc65e45)]
|
||||
interface nsIDOMMozActivityRequestHandler : nsISupports
|
||||
{
|
||||
void postResult(in jsval result);
|
||||
void postError(in DOMString error);
|
||||
readonly attribute jsval source;
|
||||
readonly attribute nsIDOMMozActivityOptions source;
|
||||
};
|
||||
|
|
|
@ -9,3 +9,6 @@ contract @mozilla.org/dom/system-messages/configurator/activity;1 {d2296daa-c406
|
|||
|
||||
component {9326952a-dbe3-4d81-a51f-d9c160d96d6b} ActivityRequestHandler.js
|
||||
contract @mozilla.org/dom/activities/request-handler;1 {9326952a-dbe3-4d81-a51f-d9c160d96d6b}
|
||||
|
||||
component {ee983dbb-d5ea-4c5b-be98-10a13cac9f9d} ActivityOptions.js
|
||||
contract @mozilla.org/dom/activities/options;1 {ee983dbb-d5ea-4c5b-be98-10a13cac9f9d}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "Activity.h"
|
||||
|
||||
#include "mozilla/dom/MozActivityBinding.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "nsIConsoleService.h"
|
||||
|
@ -32,9 +33,9 @@ Activity::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
|||
|
||||
nsresult
|
||||
Activity::Initialize(nsPIDOMWindow* aWindow,
|
||||
JSContext* aCx,
|
||||
const ActivityOptions& aOptions)
|
||||
nsIDOMMozActivityOptions* aOptions)
|
||||
{
|
||||
MOZ_ASSERT(aOptions);
|
||||
MOZ_ASSERT(aWindow);
|
||||
|
||||
nsCOMPtr<nsIDocument> document = aWindow->GetExtantDoc();
|
||||
|
@ -66,12 +67,7 @@ Activity::Initialize(nsPIDOMWindow* aWindow,
|
|||
mProxy = do_CreateInstance("@mozilla.org/dom/activities/proxy;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JS::Rooted<JS::Value> optionsValue(aCx);
|
||||
if (!aOptions.ToObject(aCx, JS::NullPtr(), &optionsValue)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mProxy->StartActivity(static_cast<nsIDOMDOMRequest*>(this), optionsValue, aWindow);
|
||||
mProxy->StartActivity(static_cast<nsIDOMDOMRequest*>(this), aOptions, aWindow);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "DOMRequest.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/MozActivityBinding.h"
|
||||
#include "nsIActivityProxy.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
@ -26,8 +25,7 @@ public:
|
|||
|
||||
static already_AddRefed<Activity>
|
||||
Constructor(const GlobalObject& aOwner,
|
||||
JSContext* aCx,
|
||||
const ActivityOptions& aOptions,
|
||||
nsIDOMMozActivityOptions* aOptions,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aOwner.GetAsSupports());
|
||||
|
@ -37,7 +35,7 @@ public:
|
|||
}
|
||||
|
||||
nsRefPtr<Activity> activity = new Activity(window);
|
||||
aRv = activity->Initialize(window, aCx, aOptions);
|
||||
aRv = activity->Initialize(window, aOptions);
|
||||
return activity.forget();
|
||||
}
|
||||
|
||||
|
@ -45,8 +43,7 @@ public:
|
|||
|
||||
protected:
|
||||
nsresult Initialize(nsPIDOMWindow* aWindow,
|
||||
JSContext* aCx,
|
||||
const ActivityOptions& aOptions);
|
||||
nsIDOMMozActivityOptions* aOptions);
|
||||
|
||||
nsCOMPtr<nsIActivityProxy> mProxy;
|
||||
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
function debug(aMsg) {
|
||||
//dump("-- ActivityOptions.js " + Date.now() + " : " + aMsg + "\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* nsIDOMMozActivityOptions implementation.
|
||||
*/
|
||||
|
||||
function ActivityOptions() {
|
||||
debug("ActivityOptions");
|
||||
this.wrappedJSObject = this;
|
||||
|
||||
// When a system message of type 'activity' is emitted, it forces the
|
||||
// creation of an ActivityWrapper which in turns replace the default
|
||||
// system message callback. The newly created wrapper then create a
|
||||
// nsIDOMActivityRequestHandler object and fills up the properties of
|
||||
// this object as well as the properties of the nsIDOMActivityOptions
|
||||
// object contains by the request handler.
|
||||
this._name = null;
|
||||
this._data = null;
|
||||
}
|
||||
|
||||
ActivityOptions.prototype = {
|
||||
get name() {
|
||||
return this._name;
|
||||
},
|
||||
|
||||
get data() {
|
||||
return this._data;
|
||||
},
|
||||
|
||||
classID: Components.ID("{ee983dbb-d5ea-4c5b-be98-10a13cac9f9d}"),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMMozActivityOptions]),
|
||||
|
||||
classInfo: XPCOMUtils.generateCI({
|
||||
classID: Components.ID("{ee983dbb-d5ea-4c5b-be98-10a13cac9f9d}"),
|
||||
contractID: "@mozilla.org/dom/activities/options;1",
|
||||
interfaces: [Ci.nsIDOMMozActivityOptions],
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT,
|
||||
classDescription: "Activity Options"
|
||||
})
|
||||
}
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivityOptions]);
|
|
@ -31,10 +31,11 @@ function ActivityRequestHandler() {
|
|||
// creation of an ActivityWrapper which in turns replace the default
|
||||
// system message callback. The newly created wrapper then create a
|
||||
// nsIDOMActivityRequestHandler object and fills up the properties of
|
||||
// this object as well as the properties of the ActivityOptions
|
||||
// dictionary contained by the request handler.
|
||||
// this object as well as the properties of the nsIDOMActivityOptions
|
||||
// object contains by the request handler.
|
||||
this._id = null;
|
||||
this._options = {name: "", data: null};
|
||||
this._options = Cc["@mozilla.org/dom/activities/options;1"]
|
||||
.createInstance(Ci.nsIDOMMozActivityOptions);
|
||||
}
|
||||
|
||||
ActivityRequestHandler.prototype = {
|
||||
|
|
|
@ -41,7 +41,7 @@ ActivityWrapper.prototype = {
|
|||
.createInstance(Ci.nsIDOMMozActivityRequestHandler);
|
||||
handler.wrappedJSObject._id = aMessage.id;
|
||||
|
||||
// options is an ActivityOptions dictionary.
|
||||
// options is an nsIDOMActivityOptions object.
|
||||
var options = handler.wrappedJSObject._options;
|
||||
options.wrappedJSObject._name = aMessage.payload.name;
|
||||
options.wrappedJSObject._data = Cu.cloneInto(aMessage.payload.data, aWindow);
|
||||
|
|
|
@ -15,6 +15,7 @@ SOURCES += [
|
|||
EXTRA_COMPONENTS += [
|
||||
'Activities.manifest',
|
||||
'ActivityMessageConfigurator.js',
|
||||
'ActivityOptions.js',
|
||||
'ActivityProxy.js',
|
||||
'ActivityRequestHandler.js',
|
||||
'ActivityWrapper.js',
|
||||
|
|
|
@ -1824,6 +1824,8 @@ def addExternalIface(iface, nativeType=None, headerFile=None,
|
|||
DOMInterfaces[iface] = domInterface
|
||||
|
||||
addExternalIface('ApplicationCache', nativeType='nsIDOMOfflineResourceList')
|
||||
addExternalIface('ActivityOptions', nativeType='nsIDOMMozActivityOptions',
|
||||
headerFile='nsIDOMActivityOptions.h')
|
||||
addExternalIface('Counter')
|
||||
addExternalIface('CSSRule')
|
||||
addExternalIface('mozIDOMApplication', nativeType='mozIDOMApplication', headerFile='nsIDOMApplicationRegistry.h')
|
||||
|
|
|
@ -4,12 +4,9 @@
|
|||
* 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/. */
|
||||
|
||||
dictionary ActivityOptions {
|
||||
DOMString name = "";
|
||||
any data = null;
|
||||
};
|
||||
interface ActivityOptions;
|
||||
|
||||
[Pref="dom.sysmsg.enabled",
|
||||
Constructor(optional ActivityOptions options)]
|
||||
Constructor(ActivityOptions options)]
|
||||
interface MozActivity : DOMRequest {
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче