Merge last PGO-green changeset of mozilla-inbound to mozilla-central

This commit is contained in:
Ed Morley 2012-07-03 10:10:06 +01:00
Родитель 6c29a312a6 fec7a1197e
Коммит 25f95a2ee3
67 изменённых файлов: 1043 добавлений и 190 удалений

Просмотреть файл

@ -334,6 +334,17 @@ nsBrowserAccess.prototype = {
}
};
// Listen for system messages and relay them to Gaia.
Services.obs.addObserver(function(aSubject, aTopic, aData) {
let msg = JSON.parse(aData);
let origin = Services.io.newURI(msg.manifest, null, null).prePath;
shell.sendEvent(shell.contentBrowser.contentWindow,
"mozChromeEvent", { type: "open-app",
url: msg.uri,
origin: origin,
manifest: msg.manifest } );
}, "system-messages-open-app", false);
(function Repl() {
if (!Services.prefs.getBoolPref('b2g.remote-js.enabled')) {
return;
@ -390,7 +401,7 @@ var CustomEventManager = {
handleEvent: function custevt_handleEvent(evt) {
let detail = evt.detail;
dump('XXX FIXME : Got a mozContentEvent: ' + detail.type);
dump('XXX FIXME : Got a mozContentEvent: ' + detail.type + "\n");
switch(detail.type) {
case 'desktop-notification-click':

Просмотреть файл

@ -37,3 +37,5 @@ fi
MOZ_APP_ID={3c2e2abc-06d4-11e1-ac3b-374f68613e61}
MOZ_EXTENSION_MANAGER=1
ENABLE_MARIONETTE=1
MOZ_SYS_MSG=1

Просмотреть файл

@ -178,6 +178,7 @@
@BINPATH@/components/dom_mms.xpt
#endif
@BINPATH@/components/dom_browserelement.xpt
@BINPATH@/components/dom_messages.xpt
@BINPATH@/components/dom_power.xpt
@BINPATH@/components/dom_range.xpt
@BINPATH@/components/dom_settings.xpt
@ -463,6 +464,10 @@
@BINPATH@/components/AppsService.js
@BINPATH@/components/AppsService.manifest
@BINPATH@/components/SystemMessageInternal.js
@BINPATH@/components/SystemMessageManager.js
@BINPATH@/components/SystemMessageManager.manifest
; Modules
@BINPATH@/modules/*

Просмотреть файл

@ -273,6 +273,8 @@ MOZ_NATIVE_NSS = @MOZ_NATIVE_NSS@
MOZ_B2G_RIL = @MOZ_B2G_RIL@
MOZ_B2G_BT = @MOZ_B2G_BT@
MOZ_SYS_MSG = @MOZ_SYS_MSG@
MOZ_ASAN = @MOZ_ASAN@
MOZ_CFLAGS_NSS = @MOZ_CFLAGS_NSS@
MOZ_NO_WLZDEFS = @MOZ_NO_WLZDEFS@

Просмотреть файл

@ -7437,6 +7437,12 @@ if test -n "$MOZ_B2G_BT"; then
fi
AC_SUBST(MOZ_B2G_BT)
dnl ========================================================
dnl = Enable Support for System Messages API
dnl ========================================================
AC_SUBST(MOZ_SYS_MSG)
dnl ========================================================
dnl = Support for demangling undefined symbols
dnl ========================================================

Просмотреть файл

@ -125,14 +125,16 @@ NS_CP_ContentTypeName(PRUint32 contentType)
return NS_ERROR_FAILURE; \
\
return policy-> action (contentType, contentLocation, requestOrigin, \
context, mimeType, extra, decision); \
context, mimeType, extra, originPrincipal, \
decision); \
PR_END_MACRO
/* Passes on parameters from its "caller"'s context. */
#define CHECK_CONTENT_POLICY_WITH_SERVICE(action, _policy) \
PR_BEGIN_MACRO \
return _policy-> action (contentType, contentLocation, requestOrigin, \
context, mimeType, extra, decision); \
context, mimeType, extra, originPrincipal, \
decision); \
PR_END_MACRO
/**

Просмотреть файл

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
#include "nsIPrincipal.idl"
interface nsIURI;
interface nsIDOMNode;
@ -18,7 +19,7 @@ interface nsIDOMNode;
* by launching a dialog to prompt the user for something).
*/
[scriptable,uuid(344f9cb0-9a17-44c5-ab96-ee707884266c)]
[scriptable,uuid(e590e74f-bac7-4876-8c58-54dde92befb2)]
interface nsIContentPolicy : nsISupports
{
const unsigned long TYPE_OTHER = 1;
@ -209,7 +210,8 @@ interface nsIContentPolicy : nsISupports
in nsIURI aRequestOrigin,
in nsISupports aContext,
in ACString aMimeTypeGuess,
in nsISupports aExtra);
in nsISupports aExtra,
[optional] in nsIPrincipal aRequestPrincipal);
/**
* Should the resource be processed?
@ -251,6 +253,7 @@ interface nsIContentPolicy : nsISupports
in nsIURI aRequestOrigin,
in nsISupports aContext,
in ACString aMimeType,
in nsISupports aExtra);
in nsISupports aExtra,
[optional] in nsIPrincipal aRequestPrincipal);
};

Просмотреть файл

@ -57,6 +57,7 @@ CSPService::ShouldLoad(PRUint32 aContentType,
nsISupports *aRequestContext,
const nsACString &aMimeTypeGuess,
nsISupports *aExtra,
nsIPrincipal *aRequestPrincipal,
PRInt16 *aDecision)
{
if (!aContentLocation)
@ -123,6 +124,7 @@ CSPService::ShouldProcess(PRUint32 aContentType,
nsISupports *aRequestContext,
const nsACString &aMimeTypeGuess,
nsISupports *aExtra,
nsIPrincipal *aRequestPrincipal,
PRInt16 *aDecision)
{
if (!aContentLocation)

Просмотреть файл

@ -76,6 +76,7 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod,
nsISupports *requestingContext,
const nsACString &mimeType,
nsISupports *extra,
nsIPrincipal *requestPrincipal,
PRInt16 *decision)
{
//sanity-check passed-through parameters
@ -122,7 +123,8 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod,
/* check the appropriate policy */
rv = (entries[i]->*policyMethod)(contentType, contentLocation,
requestingLocation, requestingContext,
mimeType, extra, decision);
mimeType, extra, requestPrincipal,
decision);
if (NS_SUCCEEDED(rv) && NS_CP_REJECTED(*decision)) {
/* policy says no, no point continuing to check */
@ -177,13 +179,15 @@ nsContentPolicy::ShouldLoad(PRUint32 contentType,
nsISupports *requestingContext,
const nsACString &mimeType,
nsISupports *extra,
nsIPrincipal *requestPrincipal,
PRInt16 *decision)
{
// ShouldProcess does not need a content location, but we do
NS_PRECONDITION(contentLocation, "Must provide request location");
nsresult rv = CheckPolicy(&nsIContentPolicy::ShouldLoad, contentType,
contentLocation, requestingLocation,
requestingContext, mimeType, extra, decision);
requestingContext, mimeType, extra,
requestPrincipal, decision);
LOG_CHECK("ShouldLoad");
return rv;
@ -196,11 +200,13 @@ nsContentPolicy::ShouldProcess(PRUint32 contentType,
nsISupports *requestingContext,
const nsACString &mimeType,
nsISupports *extra,
nsIPrincipal *requestPrincipal,
PRInt16 *decision)
{
nsresult rv = CheckPolicy(&nsIContentPolicy::ShouldProcess, contentType,
contentLocation, requestingLocation,
requestingContext, mimeType, extra, decision);
requestingContext, mimeType, extra,
requestPrincipal, decision);
LOG_CHECK("ShouldProcess");
return rv;

Просмотреть файл

@ -31,7 +31,8 @@ class nsContentPolicy : public nsIContentPolicy
NS_STDCALL_FUNCPROTO(nsresult, CPMethod, nsIContentPolicy,
ShouldProcess,
(PRUint32, nsIURI*, nsIURI*, nsISupports*,
const nsACString &, nsISupports*, PRInt16*));
const nsACString &, nsISupports*, nsIPrincipal*,
PRInt16*));
//Helper method that applies policyMethod across all policies in mPolicies
// with the given parameters
@ -39,6 +40,7 @@ class nsContentPolicy : public nsIContentPolicy
nsIURI *aURI, nsIURI *origURI,
nsISupports *requestingContext,
const nsACString &mimeGuess, nsISupports *extra,
nsIPrincipal *requestPrincipal,
PRInt16 *decision);
};

Просмотреть файл

@ -37,6 +37,7 @@ nsDataDocumentContentPolicy::ShouldLoad(PRUint32 aContentType,
nsISupports *aRequestingContext,
const nsACString &aMimeGuess,
nsISupports *aExtra,
nsIPrincipal *aRequestPrincipal,
PRInt16 *aDecision)
{
*aDecision = nsIContentPolicy::ACCEPT;
@ -129,8 +130,10 @@ nsDataDocumentContentPolicy::ShouldProcess(PRUint32 aContentType,
nsISupports *aRequestingContext,
const nsACString &aMimeGuess,
nsISupports *aExtra,
nsIPrincipal *aRequestPrincipal,
PRInt16 *aDecision)
{
return ShouldLoad(aContentType, aContentLocation, aRequestingLocation,
aRequestingContext, aMimeGuess, aExtra, aDecision);
aRequestingContext, aMimeGuess, aExtra, aRequestPrincipal,
aDecision);
}

Просмотреть файл

@ -26,6 +26,7 @@ nsNoDataProtocolContentPolicy::ShouldLoad(PRUint32 aContentType,
nsISupports *aRequestingContext,
const nsACString &aMimeGuess,
nsISupports *aExtra,
nsIPrincipal *aRequestPrincipal,
PRInt16 *aDecision)
{
*aDecision = nsIContentPolicy::ACCEPT;
@ -70,8 +71,10 @@ nsNoDataProtocolContentPolicy::ShouldProcess(PRUint32 aContentType,
nsISupports *aRequestingContext,
const nsACString &aMimeGuess,
nsISupports *aExtra,
nsIPrincipal *aRequestPrincipal,
PRInt16 *aDecision)
{
return ShouldLoad(aContentType, aContentLocation, aRequestingLocation,
aRequestingContext, aMimeGuess, aExtra, aDecision);
aRequestingContext, aMimeGuess, aExtra, aRequestPrincipal,
aDecision);
}

Просмотреть файл

