mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
86eaa55e65
- Bug 1251999 - [css-grid] Update <fixed-size> parsing to the latest spec. r=dholbert (07f68007b7)
- Bug 1151243 part 5 - [css-grid] Reftests for abs. pos. static-position. (f9a3b24508)
- Bug 1242053 part 1 - [css-grid] Fix parsing / serialization of grid-template subgrid values. r=dholbert (39576c2f6d)
- Bug 1242053 part 2 - [css-grid] Enable subgrid support for tests. r=dholbert (6da4aeb35a)
- Bug 1240956 part 2 - [css-grid] Update tests due to the changed column/row value order for 'grid', 'grid-template' and 'grid-gap' properties. (16d2258d3a)
- Bug 1253529 part 1 - [css-grid] Replace uses of the 'grid-template' shorthand with 'grid'. (f847bfa554)
- Bug 1253529 part 2 - [css-grid] Remove the 'grid-template' shorthand. r=dholbert (d553c2f623)
- Bug 594933 - Part 1: Let calc() supports number. r=dbaron (e4bc39b5f0)
- Bug 594933 - Part 2: Add support for calc() to line-height. r=dbaron (901227bacb)
- Bug 1253189 part 5 - Import reftests of css-values. r=dbaron (4599431827)
- Bug 1253189 part 4 - Add skip.list for skipping imported tests. r=dbaron (014f7ca7de)
- Bug 1253189 part 1 - Make import-tests.py compatible with Windows. r=dbaron (a22c3e4f7f)
- Bug 1253189 part 2 - Update import-tests.py script to work on the current repo. r=dbaron (7535b38b71)
- Bug 1253189 part 3 - Update existing received w3c reftests. r=dbaron (0fa2d6e2de)
- Bug 1253189 followup - Update skip.list to match the directory name on CLOSED TREE (019b55c3c9)
- Bug 968761 - Treat nested calc() as plain parenthesis. r=dbaron (537506f4e5)
- Bug 1248371 - [css-grid] Require that each track has a definite min- or max-sizing function when the track list contains a repeat(auto-fill/fit) track. r=dholbert (330dd37427)
- Bug 1244638 - Part 1:implement AnimationEffectTiming iterationStart. r=birtles, r=smaug (d0217068ac)
- Bug 1244638 - Part 2: Throw TypeError if iterationStart is NaN, negative value or Infinity. r=birtles, r=smaug (f631e261a0)
- Bug 1238845 - Implement UUID helper - dom/bluetooth & dom/webidl & layout/build change. r=jocelyn, r=bz (3ddfa8cccf)
- Bug 1252790 - Remove RuleHashTableOps. r=dbaron. (b52d9e2613)
- Bug 1252375 - Fix up jemalloc stats reporting. r=erahm. (dbecb54598)
- Bug 1249503 - Make WindowsAddressSpaceReporter bloat memory reports less. r=erahm. (3bfb6932cb)
- Bug 1253085 - Remove the |PLDHashTable*| argument from PLDHash{HashKey,MatchEntry}. r=froydnj. (1331fd9ea0)
- Bug 1251127 - Gracefully handle multiple calls to nsMemoryReporterManager::Init(). r=erahm. (c51f57907e)
- Bug 1234540 - verify the validity of hashEntry, if it's null return with NS_ERROR_FAILURE. r=michal (f44bd269db)
- Bug 1112499 - Set up shutdown pipe before new thread starts. r=keeler (73b9a56196)
- Bug 1245059 - Disable NotifyIpInterfaceChange use for now. r=mcmanus (ab11fd8507)
- Bug 1251873 - Store the trimmed referrer URL on HTTP channel if a trimming referrer policy is in effect; r=mcmanus (3f43d5b351)
- more bits of bug 366559 - patch 7, content-encoding brotli for https (f127a97450)
- Bug 1250115 - initialized pollInterval with 0 in order to prevent garbage value if Poll(..) doesn't get called. r=dragana (af55e06789)
- Bug 1251493 - Remove remaining references to MOZILLA_XPCOMRT_API from netwerk. r=mcmanus (43d711d2d6)
- Bug 1242452 - only if PR_GetIdentitiesLayer return valid pointer continue and pass it's result to PR_GetIdentitiesLayer. r=mcmanus (61a2785337)
- Bug 1251595 - Check if mNetAddr is set before sending ipv4/6 telemetry. r=mcmanus (9d081bc0b9)
- Bug 1252755: increase maximum UDP packet size to 9216 bytes for jumbo frames. r=jesup (3d629473ea)
- Bug 1194259: warnings-as-errors bustage fix rs=bustagn a CLOSED TREE (5b8288ff6d)
- Bug 1227781 - Fix crash with bogus STUN parameters. r=bwc (7d132a37ff)
- Bug 1231196: Fix init of PeerConnectionImpl::mThread for unit-tests and similar. r+drno (60f11ed191)
- Bug 1230184 - plumb setParameters down to JsepTrack. r=bwc, r=mrbkap (fdeaafb737)
- Bug 1231507 - Part 1: selectSsrc chrome-only API for SSRC-based filtering of receive tracks. r=drno, r=smaug (c24ce1a76e)
- Bug 1221837 - Accept hard coded codec numbers without rtpmaps. r=bwc (89b81c861c)
- Bug 1231507 - Part 2: added mochitest SimulCast offer test case r=jib (05d838960f)
- Bug 1230184 - setParameters webidl. r=smaug (6319cdfca7)
- Bug 1230184 - add input parameter validation to setParameters. r=bwc (c0740c142a)
- Bug 1230184 - add media.peerconnection.simulcast pref. r=bwc (99b1a4978d)
- Bug 1247619 - add console warning about OAuth for STUN not yet supported. r=jesup,smaug (801eaa66e1)
- Bug 1241153: Stop blocking addTrack on GMP init, and update codecs on existing tracks when GMP init finishes. r=jesup (3473dfe0ce)
- Bug 1251737 - Remove remaining references to MOZILLA_XPCOMRT_API from media. r=jesup (7b32d9d191)
- Bug 1218326: Prevent datachannel operations on closed PeerConnections. r=jesup a=lizzard (5d20d7dd7f)
- Bug 1211091 - use upper boundary for streams per data channel. r=bwc (7f9462c434)
- Bug 1188391 - separate immediate ICE failures from failures after checking. r=bwc, r=vladan (9095c58656)
- Bug 1227708 - Differentiate ICE_SUCCESS_RATE telemetry for loop vs webrtc r=jesup (399406c872)
- Bug 1232082 - fix removal of remote tracks to update receivers. r=jesup (81998ed355)
- Bug 1244913 - Add test_peerConnection_scaleResolution.html r=bwc,jesup (8ac2d8a363)
- Bug 1249860 - Add simulcast test for resolution scaling. r=bwc (c7753bf02b)
- Bug 1247622 - Make RTCRtpSender.setParameters return a promise. r=jesup,smaug (4c2504adc8)
235 lines
6.7 KiB
C++
235 lines
6.7 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* 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 "mozilla/dom/bluetooth/BluetoothCommon.h"
|
|
#include "mozilla/dom/bluetooth/BluetoothGattUUIDName.h"
|
|
#include "mozilla/dom/BluetoothUUID.h"
|
|
#include "mozilla/dom/UnionTypes.h" /* StringOrUnsignedLong */
|
|
|
|
|
|
using namespace mozilla;
|
|
using namespace mozilla::dom;
|
|
|
|
bool BluetoothUUID::sInShutdown = false;
|
|
// static
|
|
nsDataHashtable<nsStringHashKey, uint32_t>*
|
|
BluetoothUUID::sUUIDServiceTable;
|
|
// static
|
|
nsDataHashtable<nsStringHashKey, uint32_t>*
|
|
BluetoothUUID::sUUIDCharacteristicTable;
|
|
// static
|
|
nsDataHashtable<nsStringHashKey, uint32_t>*
|
|
BluetoothUUID::sUUIDDescriptorTable;
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(BluetoothUUID, mOwner)
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(BluetoothUUID)
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(BluetoothUUID)
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BluetoothUUID)
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
NS_INTERFACE_MAP_END
|
|
|
|
BluetoothUUID::BluetoothUUID(nsPIDOMWindowInner* aOwner)
|
|
: mOwner(aOwner)
|
|
{
|
|
MOZ_ASSERT(aOwner);
|
|
}
|
|
|
|
BluetoothUUID::~BluetoothUUID()
|
|
{
|
|
}
|
|
|
|
JSObject*
|
|
BluetoothUUID::WrapObject(JSContext* aCx,
|
|
JS::Handle<JSObject*> aGivenProto)
|
|
{
|
|
return BluetoothUUIDBinding::Wrap(aCx, this, aGivenProto);
|
|
}
|
|
|
|
//static
|
|
void BluetoothUUID::HandleShutdown()
|
|
{
|
|
sInShutdown = true;
|
|
delete sUUIDServiceTable;
|
|
delete sUUIDCharacteristicTable;
|
|
delete sUUIDDescriptorTable;
|
|
sUUIDServiceTable = nullptr;
|
|
sUUIDCharacteristicTable = nullptr;
|
|
sUUIDDescriptorTable = nullptr;
|
|
}
|
|
|
|
// static
|
|
void
|
|
BluetoothUUID::InitServiceTable()
|
|
{
|
|
size_t length = sizeof(ServiceTable) / sizeof(BluetoothGattUUIDName);
|
|
for (size_t i = 0; i < length; ++i) {
|
|
sUUIDServiceTable->Put(NS_ConvertUTF8toUTF16(ServiceTable[i].name),
|
|
ServiceTable[i].uuid);
|
|
}
|
|
}
|
|
|
|
// static
|
|
void
|
|
BluetoothUUID::InitCharacteristicTable()
|
|
{
|
|
size_t length = sizeof(CharacteristicTable) / sizeof(BluetoothGattUUIDName);
|
|
for (size_t i = 0; i < length; ++i) {
|
|
sUUIDCharacteristicTable->Put(NS_ConvertUTF8toUTF16(
|
|
CharacteristicTable[i].name),
|
|
CharacteristicTable[i].uuid);
|
|
}
|
|
}
|
|
|
|
// static
|
|
void
|
|
BluetoothUUID::InitDescriptorTable()
|
|
{
|
|
size_t length = sizeof(DescriptorTable) / sizeof(BluetoothGattUUIDName);
|
|
for (size_t i = 0; i < length; ++i) {
|
|
sUUIDDescriptorTable->Put(NS_ConvertUTF8toUTF16(DescriptorTable[i].name),
|
|
DescriptorTable[i].uuid);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Check whether the UUID(aString) is valid or not
|
|
*/
|
|
bool IsValidUUID(const nsAString& aString)
|
|
{
|
|
size_t length = aString.Length();
|
|
if (length != 36) {
|
|
return false;
|
|
}
|
|
|
|
const char16_t* uuid = aString.BeginReading();
|
|
|
|
for (size_t i = 0; i < length; ++i) {
|
|
if (i == 8 || i == 13 || i == 18 || i == 23) {
|
|
if (uuid[i] != '-') {
|
|
return false;
|
|
}
|
|
} else if ((uuid[i] < '0' || uuid[i] > '9') &&
|
|
(uuid[i] < 'a' || uuid[i] > 'f')) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
// static
|
|
void
|
|
BluetoothUUID::ResolveUUIDName(const GlobalObject& aGlobal,
|
|
const StringOrUnsignedLong& aName,
|
|
GattAttribute aAttr, nsAString& aReturn,
|
|
ErrorResult& aRv)
|
|
{
|
|
aReturn.Truncate();
|
|
|
|
if (aName.IsUnsignedLong()) {
|
|
// aName is a 16-bit or 32-bit UUID alias.
|
|
CanonicalUUID(aGlobal, aName.GetAsUnsignedLong(), aReturn);
|
|
} else if (aName.IsString()) {
|
|
uint32_t alias = 0;
|
|
nsString aString(aName.GetAsString());
|
|
|
|
if (IsValidUUID(aString)) {
|
|
// aName is a valid UUID String.
|
|
aReturn.Assign(aString);
|
|
} else if (GetTable(aAttr, aString, alias)) {
|
|
// The UUID string can be mapped to a known UUID alias.
|
|
CanonicalUUID(aGlobal, alias, aReturn);
|
|
} else {
|
|
// Exception, Syntax error, assign aReturn the error message
|
|
aRv.ThrowDOMException(NS_ERROR_DOM_SYNTAX_ERR,
|
|
NS_LITERAL_CSTRING("Invalid name: It can be a"
|
|
" 32-bit UUID alias, 128-bit valid UUID "
|
|
"(lower-case hex characters) or known "
|
|
"Service/Characteristic/Descriptor name."));
|
|
|
|
return ;
|
|
}
|
|
} else {
|
|
MOZ_ASSERT(false, "Invalid name: It can be a 32-bit UUID alias, 128-bit "
|
|
"valid UUID (lower-case hex characters) or known "
|
|
"Service/Characteristic/Descriptor name.");
|
|
}
|
|
}
|
|
|
|
// static
|
|
bool
|
|
BluetoothUUID::GetTable(GattAttribute aAttr, const nsAString& aString,
|
|
uint32_t& aAlias)
|
|
{
|
|
// If we're in shutdown, don't create a new instance.
|
|
NS_ENSURE_FALSE(sInShutdown, false);
|
|
|
|
nsDataHashtable<nsStringHashKey, uint32_t>** tableSlot;
|
|
|
|
if (aAttr == SERVICE) {
|
|
tableSlot = &sUUIDServiceTable;
|
|
} else if (aAttr == CHARACTERISTIC) {
|
|
tableSlot = &sUUIDCharacteristicTable;
|
|
} else if (aAttr == DESCRIPTOR) {
|
|
tableSlot = &sUUIDDescriptorTable;
|
|
}
|
|
|
|
if (!*tableSlot) {
|
|
(*tableSlot) = new nsDataHashtable<nsStringHashKey, uint32_t>;
|
|
if (aAttr == SERVICE) {
|
|
InitServiceTable();
|
|
} else if (aAttr == CHARACTERISTIC) {
|
|
InitCharacteristicTable();
|
|
} else if (aAttr == DESCRIPTOR) {
|
|
InitDescriptorTable();
|
|
}
|
|
}
|
|
|
|
return (*tableSlot)->Get(aString, &aAlias);
|
|
}
|
|
|
|
// static
|
|
void
|
|
BluetoothUUID::GetService(const GlobalObject& aGlobal,
|
|
const StringOrUnsignedLong& aName,
|
|
nsAString& aReturn, ErrorResult& aRv)
|
|
{
|
|
ResolveUUIDName(aGlobal, aName, SERVICE, aReturn, aRv);
|
|
}
|
|
|
|
// static
|
|
void
|
|
BluetoothUUID::GetCharacteristic(const GlobalObject& aGlobal,
|
|
const StringOrUnsignedLong& aName,
|
|
nsAString& aReturn, ErrorResult& aRv)
|
|
{
|
|
ResolveUUIDName(aGlobal, aName, CHARACTERISTIC, aReturn, aRv);
|
|
}
|
|
|
|
// static
|
|
void
|
|
BluetoothUUID::GetDescriptor(const GlobalObject& aGlobal,
|
|
const StringOrUnsignedLong& aName,
|
|
nsAString& aReturn, ErrorResult& aRv)
|
|
{
|
|
ResolveUUIDName(aGlobal, aName, DESCRIPTOR, aReturn, aRv);
|
|
}
|
|
|
|
// static
|
|
void
|
|
BluetoothUUID::CanonicalUUID(const GlobalObject& aGlobal, uint32_t aAlias,
|
|
nsAString& aReturn)
|
|
{
|
|
char uuidStr[37];
|
|
|
|
// Convert to 128-bit UUID: alias + "-0000-1000-8000-00805f9b34fb".
|
|
snprintf(uuidStr, sizeof(uuidStr), "%.8x-0000-1000-8000-00805f9b34fb",
|
|
aAlias);
|
|
|
|
aReturn.AssignLiteral(uuidStr);
|
|
}
|