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