caps/nsIDomainPolicy.idl
author Brindusan Cristian <cbrindusan@mozilla.com>
Fri, 13 Jul 2018 22:11:24 +0300
changeset 426575 bd747e24063da7d803dc5fd20b5a8af0d036f4d5
parent 341100 5a43dbcb95cab9ff9728383f05780faa72e1ad5e
child 443784 f3a78d65b0590610e4f863db4dce834303fc8b94
permissions -rw-r--r--
Backed out 12 changesets (bug 1471025) for build bustages on dom/ipc/ContentProcess.cpp. CLOSED TREE Backed out changeset 398ccedc20dc (bug 1471025) Backed out changeset 599895de063e (bug 1471025) Backed out changeset dc7ec17179d1 (bug 1471025) Backed out changeset 5051f15fc200 (bug 1471025) Backed out changeset faef4df47b20 (bug 1471025) Backed out changeset d344247b8706 (bug 1471025) Backed out changeset 83d98ea5ebac (bug 1471025) Backed out changeset 38f690f30e78 (bug 1471025) Backed out changeset 4b7a8a35ed95 (bug 1471025) Backed out changeset e3bbc87b71af (bug 1471025) Backed out changeset 68bb03c63b3c (bug 1471025) Backed out changeset 4a8fbb472c91 (bug 1471025)

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* 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 "nsISupports.idl"

interface nsIURI;
interface nsIDomainSet;

%{ C++
namespace mozilla {
namespace dom {
class DomainPolicyClone;
}
}
%}

[ptr] native DomainPolicyClonePtr(mozilla::dom::DomainPolicyClone);
[ptr] native DomainPolicyCloneConstPtr(const mozilla::dom::DomainPolicyClone);

/*
 * When a domain policy is instantiated by invoking activateDomainPolicy() on
 * nsIScriptSecurityManager, these domain sets are consulted when each new
 * global is created (they have no effect on already-created globals).
 * If javascript is globally enabled with |javascript.enabled|, the blacklists
 * are consulted. If globally disabled, the whitelists are consulted. Lookups
 * on blacklist and whitelist happen with contains(), and lookups on
 * superBlacklist and superWhitelist happen with containsSuperDomain().
 *
 * When deactivate() is invoked, the domain sets are emptied, and the
 * nsIDomainPolicy ceases to have any effect on the system.
 */
[scriptable, builtinclass, uuid(82b24a20-6701-4d40-a0f9-f5dc7321b555)]
interface nsIDomainPolicy : nsISupports
{
    readonly attribute nsIDomainSet blacklist;
    readonly attribute nsIDomainSet superBlacklist;
    readonly attribute nsIDomainSet whitelist;
    readonly attribute nsIDomainSet superWhitelist;

    void deactivate();

    [noscript, notxpcom] void cloneDomainPolicy(in DomainPolicyClonePtr aClone);
    [noscript, notxpcom] void applyClone(in DomainPolicyCloneConstPtr aClone);
};

[scriptable, builtinclass, uuid(665c981b-0a0f-4229-ac06-a826e02d4f69)]
interface nsIDomainSet : nsISupports
{
    /*
     * The type of the set. See: DomainSetType
     */
    [noscript] readonly attribute uint32_t type;

    /*
     * Add a domain to the set. No-op if it already exists.
     */
    void add(in nsIURI aDomain);

    /*
     * Remove a domain from the set. No-op if it doesn't exist.
     */
    void remove(in nsIURI aDomain);

    /*
     * Remove all entries from the set.
     */
    void clear();

    /*
     * Returns true if a given domain is in the set.
     */
    bool contains(in nsIURI aDomain);

    /*
     * Returns true if a given domain is a subdomain of one of the entries in
     * the set.
     */
    bool containsSuperDomain(in nsIURI aDomain);
};