2015-05-28 17:37:42 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* 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/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2015-06-17 21:12:23 +03:00
|
|
|
* A collection of static utility methods that are only exposed to Chrome. This
|
|
|
|
* interface is not exposed in workers, while ThreadSafeChromeUtils is.
|
2015-05-28 17:37:42 +03:00
|
|
|
*/
|
2015-06-17 21:12:23 +03:00
|
|
|
[ChromeOnly, Exposed=(Window,System)]
|
|
|
|
interface ChromeUtils : ThreadSafeChromeUtils {
|
2015-06-24 23:34:54 +03:00
|
|
|
/**
|
|
|
|
* A helper that converts OriginAttributesDictionary to a opaque suffix string.
|
|
|
|
*
|
|
|
|
* @param originAttrs The originAttributes from the caller.
|
|
|
|
*/
|
|
|
|
static ByteString
|
|
|
|
originAttributesToSuffix(optional OriginAttributesDictionary originAttrs);
|
2015-07-09 21:36:35 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the members of |originAttrs| match the provided members
|
|
|
|
* of |pattern|.
|
|
|
|
*
|
|
|
|
* @param originAttrs The originAttributes under consideration.
|
|
|
|
* @param pattern The pattern to use for matching.
|
|
|
|
*/
|
|
|
|
static boolean
|
|
|
|
originAttributesMatchPattern(optional OriginAttributesDictionary originAttrs,
|
|
|
|
optional OriginAttributesPatternDictionary pattern);
|
2016-01-06 13:08:30 +03:00
|
|
|
|
|
|
|
/**
|
2016-02-18 15:42:00 +03:00
|
|
|
* Returns an OriginAttributesDictionary with all default attributes added
|
|
|
|
* and assigned default values.
|
|
|
|
*
|
|
|
|
* @returns An OriginAttributesDictionary populated with the
|
|
|
|
* default attributes added and assigned default values.
|
|
|
|
*/
|
|
|
|
static OriginAttributesDictionary
|
|
|
|
createDefaultOriginAttributes();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an OriginAttributesDictionary with values from the |origin| suffix
|
|
|
|
* and unspecified attributes added and assigned default values.
|
|
|
|
*
|
|
|
|
* @param origin The origin URI to create from.
|
|
|
|
* @returns An OriginAttributesDictionary with values from
|
|
|
|
* the origin suffix and unspecified attributes
|
|
|
|
* added and assigned default values.
|
2016-01-06 13:08:30 +03:00
|
|
|
*/
|
|
|
|
[Throws]
|
|
|
|
static OriginAttributesDictionary
|
2016-02-18 15:42:00 +03:00
|
|
|
createOriginAttributesFromOrigin(DOMString origin);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an OriginAttributesDictionary that is a copy of |originAttrs| with
|
|
|
|
* unspecified attributes added and assigned default values.
|
|
|
|
*
|
|
|
|
* @param originAttrs The origin attributes to copy.
|
|
|
|
* @returns An OriginAttributesDictionary copy of |originAttrs|
|
|
|
|
* with unspecified attributes added and assigned
|
|
|
|
* default values.
|
|
|
|
*/
|
|
|
|
static OriginAttributesDictionary
|
|
|
|
createOriginAttributesFromDict(optional OriginAttributesDictionary originAttrs);
|
2015-05-28 17:37:42 +03:00
|
|
|
};
|
|
|
|
|
2015-06-03 09:35:09 +03:00
|
|
|
/**
|
|
|
|
* Used by principals and the script security manager to represent origin
|
2015-07-09 21:36:35 +03:00
|
|
|
* attributes. The first dictionary is designed to contain the full set of
|
|
|
|
* OriginAttributes, the second is used for pattern-matching (i.e. does this
|
|
|
|
* OriginAttributesDictionary match the non-empty attributes in this pattern).
|
2015-06-03 09:35:09 +03:00
|
|
|
*
|
2015-07-09 21:36:35 +03:00
|
|
|
* IMPORTANT: If you add any members here, you need to do the following:
|
|
|
|
* (1) Add them to both dictionaries.
|
|
|
|
* (2) Update the methods on mozilla::OriginAttributes, including equality,
|
2015-11-03 04:50:54 +03:00
|
|
|
* serialization, deserialization, and inheritance.
|
2015-07-09 21:36:35 +03:00
|
|
|
* (3) Update the methods on mozilla::OriginAttributesPattern, including matching.
|
2015-06-03 09:35:09 +03:00
|
|
|
*/
|
|
|
|
dictionary OriginAttributesDictionary {
|
|
|
|
unsigned long appId = 0;
|
2015-07-29 00:32:00 +03:00
|
|
|
unsigned long userContextId = 0;
|
2015-06-03 09:35:09 +03:00
|
|
|
boolean inBrowser = false;
|
2015-07-08 01:53:15 +03:00
|
|
|
DOMString addonId = "";
|
2015-09-18 10:11:58 +03:00
|
|
|
DOMString signedPkg = "";
|
2015-06-03 09:35:09 +03:00
|
|
|
};
|
2015-07-09 21:36:35 +03:00
|
|
|
dictionary OriginAttributesPatternDictionary {
|
|
|
|
unsigned long appId;
|
2015-07-29 00:32:00 +03:00
|
|
|
unsigned long userContextId;
|
2015-07-09 21:36:35 +03:00
|
|
|
boolean inBrowser;
|
|
|
|
DOMString addonId;
|
2015-09-18 10:11:58 +03:00
|
|
|
DOMString signedPkg;
|
2015-07-09 21:36:35 +03:00
|
|
|
};
|