2015-06-17 18:12:23 +00:00
|
|
|
/* -*- Mode: C++; 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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_ChromeUtils__
|
|
|
|
#define mozilla_dom_ChromeUtils__
|
|
|
|
|
|
|
|
#include "mozilla/AlreadyAddRefed.h"
|
|
|
|
#include "mozilla/dom/BindingDeclarations.h"
|
|
|
|
#include "mozilla/dom/ChromeUtilsBinding.h"
|
|
|
|
#include "mozilla/dom/ThreadSafeChromeUtilsBinding.h"
|
|
|
|
#include "mozilla/ErrorResult.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
namespace devtools {
|
|
|
|
class HeapSnapshot;
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace devtools
|
2015-06-17 18:12:23 +00:00
|
|
|
|
|
|
|
namespace dom {
|
|
|
|
|
2016-03-22 19:09:04 +00:00
|
|
|
class ArrayBufferViewOrArrayBuffer;
|
|
|
|
|
2015-06-17 18:12:23 +00:00
|
|
|
class ThreadSafeChromeUtils
|
|
|
|
{
|
|
|
|
public:
|
2015-09-21 17:07:31 +00:00
|
|
|
// Implemented in devtools/shared/heapsnapshot/HeapSnapshot.cpp
|
2015-06-17 18:12:23 +00:00
|
|
|
static void SaveHeapSnapshot(GlobalObject& global,
|
|
|
|
const HeapSnapshotBoundaries& boundaries,
|
2015-09-15 05:56:46 +00:00
|
|
|
nsAString& filePath,
|
2015-06-17 18:12:23 +00:00
|
|
|
ErrorResult& rv);
|
|
|
|
|
2015-09-21 17:07:31 +00:00
|
|
|
// Implemented in devtools/shared/heapsnapshot/HeapSnapshot.cpp
|
2015-06-17 18:12:23 +00:00
|
|
|
static already_AddRefed<devtools::HeapSnapshot> ReadHeapSnapshot(GlobalObject& global,
|
|
|
|
const nsAString& filePath,
|
|
|
|
ErrorResult& rv);
|
2015-11-11 11:55:00 +00:00
|
|
|
|
|
|
|
static void NondeterministicGetWeakMapKeys(GlobalObject& aGlobal,
|
|
|
|
JS::Handle<JS::Value> aMap,
|
|
|
|
JS::MutableHandle<JS::Value> aRetval,
|
|
|
|
ErrorResult& aRv);
|
2015-11-16 14:50:00 +00:00
|
|
|
|
|
|
|
static void NondeterministicGetWeakSetKeys(GlobalObject& aGlobal,
|
|
|
|
JS::Handle<JS::Value> aSet,
|
|
|
|
JS::MutableHandle<JS::Value> aRetval,
|
|
|
|
ErrorResult& aRv);
|
2016-03-22 19:09:04 +00:00
|
|
|
|
|
|
|
static void Base64URLEncode(GlobalObject& aGlobal,
|
|
|
|
const ArrayBufferViewOrArrayBuffer& aSource,
|
|
|
|
const Base64URLEncodeOptions& aOptions,
|
|
|
|
nsACString& aResult,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
|
|
|
static void Base64URLDecode(GlobalObject& aGlobal,
|
|
|
|
const nsACString& aString,
|
|
|
|
const Base64URLDecodeOptions& aOptions,
|
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
|
|
|
ErrorResult& aRv);
|
2015-06-17 18:12:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ChromeUtils : public ThreadSafeChromeUtils
|
|
|
|
{
|
|
|
|
public:
|
2015-06-24 20:34:54 +00:00
|
|
|
static void
|
2016-02-25 15:41:13 +00:00
|
|
|
OriginAttributesToSuffix(GlobalObject& aGlobal,
|
2015-06-24 20:34:54 +00:00
|
|
|
const dom::OriginAttributesDictionary& aAttrs,
|
|
|
|
nsCString& aSuffix);
|
2015-07-09 18:36:35 +00:00
|
|
|
|
|
|
|
static bool
|
|
|
|
OriginAttributesMatchPattern(dom::GlobalObject& aGlobal,
|
|
|
|
const dom::OriginAttributesDictionary& aAttrs,
|
|
|
|
const dom::OriginAttributesPatternDictionary& aPattern);
|
2016-01-06 10:08:30 +00:00
|
|
|
|
2016-02-29 11:26:00 +00:00
|
|
|
static void
|
|
|
|
CreateOriginAttributesFromOrigin(dom::GlobalObject& aGlobal,
|
|
|
|
const nsAString& aOrigin,
|
|
|
|
dom::OriginAttributesDictionary& aAttrs,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
|
|
|
static void
|
2016-04-04 10:20:00 +00:00
|
|
|
FillNonDefaultOriginAttributes(dom::GlobalObject& aGlobal,
|
2016-02-29 11:26:00 +00:00
|
|
|
const dom::OriginAttributesDictionary& aAttrs,
|
|
|
|
dom::OriginAttributesDictionary& aNewAttrs);
|
2016-02-25 15:41:13 +00:00
|
|
|
|
|
|
|
static bool
|
|
|
|
IsOriginAttributesEqual(dom::GlobalObject& aGlobal,
|
|
|
|
const dom::OriginAttributesDictionary& aA,
|
|
|
|
const dom::OriginAttributesDictionary& aB);
|
2016-06-07 17:59:22 +00:00
|
|
|
|
|
|
|
static bool
|
|
|
|
IsOriginAttributesEqualIgnoringAddonId(const dom::OriginAttributesDictionary& aA,
|
|
|
|
const dom::OriginAttributesDictionary& aB);
|
2015-06-17 18:12:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_ChromeUtils__
|