mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
1311ec4a42
- Bug 1162692 - Add SpeechSynthesisUtterance.chosenVoiceURI for testing purposes. r=smaug (aa30ec93c) - Bug 1160844 - Only initialize pico tts when not in mochitest and speech synth is enabled. r=smaug (5d00c71e4) - Bug 1167539 - Replace use of NS_ENSURE_* with NS_WARN_IF in dom//webspeech/synth/*. r=smaugmedia (10cb826f8) - Bug 903135 - Multi platform MAR verification build config. r=rstrong (8022418a3) - Bug 1144512 - Add b2g build support for API level 22. r=mwu (a1f9bf473) - Bug 1115480 - Part 1: Implement XPCOM module for mDNSProvider. r=mcmanus (9e2b49f1a) - Bug 1115480 - Part 2: Implement mDNS device provider. r=schien (22ca5283f) - Bug 1115480 - Re-add metadata to the dom/presentation xpcshell.ini that shouldn't have been removed. (e6a5b401e) - Bug 1058551 - Support redirects to data: URIs. r=honza (2ff31ce33) - fix build (b48590cd0) - Bug 1163859: Only update webrtc.debug prefs from gecko thread. r=rjesup (ac0f18cb1) - Bug 1145354: Add SingletonThreadHolder for media/mtransport, and use it for mtransport IPC IO r=bwc (1106b13b5) - Bug 1117586, [e10s] select dropdowns cannot be opened with the keyboard, r=roc (bbf8b8842) - Bug 1152290 - "[e10s] "<select>" doesn't show selected value". r=roc (2a130ec4f) - Bug 1147967 - Remove CreateStackFrameLocation. r=bholley (9ea0b73e0) - Bug 958641 - De-holder nsIXPConnect::WrapNative. r=gabor (c5fe0ee54) - Bug 1142999 - Remove gcc warning about unused typedef. r=ehoogeveen (e0103e01a) - Bug 1145015 - Part 1: Remove IsValidKey() check in MagicGrallocBufferHandle serializer. r=sotaro, r=nical (bb470de06) - Bug 1145015 - Part 2: Add more checking rules for GrallocBuffer allocation. r=sotaro, r=nical (05398af8d) - Bug 1130096 - Convert embedding/components/windowwatcher/ to Gecko style. r=mccr8 (554041661) - Bug 1164977 - Prevent MediaStreamAudioSourceNode from passing null to nsIPrincipal::subsumes. r=padenot (5f95a8ab9) - Bug 1164292 followup: Add 'override' annotations to BasePrincipal & nsSystemPrincipal GetCsp()/SetCsp() methods. rs=ehsan (76e5d2013) - Bug 1164977 - Hoist all the app attribute handling into BasePrincipal. r=gabor (e99bb5617) - Bug 1172483 - Remove erroneous assert. (r=Waldo) (70ce92c09) - Bug 1164977 - Unify subsumes/equals logic on BasePrincipal and reduce duplicated code. r=gabor (4dbf31b45) - Bug 1140472 - Set an async stack when invoking promise handlers. r=bz (f12a5c9f6) - Bug 1164977 - Hoist app attributes into a struct on BasePrincipal and refer to them as 'origin attributes'. r=gabor (85eb810f2) - Bug 1164977 - Hoist attribute serialization into BasePrincipal. r=gabor (ff51a67d1) - Bug 1158133 - Add a way to disable async stacks, and disable by default on mobile platforms. r=bent,jimb (c4954752e) - Bug 1171177 - Remove VAROBJFIX. (r=luke) (5707455e6) - Bug 1165162 - Make requestsync test failures more useful. rpending=baku (5c0a79f07) - Bug 1139254 - Use MockRegistrar in services. r=gps (da61a6fad) - Bug 1165162 - Fix up test_manager.js to use real principals. rpending=ferjm (797ffb5ce) - Bug 1165162 - Stop recreating principals from the message manager. r=smaug (5f5241a6e) - pointer style (c0da0f1a9) - fix some misspatch (e209af9a6) - Bug 1165486 - Replace the PlainObj varobj with NonSyntacticVariablesObject. (r=luke) (2179cf860) - Bug 1171177 - Remove UNQUALIFIED_VAROBJ Shape flags in favor of Class-checking. (r=luke) (93391d13f) - Bug 1165162 - Make OriginAttributes a dictionary, and make it accessible as both a jsval and a canonical string. r=gabor,r=bholley,sr=sicking (0731b0caf)
138 lines
3.4 KiB
C++
138 lines
3.4 KiB
C++
/* 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 "PlaceInfo.h"
|
|
#include "VisitInfo.h"
|
|
#include "nsIURI.h"
|
|
#include "nsServiceManagerUtils.h"
|
|
#include "nsIXPConnect.h"
|
|
#include "mozilla/Services.h"
|
|
#include "jsapi.h"
|
|
|
|
namespace mozilla {
|
|
namespace places {
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
//// PlaceInfo
|
|
|
|
PlaceInfo::PlaceInfo(int64_t aId,
|
|
const nsCString& aGUID,
|
|
already_AddRefed<nsIURI> aURI,
|
|
const nsString& aTitle,
|
|
int64_t aFrecency)
|
|
: mId(aId)
|
|
, mGUID(aGUID)
|
|
, mURI(aURI)
|
|
, mTitle(aTitle)
|
|
, mFrecency(aFrecency)
|
|
, mVisitsAvailable(false)
|
|
{
|
|
NS_PRECONDITION(mURI, "Must provide a non-null uri!");
|
|
}
|
|
|
|
PlaceInfo::PlaceInfo(int64_t aId,
|
|
const nsCString& aGUID,
|
|
already_AddRefed<nsIURI> aURI,
|
|
const nsString& aTitle,
|
|
int64_t aFrecency,
|
|
const VisitsArray& aVisits)
|
|
: mId(aId)
|
|
, mGUID(aGUID)
|
|
, mURI(aURI)
|
|
, mTitle(aTitle)
|
|
, mFrecency(aFrecency)
|
|
, mVisits(aVisits)
|
|
, mVisitsAvailable(true)
|
|
{
|
|
NS_PRECONDITION(mURI, "Must provide a non-null uri!");
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
//// mozIPlaceInfo
|
|
|
|
NS_IMETHODIMP
|
|
PlaceInfo::GetPlaceId(int64_t* _placeId)
|
|
{
|
|
*_placeId = mId;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
PlaceInfo::GetGuid(nsACString& _guid)
|
|
{
|
|
_guid = mGUID;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
PlaceInfo::GetUri(nsIURI** _uri)
|
|
{
|
|
NS_ADDREF(*_uri = mURI);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
PlaceInfo::GetTitle(nsAString& _title)
|
|
{
|
|
_title = mTitle;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
PlaceInfo::GetFrecency(int64_t* _frecency)
|
|
{
|
|
*_frecency = mFrecency;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
PlaceInfo::GetVisits(JSContext* aContext,
|
|
JS::MutableHandle<JS::Value> _visits)
|
|
{
|
|
// If the visits data was not provided, return null rather
|
|
// than an empty array to distinguish this case from the case
|
|
// of a place without any visit.
|
|
if (!mVisitsAvailable) {
|
|
_visits.setNull();
|
|
return NS_OK;
|
|
}
|
|
|
|
// TODO bug 625913 when we use this in situations that have more than one
|
|
// visit here, we will likely want to make this cache the value.
|
|
JS::Rooted<JSObject*> visits(aContext,
|
|
JS_NewArrayObject(aContext, 0));
|
|
NS_ENSURE_TRUE(visits, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
JS::Rooted<JSObject*> global(aContext, JS::CurrentGlobalOrNull(aContext));
|
|
NS_ENSURE_TRUE(global, NS_ERROR_UNEXPECTED);
|
|
|
|
nsCOMPtr<nsIXPConnect> xpc = mozilla::services::GetXPConnect();
|
|
|
|
for (VisitsArray::size_type idx = 0; idx < mVisits.Length(); idx++) {
|
|
JS::RootedObject jsobj(aContext);
|
|
nsresult rv = xpc->WrapNative(aContext, global, mVisits[idx],
|
|
NS_GET_IID(mozIVisitInfo),
|
|
jsobj.address());
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
NS_ENSURE_STATE(jsobj);
|
|
|
|
bool rc = JS_DefineElement(aContext, visits, idx, jsobj, JSPROP_ENUMERATE);
|
|
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
|
|
}
|
|
|
|
_visits.setObject(*visits);
|
|
return NS_OK;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
//// nsISupports
|
|
|
|
NS_IMPL_ISUPPORTS(
|
|
PlaceInfo
|
|
, mozIPlaceInfo
|
|
)
|
|
|
|
} // namespace places
|
|
} // namespace mozilla
|