@ -8162,8 +8162,8 @@ nsDocShell::InternalLoad(nsIURI * aURI,
}
// XXXbz would be nice to know the loading principal here... but we don't
nsCOMPtr<nsIPrincipal> loadingPrincipal;
if (aReferrer) {
nsCOMPtr<nsIPrincipal> loadingPrincipal = do_QueryInterface(aOwner);
if (!loadingPrincipal && aReferrer) {
nsCOMPtr<nsIScriptSecurityManager> secMan =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -53,6 +53,7 @@ DIRS += \
devicestorage \
file \
media \
messages \
power \
settings \
sms \

Просмотреть файл

@ -2,6 +2,8 @@
* 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/. */
"use strict";
const Cu = Components.utils;
const Cc = Components.classes;
const Ci = Components.interfaces;
@ -23,6 +25,10 @@ XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
return Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
});
XPCOMUtils.defineLazyGetter(this, "msgmgr", function() {
return Cc["@mozilla.org/system-message-internal;1"].getService(Ci.nsISystemMessagesInternal);
});
#ifdef MOZ_WIDGET_GONK
const DIRECTORY_NAME = "webappsDir";
#else
@ -52,7 +58,14 @@ let DOMApplicationRegistry = {
this.appsFile = FileUtils.getFile(DIRECTORY_NAME, ["webapps", "webapps.json"], true);
if (this.appsFile.exists()) {
this._loadJSONAsync(this.appsFile, (function(aData) { this.webapps = aData; }).bind(this));
this._loadJSONAsync(this.appsFile, (function(aData) {
this.webapps = aData;
#ifdef MOZ_SYS_MSG
for (let id in this.webapps) {
this._registerSystemMessagesForId(id);
};
#endif
}).bind(this));
}
try {
@ -64,6 +77,26 @@ let DOMApplicationRegistry = {
} catch(e) { }
},
#ifdef MOZ_SYS_MSG
_registerSystemMessages: function(aManifest, aApp) {
if (aManifest.messages && Array.isArray(aManifest.messages) && aManifest.messages.length > 0) {
let manifest = new DOMApplicationManifest(aManifest, aApp.origin);
let launchPath = Services.io.newURI(manifest.fullLaunchPath(), null, null);
let manifestURL = Services.io.newURI(aApp.manifestURL, null, null);
aManifest.messages.forEach(function registerPages(aMessage) {
msgmgr.registerPage(aMessage, launchPath, manifestURL);
});
}
},
_registerSystemMessagesForId: function(aId) {
let app = this.webapps[aId];
this._readManifests([{ id: aId }], (function registerManifest(aResult) {
this._registerSystemMessages(aResult[0].manifest, app);
}).bind(this));
},
#endif
observe: function(aSubject, aTopic, aData) {
if (aTopic == "xpcom-shutdown") {
this.messages.forEach((function(msgName) {
@ -208,6 +241,10 @@ let DOMApplicationRegistry = {
Services.obs.notifyObservers(this, "webapps-sync-install", appNote);
}).bind(this));
#ifdef MOZ_SYS_MSG
this._registerSystemMessages(id, app);
#endif
// if the manifest has an appcache_path property, use it to populate the appcache
if (manifest.appcache_path) {
let appcacheURI = Services.io.newURI(manifest.fullAppcachePath(), null, null);
@ -533,7 +570,7 @@ let DOMApplicationRegistry = {
/**
* Appcache download observer
*/
AppcacheObserver = function(aApp) {
let AppcacheObserver = function(aApp) {
this.app = aApp;
};
@ -580,7 +617,7 @@ AppcacheObserver.prototype = {
/**
* Helper object to access manifest information with locale support
*/
DOMApplicationManifest = function(aManifest, aOrigin) {
let DOMApplicationManifest = function(aManifest, aOrigin) {
this._origin = Services.io.newURI(aOrigin, null, null);
this._manifest = aManifest;
let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry)

Просмотреть файл

@ -50,6 +50,8 @@
#include "BluetoothManager.h"
#endif
#include "nsIDOMGlobalPropertyInitializer.h"
// This should not be in the namespace.
DOMCI_DATA(Navigator, mozilla::dom::Navigator)
@ -109,6 +111,7 @@ NS_INTERFACE_MAP_BEGIN(Navigator)
#ifdef MOZ_B2G_BT
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorBluetooth)
#endif
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorSystemMessages)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Navigator)
NS_INTERFACE_MAP_END
@ -172,6 +175,13 @@ Navigator::Invalidate()
mBluetooth = nsnull;
}
#endif
#ifdef MOZ_SYS_MSG
if (mMessagesManager) {
mMessagesManager = nsnull;
}
#endif
}
nsPIDOMWindow *
@ -1249,6 +1259,67 @@ Navigator::GetMozBluetooth(nsIDOMBluetoothManager** aBluetooth)
}
#endif //MOZ_B2G_BT
//*****************************************************************************
// nsNavigator::nsIDOMNavigatorSystemMessages
//*****************************************************************************
#ifdef MOZ_SYS_MSG
NS_IMETHODIMP
Navigator::EnsureMessagesManager()
{
if (mMessagesManager) {
return NS_OK;
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
nsresult rv;
nsCOMPtr<nsIDOMNavigatorSystemMessages> messageManager =
do_CreateInstance("@mozilla.org/system-message-manager;1", &rv);
nsCOMPtr<nsIDOMGlobalPropertyInitializer> gpi =
do_QueryInterface(messageManager);
NS_ENSURE_TRUE(gpi, NS_ERROR_FAILURE);
// We don't do anything with the return value.
jsval prop_val = JSVAL_VOID;
rv = gpi->Init(window, &prop_val);
NS_ENSURE_SUCCESS(rv, rv);
mMessagesManager = messageManager.forget();
return NS_OK;
}
#endif
NS_IMETHODIMP
Navigator::MozHasPendingMessage(const nsAString& aType, bool *aResult)
{
#ifdef MOZ_SYS_MSG
*aResult = false;
nsresult rv = EnsureMessagesManager();
NS_ENSURE_SUCCESS(rv, rv);
return mMessagesManager->MozHasPendingMessage(aType, aResult);
#else
return NS_ERROR_NOT_IMPLEMENTED;
#endif
}
NS_IMETHODIMP
Navigator::MozSetMessageHandler(const nsAString& aType,
nsIDOMSystemMessageCallback *aCallback)
{
#ifdef MOZ_SYS_MSG
nsresult rv = EnsureMessagesManager();
NS_ENSURE_SUCCESS(rv, rv);
return mMessagesManager->MozSetMessageHandler(aType, aCallback);
#else
return NS_ERROR_NOT_IMPLEMENTED;
#endif
}
size_t
Navigator::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
{

Просмотреть файл

@ -38,6 +38,8 @@ class nsIDOMTelephony;
#include "nsIDOMNavigatorBluetooth.h"
#endif
#include "nsIDOMNavigatorSystemMessages.h"
//*****************************************************************************
// Navigator: Script "navigator" object
//*****************************************************************************
@ -79,7 +81,7 @@ class Navigator : public nsIDOMNavigator
#ifdef MOZ_B2G_BT
, public nsIDOMNavigatorBluetooth
#endif
, public nsIDOMNavigatorSystemMessages
{
public:
Navigator(nsPIDOMWindow *aInnerWindow);
@ -104,6 +106,7 @@ public:
#ifdef MOZ_B2G_BT
NS_DECL_NSIDOMNAVIGATORBLUETOOTH
#endif
NS_DECL_NSIDOMNAVIGATORSYSTEMMESSAGES
static void Init();
@ -126,6 +129,11 @@ public:
*/
void OnNavigation();
#ifdef MOZ_SYS_MSG
// Helper to initialize mMessagesManager.
nsresult EnsureMessagesManager();
#endif
private:
bool IsSmsAllowed() const;
bool IsSmsSupported() const;
@ -145,6 +153,7 @@ private:
#ifdef MOZ_B2G_BT
nsCOMPtr<nsIDOMBluetoothManager> mBluetooth;
#endif
nsCOMPtr<nsIDOMNavigatorSystemMessages> mMessagesManager;
nsWeakPtr mWindow;
};

Просмотреть файл

@ -522,6 +522,8 @@ using mozilla::dom::indexedDB::IDBWrapperCache;
#include "BluetoothAdapter.h"
#endif
#include "nsIDOMNavigatorSystemMessages.h"
#include "DOMError.h"
#include "DOMRequest.h"
#include "nsIOpenWindowEventDetail.h"
@ -2483,6 +2485,7 @@ nsDOMClassInfo::Init()
#ifdef MOZ_B2G_BT
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorBluetooth)
#endif
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorSystemMessages)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(Plugin, nsIDOMPlugin)

Просмотреть файл

@ -64,6 +64,7 @@
#include "sampler.h"
#include "nsDOMBlobBuilder.h"
#include "nsIDOMFileHandle.h"
#include "nsIDOMApplicationRegistry.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -2569,3 +2570,16 @@ nsDOMWindowUtils::SetApp(const nsAString& aManifestURL)
return static_cast<nsGlobalWindow*>(window.get())->SetApp(aManifestURL);
}
NS_IMETHODIMP
nsDOMWindowUtils::GetApp(mozIDOMApplication** aApplication)
{
if (!IsUniversalXPConnectCapable()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
return static_cast<nsGlobalWindow*>(window.get())->GetApp(aApplication);
}

Просмотреть файл

@ -8715,12 +8715,12 @@ nsGlobalWindow::RegisterIdleObserver(nsIIdleObserver* aIdleObserver)
return NS_OK;
}
MOZ_ASSERT(mIdleCallbackIndex >= 0);
if (!mCurrentlyIdle) {
return NS_OK;
}
MOZ_ASSERT(mIdleCallbackIndex >= 0);
if (static_cast<PRInt32>(insertAtIndex) < mIdleCallbackIndex) {
NotifyIdleObserver(tmpIdleObserver.mIdleObserver,
tmpIdleObserver.mTimeInS,
@ -8784,7 +8784,6 @@ nsresult
nsGlobalWindow::UnregisterIdleObserver(nsIIdleObserver* aIdleObserver)
{
MOZ_ASSERT(IsInnerWindow(), "Must be an inner window!");
MOZ_ASSERT(mIdleTimer);
PRInt32 removeElementIndex;
nsresult rv = FindIndexOfElementToRemove(aIdleObserver, &removeElementIndex);
@ -8794,11 +8793,13 @@ nsGlobalWindow::UnregisterIdleObserver(nsIIdleObserver* aIdleObserver)
}
mIdleObservers.RemoveElementAt(removeElementIndex);
MOZ_ASSERT(mIdleTimer);
if (mIdleObservers.IsEmpty() && mIdleService) {
rv = mIdleService->RemoveIdleObserver(mObserver, MIN_IDLE_NOTIFICATION_TIME_S);
NS_ENSURE_SUCCESS(rv, rv);
mIdleService = nsnull;
mIdleTimer->Cancel();
mIdleCallbackIndex = -1;
return NS_OK;
}
@ -10677,22 +10678,14 @@ nsGlobalWindow::SetIsApp(bool aValue)
bool
nsGlobalWindow::IsPartOfApp()
{
FORWARD_TO_OUTER(IsPartOfApp, (), TriState_False);
mozIDOMApplication* app;
nsresult rv = GetApp(&app);
// We go trough all window parents until we find one with |mIsApp| set to
// something. If none is found, we are not part of an application.
for (nsGlobalWindow* w = this; w;
w = static_cast<nsGlobalWindow*>(w->GetParentInternal())) {
if (w->mIsApp == TriState_True) {
// The window should be part of an application.
MOZ_ASSERT(w->mApp);
return true;
} else if (w->mIsApp == TriState_False) {
if (NS_FAILED(rv)) {
return false;
}
}
return false;
return app != nsnull;
}
nsresult
@ -10722,6 +10715,30 @@ nsGlobalWindow::SetApp(const nsAString& aManifestURL)
return NS_OK;
}
nsresult
nsGlobalWindow::GetApp(mozIDOMApplication** aApplication)
{
*aApplication = nsnull;
FORWARD_TO_OUTER(GetApp, (aApplication), NS_OK);
// We go trough all window parents until we find one with |mIsApp| set to
// something. If none is found, we are not part of an application.
for (nsGlobalWindow* w = this; w;
w = static_cast<nsGlobalWindow*>(w->GetParentInternal())) {
if (w->mIsApp == TriState_True) {
// The window should be part of an application.
MOZ_ASSERT(w->mApp);
NS_IF_ADDREF(*aApplication = w->mApp);
return NS_OK;
} else if (w->mIsApp == TriState_False) {
return NS_OK;
}
}
return NS_OK;
}
// nsGlobalChromeWindow implementation
NS_IMPL_CYCLE_COLLECTION_CLASS(nsGlobalChromeWindow)

Просмотреть файл

@ -894,6 +894,7 @@ protected:
void SetIsApp(bool aValue);
nsresult SetApp(const nsAString& aManifestURL);
nsresult GetApp(mozIDOMApplication** aApplication);
// Implements Get{Real,Scriptable}Top.
nsresult GetTopImpl(nsIDOMWindow **aWindow, bool aScriptable);

Просмотреть файл

@ -38,6 +38,7 @@ interface nsIDOMFile;
interface nsIFile;
interface nsIDOMTouch;
interface nsIDOMClientRect;
interface mozIDOMApplication;
[scriptable, uuid(858578f1-9653-4d5c-821a-07479bf2d9b2)]
interface nsIDOMWindowUtils : nsISupports {
@ -1165,4 +1166,9 @@ interface nsIDOMWindowUtils : nsISupports {
* or isn't the manifest URL of an installed application.
*/
void setApp(in DOMString manifestURL);
/**
* Retrieves the Application object associated to this window.
* Can be null if |setApp()| has not been called.
*/
mozIDOMApplication getApp();
};

22
dom/messages/Makefile.in Normal file
Просмотреть файл

@ -0,0 +1,22 @@
# 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/.
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = dom/messages
include $(DEPTH)/config/autoconf.mk
PARALLEL_DIRS = interfaces
EXTRA_COMPONENTS = \
SystemMessageManager.js \
SystemMessageInternal.js \
SystemMessageManager.manifest \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -0,0 +1,121 @@
/* 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/. */
"use strict";
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
const Cr = Components.results;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
return Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
});
// Limit the number of pending messages for a given page.
let kMaxPendingMessages;
try {
kMaxPendingMessages = Services.prefs.getIntPref("dom.messages.maxPendingMessages");
} catch(e) {
// getIntPref throws when the pref is not set.
kMaxPendingMessages = 5;
}
function debug(aMsg) {
//dump("-- SystemMessageInternal " + Date.now() + " : " + aMsg + "\n");
}
// Implementation of the component used by internal users.
function SystemMessageInternal() {
// The set of pages registered by installed apps. We keep the
// list of pending messages for each page here also.
this._pages = [];
Services.obs.addObserver(this, "xpcom-shutdown", false);
ppmm.addMessageListener("SystemMessageManager:GetPending", this);
}
SystemMessageInternal.prototype = {
sendMessage: function sendMessage(aType, aMessage, aManifestURI) {
debug("Broadcasting " + aType + " " + JSON.stringify(aMessage));
ppmm.sendAsyncMessage("SystemMessageManager:Message" , { type: aType,
msg: aMessage,
manifest: aManifestURI.spec });
// Queue the message for pages that registered an handler for this type.
this._pages.forEach(function sendMess_openPage(aPage) {
if (aPage.type != aType || aPage.manifest != aManifestURI.spec) {
return;
}
aPage.pending.push(aMessage);
if (aPage.pending.length > kMaxPendingMessages) {
aPage.pending.splice(0, 1);
}
// We don't need to send the full object to observers.
let page = { uri: aPage.uri, manifest: aPage.manifest };
debug("Asking to open " + JSON.stringify(page));
Services.obs.notifyObservers(this, "system-messages-open-app", JSON.stringify(page));
}.bind(this))
},
registerPage: function registerPage(aType, aPageURI, aManifestURI) {
if (!aPageURI || !aManifestURI) {
throw Cr.NS_ERROR_INVALID_ARG;
}
this._pages.push({ type: aType,
uri: aPageURI.spec,
manifest: aManifestURI.spec,
pending: [] });
},
receiveMessage: function receiveMessage(aMessage) {
debug("received SystemMessageManager:GetPending " + aMessage.json.type + " for " + aMessage.json.uri + " @ " + aMessage.json.manifest);
// This is a sync call, use to return the pending message for a page.
let msg = aMessage.json;
debug(JSON.stringify(msg));
// Find the right page.
let page = null;
this._pages.some(function(aPage) {
if (aPage.uri == msg.uri &&
aPage.type == msg.type &&
aPage.manifest == msg.manifest) {
page = aPage;
}
return page !== null;
});
if (!page) {
return null;
}
let pending = page.pending;
// Clear the pending queue for this page.
// This is ok since we'll store pending events in SystemMessageManager.js
page.pending = [];
return pending;
},
observe: function observe(aSubject, aTopic, aData) {
if (aTopic == "xpcom-shutdown") {
ppmm.removeMessageListener("SystemMessageManager:GetPending", this);
Services.obs.removeObserver(this, "xpcom-shutdown");
ppmm = null;
this._pages = null;
}
},
classID: Components.ID("{70589ca5-91ac-4b9e-b839-d6a88167d714}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsISystemMessagesInternal, Ci.nsIObserver])
}
const NSGetFactory = XPCOMUtils.generateNSGetFactory([SystemMessageInternal]);

Просмотреть файл

@ -0,0 +1,172 @@
/* 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/. */
"use strict";
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
return Cc["@mozilla.org/childprocessmessagemanager;1"]
.getService(Ci.nsIFrameMessageManager)
.QueryInterface(Ci.nsISyncMessageSender);
});
// Limit the number of pending messages for a given type.
let kMaxPendingMessages;
try {
kMaxPendingMessages = Services.prefs.getIntPref("dom.messages.maxPendingMessages");
} catch(e) {
// getIntPref throws when the pref is not set.
kMaxPendingMessages = 5;
}
function debug(aMsg) {
//dump("-- SystemMessageManager " + Date.now() + " : " + aMsg + "\n");
}
// Implementation of the DOM API for system messages
function SystemMessageManager() {
// Message handlers for this page.
// We can have only one handler per message type.
this._handlers = {};
// Pending messages for this page, keyed by message type.
this._pendings = {};
}
SystemMessageManager.prototype = {
__proto__: DOMRequestIpcHelper.prototype,
mozSetMessageHandler: function sysMessMgr_setMessageHandler(aType, aHandler) {
debug("setMessage handler for [" + aType + "] " + aHandler);
if (!aType) {
// Just bail out if we have no type.
return;
}
let handlers = this._handlers;
if (!aHandler) {
// Setting the handler to null means we don't want to receive messages
// of this type anymore.
delete handlers[aType];
return;
}
// Last registered handler wins.
handlers[aType] = aHandler;
// If we have pending messages, send them asynchronously.
if (this._getPendingMessages(aType, true)) {
let thread = Services.tm.mainThread;
let pending = this._pendings[aType];
this._pendings[aType] = [];
pending.forEach(function dispatch_pending(aPending) {
thread.dispatch({
run: function run() {
aHandler.handleMessage(aPending);
}
}, Ci.nsIEventTarget.DISPATCH_NORMAL);
});
}
},
_getPendingMessages: function sysMessMgr_getPendingMessages(aType, aForceUpdate) {
debug("hasPendingMessage " + aType);
let pendings = this._pendings;
// If we have a handler for this type, we can't have any pending message.
// If called from setMessageHandler, we still want to update the pending
// queue to deliver existing messages.
if (aType in this._handlers && !aForceUpdate) {
return false;
}
// Send a sync message to the parent to check if we have a pending message
// for this type.
let messages = cpmm.sendSyncMessage("SystemMessageManager:GetPending",
{ type: aType,
uri: this._uri,
manifest: this._manifest })[0];
if (!messages) {
// No new pending messages, but the queue may not be empty yet.
return pendings[aType] && pendings[aType].length != 0;
}
if (!pendings[aType]) {
pendings[aType] = [];
}
// Doing that instead of pending.concat() to avoid array copy.
messages.forEach(function hpm_addPendings(aMessage) {
pendings[aType].push(aMessage);
if (pendings[aType].length > kMaxPendingMessages) {
pendings[aType].splice(0, 1);
}
});
return pendings[aType].length != 0;
},
mozHasPendingMessage: function sysMessMgr_hasPendingMessage(aType) {
return this._getPendingMessages(aType, false);
},
uninit: function sysMessMgr_uninit() {
this._handlers = null;
this._pendings = null;
},
receiveMessage: function sysMessMgr_receiveMessage(aMessage) {
debug("receiveMessage " + aMessage.name + " - " +
aMessage.json.type + " for " + aMessage.json.manifest +
" (" + this._manifest + ")");
let msg = aMessage.json;
if (msg.manifest != this._manifest)
return;
// Bail out if we have no handlers registered for this type.
if (!(msg.type in this._handlers)) {
debug("No handler for this type");
return;
}
this._handlers[msg.type].handleMessage(msg.msg);
},
// nsIDOMGlobalPropertyInitializer implementation.
init: function sysMessMgr_init(aWindow) {
debug("init");
this.initHelper(aWindow, ["SystemMessageManager:Message"]);
this._uri = aWindow.document.nodePrincipal.URI.spec;
let utils = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
// Get the manifest url is this is an installed app.
this._manifest = null;
let app = utils.getApp();
if (app)
this._manifest = app.manifestURL;
},
classID: Components.ID("{bc076ea0-609b-4d8f-83d7-5af7cbdc3bb2}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMNavigatorSystemMessages,
Ci.nsIDOMGlobalPropertyInitializer]),
classInfo: XPCOMUtils.generateCI({classID: Components.ID("{bc076ea0-609b-4d8f-83d7-5af7cbdc3bb2}"),
contractID: "@mozilla.org/system-message-manager;1",
interfaces: [Ci.nsIDOMNavigatorSystemMessages],
flags: Ci.nsIClassInfo.DOM_OBJECT,
classDescription: "System Messages"})
}
const NSGetFactory = XPCOMUtils.generateNSGetFactory([SystemMessageManager]);

Просмотреть файл

@ -0,0 +1,5 @@
component {bc076ea0-609b-4d8f-83d7-5af7cbdc3bb2} SystemMessageManager.js
contract @mozilla.org/system-message-manager;1 {bc076ea0-609b-4d8f-83d7-5af7cbdc3bb2}
component {70589ca5-91ac-4b9e-b839-d6a88167d714} SystemMessageInternal.js
contract @mozilla.org/system-message-internal;1 {70589ca5-91ac-4b9e-b839-d6a88167d714}

Просмотреть файл

@ -0,0 +1,21 @@
# 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/.
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
XPIDL_MODULE = dom_messages
include $(topsrcdir)/dom/dom-config.mk
XPIDLSRCS = \
nsIDOMNavigatorSystemMessages.idl \
nsISystemMessagesInternal.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -0,0 +1,19 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "domstubs.idl"
[scriptable, function, uuid(42692976-57fd-4bb4-ab95-2b97ebdc5056)]
interface nsIDOMSystemMessageCallback : nsISupports
{
void handleMessage(in jsval message);
};
[scriptable, uuid(091e90dd-0e8b-463d-8cdc-9225d3a6ff90)]
interface nsIDOMNavigatorSystemMessages : nsISupports
{
void mozSetMessageHandler(in DOMString type, in nsIDOMSystemMessageCallback callback);
boolean mozHasPendingMessage(in DOMString type);
};

Просмотреть файл

@ -0,0 +1,29 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "domstubs.idl"
interface nsIURI;
// Implemented by the contract id @mozilla.org/system-message-internal;1
[scriptable, uuid(fdc1ba03-5d8f-4de9-894a-333c7a136c5f)]
interface nsISystemMessagesInternal : nsISupports
{
/*
* Allow any internal user to broadcast a message of a given type.
* @param type The type of the message to be sent.
* @param message The message payload.
* @param manifestURI The webapp's manifest URI.
*/
void sendMessage(in DOMString type, in jsval message, in nsIURI manifestURI);
/*
* Registration of a page that wants to be notified of a message type.
* @param type The message type.
* @param pageURI The URI of the page that will be opened.
* @param manifestURI The webapp's manifest URI.
*/
void registerPage(in DOMString type, in nsIURI pageURI, in nsIURI manifestURI);
};

Просмотреть файл

@ -0,0 +1,19 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
// Failures in this file can manifest as ###!!! ASSERTION: scope has non-empty map: '0 == mWrappedNativeMap->Count()'
// followed by an Assertion failure: allocated() crash during the next GC.
// It can also manifest as a leak.
function breakthings() {
var e = document.createElement("embed");
var i = document.getElementById("i");
i.contentDocument.body.appendChild(e);
i.src = "about:blank";
}
</script>
</head>
<body onload="javascript:breakthings();">
<iframe id="i" />
</body>
</html>

Просмотреть файл

@ -10,3 +10,4 @@ load 570884.html
# this test for now is OK.
skip-if(browserIsRemote||!haveTestPlugin||http.platform!="X11"||!testPluginIsOOP()) load 598862.html
load 626602-1.html
load 752340.html

Просмотреть файл

@ -75,6 +75,7 @@ nsWebBrowserContentPolicy::ShouldLoad(PRUint32 contentType,
nsISupports *requestingContext,
const nsACString &mimeGuess,
nsISupports *extra,
nsIPrincipal *requestPrincipal,
PRInt16 *shouldLoad)
{
return PerformPolicyCheck(contentType, requestingContext, shouldLoad);
@ -87,6 +88,7 @@ nsWebBrowserContentPolicy::ShouldProcess(PRUint32 contentType,
nsISupports *requestingContext,
const nsACString &mimeGuess,
nsISupports *extra,
nsIPrincipal *requestPrincipal,
PRInt16 *shouldProcess)
{
*shouldProcess = nsIContentPolicy::ACCEPT;

Просмотреть файл

@ -127,6 +127,7 @@ nsContentBlocker::ShouldLoad(PRUint32 aContentType,
nsISupports *aRequestingContext,
const nsACString &aMimeGuess,
nsISupports *aExtra,
nsIPrincipal *aRequestPrincipal,
PRInt16 *aDecision)
{
*aDecision = nsIContentPolicy::ACCEPT;
@ -193,7 +194,8 @@ nsContentBlocker::ShouldLoad(PRUint32 aContentType,
// Found a type that tells us more about what we're loading. Try
// the permissions check again!
return ShouldLoad(aContentType, aContentLocation, aRequestingLocation,
aRequestingContext, aMimeGuess, aExtra, aDecision);
aRequestingContext, aMimeGuess, aExtra, aRequestPrincipal,
aDecision);
}
NS_IMETHODIMP
@ -203,6 +205,7 @@ nsContentBlocker::ShouldProcess(PRUint32 aContentType,
nsISupports *aRequestingContext,
const nsACString &aMimeGuess,
nsISupports *aExtra,
nsIPrincipal *aRequestPrincipal,
PRInt16 *aDecision)
{
// For loads where aRequestingContext is chrome, we should just
@ -223,7 +226,8 @@ nsContentBlocker::ShouldProcess(PRUint32 aContentType,
// This isn't a load from chrome. Just do a ShouldLoad() check --
// we want the same answer here
return ShouldLoad(aContentType, aContentLocation, aRequestingLocation,
aRequestingContext, aMimeGuess, aExtra, aDecision);
aRequestingContext, aMimeGuess, aExtra, aRequestPrincipal,
aDecision);
}
nsresult

Просмотреть файл

@ -3566,6 +3566,10 @@ JSObject::TradeGuts(JSContext *cx, JSObject *a, JSObject *b, TradeGutsReserved &
bool
JSObject::swap(JSContext *cx, JSObject *other)
{
// Ensure swap doesn't cause a finalizer to not be run.
JS_ASSERT(IsBackgroundAllocKind(getAllocKind()) ==
IsBackgroundAllocKind(other->getAllocKind()));
if (this->compartment() == other->compartment()) {
TradeGutsReserved reserved(cx);
if (!ReserveForTradeGuts(cx, this, other, reserved))

Просмотреть файл

@ -1682,7 +1682,7 @@ JS_FRIEND_DATA(Class) js::FunctionProxyClass = {
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
NULL, /* finalize */
proxy_Finalize, /* finalize */
NULL, /* checkAccess */
proxy_Call,
FunctionClass.hasInstance,

Просмотреть файл

@ -2791,6 +2791,10 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
// so 'entry' could become invalid.
}
if (!containerLayerFrame) {
return;
}
ThebesDisplayItemLayerUserData* userData =
static_cast<ThebesDisplayItemLayerUserData*>
(aLayer->GetUserData(&gThebesDisplayItemLayerUserData));

Просмотреть файл

@ -143,7 +143,8 @@ nsPresContext::IsDOMPaintEventPending()
if (!mInvalidateRequests.mRequests.IsEmpty()) {
return true;
}
if (GetRootPresContext()->mRefreshDriver->ViewManagerFlushIsPending()) {
nsRootPresContext* rpc = GetDisplayRootPresContext();
if (rpc && rpc->mRefreshDriver->ViewManagerFlushIsPending()) {
// Since we're promising that there will be a MozAfterPaint event
// fired, we record an empty invalidation in case display list
// invalidation doesn't invalidate anything further.
@ -1197,18 +1198,6 @@ nsPresContext::GetParentPresContext()
return f->PresContext();
}
}
// Not sure if this is always strictly the parent, but it works for GetRootPresContext
// where the current pres context has no frames.
nsIDocument *doc = Document();
if (doc) {
doc = doc->GetParentDocument();
if (doc) {
shell = doc->GetShell();
if (shell) {
return shell->GetPresContext();
}
}
}
return nsnull;
}
@ -1233,6 +1222,33 @@ nsPresContext::GetRootPresContext()
nsPresContext* pc = this;
for (;;) {
nsPresContext* parent = pc->GetParentPresContext();
if (!parent)
break;
pc = parent;
}
return pc->IsRoot() ? static_cast<nsRootPresContext*>(pc) : nsnull;
}
nsRootPresContext*
nsPresContext::GetDisplayRootPresContext()
{
nsPresContext* pc = this;
for (;;) {
nsPresContext* parent = pc->GetParentPresContext();
if (!parent) {
// Not sure if this is always strictly the parent, but it works for GetRootPresContext
// where the current pres context has no frames.
nsIDocument *doc = pc->Document();
if (doc) {
doc = doc->GetParentDocument();
if (doc) {
nsIPresShell* shell = doc->GetShell();
if (shell) {
parent = shell->GetPresContext();
}
}
}
}
if (!parent || parent == pc)
break;
pc = parent;

Просмотреть файл

@ -198,6 +198,7 @@ public:
* be found (e.g. it's detached).
*/
nsRootPresContext* GetRootPresContext();
nsRootPresContext* GetDisplayRootPresContext();
virtual bool IsRoot() { return false; }
nsIDocument* Document() const

Просмотреть файл

@ -3978,7 +3978,12 @@ PresShell::DocumentStatesChanged(nsIDocument* aDocument,
VERIFY_STYLE_TREE;
}
ScheduleViewManagerFlush();
if (aStateMask.HasState(NS_DOCUMENT_STATE_WINDOW_INACTIVE)) {
nsIFrame* root = mFrameConstructor->GetRootFrame();
if (root) {
root->InvalidateFrameSubtree();
}
}
}
void

Просмотреть файл

@ -4603,9 +4603,9 @@ nsIFrame::GetTransformMatrix(nsIFrame* aStopAtAncestor,
}
void
nsIFrame::InvalidateFrameSubtree(PRUint32 aFlags)
nsIFrame::InvalidateFrameSubtree()
{
InvalidateFrame(aFlags);
InvalidateFrame();
if (HasAnyStateBits(NS_FRAME_ALL_DESCENDANTS_NEED_PAINT)) {
return;
@ -4620,8 +4620,7 @@ nsIFrame::InvalidateFrameSubtree(PRUint32 aFlags)
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
childFrames.get()->
InvalidateFrameSubtree(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
childFrames.get()->InvalidateFrameSubtree();
}
}
}
@ -4648,7 +4647,7 @@ nsIFrame::ClearInvalidationStateBits()
}
void
nsIFrame::InvalidateFrame(PRUint32 aFlags)
nsIFrame::InvalidateFrame()
{
AddStateBits(NS_FRAME_NEEDS_PAINT);
nsIFrame *parent = nsLayoutUtils::GetCrossDocParentFrame(this);
@ -4656,7 +4655,7 @@ nsIFrame::InvalidateFrame(PRUint32 aFlags)
parent->AddStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT);
parent = nsLayoutUtils::GetCrossDocParentFrame(parent);
}
if (!(aFlags & INVALIDATE_DONT_SCHEDULE_PAINT)) {
if (!parent) {
SchedulePaint();
}
}
@ -4670,7 +4669,7 @@ nsIFrame::IsInvalid()
void
nsIFrame::SchedulePaint(PRUint32 aFlags)
{
nsPresContext *pres = PresContext()->GetRootPresContext();
nsPresContext *pres = PresContext()->GetDisplayRootPresContext();
if (HasAnyStateBits(NS_FRAME_IN_POPUP) || !pres) {
nsIFrame *displayRoot = nsLayoutUtils::GetDisplayRootFrame(this);
NS_ASSERTION(displayRoot, "Need a display root to schedule a paint!");
@ -7810,7 +7809,7 @@ nsFrame::SetParent(nsIFrame* aParent)
// ourselves too. This is probably faster than clearing the flag all
// the way up the frame tree.
if (aParent->HasAnyStateBits(NS_FRAME_ALL_DESCENDANTS_NEED_PAINT)) {
InvalidateFrame(INVALIDATE_DONT_SCHEDULE_PAINT);
InvalidateFrame();
}
}

Просмотреть файл

@ -2126,17 +2126,12 @@ public:
/**
* Marks all display items created by this frame as needing a repaint,
* and calls SchedulePaint() if requested.
* and calls SchedulePaint() if requested and one is not already pending.
*
* This includes all display items created by this frame, including
* container types.
* @param aFlags INVALIDATE_DONT_SCHEDULE_PAINT: Don't call SchedulePaint()
* when invalidating.
*/
enum {
INVALIDATE_DONT_SCHEDULE_PAINT
};
virtual void InvalidateFrame(PRUint32 aFlags = 0);
virtual void InvalidateFrame();
/**
* Calls InvalidateFrame() on all frames descendant frames (including
@ -2145,7 +2140,7 @@ public:
* This function doesn't walk through placeholder frames to invalidate
* the out-of-flow frames.
*/
void InvalidateFrameSubtree(PRUint32 aFlags = 0);
void InvalidateFrameSubtree();
/**
* Checks if a frame has had InvalidateFrame() called on it since the

Просмотреть файл

@ -1036,6 +1036,33 @@ struct nsRecessedBorder : public nsStyleBorder {
}
};
class nsDisplayAltFeedback : public nsDisplayItem {
public:
nsDisplayAltFeedback(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {}
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap)
{
*aSnap = false;
return mFrame->GetVisualOverflowRectRelativeToSelf() + ToReferenceFrame();
}
virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx)
{
nsImageFrame* f = static_cast<nsImageFrame*>(mFrame);
nsEventStates state = f->GetContent()->AsElement()->State();
f->DisplayAltFeedback(*aCtx,
mVisibleRect,
IMAGE_OK(state, true)
? nsImageFrame::gIconLoad->mLoadingImage
: nsImageFrame::gIconLoad->mBrokenImage,
ToReferenceFrame());
}
NS_DISPLAY_DECL_NAME("AltFeedback", TYPE_ALT_FEEDBACK)
};
void
nsImageFrame::DisplayAltFeedback(nsRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
@ -1150,19 +1177,6 @@ nsImageFrame::DisplayAltFeedback(nsRenderingContext& aRenderingContext,
aRenderingContext.PopState();
}
static void PaintAltFeedback(nsIFrame* aFrame, nsRenderingContext* aCtx,
const nsRect& aDirtyRect, nsPoint aPt)
{
nsImageFrame* f = static_cast<nsImageFrame*>(aFrame);
nsEventStates state = f->GetContent()->AsElement()->State();
f->DisplayAltFeedback(*aCtx,
aDirtyRect,
IMAGE_OK(state, true)
? nsImageFrame::gIconLoad->mLoadingImage
: nsImageFrame::gIconLoad->mBrokenImage,
aPt);
}
#ifdef DEBUG
static void PaintDebugImageMap(nsIFrame* aFrame, nsRenderingContext* aCtx,
const nsRect& aDirtyRect, nsPoint aPt) {
@ -1365,8 +1379,7 @@ nsImageFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// No image yet, or image load failed. Draw the alt-text and an icon
// indicating the status
rv = replacedContent.AppendNewToTop(new (aBuilder)
nsDisplayGeneric(aBuilder, this, PaintAltFeedback, "AltFeedback",
nsDisplayItem::TYPE_ALT_FEEDBACK));
nsDisplayAltFeedback(aBuilder, this));
NS_ENSURE_SUCCESS(rv, rv);
}
else {

Просмотреть файл

@ -210,11 +210,11 @@ public:
virtual bool UpdateOverflow();
virtual void InvalidateFrame(PRUint32 aFlags = 0)
virtual void InvalidateFrame()
{
nsIFrame::InvalidateFrame(aFlags);
nsIFrame::InvalidateFrame();
nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
tableFrame->InvalidateFrame(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
tableFrame->InvalidateFrame();
}
protected:

Просмотреть файл

@ -189,10 +189,10 @@ nsTableColFrame::GetSplittableType() const
}
void
nsTableColFrame::InvalidateFrame(PRUint32 aFlags)
nsTableColFrame::InvalidateFrame()
{
nsIFrame::InvalidateFrame(aFlags);
nsIFrame::InvalidateFrame();
nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
tableFrame->InvalidateFrame(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
tableFrame->InvalidateFrame();
}

Просмотреть файл

@ -263,7 +263,7 @@ public:
return mFinalWidth;
}
virtual void InvalidateFrame(PRUint32 aFlags = 0);
virtual void InvalidateFrame();
protected:

Просмотреть файл

@ -463,11 +463,11 @@ nsTableColGroupFrame::GetType() const
}
void
nsTableColGroupFrame::InvalidateFrame(PRUint32 aFlags)
nsTableColGroupFrame::InvalidateFrame()
{
nsIFrame::InvalidateFrame(aFlags);
nsIFrame::InvalidateFrame();
nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
tableFrame->InvalidateFrame(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
tableFrame->InvalidateFrame();
}
#ifdef DEBUG

Просмотреть файл

@ -196,7 +196,7 @@ public:
void SetContinuousBCBorderWidth(PRUint8 aForSide,
BCPixelSize aPixelValue);
virtual void InvalidateFrame(PRUint32 aFlags = 0);
virtual void InvalidateFrame();
protected:
nsTableColGroupFrame(nsStyleContext* aContext);

Просмотреть файл

@ -1350,11 +1350,11 @@ void nsTableRowFrame::InitHasCellWithStyleHeight(nsTableFrame* aTableFrame)
}
void
nsTableRowFrame::InvalidateFrame(PRUint32 aFlags)
nsTableRowFrame::InvalidateFrame()
{
nsIFrame::InvalidateFrame(aFlags);
nsIFrame::InvalidateFrame();
nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
tableFrame->InvalidateFrame(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
tableFrame->InvalidateFrame();
}
/* ----- global methods ----- */

Просмотреть файл

@ -223,7 +223,7 @@ public:
void SetContinuousBCBorderWidth(PRUint8 aForSide,
BCPixelSize aPixelValue);
virtual void InvalidateFrame(PRUint32 aFlags = 0);
virtual void InvalidateFrame();
#ifdef ACCESSIBILITY
virtual already_AddRefed<Accessible> CreateAccessible();

Просмотреть файл

@ -1841,9 +1841,9 @@ nsTableRowGroupFrame::FrameCursorData::AppendFrame(nsIFrame* aFrame)
}
void
nsTableRowGroupFrame::InvalidateFrame(PRUint32 aFlags)
nsTableRowGroupFrame::InvalidateFrame()
{
nsIFrame::InvalidateFrame(aFlags);
nsIFrame::InvalidateFrame();
nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
tableFrame->InvalidateFrame(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
tableFrame->InvalidateFrame();
}

Просмотреть файл

@ -324,7 +324,7 @@ public:
virtual nsILineIterator* GetLineIterator() { return this; }
virtual void InvalidateFrame(PRUint32 aFlags = 0);
virtual void InvalidateFrame();
protected:
nsTableRowGroupFrame(nsStyleContext* aContext);

Просмотреть файл

@ -241,6 +241,14 @@ interface nsIChannel : nsIRequest
*/
const unsigned long LOAD_CLASSIFY_URI = 1 << 22;
/**
* If this flag is set and a server's response is Content-Type
* application/octet-steam, the server's Content-Type will be ignored and
* the channel content will be sniffed as though no Content-Type had been
* passed.
*/
const unsigned long LOAD_TREAT_APPLICATION_OCTET_STREAM_AS_UNKNOWN = 1 << 23;
/**
* Access to the type implied or stated by the Content-Disposition header
* if available and if applicable. This allows determining inline versus

Просмотреть файл

@ -682,9 +682,15 @@ CallUnknownTypeSniffer(void *aClosure, const PRUint8 *aData, PRUint32 aCount)
NS_IMETHODIMP
nsBaseChannel::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
{
// If our content type is unknown, then use the content type sniffer. If the
// sniffer is not available for some reason, then we just keep going as-is.
if (NS_SUCCEEDED(mStatus) && mContentType.EqualsLiteral(UNKNOWN_CONTENT_TYPE)) {
// If our content type is unknown or if the content type is
// application/octet-stream and the caller requested it, use the content type
// sniffer. If the sniffer is not available for some reason, then we just keep
// going as-is.
bool shouldSniff = mContentType.EqualsLiteral(UNKNOWN_CONTENT_TYPE) ||
((mLoadFlags & LOAD_TREAT_APPLICATION_OCTET_STREAM_AS_UNKNOWN) &&
mContentType.EqualsLiteral(APPLICATION_OCTET_STREAM));
if (NS_SUCCEEDED(mStatus) && shouldSniff) {
mPump->PeekStream(CallUnknownTypeSniffer, static_cast<nsIChannel*>(this));
}

67
netwerk/cache/nsCacheEntryDescriptor.cpp поставляемый
Просмотреть файл

@ -51,7 +51,7 @@ nsCacheEntryDescriptor::GetClientID(char ** result)
{
NS_ENSURE_ARG_POINTER(result);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETCLIENTID));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
return ClientIDFromCacheKey(*(mCacheEntry->Key()), result);
@ -62,7 +62,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetDeviceID(char ** aDeviceID)
{
NS_ENSURE_ARG_POINTER(aDeviceID);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETDEVICEID));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
const char* deviceID = mCacheEntry->GetDeviceID();
@ -79,7 +79,7 @@ nsCacheEntryDescriptor::GetDeviceID(char ** aDeviceID)
NS_IMETHODIMP
nsCacheEntryDescriptor::GetKey(nsACString &result)
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETKEY));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
return ClientKeyFromCacheKey(*(mCacheEntry->Key()), result);
@ -90,7 +90,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetFetchCount(PRInt32 *result)
{
NS_ENSURE_ARG_POINTER(result);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETFETCHCOUNT));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->FetchCount();
@ -102,7 +102,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetLastFetched(PRUint32 *result)
{
NS_ENSURE_ARG_POINTER(result);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETLASTFETCHED));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->LastFetched();
@ -114,7 +114,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetLastModified(PRUint32 *result)
{
NS_ENSURE_ARG_POINTER(result);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETLASTMODIFIED));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->LastModified();
@ -126,7 +126,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetExpirationTime(PRUint32 *result)
{
NS_ENSURE_ARG_POINTER(result);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETEXPIRATIONTIME));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->ExpirationTime();
@ -137,7 +137,7 @@ nsCacheEntryDescriptor::GetExpirationTime(PRUint32 *result)
NS_IMETHODIMP
nsCacheEntryDescriptor::SetExpirationTime(PRUint32 expirationTime)
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_SETEXPIRATIONTIME));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
mCacheEntry->SetExpirationTime(expirationTime);
@ -149,7 +149,7 @@ nsCacheEntryDescriptor::SetExpirationTime(PRUint32 expirationTime)
NS_IMETHODIMP nsCacheEntryDescriptor::IsStreamBased(bool *result)
{
NS_ENSURE_ARG_POINTER(result);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_ISSTREAMBASED));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->IsStreamData();
@ -159,7 +159,7 @@ NS_IMETHODIMP nsCacheEntryDescriptor::IsStreamBased(bool *result)
NS_IMETHODIMP nsCacheEntryDescriptor::GetPredictedDataSize(PRInt64 *result)
{
NS_ENSURE_ARG_POINTER(result);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETPREDICTEDDATASIZE));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->PredictedDataSize();
@ -169,7 +169,7 @@ NS_IMETHODIMP nsCacheEntryDescriptor::GetPredictedDataSize(PRInt64 *result)
NS_IMETHODIMP nsCacheEntryDescriptor::SetPredictedDataSize(PRInt64
predictedSize)
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_SETPREDICTEDDATASIZE));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
mCacheEntry->SetPredictedDataSize(predictedSize);
@ -179,7 +179,7 @@ NS_IMETHODIMP nsCacheEntryDescriptor::SetPredictedDataSize(PRInt64
NS_IMETHODIMP nsCacheEntryDescriptor::GetDataSize(PRUint32 *result)
{
NS_ENSURE_ARG_POINTER(result);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETDATASIZE));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
const char* val = mCacheEntry->GetMetaDataElement("uncompressed-len");
@ -196,7 +196,7 @@ NS_IMETHODIMP nsCacheEntryDescriptor::GetDataSize(PRUint32 *result)
NS_IMETHODIMP nsCacheEntryDescriptor::GetStorageDataSize(PRUint32 *result)
{
NS_ENSURE_ARG_POINTER(result);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETSTORAGEDATASIZE));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->DataSize();
@ -208,7 +208,7 @@ NS_IMETHODIMP nsCacheEntryDescriptor::GetStorageDataSize(PRUint32 *result)
nsresult
nsCacheEntryDescriptor::RequestDataSizeChange(PRInt32 deltaSize)
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_REQUESTDATASIZECHANGE));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
nsresult rv;
@ -226,7 +226,7 @@ nsCacheEntryDescriptor::RequestDataSizeChange(PRInt32 deltaSize)
NS_IMETHODIMP
nsCacheEntryDescriptor::SetDataSize(PRUint32 dataSize)
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_SETDATASIZE));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
// XXX review for signed/unsigned math errors
@ -254,7 +254,7 @@ nsCacheEntryDescriptor::OpenInputStream(PRUint32 offset, nsIInputStream ** resul
NS_ENSURE_ARG_POINTER(result);
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_OPENINPUTSTREAM));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
if (!mCacheEntry->IsStreamData()) return NS_ERROR_CACHE_DATA_IS_NOT_STREAM;
@ -283,7 +283,7 @@ nsCacheEntryDescriptor::OpenOutputStream(PRUint32 offset, nsIOutputStream ** res
NS_ENSURE_ARG_POINTER(result);
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_OPENOUTPUTSTREAM));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
if (!mCacheEntry->IsStreamData()) return NS_ERROR_CACHE_DATA_IS_NOT_STREAM;
@ -316,7 +316,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetCacheElement(nsISupports ** result)
{
NS_ENSURE_ARG_POINTER(result);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETCACHEELEMENT));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
if (mCacheEntry->IsStreamData()) return NS_ERROR_CACHE_DATA_IS_STREAM;
@ -328,7 +328,7 @@ nsCacheEntryDescriptor::GetCacheElement(nsISupports ** result)
NS_IMETHODIMP
nsCacheEntryDescriptor::SetCacheElement(nsISupports * cacheElement)
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_SETCACHEELEMENT));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
if (mCacheEntry->IsStreamData()) return NS_ERROR_CACHE_DATA_IS_STREAM;
@ -349,7 +349,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetStoragePolicy(nsCacheStoragePolicy *result)
{
NS_ENSURE_ARG_POINTER(result);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETSTORAGEPOLICY));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->StoragePolicy();
@ -360,7 +360,7 @@ nsCacheEntryDescriptor::GetStoragePolicy(nsCacheStoragePolicy *result)
NS_IMETHODIMP
nsCacheEntryDescriptor::SetStoragePolicy(nsCacheStoragePolicy policy)
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_SETSTORAGEPOLICY));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
// XXX validate policy against session?
@ -387,7 +387,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetFile(nsIFile ** result)
{
NS_ENSURE_ARG_POINTER(result);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETFILE));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
return nsCacheService::GetFileForEntry(mCacheEntry, result);
@ -398,7 +398,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetSecurityInfo(nsISupports ** result)
{
NS_ENSURE_ARG_POINTER(result);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETSECURITYINFO));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->SecurityInfo();
@ -410,7 +410,7 @@ nsCacheEntryDescriptor::GetSecurityInfo(nsISupports ** result)
NS_IMETHODIMP
nsCacheEntryDescriptor::SetSecurityInfo(nsISupports * securityInfo)
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_SETSECURITYINFO));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
mCacheEntry->SetSecurityInfo(securityInfo);
@ -422,7 +422,7 @@ nsCacheEntryDescriptor::SetSecurityInfo(nsISupports * securityInfo)
NS_IMETHODIMP
nsCacheEntryDescriptor::Doom()
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_DOOM));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
return nsCacheService::DoomEntry(mCacheEntry);
@ -432,7 +432,7 @@ nsCacheEntryDescriptor::Doom()
NS_IMETHODIMP
nsCacheEntryDescriptor::DoomAndFailPendingRequests(nsresult status)
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_DOOMANDFAILPENDINGREQUESTS));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
return NS_ERROR_NOT_IMPLEMENTED;
@ -442,7 +442,7 @@ nsCacheEntryDescriptor::DoomAndFailPendingRequests(nsresult status)
NS_IMETHODIMP
nsCacheEntryDescriptor::MarkValid()
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_MARKVALID));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
nsresult rv = nsCacheService::ValidateEntry(mCacheEntry);
@ -453,7 +453,7 @@ nsCacheEntryDescriptor::MarkValid()
NS_IMETHODIMP
nsCacheEntryDescriptor::Close()
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_CLOSE));
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
// XXX perhaps closing descriptors should clear/sever transports
@ -472,7 +472,7 @@ nsCacheEntryDescriptor::GetMetaDataElement(const char *key, char **result)
NS_ENSURE_ARG_POINTER(key);
*result = nsnull;
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETMETADATAELEMENT));
NS_ENSURE_TRUE(mCacheEntry, NS_ERROR_NOT_AVAILABLE);
const char *value;
@ -492,7 +492,7 @@ nsCacheEntryDescriptor::SetMetaDataElement(const char *key, const char *value)
{
NS_ENSURE_ARG_POINTER(key);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_SETMETADATAELEMENT));
NS_ENSURE_TRUE(mCacheEntry, NS_ERROR_NOT_AVAILABLE);
// XXX allow null value, for clearing key?
@ -507,7 +507,8 @@ nsCacheEntryDescriptor::SetMetaDataElement(const char *key, const char *value)
NS_IMETHODIMP
nsCacheEntryDescriptor::VisitMetaData(nsICacheMetaDataVisitor * visitor)
{
nsCacheServiceAutoLock lock; // XXX check callers, we're calling out of module
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_VISITMETADATA));
// XXX check callers, we're calling out of module
NS_ENSURE_ARG_POINTER(visitor);
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
@ -526,7 +527,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsCacheEntryDescriptor::nsInputStreamWrapper,
nsresult nsCacheEntryDescriptor::
nsInputStreamWrapper::LazyInit()
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSINPUTSTREAMWRAPPER_LAZYINIT));
nsCacheAccessMode mode;
nsresult rv = mDescriptor->GetAccessGranted(&mode);
@ -739,7 +740,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsCacheEntryDescriptor::nsOutputStreamWrapper,
nsresult nsCacheEntryDescriptor::
nsOutputStreamWrapper::LazyInit()
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSOUTPUTSTREAMWRAPPER_LAZYINIT));
nsCacheAccessMode mode;
nsresult rv = mDescriptor->GetAccessGranted(&mode);

2
netwerk/cache/nsCacheEntryDescriptor.h поставляемый
Просмотреть файл

@ -157,7 +157,7 @@ private:
// XXX _HACK_ the storage stream needs this!
Close();
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSOUTPUTSTREAMWRAPPER_CLOSE));
mDescriptor->mOutput = nsnull;
}
NS_RELEASE(mDescriptor);

72
netwerk/cache/nsCacheService.cpp поставляемый
Просмотреть файл

@ -35,7 +35,6 @@
#include "nsNetCID.h"
#include <math.h> // for log()
#include "mozilla/Services.h"
#include "mozilla/Telemetry.h"
#include "nsITimer.h"
#include "mozilla/FunctionTimer.h"
@ -191,7 +190,7 @@ public:
NS_IMETHOD Notify(nsITimer* aTimer) {
if (nsCacheService::gService) {
nsCacheServiceAutoLock autoLock;
nsCacheServiceAutoLock autoLock(LOCK_TELEM(NSSETDISKSMARTSIZECALLBACK_NOTIFY));
nsCacheService::gService->SetDiskSmartSize_Locked();
nsCacheService::gService->mSmartSizeTimer = nsnull;
}
@ -271,7 +270,7 @@ public:
}
NS_IMETHOD Run()
{
nsCacheServiceAutoLock autoLock;
nsCacheServiceAutoLock autoLock(LOCK_TELEM(NSBLOCKONCACHETHREADEVENT_RUN));
#ifdef PR_LOGGING
CACHE_LOG_DEBUG(("nsBlockOnCacheThreadEvent [%p]\n", this));
#endif
@ -944,7 +943,7 @@ public:
NS_ASSERTION(mRequest->mListener,
"Sync OpenCacheEntry() posted to background thread!");
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSPROCESSREQUESTEVENT_RUN));
rv = nsCacheService::gService->ProcessRequest(mRequest,
false,
nsnull);
@ -1013,7 +1012,7 @@ public:
NS_IMETHOD Run()
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSDOOMEVENT_RUN));
bool foundActive = true;
nsresult status = NS_ERROR_NOT_AVAILABLE;
@ -1178,7 +1177,7 @@ nsCacheService::Shutdown()
nsCOMPtr<nsIFile> parentDir;
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SHUTDOWN));
NS_ASSERTION(mInitialized,
"can't shutdown nsCacheService unless it has been initialized.");
@ -1337,7 +1336,7 @@ nsCacheService::EvictEntriesForClient(const char * clientID,
nsRefPtr<EvictionNotifierRunnable> r = new EvictionNotifierRunnable(this);
NS_DispatchToMainThread(r);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_EVICTENTRIESFORCLIENT));
nsresult res = NS_OK;
if (storagePolicy == nsICache::STORE_ANYWHERE ||
@ -1386,7 +1385,7 @@ nsCacheService::IsStorageEnabledForPolicy(nsCacheStoragePolicy storagePolicy,
bool * result)
{
if (gService == nsnull) return NS_ERROR_NOT_AVAILABLE;
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_ISSTORAGEENABLEDFORPOLICY));
*result = gService->IsStorageEnabledForPolicy_Locked(storagePolicy);
return NS_OK;
@ -1435,7 +1434,7 @@ NS_IMETHODIMP nsCacheService::VisitEntries(nsICacheVisitor *visitor)
{
NS_ENSURE_ARG_POINTER(visitor);
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_VISITENTRIES));
if (!(mEnableDiskDevice || mEnableMemoryDevice))
return NS_ERROR_NOT_AVAILABLE;
@ -1488,7 +1487,7 @@ NS_IMETHODIMP nsCacheService::GetCacheIOTarget(nsIEventTarget * *aCacheIOTarget)
// read from the main thread without the lock. This is useful to prevent
// blocking the main thread on other cache operations.
if (!NS_IsMainThread()) {
Lock();
Lock(LOCK_TELEM(NSCACHESERVICE_GETCACHEIOTARGET));
}
nsresult rv;
@ -1803,7 +1802,7 @@ nsCacheService::ProcessRequest(nsCacheRequest * request,
// XXX this is probably wrong...
Unlock();
rv = request->WaitForValidation();
Lock();
Lock(LOCK_TELEM(NSCACHESERVICE_PROCESSREQUEST));
}
PR_REMOVE_AND_INIT_LINK(request);
@ -1916,7 +1915,7 @@ nsCacheService::OpenCacheEntry(nsCacheSession * session,
}
else {
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_OPENCACHEENTRY));
rv = gService->ProcessRequest(request, true, result);
// delete requests that have completed
@ -2225,7 +2224,7 @@ nsCacheService::OnProfileShutdown(bool cleanse)
// a reference to it. Ignore this call.
return;
}
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_ONPROFILESHUTDOWN));
gService->mClearingEntries = true;
gService->DoomActiveEntries(nsnull);
@ -2270,7 +2269,7 @@ nsCacheService::OnProfileChanged()
CACHE_LOG_DEBUG(("nsCacheService::OnProfileChanged"));
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_ONPROFILECHANGED));
gService->mEnableDiskDevice = gService->mObserver->DiskCacheEnabled();
gService->mEnableOfflineDevice = gService->mObserver->OfflineCacheEnabled();
@ -2324,7 +2323,7 @@ void
nsCacheService::SetDiskCacheEnabled(bool enabled)
{
if (!gService) return;
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETDISKCACHEENABLED));
gService->mEnableDiskDevice = enabled;
}
@ -2333,7 +2332,7 @@ void
nsCacheService::SetDiskCacheCapacity(PRInt32 capacity)
{
if (!gService) return;
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETDISKCACHECAPACITY));
if (gService->mDiskDevice) {
gService->mDiskDevice->SetCapacity(capacity);
@ -2347,7 +2346,7 @@ void
nsCacheService::SetDiskCacheMaxEntrySize(PRInt32 maxSize)
{
if (!gService) return;
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETDISKCACHEMAXENTRYSIZE));
if (gService->mDiskDevice) {
gService->mDiskDevice->SetMaxEntrySize(maxSize);
@ -2358,7 +2357,7 @@ void
nsCacheService::SetMemoryCacheMaxEntrySize(PRInt32 maxSize)
{
if (!gService) return;
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETMEMORYCACHEMAXENTRYSIZE));
if (gService->mMemoryDevice) {
gService->mMemoryDevice->SetMaxEntrySize(maxSize);
@ -2369,7 +2368,7 @@ void
nsCacheService::SetOfflineCacheEnabled(bool enabled)
{
if (!gService) return;
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETOFFLINECACHEENABLED));
gService->mEnableOfflineDevice = enabled;
}
@ -2377,7 +2376,7 @@ void
nsCacheService::SetOfflineCacheCapacity(PRInt32 capacity)
{
if (!gService) return;
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETOFFLINECACHECAPACITY));
if (gService->mOfflineDevice) {
gService->mOfflineDevice->SetCapacity(capacity);
@ -2394,7 +2393,7 @@ nsCacheService::SetMemoryCache()
CACHE_LOG_DEBUG(("nsCacheService::SetMemoryCache"));
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETMEMORYCACHE));
gService->mEnableMemoryDevice = gService->mObserver->MemoryCacheEnabled();
@ -2484,15 +2483,32 @@ nsCacheService::OnDataSizeChange(nsCacheEntry * entry, PRInt32 deltaSize)
}
void
nsCacheService::Lock()
nsCacheService::Lock(mozilla::Telemetry::ID mainThreadLockerID)
{
mozilla::Telemetry::ID lockerID;
mozilla::Telemetry::ID generalID;
bool on;
if (NS_IsMainThread()) {
Telemetry::AutoTimer<Telemetry::CACHE_SERVICE_LOCK_WAIT_MAINTHREAD> timer;
gService->mLock.Lock();
lockerID = mainThreadLockerID;
generalID = mozilla::Telemetry::CACHE_SERVICE_LOCK_WAIT_MAINTHREAD;
} else {
Telemetry::AutoTimer<Telemetry::CACHE_SERVICE_LOCK_WAIT> timer;
gService->mLock.Lock();
lockerID = mozilla::Telemetry::HistogramCount;
generalID = mozilla::Telemetry::CACHE_SERVICE_LOCK_WAIT;
}
TimeStamp start(TimeStamp::Now());
gService->mLock.Lock();
TimeStamp stop(TimeStamp::Now());
// Telemetry isn't thread safe on its own, but this is OK because we're
// protecting it with the cache lock.
if (lockerID != mozilla::Telemetry::HistogramCount) {
mozilla::Telemetry::AccumulateTimeDelta(lockerID, start, stop);
}
mozilla::Telemetry::AccumulateTimeDelta(generalID, start, stop);
}
void
@ -2843,7 +2859,7 @@ nsCacheService::LogCacheStatistics()
nsresult
nsCacheService::SetDiskSmartSize()
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETDISKSMARTSIZE));
if (!gService) return NS_ERROR_NOT_AVAILABLE;
@ -2886,7 +2902,7 @@ IsEntryPrivate(nsCacheEntry* entry)
void
nsCacheService::LeavePrivateBrowsing()
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_LEAVEPRIVATEBROWSING));
gService->DoomActiveEntries(IsEntryPrivate);

10
netwerk/cache/nsCacheService.h поставляемый
Просмотреть файл

@ -20,6 +20,7 @@
#include "nsRefPtrHashtable.h"
#include "mozilla/CondVar.h"
#include "mozilla/Mutex.h"
#include "mozilla/Telemetry.h"
class nsCacheRequest;
class nsCacheProfilePrefObserver;
@ -188,7 +189,7 @@ private:
* Internal Methods
*/
static void Lock();
static void Lock(::mozilla::Telemetry::ID mainThreadLockerID);
static void Unlock();
nsresult CreateDiskDevice();
@ -311,12 +312,15 @@ private:
* nsCacheServiceAutoLock
******************************************************************************/
#define LOCK_TELEM(x) \
(::mozilla::Telemetry::CACHE_SERVICE_LOCK_WAIT_MAINTHREAD_##x)
// Instantiate this class to acquire the cache service lock for a particular
// execution scope.
class nsCacheServiceAutoLock {
public:
nsCacheServiceAutoLock() {
nsCacheService::Lock();
nsCacheServiceAutoLock(mozilla::Telemetry::ID mainThreadLockerID) {
nsCacheService::Lock(mainThreadLockerID);
}
~nsCacheServiceAutoLock() {
nsCacheService::Unlock();

2
netwerk/cache/nsDiskCacheBinding.cpp поставляемый
Просмотреть файл

@ -87,7 +87,7 @@ nsDiskCacheBinding::~nsDiskCacheBinding()
// Grab the cache lock since the binding is stored in nsCacheEntry::mData
// and it is released using nsCacheService::ReleaseObject_Locked() which
// releases the object outside the cache lock.
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSDISKCACHEBINDING_DESTRUCTOR));
NS_ASSERTION(PR_CLIST_IS_EMPTY(this), "binding deleted while still on list");
if (!PR_CLIST_IS_EMPTY(this))

4
netwerk/cache/nsDiskCacheDevice.cpp поставляемый
Просмотреть файл

@ -65,7 +65,7 @@ public:
NS_IMETHOD Run()
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSDISKCACHEDEVICEDEACTIVATEENTRYEVENT_RUN));
#ifdef PR_LOGGING
CACHE_LOG_DEBUG(("nsDiskCacheDeviceDeactivateEntryEvent[%p]\n", this));
#endif
@ -90,7 +90,7 @@ public:
NS_IMETHOD Run()
{
nsCacheServiceAutoLock lock;
nsCacheServiceAutoLock lock(LOCK_TELEM(NSEVICTDISKCACHEENTRIESEVENT_RUN));
mDevice->EvictDiskCacheEntries(mDevice->mCacheCapacity);
return NS_OK;
}

4
netwerk/cache/nsDiskCacheStreams.cpp поставляемый
Просмотреть файл

@ -464,7 +464,7 @@ nsDiskCacheStreamIO::ClearBinding()
nsresult
nsDiskCacheStreamIO::CloseOutputStream(nsDiskCacheOutputStream * outputStream)
{
nsCacheServiceAutoLock lock; // grab service lock
nsCacheServiceAutoLock lock(LOCK_TELEM(NSDISKCACHESTREAMIO_CLOSEOUTPUTSTREAM)); // grab service lock
return CloseOutputStreamInternal(outputStream);
}
@ -596,7 +596,7 @@ nsDiskCacheStreamIO::Write( const char * buffer,
PRUint32 * bytesWritten)
{
nsresult rv = NS_OK;
nsCacheServiceAutoLock lock; // grab service lock
nsCacheServiceAutoLock lock(LOCK_TELEM(NSDISKCACHESTREAMIO_WRITE)); // grab service lock
if (!mBinding) return NS_ERROR_NOT_AVAILABLE;
if (mInStreamCount) {

Просмотреть файл

@ -881,8 +881,11 @@ nsresult
nsHttpChannel::CallOnStartRequest()
{
mTracingEnabled = false;
bool shouldSniff = mResponseHead && (mResponseHead->ContentType().IsEmpty() ||
((mResponseHead->ContentType().EqualsLiteral(APPLICATION_OCTET_STREAM) &&
(mLoadFlags & LOAD_TREAT_APPLICATION_OCTET_STREAM_AS_UNKNOWN))));
if (mResponseHead && mResponseHead->ContentType().IsEmpty()) {
if (shouldSniff) {
NS_ASSERTION(mConnectionInfo, "Should have connection info here");
if (!mContentTypeHint.IsEmpty())
mResponseHead->SetContentType(mContentTypeHint);

Просмотреть файл

@ -967,14 +967,14 @@ nsHttpConnection::ReadTimeoutTick(PRIntervalTime now)
PRUint32 pipelineDepth = mTransaction->PipelineDepth();
if (delta >= gHttpHandler->GetPipelineRescheduleTimeout()) {
if (delta >= gHttpHandler->GetPipelineRescheduleTimeout() &&
pipelineDepth > 1) {
// this just reschedules blocked transactions. no transaction
// is aborted completely.
LOG(("cancelling pipeline due to a %ums stall - depth %d\n",
PR_IntervalToMilliseconds(delta), pipelineDepth));
if (pipelineDepth > 1) {
nsHttpPipeline *pipeline = mTransaction->QueryPipeline();
NS_ABORT_IF_FALSE(pipeline, "pipelinedepth > 1 without pipeline");
// code this defensively for the moment and check for null in opt build
@ -986,7 +986,6 @@ nsHttpConnection::ReadTimeoutTick(PRIntervalTime now)
"because reschedule-timeout idle interval exceeded"));
}
}
}
if (delta < gHttpHandler->GetPipelineTimeout())
return;

Просмотреть файл

@ -2861,7 +2861,7 @@ nsConnectionEntry::OnPipelineFeedbackInfo(
if (mPipelineState == PS_GREEN && info == GoodCompletedOK) {
PRInt32 depth = data;
LOG(("Transaction completed at pipeline depty of %d. Host = %s\n",
LOG(("Transaction completed at pipeline depth of %d. Host = %s\n",
depth, mConnInfo->Host()));
if (depth >= 3)

Просмотреть файл

@ -0,0 +1,88 @@
// This file tests the flag LOAD_TREAT_APPLICATION_OCTET_STREAM_AS_UNKNOWN.
do_load_httpd_js();
const octetStreamType = "application/octet-stream";
const sniffedType = "application/x-sniffed";
const snifferCID = Components.ID("{954f3fdd-d717-4c02-9464-7c2da617d21d}");
const snifferContract = "@mozilla.org/network/unittest/contentsniffer;1";
const categoryName = "content-sniffing-services";
var sniffer = {
QueryInterface: function sniffer_qi(iid) {
if (iid.equals(Components.interfaces.nsISupports) ||
iid.equals(Components.interfaces.nsIFactory) ||
iid.equals(Components.interfaces.nsIContentSniffer))
return this;
throw Components.results.NS_ERROR_NO_INTERFACE;
},
createInstance: function sniffer_ci(outer, iid) {
if (outer)
throw Components.results.NS_ERROR_NO_AGGREGATION;
return this.QueryInterface(iid);
},
lockFactory: function sniffer_lockf(lock) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
},
getMIMETypeFromContent: function (request, data, length) {
return sniffedType;
}
};
var listener = {
onStartRequest: function test_onStartR(request, ctx) {
// We should have sniffed the type of the file.
var chan = request.QueryInterface(Components.interfaces.nsIChannel);
do_check_eq(chan.contentType, sniffedType);
},
onDataAvailable: function test_ODA() {
throw Components.results.NS_ERROR_UNEXPECTED;
},
onStopRequest: function test_onStopR(request, ctx, status) {
do_test_finished();
}
};
function handler(metadata, response) {
response.setHeader("Content-Type", octetStreamType);
}
function makeChan(url) {
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var chan = ios.newChannel(url, null, null);
// Force sniffing if we have "application/octet-stream" as Content-Type
chan.loadFlags |= Components.interfaces
.nsIChannel
.LOAD_TREAT_APPLICATION_OCTET_STREAM_AS_UNKNOWN;
return chan;
}
var url = "http://localhost:4444/test";
var httpserv = null;
function run_test() {
httpserv = new nsHttpServer();
httpserv.registerPathHandler("/test", handler);
httpserv.start(4444);
// Register our fake sniffer that always returns the content-type we want.
Components.manager.nsIComponentRegistrar.registerFactory(snifferCID,
"Unit test content sniffer", snifferContract, sniffer);
var catMan = Components.classes["@mozilla.org/categorymanager;1"]
.getService(Components.interfaces.nsICategoryManager);
catMan.nsICategoryManager.addCategoryEntry(categoryName, snifferContract,
"unit test", false, true);
var chan = makeChan(url);
chan.asyncOpen(listener, null);
do_test_pending();
}

Просмотреть файл

@ -100,6 +100,7 @@ fail-if = os == "android"
[test_duplicate_headers.js]
[test_event_sink.js]
[test_extract_charset_from_content_type.js]
[test_force_sniffing.js]
[test_fallback_no-cache-entry_canceled.js]
# Bug 675039: test hangs consistently on Android
skip-if = os == "android"

Просмотреть файл

@ -209,6 +209,73 @@ HISTOGRAM(CACHE_LM_INCONSISTENT, 0, 1, 2, BOOLEAN, "Cache discovered inconsiste
HISTOGRAM(CACHE_SERVICE_LOCK_WAIT, 1, 10000, 10000, LINEAR, "Time spent waiting on the cache service lock (ms)")
HISTOGRAM(CACHE_SERVICE_LOCK_WAIT_MAINTHREAD, 1, 10000, 10000, LINEAR, "Time spent waiting on the cache service lock on the main thread (ms)")
#define CACHE_LOCK_HISTOGRAM(x) \
HISTOGRAM(CACHE_SERVICE_LOCK_WAIT_MAINTHREAD_##x, 1, 10 * 1000, 50, EXPONENTIAL, "Time spent waiting on the cache service lock (ms) on the main thread in " #x)
CACHE_LOCK_HISTOGRAM(NSSETDISKSMARTSIZECALLBACK_NOTIFY)
CACHE_LOCK_HISTOGRAM(NSPROCESSREQUESTEVENT_RUN)
CACHE_LOCK_HISTOGRAM(NSOUTPUTSTREAMWRAPPER_LAZYINIT)
CACHE_LOCK_HISTOGRAM(NSOUTPUTSTREAMWRAPPER_CLOSE)
CACHE_LOCK_HISTOGRAM(NSINPUTSTREAMWRAPPER_LAZYINIT)
CACHE_LOCK_HISTOGRAM(NSEVICTDISKCACHEENTRIESEVENT_RUN)
CACHE_LOCK_HISTOGRAM(NSDOOMEVENT_RUN)
CACHE_LOCK_HISTOGRAM(NSDISKCACHESTREAMIO_WRITE)
CACHE_LOCK_HISTOGRAM(NSDISKCACHESTREAMIO_CLOSEOUTPUTSTREAM)
CACHE_LOCK_HISTOGRAM(NSDISKCACHEDEVICEDEACTIVATEENTRYEVENT_RUN)
CACHE_LOCK_HISTOGRAM(NSDISKCACHEBINDING_DESTRUCTOR)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_SHUTDOWN)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_SETOFFLINECACHEENABLED)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_SETOFFLINECACHECAPACITY)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_SETMEMORYCACHE)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_SETDISKSMARTSIZE)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_SETDISKCACHEMAXENTRYSIZE)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_SETMEMORYCACHEMAXENTRYSIZE)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_SETDISKCACHEENABLED)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_SETDISKCACHECAPACITY)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_OPENCACHEENTRY)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_ONPROFILESHUTDOWN)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_ONPROFILECHANGED)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_LEAVEPRIVATEBROWSING)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_ISSTORAGEENABLEDFORPOLICY)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_GETCACHEIOTARGET)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_EVICTENTRIESFORCLIENT)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_DOOM)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_SETPREDICTEDDATASIZE)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_GETDATASIZE)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_GETSTORAGEDATASIZE)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_REQUESTDATASIZECHANGE)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_SETDATASIZE)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_OPENINPUTSTREAM)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_OPENOUTPUTSTREAM)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_GETCACHEELEMENT)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_SETCACHEELEMENT)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_GETSTORAGEPOLICY)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_SETSTORAGEPOLICY)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_GETFILE)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_GETSECURITYINFO)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_SETSECURITYINFO)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_DOOMANDFAILPENDINGREQUESTS)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_MARKVALID)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_CLOSE)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_GETMETADATAELEMENT)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_SETMETADATAELEMENT)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_VISITMETADATA)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_SETEXPIRATIONTIME)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_ISSTREAMBASED)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_GETLASTMODIFIED)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_GETEXPIRATIONTIME)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_GETKEY)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_GETFETCHCOUNT)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_GETDEVICEID)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_PROCESSREQUEST)
CACHE_LOCK_HISTOGRAM(NSCACHESERVICE_VISITENTRIES)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_GETPREDICTEDDATASIZE)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_GETLASTFETCHED)
CACHE_LOCK_HISTOGRAM(NSCACHEENTRYDESCRIPTOR_GETCLIENTID)
CACHE_LOCK_HISTOGRAM(NSBLOCKONCACHETHREADEVENT_RUN)
#undef CACHE_LOCK_HISTOGRAM
// DNS_LOOKUP_METHOD was renamed to DNS_LOOKUP_METHOD2 as the old version did not use enumerated values
HISTOGRAM_ENUMERATED_VALUES(DNS_LOOKUP_METHOD2, 16, "DNS Lookup Type (hit, renewal, negative-hit, literal, overflow, network-first, network-shared)")
HISTOGRAM(DNS_CLEANUP_AGE, 1, 1440, 50, EXPONENTIAL, "DNS Cache Entry Age at Removal Time (minutes)")

Просмотреть файл

@ -41,6 +41,8 @@ MAKEFILES_dom="
dom/indexedDB/Makefile
dom/ipc/Makefile
dom/locales/Makefile
dom/messages/Makefile
dom/messages/interfaces/Makefile
dom/network/Makefile
dom/network/interfaces/Makefile
dom/network/src/Makefile