/*
 * Copyright (C) 2007 Henry Mason <hmason@mac.com>
 * Copyright (C) 2011 Google Inc. All rights reserved.
 * Copyright (C) 2016 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */

#if defined(ENABLE_SERVICE_WORKER) && ENABLE_SERVICE_WORKER
typedef (DOMWindow or MessagePort or ServiceWorker) MessageEventSource;
#else
typedef (DOMWindow or MessagePort) MessageEventSource;
#endif

[
    Constructor(DOMString type, optional MessageEventInit eventInitDict),
    Exposed=(Window,Worker),
    JSCustomMarkFunction,
] interface MessageEvent : Event {
    readonly attribute USVString origin;
    readonly attribute DOMString lastEventId;
    readonly attribute MessageEventSource? source;
    [CustomGetter] readonly attribute any data;
    readonly attribute FrozenArray<MessagePort> ports;

    void initMessageEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false,
        optional any data = null, optional USVString originArg = "", optional DOMString lastEventId = "", optional MessageEventSource? source = null,
        optional sequence<MessagePort> messagePorts = []);
};

dictionary MessageEventInit : EventInit {
    any data = null;
    USVString origin = "";
    DOMString lastEventId = "";
    MessageEventSource? source = null;
    sequence<MessagePort> ports = [];
};
