mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Merge inbound to m-c. a=merge
This commit is contained in:
commit
8f6f16604c
@ -1134,3 +1134,6 @@ pref("dom.activities.developer_mode_only", "import-app");
|
||||
// mulet apparently loads firefox.js as well as b2g.js, so we have to explicitly
|
||||
// disable serviceworkers here to get them disabled in mulet.
|
||||
pref("dom.serviceWorkers.enabled", false);
|
||||
|
||||
// Retain at most 10 processes' layers buffers
|
||||
pref("layers.compositor-lru-size", 10);
|
||||
|
@ -11,6 +11,6 @@ pocket-button.tooltiptext = Bei Pocket speichern
|
||||
# From browser-pocket.dtd
|
||||
saveToPocketCmd.label = Seite bei Pocket speichern
|
||||
saveToPocketCmd.accesskey = k
|
||||
saveLinkToPocketCmd.label = Link in Pocket speichern
|
||||
saveLinkToPocketCmd.label = Link bei Pocket speichern
|
||||
saveLinkToPocketCmd.accesskey = o
|
||||
pocketMenuitem.label = Pocket-Liste anzeigen
|
||||
|
@ -12,5 +12,5 @@ pocket-button.tooltiptext = Сохранить в Pocket
|
||||
saveToPocketCmd.label = Сохранить страницу в Pocket
|
||||
saveToPocketCmd.accesskey = х
|
||||
saveLinkToPocketCmd.label = Сохранить ссылку в Pocket
|
||||
saveLinkToPocketCmd.accesskey = P
|
||||
saveLinkToPocketCmd.accesskey = а
|
||||
pocketMenuitem.label = Показать список Pocket
|
||||
|
7
browser/base/content/gcli_sec_bad.svg
Normal file
7
browser/base/content/gcli_sec_bad.svg
Normal file
@ -0,0 +1,7 @@
|
||||
<svg width="30" height="30" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="15" cy="15" r="15" fill="#e74c3c"/>
|
||||
<g stroke="white" stroke-width="3">
|
||||
<line x1="9" y1="9" x2="21" y2="21"/>
|
||||
<line x1="21" y1="9" x2="9" y2="21"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 249 B |
4
browser/base/content/gcli_sec_good.svg
Normal file
4
browser/base/content/gcli_sec_good.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<svg width="30" height="30" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60">
|
||||
<circle cx="30" cy="30" r="30" fill="#2CBB0F"/>
|
||||
<polygon points="17,32 25,39 26,39 44,18 45,18 48,21 27,46 25,46 14,36 13,36 16,33 16,32" fill="white"/>
|
||||
</svg>
|
After Width: | Height: | Size: 247 B |
4
browser/base/content/gcli_sec_moderate.svg
Normal file
4
browser/base/content/gcli_sec_moderate.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<svg width="30" height="30" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="15" cy="15" r="15" fill="#F5B400"/>
|
||||
<rect x="7.5" y="13" width="15" height="4" fill="white"/>
|
||||
</svg>
|
After Width: | Height: | Size: 180 B |
@ -107,6 +107,9 @@ browser.jar:
|
||||
content/browser/defaultthemes/5.preview.jpg (content/defaultthemes/5.preview.jpg)
|
||||
content/browser/defaultthemes/devedition.header.png (content/defaultthemes/devedition.header.png)
|
||||
content/browser/defaultthemes/devedition.icon.png (content/defaultthemes/devedition.icon.png)
|
||||
content/browser/gcli_sec_bad.svg (content/gcli_sec_bad.svg)
|
||||
content/browser/gcli_sec_good.svg (content/gcli_sec_good.svg)
|
||||
content/browser/gcli_sec_moderate.svg (content/gcli_sec_moderate.svg)
|
||||
content/browser/newtab/newTab.xul (content/newtab/newTab.xul)
|
||||
* content/browser/newtab/newTab.js (content/newtab/newTab.js)
|
||||
content/browser/newtab/newTab.css (content/newtab/newTab.css)
|
||||
|
@ -35,11 +35,11 @@ Translations.de =
|
||||
addtags: "Tags hinzufügen",
|
||||
alreadyhaveacct: "Sind Sie bereits Pocket-Nutzer?",
|
||||
continueff: "Mit Firefox fortfahren",
|
||||
errorgeneric: "Beim Speichern des Links in Pocket ist ein Problem aufgetreten.",
|
||||
errorgeneric: "Beim Speichern des Links bei Pocket ist ein Fehler aufgetreten.",
|
||||
learnmore: "Mehr erfahren",
|
||||
loginnow: "Anmelden",
|
||||
maxtaglength: "Tags dürfen höchsten 25 Zeichen lang sein.",
|
||||
mustbeconnected: "Bitte versichere dich, dass du mit dem Internet verbunden bist.",
|
||||
mustbeconnected: "Bitte überprüfen Sie, ob Sie mit dem Internet verbunden sind.",
|
||||
onlylinkssaved: "Es können nur Links gespeichert werden",
|
||||
pagenotsaved: "Seite nicht gespeichert",
|
||||
pageremoved: "Seite entfernt",
|
||||
@ -48,7 +48,7 @@ Translations.de =
|
||||
processingtags: "Tags werden hinzugefügt…",
|
||||
removepage: "Seite entfernen",
|
||||
save: "Speichern",
|
||||
saving: "Speichern...",
|
||||
saving: "Speichern…",
|
||||
signupemail: "Mit E-Mail registrieren",
|
||||
signuptosave: "Registrieren Sie sich bei Pocket. Das ist kostenlos.",
|
||||
suggestedtags: "Vorgeschlagene Tags",
|
||||
@ -70,7 +70,7 @@ Translations.es =
|
||||
learnmore: "Saber más",
|
||||
loginnow: "Iniciar sesión",
|
||||
maxtaglength: "Las etiquetas están limitadas a 25 caracteres.",
|
||||
mustbeconnected: "Comprueba que tienes conexión a Internet.",
|
||||
mustbeconnected: "Compruebe que tiene conexión a Internet.",
|
||||
onlylinkssaved: "Solo se pueden guardar enlaces",
|
||||
pagenotsaved: "Página no guardada",
|
||||
pageremoved: "Página eliminada",
|
||||
@ -101,7 +101,7 @@ Translations.ja =
|
||||
learnmore: "詳細",
|
||||
loginnow: "ログイン",
|
||||
maxtaglength: "タグは 25 文字までです。",
|
||||
mustbeconnected: "インターネットに接続されていることをご確認ください。",
|
||||
mustbeconnected: "インターネットに接続されていることを確認してください。",
|
||||
onlylinkssaved: "リンクのみ保存できます",
|
||||
pagenotsaved: "ページを保存できませんでした",
|
||||
pageremoved: "ページを削除しました",
|
||||
@ -114,9 +114,9 @@ Translations.ja =
|
||||
signupemail: "メールでアカウント登録",
|
||||
signuptosave: "Pocket にアカウント登録してください。無料です。",
|
||||
suggestedtags: "タグ候補",
|
||||
tagline: "Pocket でいつでもどこでも見れるよう、Firefox から記事や動画を保存できます。",
|
||||
tagline: "Pocket でいつでもどこでも見られるよう、Firefox から記事や動画を保存できます。",
|
||||
taglinestory_one: "Firefox から記事や動画やページを保存するには、Pocket ボタンをクリックしてください。",
|
||||
taglinestory_two: "Pocket でいつでもどこでも見れます。",
|
||||
taglinestory_two: "Pocket でいつでもどこでも見られます。",
|
||||
tagssaved: "タグを追加しました",
|
||||
signinfirefox: "Firefox でログイン",
|
||||
signupfirefox: "Firefox でアカウント登録",
|
||||
@ -152,4 +152,4 @@ Translations.ru =
|
||||
signinfirefox: "Войти через Firefox",
|
||||
signupfirefox: "Регистрация через Firefox",
|
||||
viewlist: "Просмотреть список"
|
||||
};
|
||||
};
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsIObjectInputStream.h"
|
||||
#include "nsIObjectOutputStream.h"
|
||||
|
||||
@ -14,6 +15,7 @@
|
||||
#include "nsNullPrincipal.h"
|
||||
#include "nsScriptSecurityManager.h"
|
||||
|
||||
#include "mozilla/dom/CSPDictionariesBinding.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -128,6 +130,19 @@ BasePrincipal::SetCsp(nsIContentSecurityPolicy* aCsp)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BasePrincipal::GetCspJSON(nsAString& outCSPinJSON)
|
||||
{
|
||||
outCSPinJSON.Truncate();
|
||||
dom::CSPPolicies jsonPolicies;
|
||||
|
||||
if (!mCSP) {
|
||||
jsonPolicies.ToJSON(outCSPinJSON);
|
||||
return NS_OK;
|
||||
}
|
||||
return mCSP->ToJSON(outCSPinJSON);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BasePrincipal::GetIsNullPrincipal(bool* aIsNullPrincipal)
|
||||
{
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
NS_IMETHOD SubsumesConsideringDomain(nsIPrincipal* other, bool* _retval) final;
|
||||
NS_IMETHOD GetCsp(nsIContentSecurityPolicy** aCsp) override;
|
||||
NS_IMETHOD SetCsp(nsIContentSecurityPolicy* aCsp) override;
|
||||
NS_IMETHOD GetCspJSON(nsAString& outCSPinJSON) override;
|
||||
NS_IMETHOD GetIsNullPrincipal(bool* aIsNullPrincipal) override;
|
||||
NS_IMETHOD GetJarPrefix(nsACString& aJarPrefix) final;
|
||||
NS_IMETHOD GetOriginAttributes(JSContext* aCx, JS::MutableHandle<JS::Value> aVal) final;
|
||||
|
@ -20,7 +20,7 @@ interface nsIContentSecurityPolicy;
|
||||
[ptr] native JSPrincipals(JSPrincipals);
|
||||
[ptr] native PrincipalArray(nsTArray<nsCOMPtr<nsIPrincipal> >);
|
||||
|
||||
[scriptable, builtinclass, uuid(749f21f5-8ade-4d0b-a590-2b1d18e890d5)]
|
||||
[scriptable, builtinclass, uuid(49c2faf0-b6de-4640-8d0f-e0217baa8627)]
|
||||
interface nsIPrincipal : nsISerializable
|
||||
{
|
||||
/**
|
||||
@ -133,6 +133,13 @@ interface nsIPrincipal : nsISerializable
|
||||
*/
|
||||
[noscript] attribute nsIContentSecurityPolicy csp;
|
||||
|
||||
/**
|
||||
* The CSP of the principal in JSON notation.
|
||||
* Note, that the CSP itself is not exposed to JS, but script
|
||||
* should be able to obtain a JSON representation of the CSP.
|
||||
*/
|
||||
readonly attribute AString cspJSON;
|
||||
|
||||
/**
|
||||
* Returns the jar prefix of the principal.
|
||||
* The jar prefix is a string that can be used to isolate data or
|
||||
|
@ -2659,7 +2659,7 @@ if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then
|
||||
AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
|
||||
case "$OS_TARGET" in
|
||||
Darwin)
|
||||
VISIBILITY_FLAGS='-fvisibility=hidden'
|
||||
VISIBILITY_FLAGS='-fvisibility=hidden -fvisibility-inlines-hidden'
|
||||
;;
|
||||
*)
|
||||
VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden.h'
|
||||
|
@ -926,7 +926,7 @@ nsDocShell::nsDocShell()
|
||||
gDocShellLeakLog = PR_NewLogModule("nsDocShellLeak");
|
||||
}
|
||||
if (gDocShellLeakLog) {
|
||||
PR_LOG(gDocShellLeakLog, PR_LOG_DEBUG, ("DOCSHELL %p created\n", this));
|
||||
MOZ_LOG(gDocShellLeakLog, PR_LOG_DEBUG, ("DOCSHELL %p created\n", this));
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -958,7 +958,7 @@ nsDocShell::~nsDocShell()
|
||||
}
|
||||
|
||||
if (gDocShellLeakLog) {
|
||||
PR_LOG(gDocShellLeakLog, PR_LOG_DEBUG, ("DOCSHELL %p destroyed\n", this));
|
||||
MOZ_LOG(gDocShellLeakLog, PR_LOG_DEBUG, ("DOCSHELL %p destroyed\n", this));
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -1095,7 +1095,7 @@ nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
PR_LOG(gDocShellLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gDocShellLog, PR_LOG_DEBUG,
|
||||
("nsDocShell[%p]: returning app cache container %p",
|
||||
this, domDoc.get()));
|
||||
#endif
|
||||
@ -1421,7 +1421,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
|
||||
if (PR_LOG_TEST(gDocShellLog, PR_LOG_DEBUG)) {
|
||||
nsAutoCString uristr;
|
||||
aURI->GetAsciiSpec(uristr);
|
||||
PR_LOG(gDocShellLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gDocShellLog, PR_LOG_DEBUG,
|
||||
("nsDocShell[%p]: loading %s with flags 0x%08x",
|
||||
this, uristr.get(), aLoadFlags));
|
||||
}
|
||||
@ -1540,7 +1540,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
|
||||
|
||||
if (shEntry) {
|
||||
#ifdef DEBUG
|
||||
PR_LOG(gDocShellLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gDocShellLog, PR_LOG_DEBUG,
|
||||
("nsDocShell[%p]: loading from session history", this));
|
||||
#endif
|
||||
|
||||
@ -5313,7 +5313,7 @@ nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL,
|
||||
chanName.AssignLiteral("<no channel>");
|
||||
}
|
||||
|
||||
PR_LOG(gDocShellLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gDocShellLog, PR_LOG_DEBUG,
|
||||
("nsDocShell[%p]::LoadErrorPage(\"%s\", \"%s\", {...}, [%s])\n", this,
|
||||
spec.get(), NS_ConvertUTF16toUTF8(aURL).get(), chanName.get()));
|
||||
}
|
||||
@ -11164,7 +11164,7 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel, nsISupports* aOwner,
|
||||
chanName.AssignLiteral("<no channel>");
|
||||
}
|
||||
|
||||
PR_LOG(gDocShellLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gDocShellLog, PR_LOG_DEBUG,
|
||||
("nsDocShell[%p]::OnNewURI(\"%s\", [%s], 0x%x)\n", this, spec.get(),
|
||||
chanName.get(), aLoadType));
|
||||
}
|
||||
@ -11229,7 +11229,7 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel, nsISupports* aOwner,
|
||||
// XXX This log message is almost useless because |updateSHistory|
|
||||
// and |updateGHistory| are not correct at this point.
|
||||
|
||||
PR_LOG(gDocShellLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gDocShellLog, PR_LOG_DEBUG,
|
||||
(" shAvailable=%i updateSHistory=%i updateGHistory=%i"
|
||||
" equalURI=%i\n",
|
||||
shAvailable, updateSHistory, updateGHistory, equalUri));
|
||||
@ -11784,7 +11784,7 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
|
||||
chanName.AssignLiteral("<no channel>");
|
||||
}
|
||||
|
||||
PR_LOG(gDocShellLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gDocShellLog, PR_LOG_DEBUG,
|
||||
("nsDocShell[%p]::AddToSessionHistory(\"%s\", [%s])\n",
|
||||
this, spec.get(), chanName.get()));
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ GetSHistoryLog()
|
||||
}
|
||||
return sLog;
|
||||
}
|
||||
#define LOG(format) PR_LOG(GetSHistoryLog(), PR_LOG_DEBUG, format)
|
||||
#define LOG(format) MOZ_LOG(GetSHistoryLog(), PR_LOG_DEBUG, format)
|
||||
|
||||
// This macro makes it easier to print a log message which includes a URI's
|
||||
// spec. Example use:
|
||||
|
@ -392,7 +392,8 @@ ImageEncoder::ExtractDataInternal(const nsAString& aType,
|
||||
aOptions);
|
||||
} else {
|
||||
RefPtr<gfx::DataSourceSurface> dataSurface;
|
||||
dataSurface = GetBRGADataSourceSurfaceSync(aImage);
|
||||
RefPtr<layers::Image> image(aImage);
|
||||
dataSurface = GetBRGADataSourceSurfaceSync(image.forget());
|
||||
|
||||
DataSourceSurface::MappedSurface map;
|
||||
if (!dataSurface->Map(gfx::DataSourceSurface::MapType::READ, &map)) {
|
||||
|
@ -23,7 +23,7 @@ NS_IMPL_ISUPPORTS(ThirdPartyUtil, mozIThirdPartyUtil)
|
||||
//
|
||||
static PRLogModuleInfo *gThirdPartyLog;
|
||||
#undef LOG
|
||||
#define LOG(args) PR_LOG(gThirdPartyLog, PR_LOG_DEBUG, args)
|
||||
#define LOG(args) MOZ_LOG(gThirdPartyLog, PR_LOG_DEBUG, args)
|
||||
|
||||
nsresult
|
||||
ThirdPartyUtil::Init()
|
||||
|
@ -203,7 +203,7 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod,
|
||||
if (requestingLocation) { \
|
||||
requestingLocation->GetSpec(refSpec); \
|
||||
} \
|
||||
PR_LOG(gConPolLog, PR_LOG_DEBUG, \
|
||||
MOZ_LOG(gConPolLog, PR_LOG_DEBUG, \
|
||||
("Content Policy: " logType ": <%s> <Ref:%s> result=%s", \
|
||||
spec.get(), refSpec.get(), resultName) \
|
||||
); \
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "nsIApplicationCacheContainer.h"
|
||||
#include "nsIApplicationCacheChannel.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsISpeculativeConnect.h"
|
||||
#include "nsICookieService.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
@ -878,20 +877,15 @@ nsContentSink::PrefetchDNS(const nsAString &aHref)
|
||||
void
|
||||
nsContentSink::Preconnect(const nsAString &aHref)
|
||||
{
|
||||
nsCOMPtr<nsISpeculativeConnect>
|
||||
speculator(do_QueryInterface(nsContentUtils::GetIOService()));
|
||||
if (!speculator) {
|
||||
return;
|
||||
}
|
||||
|
||||
// construct URI using document charset
|
||||
const nsACString& charset = mDocument->GetDocumentCharacterSet();
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), aHref,
|
||||
charset.IsEmpty() ? nullptr : PromiseFlatCString(charset).get(),
|
||||
mDocument->GetDocBaseURI());
|
||||
if (uri) {
|
||||
speculator->SpeculativeConnect(uri, nullptr);
|
||||
|
||||
if (uri && mDocument) {
|
||||
mDocument->MaybePreconnect(uri);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,10 +163,9 @@ protected:
|
||||
void PrefetchHref(const nsAString &aHref, nsINode *aSource,
|
||||
bool aExplicit);
|
||||
|
||||
// For both PrefetchDNS() and Preconnect() aHref can either be the usual
|
||||
// For PrefetchDNS() aHref can either be the usual
|
||||
// URI format or of the form "//www.hostname.com" without a scheme.
|
||||
void PrefetchDNS(const nsAString &aHref);
|
||||
void Preconnect(const nsAString &aHref);
|
||||
|
||||
// Gets the cache key (used to identify items in a cache) of the channel.
|
||||
nsresult GetChannelCacheKey(nsIChannel* aChannel, nsACString& aCacheKey);
|
||||
@ -224,6 +223,10 @@ public:
|
||||
// element and calls the above method.
|
||||
void ProcessOfflineManifest(nsIContent *aElement);
|
||||
|
||||
// For Preconnect() aHref can either be the usual
|
||||
// URI format or of the form "//www.hostname.com" without a scheme.
|
||||
void Preconnect(const nsAString &aHref);
|
||||
|
||||
protected:
|
||||
// Tries to scroll to the URI's named anchor. Once we've successfully
|
||||
// done that, further calls to this method will be ignored.
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
extern PRLogModuleInfo* GetDataChannelLog();
|
||||
#undef LOG
|
||||
#define LOG(args) PR_LOG(GetDataChannelLog(), PR_LOG_DEBUG, args)
|
||||
#define LOG(args) MOZ_LOG(GetDataChannelLog(), PR_LOG_DEBUG, args)
|
||||
|
||||
|
||||
#include "nsDOMDataChannelDeclarations.h"
|
||||
|
@ -229,6 +229,8 @@
|
||||
#include "mozilla/dom/BoxObject.h"
|
||||
#include "gfxVR.h"
|
||||
|
||||
#include "nsISpeculativeConnect.h"
|
||||
|
||||
#ifdef MOZ_MEDIA_NAVIGATOR
|
||||
#include "mozilla/MediaManager.h"
|
||||
#endif // MOZ_MEDIA_NAVIGATOR
|
||||
@ -1593,7 +1595,7 @@ nsDocument::nsDocument(const char* aContentType)
|
||||
gDocumentLeakPRLog = PR_NewLogModule("DocumentLeak");
|
||||
|
||||
if (gDocumentLeakPRLog)
|
||||
PR_LOG(gDocumentLeakPRLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gDocumentLeakPRLog, PR_LOG_DEBUG,
|
||||
("DOCUMENT %p created", this));
|
||||
|
||||
if (!gCspPRLog)
|
||||
@ -1637,7 +1639,7 @@ nsIDocument::~nsIDocument()
|
||||
nsDocument::~nsDocument()
|
||||
{
|
||||
if (gDocumentLeakPRLog)
|
||||
PR_LOG(gDocumentLeakPRLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gDocumentLeakPRLog, PR_LOG_DEBUG,
|
||||
("DOCUMENT %p destroyed", this));
|
||||
|
||||
NS_ASSERTION(!mIsShowing, "Destroying a currently-showing document");
|
||||
@ -2771,7 +2773,7 @@ AppendCSPFromHeader(nsIContentSecurityPolicy* csp,
|
||||
rv = csp->AppendPolicy(policy, aReportOnly);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
{
|
||||
PR_LOG(gCspPRLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gCspPRLog, PR_LOG_DEBUG,
|
||||
("CSP refined with policy: \"%s\"",
|
||||
NS_ConvertUTF16toUTF8(policy).get()));
|
||||
}
|
||||
@ -2811,7 +2813,7 @@ nsDocument::InitCSP(nsIChannel* aChannel)
|
||||
{
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
if (!CSPService::sCSPEnabled) {
|
||||
PR_LOG(gCspPRLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gCspPRLog, PR_LOG_DEBUG,
|
||||
("CSP is disabled, skipping CSP init for document %p", this));
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2869,7 +2871,7 @@ nsDocument::InitCSP(nsIChannel* aChannel)
|
||||
aChannel->GetURI(getter_AddRefs(chanURI));
|
||||
nsAutoCString aspec;
|
||||
chanURI->GetAsciiSpec(aspec);
|
||||
PR_LOG(gCspPRLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gCspPRLog, PR_LOG_DEBUG,
|
||||
("no CSP for document, %s, %s",
|
||||
aspec.get(),
|
||||
applyAppDefaultCSP ? "is app" : "not an app"));
|
||||
@ -2878,7 +2880,7 @@ nsDocument::InitCSP(nsIChannel* aChannel)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PR_LOG(gCspPRLog, PR_LOG_DEBUG, ("Document is an app or CSP header specified %p", this));
|
||||
MOZ_LOG(gCspPRLog, PR_LOG_DEBUG, ("Document is an app or CSP header specified %p", this));
|
||||
|
||||
nsresult rv;
|
||||
|
||||
@ -2897,7 +2899,7 @@ nsDocument::InitCSP(nsIChannel* aChannel)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (csp) {
|
||||
PR_LOG(gCspPRLog, PR_LOG_DEBUG, ("%s %s %s",
|
||||
MOZ_LOG(gCspPRLog, PR_LOG_DEBUG, ("%s %s %s",
|
||||
"This document is sharing principal with another document.",
|
||||
"Since the document is an app, CSP was already set.",
|
||||
"Skipping attempt to set CSP."));
|
||||
@ -2908,7 +2910,7 @@ nsDocument::InitCSP(nsIChannel* aChannel)
|
||||
csp = do_CreateInstance("@mozilla.org/cspcontext;1", &rv);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
PR_LOG(gCspPRLog, PR_LOG_DEBUG, ("Failed to create CSP object: %x", rv));
|
||||
MOZ_LOG(gCspPRLog, PR_LOG_DEBUG, ("Failed to create CSP object: %x", rv));
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -2961,7 +2963,7 @@ nsDocument::InitCSP(nsIChannel* aChannel)
|
||||
rv = csp->PermitsAncestry(docShell, &safeAncestry);
|
||||
|
||||
if (NS_FAILED(rv) || !safeAncestry) {
|
||||
PR_LOG(gCspPRLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gCspPRLog, PR_LOG_DEBUG,
|
||||
("CSP doesn't like frame's ancestry, not loading."));
|
||||
// stop! ERROR page!
|
||||
aChannel->Cancel(NS_ERROR_CSP_FRAME_ANCESTOR_VIOLATION);
|
||||
@ -2982,7 +2984,7 @@ nsDocument::InitCSP(nsIChannel* aChannel)
|
||||
} else if (mReferrerPolicy != referrerPolicy) {
|
||||
mReferrerPolicy = mozilla::net::RP_No_Referrer;
|
||||
{
|
||||
PR_LOG(gCspPRLog, PR_LOG_DEBUG, ("%s %s",
|
||||
MOZ_LOG(gCspPRLog, PR_LOG_DEBUG, ("%s %s",
|
||||
"CSP wants to set referrer, but nsDocument"
|
||||
"already has it set. No referrers will be sent"));
|
||||
}
|
||||
@ -2995,7 +2997,7 @@ nsDocument::InitCSP(nsIChannel* aChannel)
|
||||
|
||||
rv = principal->SetCsp(csp);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
PR_LOG(gCspPRLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gCspPRLog, PR_LOG_DEBUG,
|
||||
("Inserted CSP into principal %p", principal));
|
||||
|
||||
return NS_OK;
|
||||
@ -5096,6 +5098,10 @@ nsDocument::DispatchContentLoadedEvents()
|
||||
// Unpin references to preloaded images
|
||||
mPreloadingImages.Clear();
|
||||
|
||||
// DOM manipulation after content loaded should not care if the element
|
||||
// came from the preloader.
|
||||
mPreloadedPreconnects.Clear();
|
||||
|
||||
if (mTiming) {
|
||||
mTiming->NotifyDOMContentLoadedStart(nsIDocument::GetDocumentURI());
|
||||
}
|
||||
@ -9810,6 +9816,23 @@ nsDocument::MaybePreLoadImage(nsIURI* uri, const nsAString &aCrossOriginAttr,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::MaybePreconnect(nsIURI* uri)
|
||||
{
|
||||
if (mPreloadedPreconnects.Contains(uri)) {
|
||||
return;
|
||||
}
|
||||
mPreloadedPreconnects.Put(uri, true);
|
||||
|
||||
nsCOMPtr<nsISpeculativeConnect>
|
||||
speculator(do_QueryInterface(nsContentUtils::GetIOService()));
|
||||
if (!speculator) {
|
||||
return;
|
||||
}
|
||||
|
||||
speculator->SpeculativeConnect(uri, nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::ForgetImagePreload(nsIURI* aURI)
|
||||
{
|
||||
|
@ -1115,6 +1115,8 @@ public:
|
||||
ReferrerPolicy aReferrerPolicy) override;
|
||||
virtual void ForgetImagePreload(nsIURI* aURI) override;
|
||||
|
||||
virtual void MaybePreconnect(nsIURI* uri) override;
|
||||
|
||||
virtual void PreloadStyle(nsIURI* uri, const nsAString& charset,
|
||||
const nsAString& aCrossOriginAttr,
|
||||
ReferrerPolicy aReferrerPolicy) override;
|
||||
@ -1785,6 +1787,11 @@ private:
|
||||
// about it anymore.
|
||||
nsRefPtrHashtable<nsURIHashKey, imgIRequest> mPreloadingImages;
|
||||
|
||||
// A list of preconnects initiated by the preloader. This prevents
|
||||
// the same uri from being used more than once, and allows the dom
|
||||
// builder to not repeat the work of the preloader.
|
||||
nsDataHashtable< nsURIHashKey, bool> mPreloadedPreconnects;
|
||||
|
||||
// Current depth of picture elements from parser
|
||||
int32_t mPreloadPictureDepth;
|
||||
|
||||
|
@ -77,8 +77,8 @@ using namespace mozilla::widget;
|
||||
PRLogModuleInfo* gFocusLog;
|
||||
PRLogModuleInfo* gFocusNavigationLog;
|
||||
|
||||
#define LOGFOCUS(args) PR_LOG(gFocusLog, PR_LOG_DEBUG, args)
|
||||
#define LOGFOCUSNAVIGATION(args) PR_LOG(gFocusNavigationLog, PR_LOG_DEBUG, args)
|
||||
#define LOGFOCUS(args) MOZ_LOG(gFocusLog, PR_LOG_DEBUG, args)
|
||||
#define LOGFOCUSNAVIGATION(args) MOZ_LOG(gFocusNavigationLog, PR_LOG_DEBUG, args)
|
||||
|
||||
#define LOGTAG(log, format, content) \
|
||||
if (PR_LOG_TEST(log, PR_LOG_DEBUG)) { \
|
||||
@ -86,7 +86,7 @@ PRLogModuleInfo* gFocusNavigationLog;
|
||||
if (content) { \
|
||||
content->NodeInfo()->NameAtom()->ToUTF8String(tag); \
|
||||
} \
|
||||
PR_LOG(log, PR_LOG_DEBUG, (format, tag.get())); \
|
||||
MOZ_LOG(log, PR_LOG_DEBUG, (format, tag.get())); \
|
||||
}
|
||||
|
||||
#define LOGCONTENT(format, content) LOGTAG(gFocusLog, format, content)
|
||||
|
@ -1211,7 +1211,7 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
|
||||
#endif
|
||||
|
||||
if (gDOMLeakPRLog)
|
||||
PR_LOG(gDOMLeakPRLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gDOMLeakPRLog, PR_LOG_DEBUG,
|
||||
("DOMWINDOW %p created outer=%p", this, aOuterWindow));
|
||||
|
||||
NS_ASSERTION(sWindowsById, "Windows hash table must be created!");
|
||||
@ -1301,7 +1301,7 @@ nsGlobalWindow::~nsGlobalWindow()
|
||||
#endif
|
||||
|
||||
if (gDOMLeakPRLog)
|
||||
PR_LOG(gDOMLeakPRLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gDOMLeakPRLog, PR_LOG_DEBUG,
|
||||
("DOMWINDOW %p destroyed", this));
|
||||
|
||||
if (IsOuterWindow()) {
|
||||
|
@ -2017,6 +2017,11 @@ public:
|
||||
*/
|
||||
virtual bool IsDocumentRightToLeft() { return false; }
|
||||
|
||||
/**
|
||||
* Called by Parser for link rel=preconnect
|
||||
*/
|
||||
virtual void MaybePreconnect(nsIURI* uri) = 0;
|
||||
|
||||
enum DocumentTheme {
|
||||
Doc_Theme_Uninitialized, // not determined yet
|
||||
Doc_Theme_None,
|
||||
|
@ -119,7 +119,7 @@ nsNodeInfoManager::nsNodeInfoManager()
|
||||
gNodeInfoManagerLeakPRLog = PR_NewLogModule("NodeInfoManagerLeak");
|
||||
|
||||
if (gNodeInfoManagerLeakPRLog)
|
||||
PR_LOG(gNodeInfoManagerLeakPRLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gNodeInfoManagerLeakPRLog, PR_LOG_DEBUG,
|
||||
("NODEINFOMANAGER %p created", this));
|
||||
|
||||
mNodeInfoHash = PL_NewHashTable(32, GetNodeInfoInnerHashValue,
|
||||
@ -139,7 +139,7 @@ nsNodeInfoManager::~nsNodeInfoManager()
|
||||
mBindingManager = nullptr;
|
||||
|
||||
if (gNodeInfoManagerLeakPRLog)
|
||||
PR_LOG(gNodeInfoManagerLeakPRLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gNodeInfoManagerLeakPRLog, PR_LOG_DEBUG,
|
||||
("NODEINFOMANAGER %p destroyed", this));
|
||||
|
||||
nsLayoutStatics::Release();
|
||||
@ -196,7 +196,7 @@ nsNodeInfoManager::Init(nsIDocument *aDocument)
|
||||
mDocument = aDocument;
|
||||
|
||||
if (gNodeInfoManagerLeakPRLog)
|
||||
PR_LOG(gNodeInfoManagerLeakPRLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gNodeInfoManagerLeakPRLog, PR_LOG_DEBUG,
|
||||
("NODEINFOMANAGER %p Init document=%p", this, aDocument));
|
||||
|
||||
return NS_OK;
|
||||
|
@ -115,7 +115,7 @@ GetObjectLog()
|
||||
return sLog;
|
||||
}
|
||||
|
||||
#define LOG(args) PR_LOG(GetObjectLog(), PR_LOG_DEBUG, args)
|
||||
#define LOG(args) MOZ_LOG(GetObjectLog(), PR_LOG_DEBUG, args)
|
||||
#define LOG_ENABLED() PR_LOG_TEST(GetObjectLog(), PR_LOG_DEBUG)
|
||||
|
||||
static bool
|
||||
|
398
dom/cache/DBSchema.cpp
vendored
398
dom/cache/DBSchema.cpp
vendored
@ -18,6 +18,7 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsHttp.h"
|
||||
#include "nsICryptoHash.h"
|
||||
#include "mozilla/dom/HeadersBinding.h"
|
||||
#include "mozilla/dom/RequestBinding.h"
|
||||
#include "mozilla/dom/ResponseBinding.h"
|
||||
@ -28,11 +29,11 @@ namespace dom {
|
||||
namespace cache {
|
||||
namespace db {
|
||||
|
||||
const int32_t kMaxWipeSchemaVersion = 8;
|
||||
const int32_t kMaxWipeSchemaVersion = 9;
|
||||
|
||||
namespace {
|
||||
|
||||
const int32_t kLatestSchemaVersion = 8;
|
||||
const int32_t kLatestSchemaVersion = 9;
|
||||
const int32_t kMaxEntriesPerStatement = 255;
|
||||
|
||||
} // anonymous namespace
|
||||
@ -151,6 +152,14 @@ namespace {
|
||||
|
||||
typedef int32_t EntryId;
|
||||
|
||||
struct IdCount
|
||||
{
|
||||
IdCount() : mId(-1), mCount(0) { }
|
||||
explicit IdCount(int32_t aId) : mId(aId), mCount(1) { }
|
||||
int32_t mId;
|
||||
int32_t mCount;
|
||||
};
|
||||
|
||||
static nsresult QueryAll(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
nsTArray<EntryId>& aEntryIdListOut);
|
||||
static nsresult QueryCache(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
@ -164,7 +173,14 @@ static nsresult MatchByVaryHeader(mozIStorageConnection* aConn,
|
||||
static nsresult DeleteEntries(mozIStorageConnection* aConn,
|
||||
const nsTArray<EntryId>& aEntryIdList,
|
||||
nsTArray<nsID>& aDeletedBodyIdListOut,
|
||||
nsTArray<IdCount>& aDeletedSecurityIdListOut,
|
||||
uint32_t aPos=0, int32_t aLen=-1);
|
||||
static nsresult InsertSecurity(mozIStorageConnection* aConn,
|
||||
const nsACString& aData, int32_t *aIdOut);
|
||||
static nsresult DeleteSecurityInfo(mozIStorageConnection* aConn, int32_t aId,
|
||||
int32_t aCount);
|
||||
static nsresult DeleteSecurityInfoList(mozIStorageConnection* aConn,
|
||||
const nsTArray<IdCount>& aDeletedStorageIdList);
|
||||
static nsresult InsertEntry(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
const CacheRequest& aRequest,
|
||||
const nsID* aRequestBodyId,
|
||||
@ -185,6 +201,10 @@ static nsresult BindId(mozIStorageStatement* aState, const nsACString& aName,
|
||||
const nsID* aId);
|
||||
static nsresult ExtractId(mozIStorageStatement* aState, uint32_t aPos,
|
||||
nsID* aIdOut);
|
||||
static nsresult CreateAndBindKeyStatement(mozIStorageConnection* aConn,
|
||||
const char* aQueryFormat,
|
||||
const nsAString& aKey,
|
||||
mozIStorageStatement** aStateOut);
|
||||
} // anonymous namespace
|
||||
|
||||
nsresult
|
||||
@ -241,6 +261,24 @@ CreateSchema(mozIStorageConnection* aConn)
|
||||
));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
// Security blobs are quite large and duplicated for every Response from
|
||||
// the same https origin. This table is used to de-duplicate this data.
|
||||
rv = aConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
||||
"CREATE TABLE security_info ("
|
||||
"id INTEGER NOT NULL PRIMARY KEY, "
|
||||
"hash BLOB NOT NULL, " // first 8-bytes of the sha1 hash of data column
|
||||
"data BLOB NOT NULL, " // full security info data, usually a few KB
|
||||
"refcount INTEGER NOT NULL"
|
||||
");"
|
||||
));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
// Index the smaller hash value instead of the large security data blob.
|
||||
rv = aConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
||||
"CREATE INDEX security_info_hash_index ON security_info (hash);"
|
||||
));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = aConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
||||
"CREATE TABLE entries ("
|
||||
"id INTEGER NOT NULL PRIMARY KEY, "
|
||||
@ -261,7 +299,7 @@ CreateSchema(mozIStorageConnection* aConn)
|
||||
"response_status_text TEXT NOT NULL, "
|
||||
"response_headers_guard INTEGER NOT NULL, "
|
||||
"response_body_id TEXT NULL, "
|
||||
"response_security_info BLOB NULL, "
|
||||
"response_security_info_id INTEGER NULL REFERENCES security_info(id), "
|
||||
"cache_id INTEGER NOT NULL REFERENCES caches(id) ON DELETE CASCADE"
|
||||
");"
|
||||
));
|
||||
@ -406,7 +444,12 @@ DeleteCacheId(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
nsresult rv = QueryAll(aConn, aCacheId, matches);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = DeleteEntries(aConn, matches, aDeletedBodyIdListOut);
|
||||
nsAutoTArray<IdCount, 16> deletedSecurityIdList;
|
||||
rv = DeleteEntries(aConn, matches, aDeletedBodyIdListOut,
|
||||
deletedSecurityIdList);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = DeleteSecurityInfoList(aConn, deletedSecurityIdList);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
// Delete the remainder of the cache using cascade semantics.
|
||||
@ -538,13 +581,20 @@ CachePut(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
nsresult rv = QueryCache(aConn, aCacheId, aRequest, params, matches);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = DeleteEntries(aConn, matches, aDeletedBodyIdListOut);
|
||||
nsAutoTArray<IdCount, 16> deletedSecurityIdList;
|
||||
rv = DeleteEntries(aConn, matches, aDeletedBodyIdListOut,
|
||||
deletedSecurityIdList);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = InsertEntry(aConn, aCacheId, aRequest, aRequestBodyId, aResponse,
|
||||
aResponseBodyId);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
// Delete the security values after doing the insert to avoid churning
|
||||
// the security table when its not necessary.
|
||||
rv = DeleteSecurityInfoList(aConn, deletedSecurityIdList);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -568,7 +618,12 @@ CacheDelete(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = DeleteEntries(aConn, matches, aDeletedBodyIdListOut);
|
||||
nsAutoTArray<IdCount, 16> deletedSecurityIdList;
|
||||
rv = DeleteEntries(aConn, matches, aDeletedBodyIdListOut,
|
||||
deletedSecurityIdList);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = DeleteSecurityInfoList(aConn, deletedSecurityIdList);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
*aSuccessOut = true;
|
||||
@ -690,20 +745,21 @@ StorageGetCacheId(mozIStorageConnection* aConn, Namespace aNamespace,
|
||||
|
||||
*aFoundCacheOut = false;
|
||||
|
||||
// Use IS for matching the key since an EmptryString() key maps to NULL.
|
||||
// How we constrain the key column depends on the value of our key. Use
|
||||
// a format string for the query and let CreateAndBindKeyStatement() fill
|
||||
// it in for us.
|
||||
const char* query = "SELECT cache_id FROM storage "
|
||||
"WHERE namespace=:namespace AND %s "
|
||||
"ORDER BY rowid;";
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> state;
|
||||
nsresult rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"SELECT cache_id FROM storage WHERE namespace=:namespace AND key IS :key "
|
||||
"ORDER BY rowid;"
|
||||
), getter_AddRefs(state));
|
||||
nsresult rv = CreateAndBindKeyStatement(aConn, query, aKey,
|
||||
getter_AddRefs(state));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindInt32ByName(NS_LITERAL_CSTRING("namespace"), aNamespace);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindStringAsBlobByName(NS_LITERAL_CSTRING("key"), aKey);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
bool hasMoreData = false;
|
||||
rv = state->ExecuteStep(&hasMoreData);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
@ -755,19 +811,19 @@ StorageForgetCache(mozIStorageConnection* aConn, Namespace aNamespace,
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
|
||||
// Use IS for matching the key since an EmptryString() key maps to NULL.
|
||||
// How we constrain the key column depends on the value of our key. Use
|
||||
// a format string for the query and let CreateAndBindKeyStatement() fill
|
||||
// it in for us.
|
||||
const char *query = "DELETE FROM storage WHERE namespace=:namespace AND %s;";
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> state;
|
||||
nsresult rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"DELETE FROM storage WHERE namespace=:namespace AND key IS :key;"
|
||||
), getter_AddRefs(state));
|
||||
nsresult rv = CreateAndBindKeyStatement(aConn, query, aKey,
|
||||
getter_AddRefs(state));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindInt32ByName(NS_LITERAL_CSTRING("namespace"), aNamespace);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindStringAsBlobByName(NS_LITERAL_CSTRING("key"), aKey);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->Execute();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
@ -1024,6 +1080,7 @@ nsresult
|
||||
DeleteEntries(mozIStorageConnection* aConn,
|
||||
const nsTArray<EntryId>& aEntryIdList,
|
||||
nsTArray<nsID>& aDeletedBodyIdListOut,
|
||||
nsTArray<IdCount>& aDeletedSecurityIdListOut,
|
||||
uint32_t aPos, int32_t aLen)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
@ -1048,7 +1105,7 @@ DeleteEntries(mozIStorageConnection* aConn,
|
||||
int32_t max = kMaxEntriesPerStatement;
|
||||
int32_t curLen = std::min(max, remaining);
|
||||
nsresult rv = DeleteEntries(aConn, aEntryIdList, aDeletedBodyIdListOut,
|
||||
curPos, curLen);
|
||||
aDeletedSecurityIdListOut, curPos, curLen);
|
||||
if (NS_FAILED(rv)) { return rv; }
|
||||
|
||||
curPos += curLen;
|
||||
@ -1059,7 +1116,8 @@ DeleteEntries(mozIStorageConnection* aConn,
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> state;
|
||||
nsAutoCString query(
|
||||
"SELECT request_body_id, response_body_id FROM entries WHERE id IN ("
|
||||
"SELECT request_body_id, response_body_id, response_security_info_id "
|
||||
"FROM entries WHERE id IN ("
|
||||
);
|
||||
AppendListParamsToQuery(query, aEntryIdList, aPos, aLen);
|
||||
query.AppendLiteral(")");
|
||||
@ -1086,6 +1144,33 @@ DeleteEntries(mozIStorageConnection* aConn,
|
||||
aDeletedBodyIdListOut.AppendElement(id);
|
||||
}
|
||||
}
|
||||
|
||||
// and then a possible third entry for the security id
|
||||
bool isNull = false;
|
||||
rv = state->GetIsNull(2, &isNull);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
if (!isNull) {
|
||||
int32_t securityId = -1;
|
||||
rv = state->GetInt32(2, &securityId);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
// First try to increment the count for this ID if we're already
|
||||
// seen it
|
||||
bool found = false;
|
||||
for (uint32_t i = 0; i < aDeletedSecurityIdListOut.Length(); ++i) {
|
||||
if (aDeletedSecurityIdListOut[i].mId == securityId) {
|
||||
found = true;
|
||||
aDeletedSecurityIdListOut[i].mCount += 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise add a new entry for this ID with a count of 1
|
||||
if (!found) {
|
||||
aDeletedSecurityIdListOut.AppendElement(IdCount(securityId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dependent records removed via ON DELETE CASCADE
|
||||
@ -1108,6 +1193,194 @@ DeleteEntries(mozIStorageConnection* aConn,
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
InsertSecurity(mozIStorageConnection* aConn, const nsACString& aData,
|
||||
int32_t *aIdOut)
|
||||
{
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_ASSERT(aIdOut);
|
||||
MOZ_ASSERT(!aData.IsEmpty());
|
||||
|
||||
// We want to use an index to find existing security blobs, but indexing
|
||||
// the full blob would be quite expensive. Instead, we index a small
|
||||
// hash value. Calculate this hash as the first 8 bytes of the SHA1 of
|
||||
// the full data.
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICryptoHash> crypto =
|
||||
do_CreateInstance(NS_CRYPTO_HASH_CONTRACTID, &rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = crypto->Init(nsICryptoHash::SHA1);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = crypto->Update(reinterpret_cast<const uint8_t*>(aData.BeginReading()),
|
||||
aData.Length());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
nsAutoCString fullHash;
|
||||
rv = crypto->Finish(false /* based64 result */, fullHash);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
nsDependentCSubstring hash(fullHash, 0, 8);
|
||||
|
||||
// Next, search for an existing entry for this blob by comparing the hash
|
||||
// value first and then the full data. SQLite is smart enough to use
|
||||
// the index on the hash to search the table before doing the expensive
|
||||
// comparison of the large data column. (This was verified with EXPLAIN.)
|
||||
nsCOMPtr<mozIStorageStatement> state;
|
||||
rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
// Note that hash and data are blobs, but we can use = here since the
|
||||
// columns are NOT NULL.
|
||||
"SELECT id, refcount FROM security_info WHERE hash=:hash AND data=:data;"
|
||||
), getter_AddRefs(state));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindUTF8StringAsBlobByName(NS_LITERAL_CSTRING("hash"), hash);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindUTF8StringAsBlobByName(NS_LITERAL_CSTRING("data"), aData);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
bool hasMoreData = false;
|
||||
rv = state->ExecuteStep(&hasMoreData);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
// This security info blob is already in the database
|
||||
if (hasMoreData) {
|
||||
// get the existing security blob id to return
|
||||
rv = state->GetInt32(0, aIdOut);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
int32_t refcount = -1;
|
||||
rv = state->GetInt32(1, &refcount);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
// But first, update the refcount in the database.
|
||||
refcount += 1;
|
||||
|
||||
rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"UPDATE security_info SET refcount=:refcount WHERE id=:id;"
|
||||
), getter_AddRefs(state));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindInt32ByName(NS_LITERAL_CSTRING("refcount"), refcount);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindInt32ByName(NS_LITERAL_CSTRING("id"), *aIdOut);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->Execute();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// This is a new security info blob. Create a new row in the security table
|
||||
// with an initial refcount of 1.
|
||||
rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"INSERT INTO security_info (hash, data, refcount) VALUES (:hash, :data, 1);"
|
||||
), getter_AddRefs(state));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindUTF8StringAsBlobByName(NS_LITERAL_CSTRING("hash"), hash);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindUTF8StringAsBlobByName(NS_LITERAL_CSTRING("data"), aData);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->Execute();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"SELECT last_insert_rowid()"
|
||||
), getter_AddRefs(state));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
hasMoreData = false;
|
||||
rv = state->ExecuteStep(&hasMoreData);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->GetInt32(0, aIdOut);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DeleteSecurityInfo(mozIStorageConnection* aConn, int32_t aId, int32_t aCount)
|
||||
{
|
||||
// First, we need to determine the current refcount for this security blob.
|
||||
nsCOMPtr<mozIStorageStatement> state;
|
||||
nsresult rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"SELECT refcount FROM security_info WHERE id=:id;"
|
||||
), getter_AddRefs(state));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindInt32ByName(NS_LITERAL_CSTRING("id"), aId);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
bool hasMoreData = false;
|
||||
rv = state->ExecuteStep(&hasMoreData);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
int32_t refcount = -1;
|
||||
rv = state->GetInt32(0, &refcount);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
MOZ_ASSERT(refcount >= aCount);
|
||||
|
||||
// Next, calculate the new refcount
|
||||
int32_t newCount = refcount - aCount;
|
||||
|
||||
// If the last reference to this security blob was removed we can
|
||||
// just remove the entire row.
|
||||
if (newCount == 0) {
|
||||
rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"DELETE FROM security_info WHERE id=:id;"
|
||||
), getter_AddRefs(state));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindInt32ByName(NS_LITERAL_CSTRING("id"), aId);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->Execute();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Otherwise update the refcount in the table to reflect the reduced
|
||||
// number of references to the security blob.
|
||||
rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"UPDATE security_info SET refcount=:refcount WHERE id=:id;"
|
||||
), getter_AddRefs(state));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindInt32ByName(NS_LITERAL_CSTRING("refcount"), newCount);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindInt32ByName(NS_LITERAL_CSTRING("id"), aId);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->Execute();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DeleteSecurityInfoList(mozIStorageConnection* aConn,
|
||||
const nsTArray<IdCount>& aDeletedStorageIdList)
|
||||
{
|
||||
for (uint32_t i = 0; i < aDeletedStorageIdList.Length(); ++i) {
|
||||
nsresult rv = DeleteSecurityInfo(aConn, aDeletedStorageIdList[i].mId,
|
||||
aDeletedStorageIdList[i].mCount);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
InsertEntry(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
const CacheRequest& aRequest,
|
||||
@ -1118,8 +1391,16 @@ InsertEntry(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
int32_t securityId = -1;
|
||||
|
||||
if (!aResponse.securityInfo().IsEmpty()) {
|
||||
rv = InsertSecurity(aConn, aResponse.securityInfo(), &securityId);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
}
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> state;
|
||||
nsresult rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"INSERT INTO entries ("
|
||||
"request_method, "
|
||||
"request_url, "
|
||||
@ -1138,7 +1419,7 @@ InsertEntry(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
"response_status_text, "
|
||||
"response_headers_guard, "
|
||||
"response_body_id, "
|
||||
"response_security_info, "
|
||||
"response_security_info_id, "
|
||||
"cache_id "
|
||||
") VALUES ("
|
||||
":request_method, "
|
||||
@ -1158,7 +1439,7 @@ InsertEntry(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
":response_status_text, "
|
||||
":response_headers_guard, "
|
||||
":response_body_id, "
|
||||
":response_security_info, "
|
||||
":response_security_info_id, "
|
||||
":cache_id "
|
||||
");"
|
||||
), getter_AddRefs(state));
|
||||
@ -1230,8 +1511,12 @@ InsertEntry(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
rv = BindId(state, NS_LITERAL_CSTRING("response_body_id"), aResponseBodyId);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindUTF8StringAsBlobByName(NS_LITERAL_CSTRING("response_security_info"),
|
||||
aResponse.securityInfo());
|
||||
if (aResponse.securityInfo().IsEmpty()) {
|
||||
rv = state->BindNullByName(NS_LITERAL_CSTRING("response_security_info_id"));
|
||||
} else {
|
||||
rv = state->BindInt32ByName(NS_LITERAL_CSTRING("response_security_info_id"),
|
||||
securityId);
|
||||
}
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindInt64ByName(NS_LITERAL_CSTRING("cache_id"), aCacheId);
|
||||
@ -1319,15 +1604,17 @@ ReadResponse(mozIStorageConnection* aConn, EntryId aEntryId,
|
||||
nsCOMPtr<mozIStorageStatement> state;
|
||||
nsresult rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"SELECT "
|
||||
"response_type, "
|
||||
"response_url, "
|
||||
"response_status, "
|
||||
"response_status_text, "
|
||||
"response_headers_guard, "
|
||||
"response_body_id, "
|
||||
"response_security_info "
|
||||
"entries.response_type, "
|
||||
"entries.response_url, "
|
||||
"entries.response_status, "
|
||||
"entries.response_status_text, "
|
||||
"entries.response_headers_guard, "
|
||||
"entries.response_body_id, "
|
||||
"security_info.data "
|
||||
"FROM entries "
|
||||
"WHERE id=:id;"
|
||||
"LEFT OUTER JOIN security_info "
|
||||
"ON entries.response_security_info_id=security_info.id "
|
||||
"WHERE entries.id=:id;"
|
||||
), getter_AddRefs(state));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
@ -1586,6 +1873,45 @@ ExtractId(mozIStorageStatement* aState, uint32_t aPos, nsID* aIdOut)
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
CreateAndBindKeyStatement(mozIStorageConnection* aConn,
|
||||
const char* aQueryFormat,
|
||||
const nsAString& aKey,
|
||||
mozIStorageStatement** aStateOut)
|
||||
{
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_ASSERT(aQueryFormat);
|
||||
MOZ_ASSERT(aStateOut);
|
||||
|
||||
// The key is stored as a blob to avoid encoding issues. An empty string
|
||||
// is mapped to NULL for blobs. Normally we would just write the query
|
||||
// as "key IS :key" to do the proper NULL checking, but that prevents
|
||||
// sqlite from using the key index. Therefore use "IS NULL" explicitly
|
||||
// if the key is empty, otherwise use "=:key" so that sqlite uses the
|
||||
// index.
|
||||
const char* constraint = nullptr;
|
||||
if (aKey.IsEmpty()) {
|
||||
constraint = "key IS NULL";
|
||||
} else {
|
||||
constraint = "key=:key";
|
||||
}
|
||||
|
||||
nsPrintfCString query(aQueryFormat, constraint);
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> state;
|
||||
nsresult rv = aConn->CreateStatement(query, getter_AddRefs(state));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
if (!aKey.IsEmpty()) {
|
||||
rv = state->BindStringAsBlobByName(NS_LITERAL_CSTRING("key"), aKey);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
}
|
||||
|
||||
state.forget(aStateOut);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
} // anonymouns namespace
|
||||
|
||||
} // namespace db
|
||||
|
3
dom/cache/test/mochitest/mochitest.ini
vendored
3
dom/cache/test/mochitest/mochitest.ini
vendored
@ -20,6 +20,7 @@ support-files =
|
||||
test_cache_requestCache.js
|
||||
test_cache_delete.js
|
||||
test_cache_put_reorder.js
|
||||
test_cache_https.js
|
||||
|
||||
[test_cache.html]
|
||||
[test_cache_add.html]
|
||||
@ -33,4 +34,6 @@ support-files =
|
||||
[test_cache_requestCache.html]
|
||||
[test_cache_delete.html]
|
||||
[test_cache_put_reorder.html]
|
||||
[test_cache_https.html]
|
||||
skip-if = buildapp == 'b2g' # bug 1162353
|
||||
[test_cache_restart.html]
|
||||
|
20
dom/cache/test/mochitest/test_cache_https.html
vendored
Normal file
20
dom/cache/test/mochitest/test_cache_https.html
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
- http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Validate Interfaces Exposed to Workers</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="driver.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe id="frame"></iframe>
|
||||
<script class="testbody" type="text/javascript">
|
||||
runTests("test_cache_https.js")
|
||||
.then(function() {
|
||||
SimpleTest.finish();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
23
dom/cache/test/mochitest/test_cache_https.js
vendored
Normal file
23
dom/cache/test/mochitest/test_cache_https.js
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
var cache = null;
|
||||
var name = 'https_' + context;
|
||||
var urlBase = 'https://example.com/tests/dom/cache/test/mochitest';
|
||||
var url1 = urlBase + '/test_cache.js';
|
||||
var url2 = urlBase + '/test_cache_add.js';
|
||||
|
||||
caches.open(name).then(function(c) {
|
||||
cache = c;
|
||||
return cache.addAll([new Request(url1, { mode: 'no-cors' }),
|
||||
new Request(url2, { mode: 'no-cors' })]);
|
||||
}).then(function() {
|
||||
return cache.delete(url1);
|
||||
}).then(function(result) {
|
||||
ok(result, 'Cache entry should be deleted');
|
||||
return cache.delete(url2);
|
||||
}).then(function(result) {
|
||||
ok(result, 'Cache entry should be deleted');
|
||||
cache = null;
|
||||
return caches.delete(name);
|
||||
}).then(function(result) {
|
||||
ok(result, 'Cache should be deleted');
|
||||
testDone();
|
||||
});
|
@ -18,7 +18,7 @@
|
||||
#include "mozilla/Logging.h"
|
||||
|
||||
extern PRLogModuleInfo* GetCameraLog();
|
||||
#define DOM_CAMERA_LOG( type, ... ) PR_LOG(GetCameraLog(), (PRLogModuleLevel)type, ( __VA_ARGS__ ))
|
||||
#define DOM_CAMERA_LOG( type, ... ) MOZ_LOG(GetCameraLog(), (PRLogModuleLevel)type, ( __VA_ARGS__ ))
|
||||
|
||||
#define DOM_CAMERA_LOGA( ... ) DOM_CAMERA_LOG( 0, __VA_ARGS__ )
|
||||
|
||||
|
@ -4079,14 +4079,16 @@ ExtractSubrect(SourceSurface* aSurface, mgfx::Rect* aSourceRect, DrawTarget* aTa
|
||||
roundedOutSourceRect.RoundOut();
|
||||
mgfx::IntRect roundedOutSourceRectInt;
|
||||
if (!roundedOutSourceRect.ToIntRect(&roundedOutSourceRectInt)) {
|
||||
return aSurface;
|
||||
RefPtr<SourceSurface> surface(aSurface);
|
||||
return surface.forget();
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget> subrectDT =
|
||||
aTargetDT->CreateSimilarDrawTarget(roundedOutSourceRectInt.Size(), SurfaceFormat::B8G8R8A8);
|
||||
|
||||
if (!subrectDT) {
|
||||
return aSurface;
|
||||
RefPtr<SourceSurface> surface(aSurface);
|
||||
return surface.forget();
|
||||
}
|
||||
|
||||
*aSourceRect -= roundedOutSourceRect.TopLeft();
|
||||
@ -5634,15 +5636,18 @@ CanvasPath::GetPath(const CanvasWindingRule& winding, const DrawTarget* aTarget)
|
||||
if (mPath &&
|
||||
(mPath->GetBackendType() == aTarget->GetBackendType()) &&
|
||||
(mPath->GetFillRule() == fillRule)) {
|
||||
return mPath;
|
||||
RefPtr<gfx::Path> path(mPath);
|
||||
return path.forget();
|
||||
}
|
||||
|
||||
if (!mPath) {
|
||||
// if there is no path, there must be a pathbuilder
|
||||
MOZ_ASSERT(mPathBuilder);
|
||||
mPath = mPathBuilder->Finish();
|
||||
if (!mPath)
|
||||
return mPath;
|
||||
if (!mPath) {
|
||||
RefPtr<gfx::Path> path(mPath);
|
||||
return path.forget();
|
||||
}
|
||||
|
||||
mPathBuilder = nullptr;
|
||||
}
|
||||
@ -5657,7 +5662,8 @@ CanvasPath::GetPath(const CanvasWindingRule& winding, const DrawTarget* aTarget)
|
||||
mPath = tmpPathBuilder->Finish();
|
||||
}
|
||||
|
||||
return mPath;
|
||||
RefPtr<gfx::Path> path(mPath);
|
||||
return path.forget();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -194,6 +194,7 @@ WebGLContextOptions::WebGLContextOptions()
|
||||
, premultipliedAlpha(true)
|
||||
, antialias(true)
|
||||
, preserveDrawingBuffer(false)
|
||||
, failIfMajorPerformanceCaveat(false)
|
||||
{
|
||||
// Set default alpha state based on preference.
|
||||
if (Preferences::GetBool("webgl.default-no-alpha", false))
|
||||
@ -431,6 +432,7 @@ WebGLContext::SetContextOptions(JSContext* cx, JS::Handle<JS::Value> options)
|
||||
newOpts.premultipliedAlpha = attributes.mPremultipliedAlpha;
|
||||
newOpts.antialias = attributes.mAntialias;
|
||||
newOpts.preserveDrawingBuffer = attributes.mPreserveDrawingBuffer;
|
||||
newOpts.failIfMajorPerformanceCaveat = attributes.mFailIfMajorPerformanceCaveat;
|
||||
|
||||
if (attributes.mAlpha.WasPassed())
|
||||
newOpts.alpha = attributes.mAlpha.Value();
|
||||
@ -500,6 +502,30 @@ IsFeatureInBlacklist(const nsCOMPtr<nsIGfxInfo>& gfxInfo, int32_t feature)
|
||||
return status != nsIGfxInfo::FEATURE_STATUS_OK;
|
||||
}
|
||||
|
||||
static bool
|
||||
HasAcceleratedLayers(const nsCOMPtr<nsIGfxInfo>& gfxInfo)
|
||||
{
|
||||
int32_t status;
|
||||
|
||||
gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS, &status);
|
||||
if (status)
|
||||
return true;
|
||||
gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_10_LAYERS, &status);
|
||||
if (status)
|
||||
return true;
|
||||
gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_10_1_LAYERS, &status);
|
||||
if (status)
|
||||
return true;
|
||||
gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS, &status);
|
||||
if (status)
|
||||
return true;
|
||||
gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_OPENGL_LAYERS, &status);
|
||||
if (status)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static already_AddRefed<GLContext>
|
||||
CreateHeadlessNativeGL(bool forceEnabled, const nsCOMPtr<nsIGfxInfo>& gfxInfo,
|
||||
bool requireCompatProfile, WebGLContext* webgl)
|
||||
@ -569,7 +595,6 @@ CreateHeadlessEGL(bool forceEnabled, bool requireCompatProfile,
|
||||
return gl.forget();
|
||||
}
|
||||
|
||||
|
||||
static already_AddRefed<GLContext>
|
||||
CreateHeadlessGL(bool forceEnabled, const nsCOMPtr<nsIGfxInfo>& gfxInfo,
|
||||
WebGLContext* webgl)
|
||||
@ -873,6 +898,18 @@ WebGLContext::SetDimensions(int32_t signedWidth, int32_t signedHeight)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
|
||||
bool failIfMajorPerformanceCaveat =
|
||||
!gfxPrefs::WebGLDisableFailIfMajorPerformanceCaveat() &&
|
||||
!HasAcceleratedLayers(gfxInfo);
|
||||
if (failIfMajorPerformanceCaveat) {
|
||||
Nullable<dom::WebGLContextAttributes> contextAttributes;
|
||||
this->GetContextAttributes(contextAttributes);
|
||||
if (contextAttributes.Value().mFailIfMajorPerformanceCaveat) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
// Alright, now let's start trying.
|
||||
bool forceEnabled = Preferences::GetBool("webgl.force-enabled", false);
|
||||
ScopedGfxFeatureReporter reporter("WebGL", forceEnabled);
|
||||
@ -1255,6 +1292,7 @@ WebGLContext::GetContextAttributes(Nullable<dom::WebGLContextAttributes>& retval
|
||||
result.mAntialias = mOptions.antialias;
|
||||
result.mPremultipliedAlpha = mOptions.premultipliedAlpha;
|
||||
result.mPreserveDrawingBuffer = mOptions.preserveDrawingBuffer;
|
||||
result.mFailIfMajorPerformanceCaveat = mOptions.failIfMajorPerformanceCaveat;
|
||||
}
|
||||
|
||||
/* [noscript] DOMString mozGetUnderlyingParamString(in GLenum pname); */
|
||||
|
@ -128,6 +128,7 @@ struct WebGLContextOptions
|
||||
bool premultipliedAlpha;
|
||||
bool antialias;
|
||||
bool preserveDrawingBuffer;
|
||||
bool failIfMajorPerformanceCaveat;
|
||||
};
|
||||
|
||||
// From WebGLContextUtils
|
||||
|
@ -201,7 +201,7 @@ IMEStateManager::Init()
|
||||
void
|
||||
IMEStateManager::Shutdown()
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::Shutdown(), "
|
||||
"sTextCompositions=0x%p, sTextCompositions->Length()=%u",
|
||||
sTextCompositions, sTextCompositions ? sTextCompositions->Length() : 0));
|
||||
@ -222,7 +222,7 @@ IMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext)
|
||||
TextCompositionArray::index_type i =
|
||||
sTextCompositions->IndexOf(aPresContext);
|
||||
if (i != TextCompositionArray::NoIndex) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnDestroyPresContext(), "
|
||||
"removing TextComposition instance from the array (index=%u)", i));
|
||||
// there should be only one composition per presContext object.
|
||||
@ -230,7 +230,7 @@ IMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext)
|
||||
sTextCompositions->RemoveElementAt(i);
|
||||
if (sTextCompositions->IndexOf(aPresContext) !=
|
||||
TextCompositionArray::NoIndex) {
|
||||
PR_LOG(sISMLog, PR_LOG_ERROR,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ERROR,
|
||||
("ISM: IMEStateManager::OnDestroyPresContext(), FAILED to remove "
|
||||
"TextComposition instance from the array"));
|
||||
MOZ_CRASH("Failed to remove TextComposition instance from the array");
|
||||
@ -242,7 +242,7 @@ IMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnDestroyPresContext(aPresContext=0x%p), "
|
||||
"sPresContext=0x%p, sContent=0x%p, sTextCompositions=0x%p",
|
||||
aPresContext, sPresContext, sContent, sTextCompositions));
|
||||
@ -274,7 +274,7 @@ IMEStateManager::OnRemoveContent(nsPresContext* aPresContext,
|
||||
sTextCompositions->GetCompositionInContent(aPresContext, aContent);
|
||||
|
||||
if (compositionInContent) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnRemoveContent(), "
|
||||
"composition is in the content"));
|
||||
|
||||
@ -297,7 +297,7 @@ IMEStateManager::OnRemoveContent(nsPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnRemoveContent(aPresContext=0x%p, "
|
||||
"aContent=0x%p), sPresContext=0x%p, sContent=0x%p, sTextCompositions=0x%p",
|
||||
aPresContext, aContent, sPresContext, sContent, sTextCompositions));
|
||||
@ -325,7 +325,7 @@ IMEStateManager::OnChangeFocus(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
InputContextAction::Cause aCause)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnChangeFocus(aPresContext=0x%p, "
|
||||
"aContent=0x%p, aCause=%s)",
|
||||
aPresContext, aContent, GetActionCauseName(aCause)));
|
||||
@ -340,7 +340,7 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
InputContextAction aAction)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnChangeFocusInternal(aPresContext=0x%p, "
|
||||
"aContent=0x%p, aAction={ mCause=%s, mFocusChange=%s }), "
|
||||
"sPresContext=0x%p, sContent=0x%p, sActiveIMEContentObserver=0x%p",
|
||||
@ -368,7 +368,7 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
if (!aPresContext) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnChangeFocusInternal(), "
|
||||
"no nsPresContext is being activated"));
|
||||
return NS_OK;
|
||||
@ -378,7 +378,7 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
|
||||
(sPresContext == aPresContext) ? oldWidget.get() :
|
||||
aPresContext->GetRootWidget();
|
||||
if (NS_WARN_IF(!widget)) {
|
||||
PR_LOG(sISMLog, PR_LOG_ERROR,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ERROR,
|
||||
("ISM: IMEStateManager::OnChangeFocusInternal(), FAILED due to "
|
||||
"no widget to manage its IME state"));
|
||||
return NS_OK;
|
||||
@ -396,7 +396,7 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
|
||||
// on focus to the main process... but this cannot cause bugs like missed keypresses.
|
||||
// (It just means a lot of needless IPC.)
|
||||
if ((newState.mEnabled == IMEState::DISABLED) && TabParent::GetIMETabParent()) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnChangeFocusInternal(), "
|
||||
"Parent process cancels to set DISABLED state because the content process "
|
||||
"has IME focus and has already sets IME state"));
|
||||
@ -411,7 +411,7 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
|
||||
// we should do it.
|
||||
InputContext context = widget->GetInputContext();
|
||||
if (context.mIMEState.mEnabled == newState.mEnabled) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnChangeFocusInternal(), "
|
||||
"neither focus nor IME state is changing"));
|
||||
return NS_OK;
|
||||
@ -450,7 +450,7 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
|
||||
void
|
||||
IMEStateManager::OnInstalledMenuKeyboardListener(bool aInstalling)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnInstalledMenuKeyboardListener(aInstalling=%s), "
|
||||
"sInstalledMenuKeyboardListener=%s",
|
||||
GetBoolName(aInstalling), GetBoolName(sInstalledMenuKeyboardListener)));
|
||||
@ -469,27 +469,27 @@ IMEStateManager::OnMouseButtonEventInEditor(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIDOMMouseEvent* aMouseEvent)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnMouseButtonEventInEditor(aPresContext=0x%p, "
|
||||
"aContent=0x%p, aMouseEvent=0x%p), sPresContext=0x%p, sContent=0x%p",
|
||||
aPresContext, aContent, aMouseEvent, sPresContext, sContent));
|
||||
|
||||
if (sPresContext != aPresContext || sContent != aContent) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnMouseButtonEventInEditor(), "
|
||||
"the mouse event isn't fired on the editor managed by ISM"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sActiveIMEContentObserver) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnMouseButtonEventInEditor(), "
|
||||
"there is no active IMEContentObserver"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sActiveIMEContentObserver->IsManaging(aPresContext, aContent)) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnMouseButtonEventInEditor(), "
|
||||
"the active IMEContentObserver isn't managing the editor"));
|
||||
return false;
|
||||
@ -498,7 +498,7 @@ IMEStateManager::OnMouseButtonEventInEditor(nsPresContext* aPresContext,
|
||||
WidgetMouseEvent* internalEvent =
|
||||
aMouseEvent->GetInternalNSEvent()->AsMouseEvent();
|
||||
if (NS_WARN_IF(!internalEvent)) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnMouseButtonEventInEditor(), "
|
||||
"the internal event of aMouseEvent isn't WidgetMouseEvent"));
|
||||
return false;
|
||||
@ -510,7 +510,7 @@ IMEStateManager::OnMouseButtonEventInEditor(nsPresContext* aPresContext,
|
||||
if (PR_LOG_TEST(sISMLog, PR_LOG_ALWAYS)) {
|
||||
nsAutoString eventType;
|
||||
aMouseEvent->GetType(eventType);
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnMouseButtonEventInEditor(), "
|
||||
"mouse event (type=%s, button=%d) is %s",
|
||||
NS_ConvertUTF16toUTF8(eventType).get(), internalEvent->button,
|
||||
@ -526,13 +526,13 @@ IMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIDOMMouseEvent* aMouseEvent)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnClickInEditor(aPresContext=0x%p, aContent=0x%p, "
|
||||
"aMouseEvent=0x%p), sPresContext=0x%p, sContent=0x%p",
|
||||
aPresContext, aContent, aMouseEvent, sPresContext, sContent));
|
||||
|
||||
if (sPresContext != aPresContext || sContent != aContent) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnClickInEditor(), "
|
||||
"the mouse event isn't fired on the editor managed by ISM"));
|
||||
return;
|
||||
@ -545,7 +545,7 @@ IMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
|
||||
nsresult rv = aMouseEvent->GetIsTrusted(&isTrusted);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
if (!isTrusted) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnClickInEditor(), "
|
||||
"the mouse event isn't a trusted event"));
|
||||
return; // ignore untrusted event.
|
||||
@ -555,7 +555,7 @@ IMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
|
||||
rv = aMouseEvent->GetButton(&button);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
if (button != 0) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnClickInEditor(), "
|
||||
"the mouse event isn't a left mouse button event"));
|
||||
return; // not a left click event.
|
||||
@ -565,7 +565,7 @@ IMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
|
||||
rv = aMouseEvent->GetDetail(&clickCount);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
if (clickCount != 1) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnClickInEditor(), "
|
||||
"the mouse event isn't a single click event"));
|
||||
return; // should notify only first click event.
|
||||
@ -583,7 +583,7 @@ IMEStateManager::OnFocusInEditor(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIEditor* aEditor)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnFocusInEditor(aPresContext=0x%p, aContent=0x%p, "
|
||||
"aEditor=0x%p), sPresContext=0x%p, sContent=0x%p, "
|
||||
"sActiveIMEContentObserver=0x%p",
|
||||
@ -591,7 +591,7 @@ IMEStateManager::OnFocusInEditor(nsPresContext* aPresContext,
|
||||
sActiveIMEContentObserver));
|
||||
|
||||
if (sPresContext != aPresContext || sContent != aContent) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnFocusInEditor(), "
|
||||
"an editor not managed by ISM gets focus"));
|
||||
return;
|
||||
@ -601,7 +601,7 @@ IMEStateManager::OnFocusInEditor(nsPresContext* aPresContext,
|
||||
// we need to recreate the instance.
|
||||
if (sActiveIMEContentObserver) {
|
||||
if (sActiveIMEContentObserver->IsManaging(aPresContext, aContent)) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnFocusInEditor(), "
|
||||
"the editor is already being managed by sActiveIMEContentObserver"));
|
||||
return;
|
||||
@ -618,7 +618,7 @@ IMEStateManager::UpdateIMEState(const IMEState& aNewIMEState,
|
||||
nsIContent* aContent,
|
||||
nsIEditor* aEditor)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::UpdateIMEState(aNewIMEState={ mEnabled=%s, "
|
||||
"mOpen=%s }, aContent=0x%p, aEditor=0x%p), "
|
||||
"sPresContext=0x%p, sContent=0x%p, sActiveIMEContentObserver=0x%p, "
|
||||
@ -629,21 +629,21 @@ IMEStateManager::UpdateIMEState(const IMEState& aNewIMEState,
|
||||
GetBoolName(sIsGettingNewIMEState)));
|
||||
|
||||
if (sIsGettingNewIMEState) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::UpdateIMEState(), "
|
||||
"does nothing because of called while getting new IME state"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(!sPresContext)) {
|
||||
PR_LOG(sISMLog, PR_LOG_ERROR,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ERROR,
|
||||
("ISM: IMEStateManager::UpdateIMEState(), FAILED due to "
|
||||
"no managing nsPresContext"));
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIWidget> widget = sPresContext->GetRootWidget();
|
||||
if (NS_WARN_IF(!widget)) {
|
||||
PR_LOG(sISMLog, PR_LOG_ERROR,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ERROR,
|
||||
("ISM: IMEStateManager::UpdateIMEState(), FAILED due to "
|
||||
"no widget for the managing nsPresContext"));
|
||||
return;
|
||||
@ -684,7 +684,7 @@ IMEState
|
||||
IMEStateManager::GetNewIMEState(nsPresContext* aPresContext,
|
||||
nsIContent* aContent)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::GetNewIMEState(aPresContext=0x%p, aContent=0x%p), "
|
||||
"sInstalledMenuKeyboardListener=%s",
|
||||
aPresContext, aContent, GetBoolName(sInstalledMenuKeyboardListener)));
|
||||
@ -692,14 +692,14 @@ IMEStateManager::GetNewIMEState(nsPresContext* aPresContext,
|
||||
// On Printing or Print Preview, we don't need IME.
|
||||
if (aPresContext->Type() == nsPresContext::eContext_PrintPreview ||
|
||||
aPresContext->Type() == nsPresContext::eContext_Print) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::GetNewIMEState() returns DISABLED because "
|
||||
"the nsPresContext is for print or print preview"));
|
||||
return IMEState(IMEState::DISABLED);
|
||||
}
|
||||
|
||||
if (sInstalledMenuKeyboardListener) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::GetNewIMEState() returns DISABLED because "
|
||||
"menu keyboard listener was installed"));
|
||||
return IMEState(IMEState::DISABLED);
|
||||
@ -710,12 +710,12 @@ IMEStateManager::GetNewIMEState(nsPresContext* aPresContext,
|
||||
// editable, such case is design mode.
|
||||
nsIDocument* doc = aPresContext->Document();
|
||||
if (doc && doc->HasFlag(NODE_IS_EDITABLE)) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::GetNewIMEState() returns ENABLED because "
|
||||
"design mode editor has focus"));
|
||||
return IMEState(IMEState::ENABLED);
|
||||
}
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::GetNewIMEState() returns DISABLED because "
|
||||
"no content has focus"));
|
||||
return IMEState(IMEState::DISABLED);
|
||||
@ -729,7 +729,7 @@ IMEStateManager::GetNewIMEState(nsPresContext* aPresContext,
|
||||
GettingNewIMEStateBlocker blocker;
|
||||
|
||||
IMEState newIMEState = aContent->GetDesiredIMEState();
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::GetNewIMEState() returns { mEnabled=%s, "
|
||||
"mOpen=%s }",
|
||||
GetIMEStateEnabledName(newIMEState.mEnabled),
|
||||
@ -750,7 +750,7 @@ public:
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
services::GetObserverService();
|
||||
if (observerService) {
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEEnabledStateChangedEvent::Run(), notifies observers of "
|
||||
"\"ime-enabled-state-changed\""));
|
||||
nsAutoString state;
|
||||
@ -772,7 +772,7 @@ IMEStateManager::SetIMEState(const IMEState& aState,
|
||||
nsIWidget* aWidget,
|
||||
InputContextAction aAction)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::SetIMEState(aState={ mEnabled=%s, mOpen=%s }, "
|
||||
"aContent=0x%p, aWidget=0x%p, aAction={ mCause=%s, mFocusChange=%s })",
|
||||
GetIMEStateEnabledName(aState.mEnabled),
|
||||
@ -858,7 +858,7 @@ IMEStateManager::SetIMEState(const IMEState& aState,
|
||||
}
|
||||
|
||||
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::SetIMEState(), "
|
||||
"calling nsIWidget::SetInputContext(context={ mIMEState={ mEnabled=%s, "
|
||||
"mOpen=%s }, mHTMLInputType=\"%s\", mHTMLInputInputmode=\"%s\", "
|
||||
@ -900,7 +900,7 @@ IMEStateManager::DispatchCompositionEvent(
|
||||
EventDispatchingCallback* aCallBack,
|
||||
bool aIsSynthesized)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::DispatchCompositionEvent(aNode=0x%p, "
|
||||
"aPresContext=0x%p, aCompositionEvent={ message=%s, "
|
||||
"mFlags={ mIsTrusted=%s, mPropagationStopped=%s } }, "
|
||||
@ -929,7 +929,7 @@ IMEStateManager::DispatchCompositionEvent(
|
||||
if (NS_WARN_IF(aIsSynthesized)) {
|
||||
return;
|
||||
}
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::DispatchCompositionEvent(), "
|
||||
"adding new TextComposition to the array"));
|
||||
MOZ_ASSERT(aCompositionEvent->message == NS_COMPOSITION_START);
|
||||
@ -965,7 +965,7 @@ IMEStateManager::DispatchCompositionEvent(
|
||||
TextCompositionArray::index_type i =
|
||||
sTextCompositions->IndexOf(aCompositionEvent->widget);
|
||||
if (i != TextCompositionArray::NoIndex) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::DispatchCompositionEvent(), "
|
||||
"removing TextComposition from the array since NS_COMPOSTION_END "
|
||||
"was dispatched"));
|
||||
@ -983,7 +983,7 @@ IMEStateManager::OnCompositionEventDiscarded(
|
||||
// Note that this method is never called for synthesized events for emulating
|
||||
// commit or cancel composition.
|
||||
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnCompositionEventDiscarded(aCompositionEvent={ "
|
||||
"message=%s, mFlags={ mIsTrusted=%s } })",
|
||||
GetEventMessageName(aCompositionEvent->message),
|
||||
@ -1006,7 +1006,7 @@ IMEStateManager::OnCompositionEventDiscarded(
|
||||
// a TextComposition instance for the composition was already removed from
|
||||
// the array and destroyed in OnDestroyPresContext(). Therefore, we may
|
||||
// fail to retrieve a TextComposition instance here.
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnCompositionEventDiscarded(), "
|
||||
"TextComposition instance for the widget has already gone"));
|
||||
return;
|
||||
@ -1027,14 +1027,14 @@ IMEStateManager::NotifyIME(IMEMessage aMessage,
|
||||
bool isSynthesizedForTests =
|
||||
composition && composition->IsSynthesizedForTests();
|
||||
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::NotifyIME(aMessage=%s, aWidget=0x%p), "
|
||||
"composition=0x%p, composition->IsSynthesizedForTests()=%s",
|
||||
GetNotifyIMEMessageName(aMessage), aWidget, composition.get(),
|
||||
GetBoolName(isSynthesizedForTests)));
|
||||
|
||||
if (NS_WARN_IF(!aWidget)) {
|
||||
PR_LOG(sISMLog, PR_LOG_ERROR,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ERROR,
|
||||
("ISM: IMEStateManager::NotifyIME(), FAILED due to no widget"));
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
@ -1062,7 +1062,7 @@ nsresult
|
||||
IMEStateManager::NotifyIME(IMEMessage aMessage,
|
||||
nsPresContext* aPresContext)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::NotifyIME(aMessage=%s, aPresContext=0x%p)",
|
||||
GetNotifyIMEMessageName(aMessage), aPresContext));
|
||||
|
||||
@ -1070,7 +1070,7 @@ IMEStateManager::NotifyIME(IMEMessage aMessage,
|
||||
|
||||
nsIWidget* widget = aPresContext->GetRootWidget();
|
||||
if (NS_WARN_IF(!widget)) {
|
||||
PR_LOG(sISMLog, PR_LOG_ERROR,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ERROR,
|
||||
("ISM: IMEStateManager::NotifyIME(), FAILED due to no widget for the "
|
||||
"nsPresContext"));
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
@ -1146,18 +1146,18 @@ IMEStateManager::IsEditableIMEState(nsIWidget* aWidget)
|
||||
void
|
||||
IMEStateManager::DestroyIMEContentObserver()
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::DestroyIMEContentObserver(), "
|
||||
"sActiveIMEContentObserver=0x%p",
|
||||
sActiveIMEContentObserver));
|
||||
|
||||
if (!sActiveIMEContentObserver) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::DestroyIMEContentObserver() does nothing"));
|
||||
return;
|
||||
}
|
||||
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::DestroyIMEContentObserver(), destroying "
|
||||
"the active IMEContentObserver..."));
|
||||
nsRefPtr<IMEContentObserver> tsm;
|
||||
@ -1169,7 +1169,7 @@ IMEStateManager::DestroyIMEContentObserver()
|
||||
void
|
||||
IMEStateManager::CreateIMEContentObserver(nsIEditor* aEditor)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::CreateIMEContentObserver(aEditor=0x%p), "
|
||||
"sPresContext=0x%p, sContent=0x%p, sActiveIMEContentObserver=0x%p, "
|
||||
"sActiveIMEContentObserver->IsManaging(sPresContext, sContent)=%s",
|
||||
@ -1178,7 +1178,7 @@ IMEStateManager::CreateIMEContentObserver(nsIEditor* aEditor)
|
||||
sActiveIMEContentObserver->IsManaging(sPresContext, sContent) : false)));
|
||||
|
||||
if (NS_WARN_IF(sActiveIMEContentObserver)) {
|
||||
PR_LOG(sISMLog, PR_LOG_ERROR,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ERROR,
|
||||
("ISM: IMEStateManager::CreateIMEContentObserver(), FAILED due to "
|
||||
"there is already an active IMEContentObserver"));
|
||||
MOZ_ASSERT(sActiveIMEContentObserver->IsManaging(sPresContext, sContent));
|
||||
@ -1187,7 +1187,7 @@ IMEStateManager::CreateIMEContentObserver(nsIEditor* aEditor)
|
||||
|
||||
nsCOMPtr<nsIWidget> widget = sPresContext->GetRootWidget();
|
||||
if (!widget) {
|
||||
PR_LOG(sISMLog, PR_LOG_ERROR,
|
||||
MOZ_LOG(sISMLog, PR_LOG_ERROR,
|
||||
("ISM: IMEStateManager::CreateIMEContentObserver(), FAILED due to "
|
||||
"there is a root widget for the nsPresContext"));
|
||||
return; // Sometimes, there are no widgets.
|
||||
@ -1195,7 +1195,7 @@ IMEStateManager::CreateIMEContentObserver(nsIEditor* aEditor)
|
||||
|
||||
// If it's not text ediable, we don't need to create IMEContentObserver.
|
||||
if (!IsEditableIMEState(widget)) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::CreateIMEContentObserver() doesn't create "
|
||||
"IMEContentObserver because of non-editable IME state"));
|
||||
return;
|
||||
@ -1207,7 +1207,7 @@ IMEStateManager::CreateIMEContentObserver(nsIEditor* aEditor)
|
||||
sInitializeIsTestingIME = false;
|
||||
}
|
||||
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::CreateIMEContentObserver() is creating an "
|
||||
"IMEContentObserver instance..."));
|
||||
sActiveIMEContentObserver = new IMEContentObserver();
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMStyleSheet.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsISpeculativeConnect.h"
|
||||
#include "nsIStyleSheet.h"
|
||||
#include "nsIStyleSheetLinkingElement.h"
|
||||
#include "nsIURL.h"
|
||||
@ -182,6 +181,8 @@ HTMLLinkElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
// be under a different xml:base, so forget the cached state now.
|
||||
Link::ResetLinkState(false, Link::ElementHasHref());
|
||||
|
||||
// If this is reinserted back into the document it will not be
|
||||
// from the parser.
|
||||
nsCOMPtr<nsIDocument> oldDoc = GetUncomposedDoc();
|
||||
|
||||
// Check for a ShadowRoot because link elements are inert in a
|
||||
@ -311,12 +312,11 @@ HTMLLinkElement::UpdatePreconnect()
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISpeculativeConnect>
|
||||
speculator(do_QueryInterface(nsContentUtils::GetIOService()));
|
||||
if (speculator) {
|
||||
nsIDocument *owner = OwnerDoc();
|
||||
if (owner) {
|
||||
nsCOMPtr<nsIURI> uri = GetHrefURI();
|
||||
if (uri) {
|
||||
speculator->SpeculativeConnect(uri, nullptr);
|
||||
owner->MaybePreconnect(uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,8 +94,8 @@
|
||||
|
||||
static PRLogModuleInfo* gMediaElementLog;
|
||||
static PRLogModuleInfo* gMediaElementEventsLog;
|
||||
#define LOG(type, msg) PR_LOG(gMediaElementLog, type, msg)
|
||||
#define LOG_EVENT(type, msg) PR_LOG(gMediaElementEventsLog, type, msg)
|
||||
#define LOG(type, msg) MOZ_LOG(gMediaElementLog, type, msg)
|
||||
#define LOG_EVENT(type, msg) MOZ_LOG(gMediaElementEventsLog, type, msg)
|
||||
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "nsVideoFrame.h"
|
||||
|
||||
static PRLogModuleInfo* gTrackElementLog;
|
||||
#define LOG(type, msg) PR_LOG(gTrackElementLog, type, msg)
|
||||
#define LOG(type, msg) MOZ_LOG(gTrackElementLog, type, msg)
|
||||
|
||||
// Replace the usual NS_IMPL_NS_NEW_HTML_ELEMENT(Track) so
|
||||
// we can return an UnknownElement instead when pref'd off.
|
||||
|
@ -8,7 +8,7 @@
|
||||
"use strict";
|
||||
|
||||
if (W3CTest.runner) {
|
||||
W3CTest.runner.requestLongerTimeout(2);
|
||||
W3CTest.runner.requestLongerTimeout(5);
|
||||
}
|
||||
|
||||
function testCollapse(range, point) {
|
||||
|
@ -101,7 +101,7 @@
|
||||
#endif
|
||||
|
||||
#define IDB_DEBUG_LOG(_args) \
|
||||
PR_LOG(IndexedDatabaseManager::GetLoggingModule(), \
|
||||
MOZ_LOG(IndexedDatabaseManager::GetLoggingModule(), \
|
||||
PR_LOG_DEBUG, \
|
||||
_args )
|
||||
|
||||
|
@ -297,7 +297,7 @@ LoggingHelper(bool aUseProfiler, const char* aFmt, ...)
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
PR_LOG(logModule, logLevel, ("%s", message.get()));
|
||||
MOZ_LOG(logModule, logLevel, ("%s", message.get()));
|
||||
|
||||
if (aUseProfiler) {
|
||||
PROFILER_MARKER(message.get());
|
||||
|
@ -20,7 +20,7 @@ interface nsIURI;
|
||||
|
||||
typedef unsigned short CSPDirective;
|
||||
|
||||
[scriptable, uuid(68434447-b816-4473-a731-efc4f6d59902)]
|
||||
[scriptable, uuid(459fe61a-203e-4460-9ced-352a9bd3aa71)]
|
||||
interface nsIContentSecurityPolicy : nsISerializable
|
||||
{
|
||||
/**
|
||||
@ -282,4 +282,9 @@ interface nsIContentSecurityPolicy : nsISerializable
|
||||
#define CSP_VIOLATION_TOPIC "csp-on-violate-policy"
|
||||
%}
|
||||
|
||||
/**
|
||||
* Returns the CSP in JSON notation.
|
||||
*/
|
||||
AString toJSON();
|
||||
|
||||
};
|
||||
|
@ -77,10 +77,10 @@
|
||||
return sLog;
|
||||
}
|
||||
# define LOG(fmt, ...) \
|
||||
PR_LOG(GetPPMLog(), PR_LOG_DEBUG, \
|
||||
MOZ_LOG(GetPPMLog(), PR_LOG_DEBUG, \
|
||||
("ProcessPriorityManager - " fmt, ##__VA_ARGS__))
|
||||
# define LOGP(fmt, ...) \
|
||||
PR_LOG(GetPPMLog(), PR_LOG_DEBUG, \
|
||||
MOZ_LOG(GetPPMLog(), PR_LOG_DEBUG, \
|
||||
("ProcessPriorityManager[%schild-id=%" PRIu64 ", pid=%d] - " fmt, \
|
||||
NameWithComma().get(), \
|
||||
static_cast<uint64_t>(ChildID()), Pid(), ##__VA_ARGS__))
|
||||
|
@ -2972,17 +2972,23 @@ TabChild::NotifyPainted()
|
||||
void
|
||||
TabChild::MakeVisible()
|
||||
{
|
||||
if (mWidget) {
|
||||
mWidget->Show(true);
|
||||
}
|
||||
CompositorChild* compositor = CompositorChild::Get();
|
||||
compositor->SendNotifyVisible(mLayersId);
|
||||
|
||||
if (mWidget) {
|
||||
mWidget->Show(true);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TabChild::MakeHidden()
|
||||
{
|
||||
if (mWidget) {
|
||||
mWidget->Show(false);
|
||||
}
|
||||
CompositorChild* compositor = CompositorChild::Get();
|
||||
compositor->SendNotifyHidden(mLayersId);
|
||||
|
||||
if (mWidget) {
|
||||
mWidget->Show(false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -3124,6 +3130,17 @@ TabChild::DidComposite(uint64_t aTransactionId)
|
||||
manager->DidComposite(aTransactionId);
|
||||
}
|
||||
|
||||
void
|
||||
TabChild::ClearCachedResources()
|
||||
{
|
||||
MOZ_ASSERT(mWidget);
|
||||
MOZ_ASSERT(mWidget->GetLayerManager());
|
||||
MOZ_ASSERT(mWidget->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT);
|
||||
|
||||
ClientLayerManager *manager = static_cast<ClientLayerManager*>(mWidget->GetLayerManager());
|
||||
manager->ClearCachedResources();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::OnShowTooltip(int32_t aXCoords, int32_t aYCoords, const char16_t *aTipText)
|
||||
{
|
||||
|
@ -475,6 +475,7 @@ public:
|
||||
static TabChild* GetFrom(uint64_t aLayersId);
|
||||
|
||||
void DidComposite(uint64_t aTransactionId);
|
||||
void ClearCachedResources();
|
||||
|
||||
static inline TabChild*
|
||||
GetFrom(nsIDOMWindow* aWindow)
|
||||
|
@ -14,11 +14,11 @@
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* .process(aManifest, aBaseURL, aMemberName, console);
|
||||
* .process(aManifest, aBaseURL, aMemberName);
|
||||
*
|
||||
*/
|
||||
/*exported EXPORTED_SYMBOLS */
|
||||
/*globals extractValue, Components*/
|
||||
/*exported EXPORTED_SYMBOLS*/
|
||||
/*globals Components*/
|
||||
'use strict';
|
||||
this.EXPORTED_SYMBOLS = ['ManifestImageObjectProcessor']; // jshint ignore:line
|
||||
const imports = {};
|
||||
@ -27,19 +27,15 @@ const {
|
||||
classes: Cc,
|
||||
interfaces: Ci
|
||||
} = Components;
|
||||
const scriptLoader = Cc['@mozilla.org/moz/jssubscript-loader;1']
|
||||
.getService(Ci.mozIJSSubScriptLoader);
|
||||
scriptLoader.loadSubScript(
|
||||
'resource://gre/modules/manifestValueExtractor.js',
|
||||
this); // jshint ignore:line
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
Cu.importGlobalProperties(['URL']);
|
||||
imports.netutil = Cc['@mozilla.org/network/util;1']
|
||||
.getService(Ci.nsINetUtil);
|
||||
imports.DOMUtils = Cc['@mozilla.org/inspector/dom-utils;1']
|
||||
.getService(Ci.inIDOMUtils);
|
||||
|
||||
function ManifestImageObjectProcessor() {}
|
||||
function ManifestImageObjectProcessor(aConsole, aExtractor) {
|
||||
this.console = aConsole;
|
||||
this.extractor = aExtractor;
|
||||
}
|
||||
|
||||
// Static getters
|
||||
Object.defineProperties(ManifestImageObjectProcessor, {
|
||||
@ -55,8 +51,8 @@ Object.defineProperties(ManifestImageObjectProcessor, {
|
||||
}
|
||||
});
|
||||
|
||||
ManifestImageObjectProcessor.process = function(
|
||||
aManifest, aBaseURL, aMemberName, console
|
||||
ManifestImageObjectProcessor.prototype.process = function(
|
||||
aManifest, aBaseURL, aMemberName
|
||||
) {
|
||||
const spec = {
|
||||
objectName: 'manifest',
|
||||
@ -65,8 +61,9 @@ ManifestImageObjectProcessor.process = function(
|
||||
expectedType: 'array',
|
||||
trim: false
|
||||
};
|
||||
const extractor = this.extractor;
|
||||
const images = [];
|
||||
const value = extractValue(spec, console);
|
||||
const value = extractor.extractValue(spec);
|
||||
if (Array.isArray(value)) {
|
||||
// Filter out images whose "src" is not useful.
|
||||
value.filter(item => !!processSrcMember(item, aBaseURL))
|
||||
@ -95,7 +92,7 @@ ManifestImageObjectProcessor.process = function(
|
||||
expectedType: 'string',
|
||||
trim: true
|
||||
};
|
||||
let value = extractValue(spec, console);
|
||||
let value = extractor.extractValue(spec);
|
||||
if (value) {
|
||||
value = imports.netutil.parseContentType(value, charset, hadCharset);
|
||||
}
|
||||
@ -117,7 +114,7 @@ ManifestImageObjectProcessor.process = function(
|
||||
expectedType: 'string',
|
||||
trim: false
|
||||
};
|
||||
const value = extractValue(spec, console);
|
||||
const value = extractor.extractValue(spec);
|
||||
let url;
|
||||
if (value && value.length) {
|
||||
try {
|
||||
@ -136,7 +133,7 @@ ManifestImageObjectProcessor.process = function(
|
||||
expectedType: 'string',
|
||||
trim: true
|
||||
};
|
||||
const value = extractValue(spec, console);
|
||||
const value = extractor.extractValue(spec);
|
||||
if (value) {
|
||||
// Split on whitespace and filter out invalid values.
|
||||
value.split(/\s+/)
|
||||
@ -171,15 +168,7 @@ ManifestImageObjectProcessor.process = function(
|
||||
expectedType: 'string',
|
||||
trim: true
|
||||
};
|
||||
const value = extractValue(spec, console);
|
||||
let color;
|
||||
if (imports.DOMUtils.isValidCSSColor(value)) {
|
||||
color = value;
|
||||
} else {
|
||||
const msg = `background_color: ${value} is not a valid CSS color.`;
|
||||
console.warn(msg);
|
||||
}
|
||||
return color;
|
||||
return extractor.extractColorValue(spec);
|
||||
}
|
||||
};
|
||||
this.ManifestImageObjectProcessor = ManifestImageObjectProcessor; // jshint ignore:line
|
||||
|
@ -21,29 +21,17 @@
|
||||
*/
|
||||
/*exported EXPORTED_SYMBOLS */
|
||||
/*JSLint options in comment below: */
|
||||
/*globals Components, XPCOMUtils, extractValue*/
|
||||
/*globals Components, XPCOMUtils*/
|
||||
'use strict';
|
||||
this.EXPORTED_SYMBOLS = ['ManifestProcessor']; // jshint ignore:line
|
||||
const imports = {};
|
||||
const {
|
||||
utils: Cu,
|
||||
classes: Cc,
|
||||
interfaces: Ci
|
||||
utils: Cu
|
||||
} = Components;
|
||||
const scriptLoader = Cc['@mozilla.org/moz/jssubscript-loader;1']
|
||||
.getService(Ci.mozIJSSubScriptLoader);
|
||||
//Add extractValue() helper to this context.
|
||||
scriptLoader.loadSubScript(
|
||||
'resource://gre/modules/manifestValueExtractor.js',
|
||||
this); // jshint ignore:line
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
Cu.importGlobalProperties(['URL']);
|
||||
XPCOMUtils.defineLazyModuleGetter(imports, 'Services',
|
||||
'resource://gre/modules/Services.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(imports, 'ManifestImageObjectProcessor',
|
||||
'resource://gre/modules/ManifestImageObjectProcessor.jsm');
|
||||
imports.netutil = Cc['@mozilla.org/network/util;1']
|
||||
.getService(Ci.nsINetUtil);
|
||||
const displayModes = new Set(['fullscreen', 'standalone', 'minimal-ui',
|
||||
'browser'
|
||||
]);
|
||||
@ -54,6 +42,13 @@ const orientationTypes = new Set(['any', 'natural', 'landscape', 'portrait',
|
||||
const {
|
||||
ConsoleAPI
|
||||
} = Cu.import('resource://gre/modules/devtools/Console.jsm');
|
||||
const {
|
||||
ManifestImageObjectProcessor: ImgObjProcessor
|
||||
} = Cu.import('resource://gre/modules/ManifestImageObjectProcessor.jsm');
|
||||
|
||||
const {
|
||||
ManifestValueExtractor
|
||||
} = Cu.import('resource://gre/modules/ManifestValueExtractor.jsm');
|
||||
|
||||
function ManifestProcessor() {}
|
||||
|
||||
@ -77,22 +72,22 @@ Object.defineProperties(ManifestProcessor, {
|
||||
});
|
||||
|
||||
ManifestProcessor.prototype = {
|
||||
// process method: processes JSON text into a clean manifest
|
||||
// process() method processes JSON text into a clean manifest
|
||||
// that conforms with the W3C specification. Takes an object
|
||||
// expecting the following dictionary items:
|
||||
// * aJsonText: the JSON string to be processed.
|
||||
// * aManifestURL: the URL of the manifest, to resolve URLs.
|
||||
// * aDocURL: the URL of the owner doc, for security checks.
|
||||
// * aDocURL: the URL of the owner doc, for security checks
|
||||
process({
|
||||
jsonText: aJsonText,
|
||||
manifestURL: aManifestURL,
|
||||
docURL: aDocURL
|
||||
}) {
|
||||
const manifestURL = new URL(aManifestURL);
|
||||
const docURL = new URL(aDocURL);
|
||||
const console = new ConsoleAPI({
|
||||
prefix: 'Web Manifest: '
|
||||
});
|
||||
const manifestURL = new URL(aManifestURL);
|
||||
const docURL = new URL(aDocURL);
|
||||
let rawManifest = {};
|
||||
try {
|
||||
rawManifest = JSON.parse(aJsonText);
|
||||
@ -102,18 +97,21 @@ ManifestProcessor.prototype = {
|
||||
console.warn(msg);
|
||||
rawManifest = {};
|
||||
}
|
||||
const extractor = new ManifestValueExtractor(console);
|
||||
const imgObjProcessor = new ImgObjProcessor(console, extractor);
|
||||
const processedManifest = {
|
||||
'start_url': processStartURLMember(rawManifest, manifestURL, docURL),
|
||||
'display': processDisplayMember(rawManifest),
|
||||
'orientation': processOrientationMember(rawManifest),
|
||||
'name': processNameMember(rawManifest),
|
||||
'icons': imports.ManifestImageObjectProcessor.process(
|
||||
rawManifest, manifestURL, 'icons', console
|
||||
'icons': imgObjProcessor.process(
|
||||
rawManifest, manifestURL, 'icons'
|
||||
),
|
||||
'splash_screens': imports.ManifestImageObjectProcessor.process(
|
||||
rawManifest, manifestURL, 'splash_screens', console
|
||||
'splash_screens': imgObjProcessor.process(
|
||||
rawManifest, manifestURL, 'splash_screens'
|
||||
),
|
||||
'short_name': processShortNameMember(rawManifest),
|
||||
'theme_color': processThemeColorMember(rawManifest),
|
||||
};
|
||||
processedManifest.scope = processScopeMember(rawManifest, manifestURL,
|
||||
docURL, new URL(processedManifest['start_url'])); // jshint ignore:line
|
||||
@ -128,7 +126,7 @@ ManifestProcessor.prototype = {
|
||||
expectedType: 'string',
|
||||
trim: true
|
||||
};
|
||||
return extractValue(spec, console);
|
||||
return extractor.extractValue(spec);
|
||||
}
|
||||
|
||||
function processShortNameMember(aManifest) {
|
||||
@ -139,7 +137,7 @@ ManifestProcessor.prototype = {
|
||||
expectedType: 'string',
|
||||
trim: true
|
||||
};
|
||||
return extractValue(spec, console);
|
||||
return extractor.extractValue(spec);
|
||||
}
|
||||
|
||||
function processOrientationMember(aManifest) {
|
||||
@ -150,7 +148,7 @@ ManifestProcessor.prototype = {
|
||||
expectedType: 'string',
|
||||
trim: true
|
||||
};
|
||||
const value = extractValue(spec, console);
|
||||
const value = extractor.extractValue(spec);
|
||||
if (ManifestProcessor.orientationTypes.has(value)) {
|
||||
return value;
|
||||
}
|
||||
@ -166,7 +164,7 @@ ManifestProcessor.prototype = {
|
||||
expectedType: 'string',
|
||||
trim: true
|
||||
};
|
||||
const value = extractValue(spec, console);
|
||||
const value = extractor.extractValue(spec);
|
||||
if (ManifestProcessor.displayModes.has(value)) {
|
||||
return value;
|
||||
}
|
||||
@ -182,7 +180,7 @@ ManifestProcessor.prototype = {
|
||||
trim: false
|
||||
};
|
||||
let scopeURL;
|
||||
const value = extractValue(spec, console);
|
||||
const value = extractor.extractValue(spec);
|
||||
if (value === undefined || value === '') {
|
||||
return undefined;
|
||||
}
|
||||
@ -218,7 +216,7 @@ ManifestProcessor.prototype = {
|
||||
trim: false
|
||||
};
|
||||
let result = new URL(aDocURL).href;
|
||||
const value = extractValue(spec, console);
|
||||
const value = extractor.extractValue(spec);
|
||||
if (value === undefined || value === '') {
|
||||
return result;
|
||||
}
|
||||
@ -237,6 +235,18 @@ ManifestProcessor.prototype = {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function processThemeColorMember(aManifest) {
|
||||
const spec = {
|
||||
objectName: 'manifest',
|
||||
object: aManifest,
|
||||
property: 'theme_color',
|
||||
expectedType: 'string',
|
||||
trim: true
|
||||
};
|
||||
return extractor.extractColorValue(spec);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.ManifestProcessor = ManifestProcessor; // jshint ignore:line
|
||||
|
68
dom/manifest/ManifestValueExtractor.jsm
Normal file
68
dom/manifest/ManifestValueExtractor.jsm
Normal file
@ -0,0 +1,68 @@
|
||||
/* 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 https://www.mozilla.org/MPL/2.0/. */
|
||||
/*
|
||||
* Helper functions extract values from manifest members
|
||||
* and reports conformance violations.
|
||||
*/
|
||||
/*globals Components*/
|
||||
'use strict';
|
||||
const imports = {};
|
||||
const {
|
||||
classes: Cc,
|
||||
interfaces: Ci
|
||||
} = Components;
|
||||
imports.DOMUtils = Cc['@mozilla.org/inspector/dom-utils;1']
|
||||
.getService(Ci.inIDOMUtils);
|
||||
|
||||
this.EXPORTED_SYMBOLS = ['ManifestValueExtractor']; // jshint ignore:line
|
||||
|
||||
function ManifestValueExtractor(aConsole) {
|
||||
this.console = aConsole;
|
||||
}
|
||||
|
||||
ManifestValueExtractor.prototype = {
|
||||
// This function takes a 'spec' object and destructures
|
||||
// it to extract a value. If the value is of th wrong type, it
|
||||
// warns the developer and returns undefined.
|
||||
// expectType: is the type of a JS primitive (string, number, etc.)
|
||||
// object: is the object from which to extract the value.
|
||||
// objectName: string used to construct the developer warning.
|
||||
// property: the name of the property being extracted.
|
||||
// trim: boolean, if the value should be trimmed (used by string type).
|
||||
extractValue({
|
||||
expectedType, object, objectName, property, trim
|
||||
}) {
|
||||
const value = object[property];
|
||||
const isArray = Array.isArray(value);
|
||||
// We need to special-case "array", as it's not a JS primitive.
|
||||
const type = (isArray) ? 'array' : typeof value;
|
||||
if (type !== expectedType) {
|
||||
if (type !== 'undefined') {
|
||||
let msg = `Expected the ${objectName}'s ${property} `;
|
||||
msg += `member to be a ${expectedType}.`;
|
||||
this.console.log(msg);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
// Trim string and returned undefined if the empty string.
|
||||
const shouldTrim = expectedType === 'string' && value && trim;
|
||||
if (shouldTrim) {
|
||||
return value.trim() || undefined;
|
||||
}
|
||||
return value;
|
||||
},
|
||||
extractColorValue(spec) {
|
||||
const value = this.extractValue(spec);
|
||||
let color;
|
||||
if (imports.DOMUtils.isValidCSSColor(value)) {
|
||||
color = value;
|
||||
} else {
|
||||
const msg = `background_color: ${value} is not a valid CSS color.`;
|
||||
this.console.warn(msg);
|
||||
}
|
||||
return color;
|
||||
}
|
||||
};
|
||||
|
||||
this.ManifestValueExtractor = ManifestValueExtractor; // jshint ignore:line
|
@ -1,34 +0,0 @@
|
||||
/* 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/. */
|
||||
/*
|
||||
* Helper function extracts values from manifest members
|
||||
* and reports conformance violations.
|
||||
*/
|
||||
|
||||
function extractValue({
|
||||
objectName,
|
||||
object,
|
||||
property,
|
||||
expectedType,
|
||||
trim
|
||||
}, console) {
|
||||
const value = object[property];
|
||||
const isArray = Array.isArray(value);
|
||||
// We need to special-case "array", as it's not a JS primitive.
|
||||
const type = (isArray) ? 'array' : typeof value;
|
||||
if (type !== expectedType) {
|
||||
if (type !== 'undefined') {
|
||||
let msg = `Expected the ${objectName}'s ${property} `;
|
||||
msg += `member to be a ${expectedType}.`;
|
||||
console.log(msg);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
// Trim string and returned undefined if the empty string.
|
||||
const shouldTrim = expectedType === 'string' && value && trim;
|
||||
if (shouldTrim) {
|
||||
return value.trim() || undefined;
|
||||
}
|
||||
return value;
|
||||
}
|
@ -8,7 +8,7 @@ EXTRA_JS_MODULES += [
|
||||
'ManifestImageObjectProcessor.jsm',
|
||||
'ManifestObtainer.jsm',
|
||||
'ManifestProcessor.jsm',
|
||||
'manifestValueExtractor.js'
|
||||
'ManifestValueExtractor.jsm'
|
||||
]
|
||||
|
||||
MOCHITEST_MANIFESTS += ['test/mochitest.ini']
|
||||
|
@ -12,9 +12,9 @@ namespace mozilla {
|
||||
|
||||
extern PRLogModuleInfo* gMediaDecoderLog;
|
||||
#define SINK_LOG(msg, ...) \
|
||||
PR_LOG(gMediaDecoderLog, PR_LOG_DEBUG, ("AudioSink=%p " msg, this, ##__VA_ARGS__))
|
||||
MOZ_LOG(gMediaDecoderLog, PR_LOG_DEBUG, ("AudioSink=%p " msg, this, ##__VA_ARGS__))
|
||||
#define SINK_LOG_V(msg, ...) \
|
||||
PR_LOG(gMediaDecoderLog, PR_LOG_DEBUG+1, ("AudioSink=%p " msg, this, ##__VA_ARGS__))
|
||||
MOZ_LOG(gMediaDecoderLog, PR_LOG_DEBUG+1, ("AudioSink=%p " msg, this, ##__VA_ARGS__))
|
||||
|
||||
AudioSink::OnAudioEndTimeUpdateTask::OnAudioEndTimeUpdateTask(
|
||||
MediaDecoderStateMachine* aStateMachine)
|
||||
@ -38,7 +38,8 @@ AudioSink::OnAudioEndTimeUpdateTask::Dispatch(int64_t aEndTime) {
|
||||
MutexAutoLock lock(mMutex);
|
||||
if (mStateMachine) {
|
||||
mEndTime = aEndTime;
|
||||
mStateMachine->TaskQueue()->Dispatch(this);
|
||||
nsRefPtr<AudioSink::OnAudioEndTimeUpdateTask> runnable(this);
|
||||
mStateMachine->TaskQueue()->Dispatch(runnable.forget());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace mozilla {
|
||||
|
||||
PRLogModuleInfo* gAudioStreamLog = nullptr;
|
||||
// For simple logs
|
||||
#define LOG(x) PR_LOG(gAudioStreamLog, PR_LOG_DEBUG, x)
|
||||
#define LOG(x) MOZ_LOG(gAudioStreamLog, PR_LOG_DEBUG, x)
|
||||
|
||||
/**
|
||||
* When MOZ_DUMP_AUDIO is set in the environment (to anything),
|
||||
@ -329,7 +329,7 @@ AudioStream::Init(int32_t aNumChannels, int32_t aRate,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PR_LOG(gAudioStreamLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gAudioStreamLog, PR_LOG_DEBUG,
|
||||
("%s channels: %d, rate: %d for %p", __FUNCTION__, aNumChannels, aRate, this));
|
||||
mInRate = mOutRate = aRate;
|
||||
mChannels = aNumChannels;
|
||||
@ -546,12 +546,12 @@ AudioStream::CheckForStart()
|
||||
if (mLatencyRequest == LowLatency || mNeedsStart) {
|
||||
StartUnlocked(); // mState = STARTED or ERRORED
|
||||
mNeedsStart = false;
|
||||
PR_LOG(gAudioStreamLog, PR_LOG_WARNING,
|
||||
MOZ_LOG(gAudioStreamLog, PR_LOG_WARNING,
|
||||
("Started waiting %s-latency stream",
|
||||
mLatencyRequest == LowLatency ? "low" : "high"));
|
||||
} else {
|
||||
// high latency, not full - OR Pause() was called before we got here
|
||||
PR_LOG(gAudioStreamLog, PR_LOG_DEBUG,
|
||||
MOZ_LOG(gAudioStreamLog, PR_LOG_DEBUG,
|
||||
("Not starting waiting %s-latency stream",
|
||||
mLatencyRequest == LowLatency ? "low" : "high"));
|
||||
}
|
||||
@ -644,7 +644,7 @@ AudioStream::Write(const AudioDataValue* aBuf, uint32_t aFrames, TimeStamp *aTim
|
||||
remains = mBuffer.Length() - bytesToCopy; // Free up just enough space
|
||||
}
|
||||
// account for dropping samples
|
||||
PR_LOG(gAudioStreamLog, PR_LOG_WARNING, ("Stream %p dropping %u bytes (%u frames)in Write()",
|
||||
MOZ_LOG(gAudioStreamLog, PR_LOG_WARNING, ("Stream %p dropping %u bytes (%u frames)in Write()",
|
||||
this, mBuffer.Length() - remains, BytesToFrames(mBuffer.Length() - remains)));
|
||||
mReadPoint += BytesToFrames(mBuffer.Length() - remains);
|
||||
mBuffer.ContractTo(remains);
|
||||
@ -652,14 +652,14 @@ AudioStream::Write(const AudioDataValue* aBuf, uint32_t aFrames, TimeStamp *aTim
|
||||
// If we are not playing, but our buffer is full, start playing to make
|
||||
// room for soon-to-be-decoded data.
|
||||
if (mState != STARTED && mState != RUNNING) {
|
||||
PR_LOG(gAudioStreamLog, PR_LOG_WARNING, ("Starting stream %p in Write (%u waiting)",
|
||||
MOZ_LOG(gAudioStreamLog, PR_LOG_WARNING, ("Starting stream %p in Write (%u waiting)",
|
||||
this, bytesToCopy));
|
||||
StartUnlocked();
|
||||
if (mState == ERRORED) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
PR_LOG(gAudioStreamLog, PR_LOG_WARNING, ("Stream %p waiting in Write() (%u waiting)",
|
||||
MOZ_LOG(gAudioStreamLog, PR_LOG_WARNING, ("Stream %p waiting in Write() (%u waiting)",
|
||||
this, bytesToCopy));
|
||||
mon.Wait();
|
||||
}
|
||||
@ -1072,16 +1072,16 @@ AudioStream::DataCallback(void* aBuffer, long aFrames)
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
if (!mStartTime.IsNull()) {
|
||||
int64_t timeMs = (now - mStartTime).ToMilliseconds();
|
||||
PR_LOG(gAudioStreamLog, PR_LOG_WARNING,
|
||||
MOZ_LOG(gAudioStreamLog, PR_LOG_WARNING,
|
||||
("Stream took %lldms to start after first Write() @ %u", timeMs, mOutRate));
|
||||
} else {
|
||||
PR_LOG(gAudioStreamLog, PR_LOG_WARNING,
|
||||
MOZ_LOG(gAudioStreamLog, PR_LOG_WARNING,
|
||||
("Stream started before Write() @ %u", mOutRate));
|
||||
}
|
||||
|
||||
if (old_len != available) {
|
||||
// Note that we may have dropped samples in Write() as well!
|
||||
PR_LOG(gAudioStreamLog, PR_LOG_WARNING,
|
||||
MOZ_LOG(gAudioStreamLog, PR_LOG_WARNING,
|
||||
("AudioStream %p dropped %u + %u initial frames @ %u", this,
|
||||
mReadPoint, BytesToFrames(old_len - available), mOutRate));
|
||||
mReadPoint += BytesToFrames(old_len - available);
|
||||
@ -1122,7 +1122,7 @@ AudioStream::DataCallback(void* aBuffer, long aFrames)
|
||||
uint8_t* rpos = static_cast<uint8_t*>(aBuffer) + FramesToBytes(aFrames - underrunFrames);
|
||||
memset(rpos, 0, FramesToBytes(underrunFrames));
|
||||
if (underrunFrames) {
|
||||
PR_LOG(gAudioStreamLog, PR_LOG_WARNING,
|
||||
MOZ_LOG(gAudioStreamLog, PR_LOG_WARNING,
|
||||
("AudioStream %p lost %d frames", this, underrunFrames));
|
||||
}
|
||||
servicedFrames += underrunFrames;
|
||||
|
@ -11,7 +11,7 @@
|
||||
#endif
|
||||
|
||||
extern PRLogModuleInfo* gMediaStreamGraphLog;
|
||||
#define STREAM_LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg)
|
||||
#define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg)
|
||||
|
||||
// We don't use NSPR log here because we want this interleaved with adb logcat
|
||||
// on Android/B2G
|
||||
@ -319,7 +319,7 @@ SystemClockDriver::GetIntervalForIteration(GraphTime& aFrom, GraphTime& aTo)
|
||||
|
||||
mCurrentTimeStamp = now;
|
||||
|
||||
PR_LOG(gMediaStreamGraphLog, PR_LOG_DEBUG+1, ("Updating current time to %f (real %f, mStateComputedTime %f)",
|
||||
MOZ_LOG(gMediaStreamGraphLog, PR_LOG_DEBUG+1, ("Updating current time to %f (real %f, mStateComputedTime %f)",
|
||||
mGraphImpl->MediaTimeToSeconds(aTo),
|
||||
(now - mInitialTimeStamp).ToSeconds(),
|
||||
mGraphImpl->MediaTimeToSeconds(StateComputedTime())));
|
||||
|
@ -191,11 +191,11 @@ void AsyncLatencyLogger::WriteLog(LatencyLogIndex aIndex, uint64_t aID, int64_t
|
||||
TimeStamp aTimeStamp)
|
||||
{
|
||||
if (aTimeStamp.IsNull()) {
|
||||
PR_LOG(GetLatencyLog(), PR_LOG_DEBUG,
|
||||
MOZ_LOG(GetLatencyLog(), PR_LOG_DEBUG,
|
||||
("Latency: %s,%llu,%lld,%lld",
|
||||
LatencyLogIndex2Strings[aIndex], aID, GetTimeStamp(), aValue));
|
||||
} else {
|
||||
PR_LOG(GetLatencyLog(), PR_LOG_DEBUG,
|
||||
MOZ_LOG(GetLatencyLog(), PR_LOG_DEBUG,
|
||||
("Latency: %s,%llu,%lld,%lld,%lld",
|
||||
LatencyLogIndex2Strings[aIndex], aID, GetTimeStamp(), aValue,
|
||||
static_cast<int64_t>((aTimeStamp - gAsyncLogger->mStart).ToMilliseconds())));
|
||||
|
@ -25,7 +25,7 @@
|
||||
namespace mozilla {
|
||||
|
||||
PRLogModuleInfo* gMediaCacheLog;
|
||||
#define CACHE_LOG(type, msg) PR_LOG(gMediaCacheLog, type, msg)
|
||||
#define CACHE_LOG(type, msg) MOZ_LOG(gMediaCacheLog, type, msg)
|
||||
|
||||
// Readahead blocks for non-seekable streams will be limited to this
|
||||
// fraction of the cache space. We don't normally evict such blocks
|
||||
|
@ -53,7 +53,7 @@ static const int64_t CAN_PLAY_THROUGH_MARGIN = 1;
|
||||
|
||||
PRLogModuleInfo* gMediaDecoderLog;
|
||||
#define DECODER_LOG(x, ...) \
|
||||
PR_LOG(gMediaDecoderLog, PR_LOG_DEBUG, ("Decoder=%p " x, this, ##__VA_ARGS__))
|
||||
MOZ_LOG(gMediaDecoderLog, PR_LOG_DEBUG, ("Decoder=%p " x, this, ##__VA_ARGS__))
|
||||
|
||||
static const char* const gPlayStateStr[] = {
|
||||
"START",
|
||||
@ -209,7 +209,7 @@ void MediaDecoder::UpdateDormantState(bool aDormantTimeout, bool aActivity)
|
||||
mDecoderStateMachine,
|
||||
&MediaDecoderStateMachine::SetDormant,
|
||||
true);
|
||||
mDecoderStateMachine->TaskQueue()->Dispatch(event);
|
||||
mDecoderStateMachine->TaskQueue()->Dispatch(event.forget());
|
||||
|
||||
if (IsEnded()) {
|
||||
mWasEndedWhenEnteredDormant = true;
|
||||
@ -225,7 +225,7 @@ void MediaDecoder::UpdateDormantState(bool aDormantTimeout, bool aActivity)
|
||||
mDecoderStateMachine,
|
||||
&MediaDecoderStateMachine::SetDormant,
|
||||
false);
|
||||
mDecoderStateMachine->TaskQueue()->Dispatch(event);
|
||||
mDecoderStateMachine->TaskQueue()->Dispatch(event.forget());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace mozilla {
|
||||
|
||||
extern PRLogModuleInfo* gMediaDecoderLog;
|
||||
#define DECODER_LOG(x, ...) \
|
||||
PR_LOG(gMediaDecoderLog, PR_LOG_DEBUG, ("Decoder=%p " x, mDecoder, ##__VA_ARGS__))
|
||||
MOZ_LOG(gMediaDecoderLog, PR_LOG_DEBUG, ("Decoder=%p " x, mDecoder, ##__VA_ARGS__))
|
||||
|
||||
// Same workaround as MediaDecoderStateMachine.cpp.
|
||||
#define DECODER_WARN_HELPER(a, b) NS_WARNING b
|
||||
@ -277,7 +277,7 @@ MediaDecoderReader::RequestVideoData(bool aSkipToNextKeyframe,
|
||||
// again. We don't just decode straight in a loop here, as that
|
||||
// would hog the decode task queue.
|
||||
RefPtr<nsIRunnable> task(new ReRequestVideoWithSkipTask(this, aTimeThreshold));
|
||||
mTaskQueue->Dispatch(task);
|
||||
mTaskQueue->Dispatch(task.forget());
|
||||
return p;
|
||||
}
|
||||
}
|
||||
@ -313,7 +313,7 @@ MediaDecoderReader::RequestAudioData()
|
||||
// consumed. (|mVideoSinkBufferCount| > 0)
|
||||
if (AudioQueue().GetSize() == 0 && mTaskQueue) {
|
||||
RefPtr<nsIRunnable> task(new ReRequestAudioTask(this));
|
||||
mTaskQueue->Dispatch(task);
|
||||
mTaskQueue->Dispatch(task.forget());
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ using namespace mozilla::gfx;
|
||||
extern PRLogModuleInfo* gMediaDecoderLog;
|
||||
extern PRLogModuleInfo* gMediaSampleLog;
|
||||
#define LOG(m, l, x, ...) \
|
||||
PR_LOG(m, l, ("Decoder=%p " x, mDecoder.get(), ##__VA_ARGS__))
|
||||
MOZ_LOG(m, l, ("Decoder=%p " x, mDecoder.get(), ##__VA_ARGS__))
|
||||
#define DECODER_LOG(x, ...) \
|
||||
LOG(gMediaDecoderLog, PR_LOG_DEBUG, x, ##__VA_ARGS__)
|
||||
#define VERBOSE_LOG(x, ...) \
|
||||
|
@ -176,7 +176,9 @@ public:
|
||||
|
||||
void DispatchShutdown()
|
||||
{
|
||||
TaskQueue()->Dispatch(NS_NewRunnableMethod(this, &MediaDecoderStateMachine::Shutdown));
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &MediaDecoderStateMachine::Shutdown);
|
||||
TaskQueue()->Dispatch(runnable.forget());
|
||||
}
|
||||
|
||||
void FinishShutdown();
|
||||
@ -243,7 +245,9 @@ public:
|
||||
|
||||
void DispatchStartBuffering()
|
||||
{
|
||||
TaskQueue()->Dispatch(NS_NewRunnableMethod(this, &MediaDecoderStateMachine::StartBuffering));
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &MediaDecoderStateMachine::StartBuffering);
|
||||
TaskQueue()->Dispatch(runnable.forget());
|
||||
}
|
||||
|
||||
// This is called on the state machine thread and audio thread.
|
||||
@ -745,7 +749,9 @@ private:
|
||||
public:
|
||||
void DispatchOnAudioSinkComplete()
|
||||
{
|
||||
TaskQueue()->Dispatch(NS_NewRunnableMethod(this, &MediaDecoderStateMachine::OnAudioSinkComplete));
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &MediaDecoderStateMachine::OnAudioSinkComplete);
|
||||
TaskQueue()->Dispatch(runnable.forget());
|
||||
}
|
||||
|
||||
// Called by the AudioSink to signal errors.
|
||||
@ -753,7 +759,9 @@ public:
|
||||
|
||||
void DispatchOnAudioSinkError()
|
||||
{
|
||||
TaskQueue()->Dispatch(NS_NewRunnableMethod(this, &MediaDecoderStateMachine::OnAudioSinkError));
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &MediaDecoderStateMachine::OnAudioSinkError);
|
||||
TaskQueue()->Dispatch(runnable.forget());
|
||||
}
|
||||
|
||||
// Return true if the video decoder's decode speed can not catch up the
|
||||
|
@ -35,8 +35,8 @@ PRLogModuleInfo* GetFormatDecoderLog() {
|
||||
}
|
||||
return log;
|
||||
}
|
||||
#define LOG(arg, ...) PR_LOG(GetFormatDecoderLog(), PR_LOG_DEBUG, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
|
||||
#define LOGV(arg, ...) PR_LOG(GetFormatDecoderLog(), PR_LOG_DEBUG+1, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
|
||||
#define LOG(arg, ...) MOZ_LOG(GetFormatDecoderLog(), PR_LOG_DEBUG, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
|
||||
#define LOGV(arg, ...) MOZ_LOG(GetFormatDecoderLog(), PR_LOG_DEBUG+1, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -1017,7 +1017,7 @@ MediaFormatReader::Output(TrackType aTrack, MediaData* aSample)
|
||||
RefPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethodWithArgs<TrackType, StorensRefPtrPassByPtr<MediaData>>(
|
||||
this, &MediaFormatReader::NotifyNewOutput, aTrack, aSample);
|
||||
GetTaskQueue()->Dispatch(task);
|
||||
GetTaskQueue()->Dispatch(task.forget());
|
||||
}
|
||||
|
||||
void
|
||||
@ -1026,7 +1026,7 @@ MediaFormatReader::DrainComplete(TrackType aTrack)
|
||||
RefPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethodWithArg<TrackType>(
|
||||
this, &MediaFormatReader::NotifyDrainComplete, aTrack);
|
||||
GetTaskQueue()->Dispatch(task);
|
||||
GetTaskQueue()->Dispatch(task.forget());
|
||||
}
|
||||
|
||||
void
|
||||
@ -1035,7 +1035,7 @@ MediaFormatReader::InputExhausted(TrackType aTrack)
|
||||
RefPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethodWithArg<TrackType>(
|
||||
this, &MediaFormatReader::NotifyInputExhausted, aTrack);
|
||||
GetTaskQueue()->Dispatch(task);
|
||||
GetTaskQueue()->Dispatch(task.forget());
|
||||
}
|
||||
|
||||
void
|
||||
@ -1044,7 +1044,7 @@ MediaFormatReader::Error(TrackType aTrack)
|
||||
RefPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethodWithArg<TrackType>(
|
||||
this, &MediaFormatReader::NotifyError, aTrack);
|
||||
GetTaskQueue()->Dispatch(task);
|
||||
GetTaskQueue()->Dispatch(task.forget());
|
||||
}
|
||||
|
||||
void
|
||||
@ -1362,7 +1362,7 @@ MediaFormatReader::NotifyDataArrived(const char* aBuffer, uint32_t aLength, int6
|
||||
NS_NewRunnableMethodWithArgs<int32_t, uint64_t>(
|
||||
this, &MediaFormatReader::NotifyDemuxer,
|
||||
aLength, aOffset);
|
||||
GetTaskQueue()->Dispatch(task);
|
||||
GetTaskQueue()->Dispatch(task.forget());
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -111,7 +111,7 @@ GetMediaManagerLog()
|
||||
sLog = PR_NewLogModule("MediaManager");
|
||||
return sLog;
|
||||
}
|
||||
#define LOG(msg) PR_LOG(GetMediaManagerLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(msg) MOZ_LOG(GetMediaManagerLog(), PR_LOG_DEBUG, msg)
|
||||
|
||||
using dom::File;
|
||||
using dom::MediaStreamConstraints;
|
||||
@ -2242,7 +2242,7 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
// cleared until the lambda function clears it.
|
||||
|
||||
MediaManager::GetMessageLoop()->PostTask(FROM_HERE, new ShutdownTask(
|
||||
media::CallbackRunnable::New([this]() mutable {
|
||||
media::NewRunnableFrom([this]() mutable {
|
||||
// Close off any remaining active windows.
|
||||
MutexAutoLock lock(mMutex);
|
||||
GetActiveWindows()->Clear();
|
||||
|
@ -49,7 +49,7 @@ struct MediaTrackConstraintSet;
|
||||
}
|
||||
|
||||
extern PRLogModuleInfo* GetMediaManagerLog();
|
||||
#define MM_LOG(msg) PR_LOG(GetMediaManagerLog(), PR_LOG_DEBUG, msg)
|
||||
#define MM_LOG(msg) MOZ_LOG(GetMediaManagerLog(), PR_LOG_DEBUG, msg)
|
||||
|
||||
/**
|
||||
* This class is an implementation of MediaStreamListener. This is used
|
||||
|
@ -31,7 +31,7 @@ extern PRLogModuleInfo* gMediaPromiseLog;
|
||||
|
||||
#define PROMISE_LOG(x, ...) \
|
||||
MOZ_ASSERT(gMediaPromiseLog); \
|
||||
PR_LOG(gMediaPromiseLog, PR_LOG_DEBUG, (x, ##__VA_ARGS__))
|
||||
MOZ_LOG(gMediaPromiseLog, PR_LOG_DEBUG, (x, ##__VA_ARGS__))
|
||||
|
||||
/*
|
||||
* A promise manages an asynchronous request that may or may not be able to be
|
||||
|
@ -32,7 +32,7 @@
|
||||
#endif
|
||||
|
||||
PRLogModuleInfo* gMediaRecorderLog;
|
||||
#define LOG(type, msg) PR_LOG(gMediaRecorderLog, type, msg)
|
||||
#define LOG(type, msg) MOZ_LOG(gMediaRecorderLog, type, msg)
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "nsIContentPolicy.h"
|
||||
|
||||
PRLogModuleInfo* gMediaResourceLog;
|
||||
#define RESOURCE_LOG(msg, ...) PR_LOG(gMediaResourceLog, PR_LOG_DEBUG, \
|
||||
#define RESOURCE_LOG(msg, ...) MOZ_LOG(gMediaResourceLog, PR_LOG_DEBUG, \
|
||||
(msg, ##__VA_ARGS__))
|
||||
// Debug logging macro with object pointer and class name.
|
||||
#define CMLOG(msg, ...) \
|
||||
|
@ -14,7 +14,7 @@
|
||||
namespace mozilla {
|
||||
|
||||
extern PRLogModuleInfo* gMediaDecoderLog;
|
||||
#define DECODER_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg)
|
||||
#define DECODER_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg)
|
||||
|
||||
NS_IMPL_ISUPPORTS(MediaShutdownManager, nsIObserver)
|
||||
|
||||
|
@ -42,7 +42,7 @@ using namespace mozilla::gfx;
|
||||
namespace mozilla {
|
||||
|
||||
PRLogModuleInfo* gMediaStreamGraphLog;
|
||||
#define STREAM_LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg)
|
||||
#define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg)
|
||||
|
||||
// #define ENABLE_LIFECYCLE_LOG
|
||||
|
||||
@ -2523,7 +2523,7 @@ SourceMediaStream::ResampleAudioToGraphSampleRate(TrackData* aTrackData, MediaSe
|
||||
SpeexResamplerState* state = speex_resampler_init(channels,
|
||||
aTrackData->mInputRate,
|
||||
GraphImpl()->GraphRate(),
|
||||
SPEEX_RESAMPLER_QUALITY_DEFAULT,
|
||||
SPEEX_RESAMPLER_QUALITY_MIN,
|
||||
nullptr);
|
||||
if (!state) {
|
||||
return;
|
||||
|
@ -23,7 +23,7 @@ extern PRLogModuleInfo* gMediaTimerLog;
|
||||
|
||||
#define TIMER_LOG(x, ...) \
|
||||
MOZ_ASSERT(gMediaTimerLog); \
|
||||
PR_LOG(gMediaTimerLog, PR_LOG_DEBUG, ("[MediaTimer=%p relative_t=%lld]" x, this, \
|
||||
MOZ_LOG(gMediaTimerLog, PR_LOG_DEBUG, ("[MediaTimer=%p relative_t=%lld]" x, this, \
|
||||
RelativeMicroseconds(TimeStamp::Now()), ##__VA_ARGS__))
|
||||
|
||||
// This promise type is only exclusive because so far there isn't a reason for
|
||||
|
@ -21,7 +21,7 @@
|
||||
using namespace mozilla::net;
|
||||
|
||||
PRLogModuleInfo* gRtspMediaResourceLog;
|
||||
#define RTSP_LOG(msg, ...) PR_LOG(gRtspMediaResourceLog, PR_LOG_DEBUG, \
|
||||
#define RTSP_LOG(msg, ...) MOZ_LOG(gRtspMediaResourceLog, PR_LOG_DEBUG, \
|
||||
(msg, ##__VA_ARGS__))
|
||||
// Debug logging macro with object pointer and class name.
|
||||
#define RTSPMLOG(msg, ...) \
|
||||
|
@ -50,7 +50,7 @@ namespace mozilla {
|
||||
// the same log module.
|
||||
#define MIRROR_LOG(x, ...) \
|
||||
MOZ_ASSERT(gStateWatchingLog); \
|
||||
PR_LOG(gStateWatchingLog, PR_LOG_DEBUG, (x, ##__VA_ARGS__))
|
||||
MOZ_LOG(gStateWatchingLog, PR_LOG_DEBUG, (x, ##__VA_ARGS__))
|
||||
|
||||
template<typename T> class AbstractMirror;
|
||||
|
||||
|
@ -60,7 +60,7 @@ extern PRLogModuleInfo* gStateWatchingLog;
|
||||
|
||||
#define WATCH_LOG(x, ...) \
|
||||
MOZ_ASSERT(gStateWatchingLog); \
|
||||
PR_LOG(gStateWatchingLog, PR_LOG_DEBUG, (x, ##__VA_ARGS__))
|
||||
MOZ_LOG(gStateWatchingLog, PR_LOG_DEBUG, (x, ##__VA_ARGS__))
|
||||
|
||||
/*
|
||||
* AbstractWatcher is a superclass from which all watchers must inherit.
|
||||
|
@ -10,7 +10,7 @@
|
||||
namespace mozilla {
|
||||
|
||||
extern PRLogModuleInfo* gMediaStreamGraphLog;
|
||||
#define STREAM_LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg)
|
||||
#define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg)
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
|
@ -43,7 +43,7 @@ namespace mozilla {
|
||||
#endif
|
||||
|
||||
PRLogModuleInfo* gTrackUnionStreamLog;
|
||||
#define STREAM_LOG(type, msg) PR_LOG(gTrackUnionStreamLog, type, msg)
|
||||
#define STREAM_LOG(type, msg) MOZ_LOG(gTrackUnionStreamLog, type, msg)
|
||||
|
||||
TrackUnionStream::TrackUnionStream(DOMMediaStream* aWrapper) :
|
||||
ProcessedMediaStream(aWrapper)
|
||||
|
@ -29,7 +29,7 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(WebVTTListener)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(WebVTTListener)
|
||||
|
||||
PRLogModuleInfo* gTextTrackLog;
|
||||
# define VTT_LOG(...) PR_LOG(gTextTrackLog, PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
# define VTT_LOG(...) MOZ_LOG(gTextTrackLog, PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
|
||||
WebVTTListener::WebVTTListener(HTMLTrackElement* aElement)
|
||||
: mElement(aElement)
|
||||
|
@ -22,9 +22,9 @@
|
||||
namespace mozilla {
|
||||
|
||||
extern PRLogModuleInfo* gMediaDecoderLog;
|
||||
#define LOGE(...) PR_LOG(gMediaDecoderLog, PR_LOG_ERROR, (__VA_ARGS__))
|
||||
#define LOGW(...) PR_LOG(gMediaDecoderLog, PR_LOG_WARNING, (__VA_ARGS__))
|
||||
#define LOGD(...) PR_LOG(gMediaDecoderLog, PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
#define LOGE(...) MOZ_LOG(gMediaDecoderLog, PR_LOG_ERROR, (__VA_ARGS__))
|
||||
#define LOGW(...) MOZ_LOG(gMediaDecoderLog, PR_LOG_WARNING, (__VA_ARGS__))
|
||||
#define LOGD(...) MOZ_LOG(gMediaDecoderLog, PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
|
||||
#define PROPERTY_ID_FORMAT "%c%c%c%c"
|
||||
#define PROPERTY_ID_PRINT(x) ((x) >> 24), \
|
||||
|
@ -24,7 +24,7 @@ using namespace mozilla::media;
|
||||
namespace mozilla {
|
||||
|
||||
PRLogModuleInfo* GetDirectShowLog();
|
||||
#define LOG(...) PR_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
#define LOG(...) MOZ_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
|
||||
AudioSinkFilter::AudioSinkFilter(const wchar_t* aObjectName, HRESULT* aOutResult)
|
||||
: BaseFilter(aObjectName, CLSID_MozAudioSinkFilter),
|
||||
|
@ -16,7 +16,7 @@ using namespace mozilla::media;
|
||||
namespace mozilla {
|
||||
|
||||
PRLogModuleInfo* GetDirectShowLog();
|
||||
#define LOG(...) PR_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
#define LOG(...) MOZ_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
|
||||
AudioSinkInputPin::AudioSinkInputPin(wchar_t* aObjectName,
|
||||
AudioSinkFilter* aFilter,
|
||||
@ -139,7 +139,7 @@ AudioSinkInputPin::GetConnectedPinSeeking()
|
||||
return nullptr;
|
||||
RefPtr<IMediaSeeking> seeking;
|
||||
peer->QueryInterface(static_cast<IMediaSeeking**>(byRef(seeking)));
|
||||
return seeking;
|
||||
return seeking.forget();
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -26,7 +26,7 @@ GetDirectShowLog() {
|
||||
return log;
|
||||
}
|
||||
|
||||
#define LOG(...) PR_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
#define LOG(...) MOZ_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
|
||||
DirectShowReader::DirectShowReader(AbstractMediaDecoder* aDecoder)
|
||||
: MediaDecoderReader(aDecoder),
|
||||
|
@ -298,7 +298,7 @@ GetUnconnectedPin(IBaseFilter* aFilter, PIN_DIRECTION aPinDir)
|
||||
bool matches = FALSE;
|
||||
if (SUCCEEDED(MatchUnconnectedPin(pin, aPinDir, &matches)) &&
|
||||
matches) {
|
||||
return pin;
|
||||
return pin.forget();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ using namespace mozilla::media;
|
||||
namespace mozilla {
|
||||
|
||||
PRLogModuleInfo* GetDirectShowLog();
|
||||
#define LOG(...) PR_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
#define LOG(...) MOZ_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
|
||||
SampleSink::SampleSink()
|
||||
: mMonitor("SampleSink"),
|
||||
|
@ -21,7 +21,7 @@ namespace mozilla {
|
||||
|
||||
#if defined (DEBUG_SOURCE_TRACE)
|
||||
PRLogModuleInfo* GetDirectShowLog();
|
||||
#define DIRECTSHOW_LOG(...) PR_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
#define DIRECTSHOW_LOG(...) MOZ_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
#else
|
||||
#define DIRECTSHOW_LOG(...)
|
||||
#endif
|
||||
|
@ -14,13 +14,13 @@ namespace mozilla {
|
||||
|
||||
#ifndef EME_LOG
|
||||
PRLogModuleInfo* GetEMELog();
|
||||
#define EME_LOG(...) PR_LOG(GetEMELog(), PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
#define EME_LOG(...) MOZ_LOG(GetEMELog(), PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
#define EME_LOG_ENABLED() PR_LOG_TEST(GetEMELog(), PR_LOG_DEBUG)
|
||||
#endif
|
||||
|
||||
#ifndef EME_VERBOSE_LOG
|
||||
PRLogModuleInfo* GetEMEVerboseLog();
|
||||
#define EME_VERBOSE_LOG(...) PR_LOG(GetEMEVerboseLog(), PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
#define EME_VERBOSE_LOG(...) MOZ_LOG(GetEMEVerboseLog(), PR_LOG_DEBUG, (__VA_ARGS__))
|
||||
#else
|
||||
#ifndef EME_LOG
|
||||
#define EME_LOG(...)
|
||||
|
@ -32,7 +32,7 @@
|
||||
#endif
|
||||
|
||||
PRLogModuleInfo* gMediaEncoderLog;
|
||||
#define LOG(type, msg) PR_LOG(gMediaEncoderLog, type, msg)
|
||||
#define LOG(type, msg) MOZ_LOG(gMediaEncoderLog, type, msg)
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
namespace mozilla {
|
||||
|
||||
PRLogModuleInfo* gTrackEncoderLog;
|
||||
#define TRACK_LOG(type, msg) PR_LOG(gTrackEncoderLog, type, msg)
|
||||
#define TRACK_LOG(type, msg) MOZ_LOG(gTrackEncoderLog, type, msg)
|
||||
|
||||
static const int DEFAULT_CHANNELS = 1;
|
||||
static const int DEFAULT_SAMPLING_RATE = 16000;
|
||||
|
@ -16,7 +16,7 @@
|
||||
namespace mozilla {
|
||||
|
||||
PRLogModuleInfo* gVP8TrackEncoderLog;
|
||||
#define VP8LOG(msg, ...) PR_LOG(gVP8TrackEncoderLog, PR_LOG_DEBUG, \
|
||||
#define VP8LOG(msg, ...) MOZ_LOG(gVP8TrackEncoderLog, PR_LOG_DEBUG, \
|
||||
(msg, ##__VA_ARGS__))
|
||||
// Debug logging macro with object pointer and class name.
|
||||
|
||||
|
@ -18,7 +18,7 @@ namespace mozilla {
|
||||
|
||||
#undef LOG
|
||||
PRLogModuleInfo* gVorbisTrackEncoderLog;
|
||||
#define VORBISLOG(msg, ...) PR_LOG(gVorbisTrackEncoderLog, PR_LOG_DEBUG, \
|
||||
#define VORBISLOG(msg, ...) MOZ_LOG(gVorbisTrackEncoderLog, PR_LOG_DEBUG, \
|
||||
(msg, ##__VA_ARGS__))
|
||||
|
||||
VorbisTrackEncoder::VorbisTrackEncoder()
|
||||
|
@ -40,8 +40,8 @@ PRLogModuleInfo* GetDemuxerLog() {
|
||||
}
|
||||
return log;
|
||||
}
|
||||
#define LOG(arg, ...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, ("MP4Reader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
|
||||
#define VLOG(arg, ...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, ("MP4Reader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
|
||||
#define LOG(arg, ...) MOZ_LOG(GetDemuxerLog(), PR_LOG_DEBUG, ("MP4Reader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
|
||||
#define VLOG(arg, ...) MOZ_LOG(GetDemuxerLog(), PR_LOG_DEBUG, ("MP4Reader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
|
||||
|
||||
using namespace mp4_demuxer;
|
||||
|
||||
|
@ -19,8 +19,8 @@ namespace mozilla {
|
||||
|
||||
extern PRLogModuleInfo* GetGMPLog();
|
||||
|
||||
#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg)
|
||||
#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
|
||||
|
||||
namespace gmp {
|
||||
|
||||
|
@ -46,7 +46,7 @@ namespace mozilla {
|
||||
#undef LOGD
|
||||
|
||||
extern PRLogModuleInfo* GetGMPLog();
|
||||
#define LOG(level, x, ...) PR_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__))
|
||||
#define LOG(level, x, ...) MOZ_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__))
|
||||
#define LOGD(x, ...) LOG(PR_LOG_DEBUG, "GMPChild[pid=%d] " x, (int)base::GetCurrentProcId(), ##__VA_ARGS__)
|
||||
|
||||
namespace gmp {
|
||||
|
@ -21,8 +21,8 @@ namespace mozilla {
|
||||
|
||||
extern PRLogModuleInfo* GetGMPLog();
|
||||
|
||||
#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg)
|
||||
#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
|
||||
|
||||
#ifdef __CLASS__
|
||||
#undef __CLASS__
|
||||
|
@ -42,7 +42,7 @@ namespace mozilla {
|
||||
#undef LOGD
|
||||
|
||||
extern PRLogModuleInfo* GetGMPLog();
|
||||
#define LOG(level, x, ...) PR_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__))
|
||||
#define LOG(level, x, ...) MOZ_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__))
|
||||
#define LOGD(x, ...) LOG(PR_LOG_DEBUG, "GMPParent[%p|childPid=%d] " x, this, mChildPid, ##__VA_ARGS__)
|
||||
|
||||
namespace gmp {
|
||||
|
@ -50,8 +50,8 @@ GetGMPLog()
|
||||
return sLog;
|
||||
}
|
||||
|
||||
#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg)
|
||||
#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
|
||||
|
||||
#ifdef __CLASS__
|
||||
#undef __CLASS__
|
||||
|
@ -12,8 +12,8 @@ namespace mozilla {
|
||||
#undef LOG
|
||||
#endif
|
||||
|
||||
#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg)
|
||||
#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
|
||||
|
||||
#ifdef __CLASS__
|
||||
#undef __CLASS__
|
||||
|
@ -40,8 +40,8 @@ namespace mozilla {
|
||||
#undef LOG
|
||||
#endif
|
||||
|
||||
#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg)
|
||||
#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
|
||||
|
||||
#ifdef __CLASS__
|
||||
#undef __CLASS__
|
||||
|
@ -28,8 +28,8 @@ namespace mozilla {
|
||||
|
||||
extern PRLogModuleInfo* GetGMPLog();
|
||||
|
||||
#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg)
|
||||
#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
|
||||
|
||||
#ifdef __CLASS__
|
||||
#undef __CLASS__
|
||||
|
@ -15,8 +15,8 @@ namespace mozilla {
|
||||
|
||||
extern PRLogModuleInfo* GetGMPLog();
|
||||
|
||||
#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg)
|
||||
#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
|
||||
|
||||
#ifdef __CLASS__
|
||||
#undef __CLASS__
|
||||
|
@ -23,8 +23,8 @@ namespace mozilla {
|
||||
|
||||
extern PRLogModuleInfo* GetGMPLog();
|
||||
|
||||
#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg)
|
||||
#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
|
||||
|
||||
namespace gmp {
|
||||
|
||||
|
@ -25,8 +25,8 @@ namespace mozilla {
|
||||
|
||||
extern PRLogModuleInfo* GetGMPLog();
|
||||
|
||||
#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg)
|
||||
#define LOGD(msg) MOZ_LOG(GetGMPLog(), PR_LOG_DEBUG, msg)
|
||||
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
|
||||
|
||||
#ifdef __CLASS__
|
||||
#undef __CLASS__
|
||||
|
@ -31,7 +31,7 @@ using namespace layers;
|
||||
|
||||
extern PRLogModuleInfo* gMediaDecoderLog;
|
||||
#define LOG(type, msg, ...) \
|
||||
PR_LOG(gMediaDecoderLog, type, ("GStreamerReader(%p) " msg, this, ##__VA_ARGS__))
|
||||
MOZ_LOG(gMediaDecoderLog, type, ("GStreamerReader(%p) " msg, this, ##__VA_ARGS__))
|
||||
|
||||
#if DEBUG
|
||||
static const unsigned int MAX_CHANNELS = 4;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user