2008-11-04 13:49:04 -08:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Web Workers.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Mozilla Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2008
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Ben Turner <bent.mozilla@gmail.com> (Original Author)
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* From http://www.whatwg.org/specs/web-workers/current-work
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "nsIDOMEvent.idl"
|
|
|
|
#include "nsIDOMEventTarget.idl"
|
|
|
|
|
|
|
|
interface nsIDOMEventListener;
|
|
|
|
|
2008-12-07 16:15:49 -08:00
|
|
|
[scriptable, uuid(ab3725b8-3fca-40cc-a42c-92fb154ef01d)]
|
2008-11-04 13:49:04 -08:00
|
|
|
interface nsIWorkerMessagePort : nsISupports
|
|
|
|
{
|
2008-12-07 16:15:49 -08:00
|
|
|
void postMessage(/* in JSObject aMessage */);
|
2008-11-04 13:49:04 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
[scriptable, uuid(508f2d49-e9a0-4fe8-bd33-321820173b4a)]
|
|
|
|
interface nsIWorkerMessageEvent : nsIDOMEvent
|
|
|
|
{
|
|
|
|
readonly attribute DOMString data;
|
|
|
|
readonly attribute DOMString origin;
|
|
|
|
|
|
|
|
readonly attribute nsISupports source;
|
|
|
|
|
|
|
|
void initMessageEvent(in DOMString aTypeArg,
|
|
|
|
in boolean aCanBubbleArg,
|
|
|
|
in boolean aCancelableArg,
|
|
|
|
in DOMString aDataArg,
|
|
|
|
in DOMString aOriginArg,
|
|
|
|
in nsISupports aSourceArg);
|
|
|
|
};
|
|
|
|
|
2008-12-30 14:25:05 -08:00
|
|
|
[scriptable, uuid(73d82c1d-05de-49c9-a23b-7121ff09a67a)]
|
|
|
|
interface nsIWorkerErrorEvent : nsIDOMEvent
|
|
|
|
{
|
|
|
|
readonly attribute DOMString message;
|
|
|
|
readonly attribute DOMString filename;
|
|
|
|
|
|
|
|
readonly attribute unsigned long lineno;
|
|
|
|
|
|
|
|
void initErrorEvent(in DOMString aTypeArg,
|
|
|
|
in boolean aCanBubbleArg,
|
|
|
|
in boolean aCancelableArg,
|
|
|
|
in DOMString aMessageArg,
|
|
|
|
in DOMString aFilenameArg,
|
|
|
|
in unsigned long aLinenoArg);
|
|
|
|
};
|
|
|
|
|
2009-08-12 16:39:08 -07:00
|
|
|
[scriptable, uuid(17a005c3-4f2f-4bb6-b169-c181fa6873de)]
|
|
|
|
interface nsIWorkerLocation : nsISupports
|
|
|
|
{
|
|
|
|
readonly attribute AUTF8String href;
|
|
|
|
readonly attribute AUTF8String protocol;
|
|
|
|
readonly attribute AUTF8String host;
|
|
|
|
readonly attribute AUTF8String hostname;
|
|
|
|
readonly attribute AUTF8String port;
|
|
|
|
readonly attribute AUTF8String pathname;
|
|
|
|
readonly attribute AUTF8String search;
|
|
|
|
readonly attribute AUTF8String hash;
|
|
|
|
|
|
|
|
AUTF8String toString();
|
|
|
|
};
|
|
|
|
|
2008-11-26 22:16:40 -08:00
|
|
|
[scriptable, uuid(74fb665a-e477-4ce2-b3c6-c58b1b28b6c3)]
|
|
|
|
interface nsIWorkerNavigator : nsISupports
|
|
|
|
{
|
|
|
|
readonly attribute DOMString appName;
|
|
|
|
readonly attribute DOMString appVersion;
|
|
|
|
readonly attribute DOMString platform;
|
|
|
|
readonly attribute DOMString userAgent;
|
|
|
|
};
|
|
|
|
|
2009-08-12 16:39:08 -07:00
|
|
|
[scriptable, uuid(c111e7d3-8044-4458-aa7b-637696ffb841)]
|
2008-11-04 13:49:04 -08:00
|
|
|
interface nsIWorkerGlobalScope : nsISupports
|
|
|
|
{
|
|
|
|
readonly attribute nsIWorkerGlobalScope self;
|
2008-11-26 22:16:40 -08:00
|
|
|
readonly attribute nsIWorkerNavigator navigator;
|
2009-08-12 16:39:08 -07:00
|
|
|
readonly attribute nsIWorkerLocation location;
|
2008-12-30 14:25:05 -08:00
|
|
|
|
|
|
|
attribute nsIDOMEventListener onerror;
|
2008-11-04 13:49:04 -08:00
|
|
|
};
|
|
|
|
|
2009-03-15 15:30:31 -07:00
|
|
|
[scriptable, uuid(5c55ea4b-e4ac-4ceb-bfeb-46bd5e521b8a)]
|
2008-11-04 13:49:04 -08:00
|
|
|
interface nsIWorkerScope : nsIWorkerGlobalScope
|
|
|
|
{
|
2008-12-07 16:15:49 -08:00
|
|
|
void postMessage(/* in JSObject aMessage */);
|
2008-11-04 13:49:04 -08:00
|
|
|
|
2009-03-15 15:30:31 -07:00
|
|
|
void close();
|
|
|
|
|
2008-11-04 13:49:04 -08:00
|
|
|
attribute nsIDOMEventListener onmessage;
|
2009-03-15 15:30:31 -07:00
|
|
|
attribute nsIDOMEventListener onclose;
|
2008-11-04 13:49:04 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
[scriptable, uuid(b90b7561-b5e2-4545-84b0-280dbaaa94ea)]
|
|
|
|
interface nsIAbstractWorker : nsIDOMEventTarget
|
|
|
|
{
|
|
|
|
attribute nsIDOMEventListener onerror;
|
|
|
|
};
|
|
|
|
|
2008-12-07 16:15:49 -08:00
|
|
|
[scriptable, uuid(daf945c3-8d29-4724-8939-dd383f7d27a7)]
|
2008-11-04 13:49:04 -08:00
|
|
|
interface nsIWorker : nsIAbstractWorker
|
|
|
|
{
|
2008-12-07 16:15:49 -08:00
|
|
|
void postMessage(/* in JSObject aMessage */);
|
2008-11-04 13:49:04 -08:00
|
|
|
|
|
|
|
attribute nsIDOMEventListener onmessage;
|
2008-11-26 22:16:41 -08:00
|
|
|
|
|
|
|
void terminate();
|
2008-11-04 13:49:04 -08:00
|
|
|
};
|
2010-04-20 09:44:56 -07:00
|
|
|
|
2010-11-16 12:53:47 -08:00
|
|
|
[scriptable, uuid(cfc4bb32-ca83-4d58-9b6f-66f8054a333a)]
|
|
|
|
interface nsIWorkerFactory : nsISupports
|
2010-04-20 09:44:56 -07:00
|
|
|
{
|
2010-11-16 12:53:47 -08:00
|
|
|
nsIWorker newChromeWorker(/* in DOMString aScriptURL */);
|
2010-04-20 09:44:56 -07:00
|
|
|
};
|
2010-11-16 12:53:47 -08:00
|
|
|
|
|
|
|
%{ C++
|
|
|
|
#define NS_WORKERFACTORY_CONTRACTID \
|
|
|
|
"@mozilla.org/threads/workerfactory;1"
|
|
|
|
%}
|