merge mozilla-central to autoland. r=merge a=merge

This commit is contained in:
Sebastian Hengst 2017-08-24 13:30:00 +02:00
commit ab6a6e1367
101 changed files with 1121 additions and 1020 deletions

View File

@ -258,11 +258,13 @@ a11y::MakeXPCEvent(AccEvent* aEvent)
if (eventGroup & (1 << AccEvent::eObjectAttrChangedEvent)) {
AccObjectAttrChangedEvent* oac = downcast_accEvent(aEvent);
nsString attribute;
oac->GetAttribute()->ToString(attribute);
xpEvent = new xpcAccObjectAttributeChangedEvent(type,
ToXPC(acc),
ToXPCDocument(doc), domNode,
fromUser,
oac->GetAttribute());
attribute);
return xpEvent.forget();
}

View File

@ -6,8 +6,6 @@
#include "nsIAccessibleEvent.idl"
interface nsIAtom;
/**
* Fired when an attribute of an accessible changes.
*/
@ -17,5 +15,5 @@ interface nsIAccessibleObjectAttributeChangedEvent : nsIAccessibleEvent
/**
* Return the accessible attribute that changed.
*/
readonly attribute nsIAtom changedAttribute;
readonly attribute AString changedAttribute;
};

View File

@ -232,7 +232,7 @@ this.EventManager.prototype = {
{
let evt = aEvent.QueryInterface(
Ci.nsIAccessibleObjectAttributeChangedEvent);
if (evt.changedAttribute.toString() !== "aria-hidden") {
if (evt.changedAttribute !== "aria-hidden") {
// Only handle aria-hidden attribute change.
break;
}

View File

@ -252,8 +252,7 @@ this.Utils = { // jshint ignore:line
getMessageManager: function getMessageManager(aBrowser) {
try {
return aBrowser.QueryInterface(Ci.nsIFrameLoaderOwner).
frameLoader.messageManager;
return aBrowser.frameLoader.messageManager;
} catch (x) {
return null;
}

View File

@ -1745,7 +1745,7 @@ function objAttrChangedChecker(aID, aAttr) {
return;
}
is(event.changedAttribute.toString(), aAttr,
is(event.changedAttribute, aAttr,
"Wrong attribute name of the object attribute changed event.");
};
@ -1754,7 +1754,7 @@ function objAttrChangedChecker(aID, aAttr) {
var scEvent = aEvent.QueryInterface(
nsIAccessibleObjectAttributeChangedEvent);
return (aEvent.accessible == getAccessible(this.target)) &&
(scEvent.changedAttribute.toString() == aAttr);
(scEvent.changedAttribute == aAttr);
}
return false;
};

View File

@ -107,7 +107,6 @@ var wrapper = {
let iframe = document.getElementById("remote");
this.iframe = iframe;
this.iframe.QueryInterface(Ci.nsIFrameLoaderOwner);
let docShell = this.iframe.frameLoader.docShell;
docShell.QueryInterface(Ci.nsIWebProgress);
docShell.addProgressListener(this.iframeListener,

View File

@ -5361,17 +5361,13 @@ nsBrowserAccess.prototype = {
: Ci.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID
let referrer = aParams.referrer ? makeURI(aParams.referrer) : null;
let browser = this._openURIInNewTab(aURI, referrer,
aParams.referrerPolicy,
aParams.isPrivate,
isExternal, false,
userContextId, null, aParams.openerBrowser,
aParams.triggeringPrincipal,
aNextTabParentId, aName);
if (browser)
return browser.QueryInterface(Ci.nsIFrameLoaderOwner);
return null;
return this._openURIInNewTab(aURI, referrer,
aParams.referrerPolicy,
aParams.isPrivate,
isExternal, false,
userContextId, null, aParams.openerBrowser,
aParams.triggeringPrincipal,
aNextTabParentId, aName);
},
isTabContentWindow(aWindow) {

View File

@ -232,7 +232,6 @@ var gBundle;
const PERMISSION_CONTRACTID = "@mozilla.org/permissionmanager;1";
const PREFERENCES_CONTRACTID = "@mozilla.org/preferences-service;1";
const ATOM_CONTRACTID = "@mozilla.org/atom-service;1";
// a number of services I'll need later
// the cache services

View File

@ -2119,7 +2119,7 @@
if (aParams.remoteType) {
throw new Error("Cannot set opener window on a remote browser!");
}
b.QueryInterface(Ci.nsIFrameLoaderOwner).presetOpenerWindow(aParams.openerWindow);
b.presetOpenerWindow(aParams.openerWindow);
}
if (!aParams.isPreloadBrowser && this.hasAttribute("autocompletepopup")) {
@ -4136,7 +4136,7 @@
this.setTabStateNoAction(tab, state);
let browser = tab.linkedBrowser;
let {tabParent} = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
let {tabParent} = browser.frameLoader;
if (state == this.STATE_LOADING) {
this.assert(!this.minimizedOrFullyOccluded);
browser.docShellIsActive = true;
@ -4723,7 +4723,7 @@
this.requestedTab = tab;
let browser = this.requestedTab.linkedBrowser;
let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
let fl = browser.frameLoader;
if (fl && fl.tabParent && !this.activeSuppressDisplayport.has(fl.tabParent)) {
fl.tabParent.suppressDisplayport(true);

View File

@ -4756,7 +4756,7 @@ var SessionStoreInternal = {
if (options.tabData.storage) {
for (let origin of Object.getOwnPropertyNames(options.tabData.storage)) {
try {
let {frameLoader} = browser.QueryInterface(Components.interfaces.nsIFrameLoaderOwner);
let {frameLoader} = browser;
if (frameLoader.tabParent) {
let attrs = browser.contentPrincipal.originAttributes;
let dataPrincipal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(origin);

View File

@ -224,7 +224,7 @@ var ProcessHangMonitor = {
* Find a active hang report for the given <browser> element.
*/
findActiveReport(browser) {
let frameLoader = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
let frameLoader = browser.frameLoader;
for (let report of this._activeReports) {
if (report.isReportForBrowser(frameLoader)) {
return report;
@ -237,7 +237,7 @@ var ProcessHangMonitor = {
* Find a paused hang report for the given <browser> element.
*/
findPausedReport(browser) {
let frameLoader = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
let frameLoader = browser.frameLoader;
for (let [report, ] of this._pausedReports) {
if (report.isReportForBrowser(frameLoader)) {
return report;

View File

@ -62,10 +62,9 @@ if (url.search.length > 1) {
throw new Error("Unable to find the targeted iframe to debug");
}
// Need to use a xray and query some interfaces to have
// attributes and behavior expected by devtools codebase
// Need to use a xray to have attributes and behavior expected by
// devtools codebase
iframe = XPCNativeWrapper(iframe);
iframe.QueryInterface(Ci.nsIFrameLoaderOwner);
// Fake a xul:tab object as we don't have one.
// linkedBrowser is the only one attribute being queried by client.getTab

View File

@ -627,8 +627,7 @@ const JsonView = {
// The following code emulates saveBrowser, but:
// - Uses the given blob URL containing the custom contents to save.
// - Obtains the file name from the URL of the document, not the blob.
let persistable = browser.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader.QueryInterface(Ci.nsIWebBrowserPersistable);
let persistable = browser.frameLoader;
persistable.startPersistence(message.data.windowID, {
onDocumentReady(doc) {
let uri = chrome.makeURI(doc.documentURI, doc.characterSet);

View File

@ -89,6 +89,20 @@ GetMaxBudget(bool aIsBackground)
return maxBudget > 0 ? TimeDuration::FromMilliseconds(maxBudget)
: TimeDuration::Forever();
}
TimeDuration
GetMinBudget(bool aIsBackground)
{
// The minimum budget is computed by looking up the maximum allowed
// delay and computing how long time it would take to regenerate
// that budget using the regeneration factor. This number is
// expected to be negative.
return TimeDuration::FromMilliseconds(
- gBudgetThrottlingMaxDelay /
std::max(aIsBackground ? gBackgroundBudgetRegenerationFactor
: gForegroundBudgetRegenerationFactor,
1));
}
} // namespace
//
@ -205,9 +219,7 @@ TimeoutManager::MinSchedulingDelay() const
mExecutionBudget < TimeDuration()) {
// Only throttle if execution budget is less than 0
double factor = 1.0 / GetRegenerationFactor(mWindow.IsBackgroundInternal());
return TimeDuration::Min(
TimeDuration::FromMilliseconds(gBudgetThrottlingMaxDelay),
TimeDuration::Max(unthrottled, -mExecutionBudget.MultDouble(factor)));
return TimeDuration::Max(unthrottled, -mExecutionBudget.MultDouble(factor));
}
//
return unthrottled;
@ -333,9 +345,11 @@ TimeoutManager::UpdateBudget(const TimeStamp& aNow, const TimeDuration& aDuratio
if (BudgetThrottlingEnabled(isBackground)) {
double factor = GetRegenerationFactor(isBackground);
TimeDuration regenerated = (aNow - mLastBudgetUpdate).MultDouble(factor);
// Clamp the budget to the maximum allowed budget.
mExecutionBudget = TimeDuration::Min(
GetMaxBudget(isBackground), mExecutionBudget - aDuration + regenerated);
// Clamp the budget to the range of minimum and maximum allowed budget.
mExecutionBudget = TimeDuration::Max(
GetMinBudget(isBackground),
TimeDuration::Min(GetMaxBudget(isBackground),
mExecutionBudget - aDuration + regenerated));
}
mLastBudgetUpdate = aNow;
}

View File

@ -84,6 +84,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/FrameLoaderBinding.h"
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "mozilla/layout/RenderFrameParent.h"
#include "GeckoProfiler.h"
@ -143,17 +144,18 @@ typedef FrameMetrics::ViewID ViewID;
// we'd need to re-institute a fixed version of bug 98158.
#define MAX_DEPTH_CONTENT_FRAMES 10
NS_IMPL_CYCLE_COLLECTION(nsFrameLoader,
mDocShell,
mMessageManager,
mChildMessageManager,
mOpener,
mPartialSHistory)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsFrameLoader,
mDocShell,
mMessageManager,
mChildMessageManager,
mOpener,
mPartialSHistory)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsFrameLoader)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFrameLoader)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameLoader)
NS_INTERFACE_MAP_ENTRY(nsIFrameLoader)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIFrameLoader)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserPersistable)
NS_INTERFACE_MAP_END
@ -231,6 +233,15 @@ nsFrameLoader::Create(Element* aOwner, nsPIDOMWindowOuter* aOpener, bool aNetwor
return new nsFrameLoader(aOwner, aOpener, aNetworkCreated, aJSPluginId);
}
void
nsFrameLoader::LoadFrame(ErrorResult& aRv)
{
nsresult rv = LoadFrame();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::LoadFrame()
{
@ -309,6 +320,15 @@ nsFrameLoader::FireErrorEvent()
loadBlockingAsyncDispatcher->PostDOMEvent();
}
void
nsFrameLoader::LoadURI(nsIURI* aURI, ErrorResult& aRv)
{
nsresult rv = LoadURI(aURI);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::LoadURI(nsIURI* aURI)
{
@ -336,6 +356,15 @@ nsFrameLoader::LoadURI(nsIURI* aURI)
return rv;
}
void
nsFrameLoader::SetIsPrerendered(ErrorResult& aRv)
{
nsresult rv = SetIsPrerendered();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::SetIsPrerendered()
{
@ -345,6 +374,15 @@ nsFrameLoader::SetIsPrerendered()
return NS_OK;
}
void
nsFrameLoader::MakePrerenderedLoaderActive(ErrorResult& aRv)
{
nsresult rv = MakePrerenderedLoaderActive();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::MakePrerenderedLoaderActive()
{
@ -371,6 +409,14 @@ nsFrameLoader::MakePrerenderedLoaderActive()
return NS_OK;
}
already_AddRefed<nsIPartialSHistory>
nsFrameLoader::GetPartialSHistory()
{
nsCOMPtr<nsIPartialSHistory> partialSHistory;
MOZ_ALWAYS_SUCCEEDS(GetPartialSHistory(getter_AddRefs(partialSHistory)));
return partialSHistory.forget();
}
NS_IMETHODIMP
nsFrameLoader::GetPartialSHistory(nsIPartialSHistory** aResult)
{
@ -385,6 +431,17 @@ nsFrameLoader::GetPartialSHistory(nsIPartialSHistory** aResult)
return NS_OK;
}
already_AddRefed<nsIGroupedSHistory>
nsFrameLoader::EnsureGroupedSHistory(ErrorResult& aRv)
{
nsCOMPtr<nsIGroupedSHistory> result;
nsresult rv = EnsureGroupedSHistory(getter_AddRefs(result));
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
return result.forget();
}
NS_IMETHODIMP
nsFrameLoader::EnsureGroupedSHistory(nsIGroupedSHistory** aResult)
{
@ -409,6 +466,14 @@ nsFrameLoader::EnsureGroupedSHistory(nsIGroupedSHistory** aResult)
return NS_OK;
}
already_AddRefed<nsIGroupedSHistory>
nsFrameLoader::GetGroupedSHistory()
{
nsCOMPtr<nsIGroupedSHistory> groupedSHistory;
MOZ_ALWAYS_SUCCEEDS(GetGroupedSHistory(getter_AddRefs(groupedSHistory)));
return groupedSHistory.forget();
}
NS_IMETHODIMP
nsFrameLoader::GetGroupedSHistory(nsIGroupedSHistory** aResult)
{
@ -680,30 +745,32 @@ nsFrameLoader::FireWillChangeProcessEvent()
return allPromise.forget();
}
NS_IMETHODIMP
nsFrameLoader::AppendPartialSHistoryAndSwap(nsIFrameLoader* aOther, nsISupports** aPromise)
already_AddRefed<Promise>
nsFrameLoader::AppendPartialSHistoryAndSwap(nsIFrameLoader& aOther, ErrorResult& aRv)
{
if (!aOther) {
return NS_ERROR_INVALID_POINTER;
nsresult rv = SetIsPrerendered();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return nullptr;
}
if (aOther == this) {
return NS_OK;
if (&aOther == this) {
return nullptr;
}
RefPtr<nsFrameLoader> otherLoader = static_cast<nsFrameLoader*>(aOther);
RefPtr<nsFrameLoader> otherLoader = static_cast<nsFrameLoader*>(&aOther);
RefPtr<Promise> ready = FireWillChangeProcessEvent();
if (NS_WARN_IF(!ready)) {
return NS_ERROR_FAILURE;
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
// This promise will be resolved when the swap has finished, we return it now
// and pass it to our helper so our helper can resolve it.
ErrorResult rv;
RefPtr<Promise> complete = Promise::Create(mOwnerContent->GetOwnerGlobal(), rv);
if (NS_WARN_IF(rv.Failed())) {
return rv.StealNSResult();
RefPtr<Promise> complete = Promise::Create(mOwnerContent->GetOwnerGlobal(), aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
// Attach our handler to the ready promise, and make it fulfil the complete
@ -711,25 +778,39 @@ nsFrameLoader::AppendPartialSHistoryAndSwap(nsIFrameLoader* aOther, nsISupports*
RefPtr<AppendPartialSHistoryAndSwapHelper> helper =
new AppendPartialSHistoryAndSwapHelper(this, otherLoader, complete);
ready->AppendNativeHandler(helper);
return complete.forget();
}
NS_IMETHODIMP
nsFrameLoader::AppendPartialSHistoryAndSwap(nsIFrameLoader* aOther, nsISupports** aPromise)
{
if (!aOther) {
return NS_ERROR_INVALID_POINTER;
}
ErrorResult rv;
RefPtr<Promise> complete = AppendPartialSHistoryAndSwap(*aOther, rv);
if (rv.Failed()) {
return rv.StealNSResult();
}
complete.forget(aPromise);
return NS_OK;
}
NS_IMETHODIMP
nsFrameLoader::RequestGroupedHistoryNavigation(uint32_t aGlobalIndex, nsISupports** aPromise)
already_AddRefed<Promise>
nsFrameLoader::RequestGroupedHistoryNavigation(uint32_t aGlobalIndex, ErrorResult& aRv)
{
RefPtr<Promise> ready = FireWillChangeProcessEvent();
if (NS_WARN_IF(!ready)) {
return NS_ERROR_FAILURE;
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
// This promise will be resolved when the swap has finished, we return it now
// and pass it to our helper so our helper can resolve it.
ErrorResult rv;
RefPtr<Promise> complete = Promise::Create(mOwnerContent->GetOwnerGlobal(), rv);
if (NS_WARN_IF(rv.Failed())) {
return rv.StealNSResult();
RefPtr<Promise> complete = Promise::Create(mOwnerContent->GetOwnerGlobal(), aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
// Attach our handler to the ready promise, and make it fulfil the complete
@ -737,10 +818,31 @@ nsFrameLoader::RequestGroupedHistoryNavigation(uint32_t aGlobalIndex, nsISupport
RefPtr<RequestGroupedHistoryNavigationHelper> helper =
new RequestGroupedHistoryNavigationHelper(this, aGlobalIndex, complete);
ready->AppendNativeHandler(helper);
return complete.forget();
}
NS_IMETHODIMP
nsFrameLoader::RequestGroupedHistoryNavigation(uint32_t aGlobalIndex, nsISupports** aPromise)
{
ErrorResult rv;
RefPtr<Promise> complete = RequestGroupedHistoryNavigation(aGlobalIndex, rv);
if (rv.Failed()) {
return rv.StealNSResult();
}
complete.forget(aPromise);
return NS_OK;
}
void
nsFrameLoader::AddProcessChangeBlockingPromise(Promise& aPromise, ErrorResult& aRv)
{
if (NS_WARN_IF(!mBrowserChangingProcessBlockers)) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
} else {
mBrowserChangingProcessBlockers->AppendElement(&aPromise);
}
}
NS_IMETHODIMP
nsFrameLoader::AddProcessChangeBlockingPromise(js::Handle<js::Value> aPromise,
JSContext* aCx)
@ -755,11 +857,10 @@ nsFrameLoader::AddProcessChangeBlockingPromise(js::Handle<js::Value> aPromise,
return rv.StealNSResult();
}
if (NS_WARN_IF(!mBrowserChangingProcessBlockers)) {
return NS_ERROR_DOM_INVALID_STATE_ERR;
AddProcessChangeBlockingPromise(*promise, rv);
if (NS_WARN_IF(rv.Failed())) {
return rv.StealNSResult();
}
mBrowserChangingProcessBlockers->AppendElement(promise);
return NS_OK;
}
@ -926,6 +1027,17 @@ nsFrameLoader::CheckURILoad(nsIURI* aURI)
return CheckForRecursiveLoad(aURI);
}
already_AddRefed<nsIDocShell>
nsFrameLoader::GetDocShell(ErrorResult& aRv)
{
nsCOMPtr<nsIDocShell> docShell;
nsresult rv = GetDocShell(getter_AddRefs(docShell));
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
return docShell.forget();
}
NS_IMETHODIMP
nsFrameLoader::GetDocShell(nsIDocShell **aDocShell)
{
@ -1980,6 +2092,15 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
return NS_OK;
}
void
nsFrameLoader::Destroy(ErrorResult& aRv)
{
nsresult rv = Destroy();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::Destroy()
{
@ -2235,6 +2356,17 @@ nsFrameLoader::SetOwnerContent(Element* aContent)
mOwnerContent->RemoveMutationObserver(this);
}
mOwnerContent = aContent;
AutoJSAPI jsapi;
jsapi.Init();
JS::RootedObject wrapper(jsapi.cx(), GetWrapper());
if (wrapper) {
JSAutoCompartment ac(jsapi.cx(), wrapper);
nsresult rv = ReparentWrapper(jsapi.cx(), wrapper);
Unused << NS_WARN_IF(NS_FAILED(rv));
}
if (RenderFrameParent* rfp = GetCurrentRenderFrame()) {
rfp->OwnerContentChanged(aContent);
}
@ -2784,29 +2916,43 @@ nsFrameLoader::UpdateBaseWindowPositionAndSize(nsSubDocumentFrame *aIFrame)
}
}
NS_IMETHODIMP
nsFrameLoader::GetLazyWidth(uint32_t* aLazyWidth)
uint32_t
nsFrameLoader::LazyWidth() const
{
*aLazyWidth = mLazySize.width;
uint32_t lazyWidth = mLazySize.width;
nsIFrame* frame = GetPrimaryFrameOfOwningContent();
if (frame) {
*aLazyWidth = frame->PresContext()->DevPixelsToIntCSSPixels(*aLazyWidth);
lazyWidth = frame->PresContext()->DevPixelsToIntCSSPixels(lazyWidth);
}
return lazyWidth;
}
NS_IMETHODIMP
nsFrameLoader::GetLazyWidth(uint32_t* aLazyWidth)
{
*aLazyWidth = LazyWidth();
return NS_OK;
}
uint32_t
nsFrameLoader::LazyHeight() const
{
uint32_t lazyHeight = mLazySize.height;
nsIFrame* frame = GetPrimaryFrameOfOwningContent();
if (frame) {
lazyHeight = frame->PresContext()->DevPixelsToIntCSSPixels(lazyHeight);
}
return lazyHeight;
}
NS_IMETHODIMP
nsFrameLoader::GetLazyHeight(uint32_t* aLazyHeight)
{
*aLazyHeight = mLazySize.height;
nsIFrame* frame = GetPrimaryFrameOfOwningContent();
if (frame) {
*aLazyHeight = frame->PresContext()->DevPixelsToIntCSSPixels(*aLazyHeight);
}
*aLazyHeight = LazyHeight();
return NS_OK;
}
@ -3084,6 +3230,15 @@ nsFrameLoader::GetCurrentRenderFrame() const
return nullptr;
}
void
nsFrameLoader::ActivateRemoteFrame(ErrorResult& aRv)
{
nsresult rv = ActivateRemoteFrame();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::ActivateRemoteFrame() {
if (mRemoteBrowser) {
@ -3093,6 +3248,15 @@ nsFrameLoader::ActivateRemoteFrame() {
return NS_ERROR_UNEXPECTED;
}
void
nsFrameLoader::DeactivateRemoteFrame(ErrorResult& aRv)
{
nsresult rv = DeactivateRemoteFrame();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::DeactivateRemoteFrame() {
if (mRemoteBrowser) {
@ -3102,6 +3266,22 @@ nsFrameLoader::DeactivateRemoteFrame() {
return NS_ERROR_UNEXPECTED;
}
void
nsFrameLoader::SendCrossProcessMouseEvent(const nsAString& aType,
float aX,
float aY,
int32_t aButton,
int32_t aClickCount,
int32_t aModifiers,
bool aIgnoreRootScrollFrame,
ErrorResult& aRv)
{
nsresult rv = SendCrossProcessMouseEvent(aType, aX, aY, aButton, aClickCount, aModifiers, aIgnoreRootScrollFrame);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::SendCrossProcessMouseEvent(const nsAString& aType,
float aX,
@ -3120,6 +3300,15 @@ nsFrameLoader::SendCrossProcessMouseEvent(const nsAString& aType,
return NS_ERROR_FAILURE;
}
void
nsFrameLoader::ActivateFrameEvent(const nsAString& aType, bool aCapture, ErrorResult& aRv)
{
nsresult rv = ActivateFrameEvent(aType, aCapture);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::ActivateFrameEvent(const nsAString& aType,
bool aCapture)
@ -3131,6 +3320,20 @@ nsFrameLoader::ActivateFrameEvent(const nsAString& aType,
return NS_ERROR_FAILURE;
}
void
nsFrameLoader::SendCrossProcessKeyEvent(const nsAString& aType,
int32_t aKeyCode,
int32_t aCharCode,
int32_t aModifiers,
bool aPreventDefault,
ErrorResult& aRv)
{
nsresult rv = SendCrossProcessKeyEvent(aType, aKeyCode, aCharCode, aModifiers, aPreventDefault);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::SendCrossProcessKeyEvent(const nsAString& aType,
int32_t aKeyCode,
@ -3264,6 +3467,14 @@ nsFrameLoader::DoSendAsyncMessage(JSContext* aCx,
return NS_ERROR_UNEXPECTED;
}
already_AddRefed<nsIMessageSender>
nsFrameLoader::GetMessageManager()
{
nsCOMPtr<nsIMessageSender> messageManager;
MOZ_ALWAYS_SUCCEEDS(GetMessageManager(getter_AddRefs(messageManager)));
return messageManager.forget();
}
NS_IMETHODIMP
nsFrameLoader::GetMessageManager(nsIMessageSender** aManager)
{
@ -3353,6 +3564,13 @@ nsFrameLoader::GetTabChildGlobalAsEventTarget()
return static_cast<nsInProcessTabChildGlobal*>(mChildMessageManager.get());
}
already_AddRefed<Element>
nsFrameLoader::GetOwnerElement()
{
nsCOMPtr<Element> element = do_QueryInterface(mOwnerContent);
return element.forget();
}
NS_IMETHODIMP
nsFrameLoader::GetOwnerElement(nsIDOMElement **aElement)
{
@ -3490,6 +3708,15 @@ nsFrameLoader::AttributeChanged(nsIDocument* aDocument,
/**
* Send the RequestNotifyAfterRemotePaint message to the current Tab.
*/
void
nsFrameLoader::RequestNotifyAfterRemotePaint(ErrorResult& aRv)
{
nsresult rv = RequestNotifyAfterRemotePaint();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::RequestNotifyAfterRemotePaint()
{
@ -3501,6 +3728,15 @@ nsFrameLoader::RequestNotifyAfterRemotePaint()
return NS_OK;
}
void
nsFrameLoader::RequestFrameLoaderClose(ErrorResult& aRv)
{
nsresult rv = RequestFrameLoaderClose();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::RequestFrameLoaderClose()
{
@ -3513,6 +3749,18 @@ nsFrameLoader::RequestFrameLoaderClose()
return browser->CloseBrowser();
}
void
nsFrameLoader::Print(uint64_t aOuterWindowID,
nsIPrintSettings* aPrintSettings,
nsIWebProgressListener* aProgressListener,
ErrorResult& aRv)
{
nsresult rv = Print(aOuterWindowID, aPrintSettings, aProgressListener);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::Print(uint64_t aOuterWindowID,
nsIPrintSettings* aPrintSettings,
@ -3551,6 +3799,12 @@ nsFrameLoader::Print(uint64_t aOuterWindowID,
return NS_OK;
}
already_AddRefed<nsITabParent>
nsFrameLoader::GetTabParent()
{
return do_AddRef(mRemoteBrowser);
}
NS_IMETHODIMP
nsFrameLoader::GetTabParent(nsITabParent** aTabParent)
{
@ -3559,6 +3813,14 @@ nsFrameLoader::GetTabParent(nsITabParent** aTabParent)
return NS_OK;
}
already_AddRefed<nsILoadContext>
nsFrameLoader::LoadContext()
{
nsCOMPtr<nsILoadContext> loadContext;
MOZ_ALWAYS_SUCCEEDS(GetLoadContext(getter_AddRefs(loadContext)));
return loadContext.forget();
}
NS_IMETHODIMP
nsFrameLoader::GetLoadContext(nsILoadContext** aLoadContext)
{
@ -3611,6 +3873,17 @@ nsFrameLoader::DestroyBrowserFrameScripts()
}
}
void
nsFrameLoader::StartPersistence(uint64_t aOuterWindowID,
nsIWebBrowserPersistDocumentReceiver* aRecv,
ErrorResult& aRv)
{
nsresult rv = StartPersistence(aOuterWindowID, aRecv);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::StartPersistence(uint64_t aOuterWindowID,
nsIWebBrowserPersistDocumentReceiver* aRecv)
@ -3768,3 +4041,11 @@ nsFrameLoader::GetProcessMessageManager() const
return mRemoteBrowser ? mRemoteBrowser->Manager()->GetMessageManager()
: nullptr;
};
JSObject*
nsFrameLoader::WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto)
{
JS::RootedObject result(cx);
FrameLoaderBinding::Wrap(cx, this, this, aGivenProto, &result);
return result;
}

View File

@ -17,8 +17,10 @@
#include "nsIFrameLoader.h"
#include "nsPoint.h"
#include "nsSize.h"
#include "nsWrapperCache.h"
#include "nsIURI.h"
#include "nsFrameMessageManager.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Attributes.h"
#include "nsStubMutationObserver.h"
@ -67,7 +69,8 @@ typedef struct _GtkWidget GtkWidget;
class nsFrameLoader final : public nsIFrameLoader,
public nsIWebBrowserPersistable,
public nsStubMutationObserver,
public mozilla::dom::ipc::MessageManagerCallback
public mozilla::dom::ipc::MessageManagerCallback,
public nsWrapperCache
{
friend class AutoResetInShow;
friend class AutoResetInFrameSwap;
@ -84,7 +87,7 @@ public:
int32_t aJSPluginID = nsFakePluginTag::NOT_JSPLUGIN);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
NS_DECL_NSIFRAMELOADER
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
NS_DECL_NSIWEBBROWSERPERSISTABLE
@ -97,6 +100,107 @@ public:
mozilla::dom::EventTarget* GetTabChildGlobalAsEventTarget();
nsresult CreateStaticClone(nsIFrameLoader* aDest);
// WebIDL methods
already_AddRefed<nsIDocShell> GetDocShell(mozilla::ErrorResult& aRv);
already_AddRefed<nsITabParent> GetTabParent();
already_AddRefed<nsILoadContext> LoadContext();
void LoadFrame(mozilla::ErrorResult& aRv);
void LoadURI(nsIURI* aURI, mozilla::ErrorResult& aRv);
void SetIsPrerendered(mozilla::ErrorResult& aRv);
void MakePrerenderedLoaderActive(mozilla::ErrorResult& aRv);
already_AddRefed<mozilla::dom::Promise>
AppendPartialSHistoryAndSwap(nsIFrameLoader& aOther, mozilla::ErrorResult& aRv);
already_AddRefed<mozilla::dom::Promise>
RequestGroupedHistoryNavigation(uint32_t aGlobalIndex, mozilla::ErrorResult& aRv);
void AddProcessChangeBlockingPromise(mozilla::dom::Promise& aPromise, mozilla::ErrorResult& aRv);
void Destroy(mozilla::ErrorResult& aRv);
void ActivateRemoteFrame(mozilla::ErrorResult& aRv);
void DeactivateRemoteFrame(mozilla::ErrorResult& aRv);
void SendCrossProcessMouseEvent(const nsAString& aType,
float aX,
float aY,
int32_t aButton,
int32_t aClickCount,
int32_t aModifiers,
bool aIgnoreRootScrollFrame,
mozilla::ErrorResult& aRv);
void SendCrossProcessKeyEvent(const nsAString& aType,
int32_t aKeyCode,
int32_t aCharCode,
int32_t aModifiers,
bool aPreventDefault,
mozilla::ErrorResult& aRv);
void ActivateFrameEvent(const nsAString& aType,
bool aCapture,
mozilla::ErrorResult& aRv);
void RequestNotifyAfterRemotePaint(mozilla::ErrorResult& aRv);
void RequestFrameLoaderClose(mozilla::ErrorResult& aRv);
void Print(uint64_t aOuterWindowID,
nsIPrintSettings* aPrintSettings,
nsIWebProgressListener* aProgressListener,
mozilla::ErrorResult& aRv);
already_AddRefed<nsIGroupedSHistory> EnsureGroupedSHistory(mozilla::ErrorResult& aRv);
void StartPersistence(uint64_t aOuterWindowID,
nsIWebBrowserPersistDocumentReceiver* aRecv,
mozilla::ErrorResult& aRv);
// WebIDL getters
already_AddRefed<nsIMessageSender> GetMessageManager();
uint32_t EventMode() const { return mEventMode; }
already_AddRefed<Element> GetOwnerElement();
uint32_t LazyWidth() const;
uint32_t LazyHeight() const;
already_AddRefed<nsIPartialSHistory> GetPartialSHistory();
already_AddRefed<nsIGroupedSHistory> GetGroupedSHistory();
uint64_t ChildID() const { return mChildID; }
bool ClampScrollPosition() const { return mClampScrollPosition; }
bool ClipSubdocument() const { return mClipSubdocument; }
bool DepthTooGreat() const { return mDepthTooGreat; }
bool IsDead() const { return mDestroyCalled; }
/**
* Is this a frame loader for a bona fide <iframe mozbrowser>?
* <xul:browser> is not a mozbrowser, so this is false for that case.
*/
bool OwnerIsMozBrowserFrame();
nsIContent* GetParentObject() const { return mOwnerContent; }
/**
* MessageManagerCallback methods that we override.
*/
@ -231,6 +335,8 @@ public:
RefPtr<nsFrameMessageManager> mMessageManager;
nsCOMPtr<nsIInProcessContentFrameMessageManager> mChildMessageManager;
virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override;
private:
nsFrameLoader(mozilla::dom::Element* aOwner,
nsPIDOMWindowOuter* aOpener,
@ -252,12 +358,6 @@ private:
return mJSPluginID != nsFakePluginTag::NOT_JSPLUGIN;
}
/**
* Is this a frame loader for a bona fide <iframe mozbrowser>?
* <xul:browser> is not a mozbrowser, so this is false for that case.
*/
bool OwnerIsMozBrowserFrame();
/**
* Is this a frame loader for an isolated <iframe mozbrowser>?
*

View File

@ -20,7 +20,7 @@ interface nsIWebProgressListener;
interface nsIGroupedSHistory;
interface nsIPartialSHistory;
[scriptable, builtinclass, uuid(1645af04-1bc7-4363-8f2c-eb9679220ab1)]
[builtinclass, uuid(1645af04-1bc7-4363-8f2c-eb9679220ab1)]
interface nsIFrameLoader : nsISupports
{
/**

View File

@ -379,6 +379,10 @@ DOMInterfaces = {
'wrapperCache': False,
},
'FrameLoader': {
'nativeType': 'nsFrameLoader',
},
'FuzzingFunctions': {
# The codegen is dumb, and doesn't understand that this interface is only a
# collection of static methods, so we have this `concrete: False` hack.
@ -1728,6 +1732,7 @@ addExternalIface('RTCDataChannel', nativeType='nsIDOMDataChannel')
addExternalIface('HitRegionOptions', nativeType='nsISupports')
addExternalIface('imgINotificationObserver', nativeType='imgINotificationObserver')
addExternalIface('imgIRequest', nativeType='imgIRequest', notflattened=True)
addExternalIface('LoadContext', nativeType='nsILoadContext', notflattened=True)
addExternalIface('LoadInfo', nativeType='nsILoadInfo',
headerFile='nsILoadInfo.h', notflattened=True)
addExternalIface('MenuBuilder', nativeType='nsIMenuBuilder', notflattened=True)
@ -1745,10 +1750,18 @@ addExternalIface('nsIBrowserDOMWindow', nativeType='nsIBrowserDOMWindow',
addExternalIface('nsIDOMCrypto', nativeType='nsIDOMCrypto',
headerFile='Crypto.h')
addExternalIface('nsIFile', nativeType='nsIFile', notflattened=True)
addExternalIface('nsIGroupedSHistory', nativeType='nsIGroupedSHistory',
notflattened=True)
addExternalIface('nsILoadGroup', nativeType='nsILoadGroup',
headerFile='nsILoadGroup.h', notflattened=True)
addExternalIface('nsIMessageBroadcaster', nativeType='nsIMessageBroadcaster',
headerFile='nsIMessageManager.h', notflattened=True)
addExternalIface('nsIMessageSender', nativeType='nsIMessageSender',
headerFile='nsIMessageManager.h', notflattened=True)
addExternalIface('nsIPartialSHistory', nativeType='nsIPartialSHistory',
notflattened=True)
addExternalIface('nsIPrintSettings', nativeType='nsIPrintSettings',
notflattened=True)
addExternalIface('nsISelectionListener', nativeType='nsISelectionListener')
addExternalIface('nsIStreamListener', nativeType='nsIStreamListener', notflattened=True)
addExternalIface('nsITransportProvider', nativeType='nsITransportProvider')
@ -1758,6 +1771,12 @@ addExternalIface('nsISupports', nativeType='nsISupports')
addExternalIface('nsIDocShell', nativeType='nsIDocShell', notflattened=True)
addExternalIface('nsIEditor', nativeType='nsIEditor', notflattened=True)
addExternalIface('nsIVariant', nativeType='nsIVariant', notflattened=True)
addExternalIface('nsIWebBrowserPersistDocumentReceiver',
nativeType='nsIWebBrowserPersistDocumentReceiver',
headerFile='nsIWebBrowserPersistDocument.h',
notflattened=True)
addExternalIface('nsIWebProgressListener', nativeType='nsIWebProgressListener',
notflattened=True)
addExternalIface('nsIScriptableRegion', nativeType='nsIScriptableRegion', notflattened=True)
addExternalIface('OutputStream', nativeType='nsIOutputStream',
notflattened=True)
@ -1765,6 +1784,8 @@ addExternalIface('Principal', nativeType='nsIPrincipal',
headerFile='nsIPrincipal.h', notflattened=True)
addExternalIface('StackFrame', nativeType='nsIStackFrame',
headerFile='nsIException.h', notflattened=True)
addExternalIface('TabParent', nativeType='nsITabParent',
notflattened=True)
addExternalIface('URI', nativeType='nsIURI', headerFile='nsIURI.h',
notflattened=True)
addExternalIface('XULCommandDispatcher', notflattened=True)

View File

@ -33,7 +33,7 @@ interface nsIWebBrowserPersistDocumentReceiver;
* The nsIWebBrowserPersistDocumentReceiver is a callback that
* will be fired once the document is ready for persisting.
*/
[scriptable, uuid(f4c3fa8e-83e9-49f8-ac6f-951fc7541fe4)]
[uuid(f4c3fa8e-83e9-49f8-ac6f-951fc7541fe4)]
interface nsIWebBrowserPersistable : nsISupports
{
void startPersistence(in unsigned long long aOuterWindowID,

View File

@ -0,0 +1,284 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
interface LoadContext;
interface TabParent;
interface URI;
interface nsIDocShell;
interface nsIGroupedSHistory;
interface nsIMessageSender;
interface nsIPartialSHistory;
interface nsIPrintSettings;
interface nsIWebBrowserPersistDocumentReceiver;
interface nsIWebProgressListener;
[ChromeOnly]
interface FrameLoader {
/**
* Get the docshell from the frame loader.
*/
[GetterThrows]
readonly attribute nsIDocShell? docShell;
/**
* Get this frame loader's TabParent, if it has a remote frame. Otherwise,
* returns null.
*/
readonly attribute TabParent? tabParent;
/**
* Get an nsILoadContext for the top-level docshell. For remote
* frames, a shim is returned that contains private browsing and app
* information.
*/
readonly attribute LoadContext loadContext;
/**
* Start loading the frame. This method figures out what to load
* from the owner content in the frame loader.
*/
[Throws]
void loadFrame();
/**
* Loads the specified URI in this frame. Behaves identically to loadFrame,
* except that this method allows specifying the URI to load.
*/
[Throws]
void loadURI(URI aURI);
/**
* Puts the frameloader in prerendering mode.
*/
[Throws]
void setIsPrerendered();
/**
* Make the prerendered frameloader being active (and clear isPrerendered flag).
*/
[Throws]
void makePrerenderedLoaderActive();
/**
* Append partial session history from another frame loader.
*
* @return A promise which will be resolved when the navigation is complete.
*/
[Throws]
Promise<void> appendPartialSHistoryAndSwap(FrameLoader aOther);
/**
* If grouped session history is applied, use this function to navigate to
* an entry of session history object of another frameloader.
*
* @return A promise which will be resolved when the navigation is complete.
*/
[Throws]
Promise<void> requestGroupedHistoryNavigation(unsigned long aGlobalIndex);
/**
* Adds a blocking promise for the current cross process navigation.
* This method can only be called while the "BrowserWillChangeProcess" event
* is being fired.
*/
[Throws]
void addProcessChangeBlockingPromise(Promise<any> aPromise);
/**
* Destroy the frame loader and everything inside it. This will
* clear the weak owner content reference.
*/
[Throws]
void destroy();
/**
* Find out whether the loader's frame is at too great a depth in
* the frame tree. This can be used to decide what operations may
* or may not be allowed on the loader's docshell.
*/
[Pure]
readonly attribute boolean depthTooGreat;
/**
* Activate remote frame.
* Throws an exception with non-remote frames.
*/
[Throws]
void activateRemoteFrame();
/**
* Deactivate remote frame.
* Throws an exception with non-remote frames.
*/
[Throws]
void deactivateRemoteFrame();
/**
* @see nsIDOMWindowUtils sendMouseEvent.
*/
[Throws]
void sendCrossProcessMouseEvent(DOMString aType,
float aX,
float aY,
long aButton,
long aClickCount,
long aModifiers,
optional boolean aIgnoreRootScrollFrame = false);
/**
* Activate event forwarding from client (remote frame) to parent.
*/
[Throws]
void activateFrameEvent(DOMString aType, boolean capture);
// Note, when frameloaders are swapped, also messageManagers are swapped.
readonly attribute nsIMessageSender? messageManager;
/**
* @see nsIDOMWindowUtils sendKeyEvent.
*/
[Throws]
void sendCrossProcessKeyEvent(DOMString aType,
long aKeyCode,
long aCharCode,
long aModifiers,
optional boolean aPreventDefault = false);
/**
* Request that the next time a remote layer transaction has been
* received by the Compositor, a MozAfterRemoteFrame event be sent
* to the window.
*/
[Throws]
void requestNotifyAfterRemotePaint();
/**
* Close the window through the ownerElement.
*/
[Throws]
void requestFrameLoaderClose();
/**
* Print the current document.
*
* @param aOuterWindowID the ID of the outer window to print
* @param aPrintSettings optional print settings to use; printSilent can be
* set to prevent prompting.
* @param aProgressListener optional print progress listener.
*/
[Throws]
void print(unsigned long long aOuterWindowID,
nsIPrintSettings aPrintSettings,
nsIWebProgressListener aProgressListener);
/**
* Ensure that the current nsIFrameLoader has a GroupedSHistory.
*/
[Throws]
nsIGroupedSHistory ensureGroupedSHistory();
/**
* The default event mode automatically forwards the events
* handled in EventStateManager::HandleCrossProcessEvent to
* the child content process when these events are targeted to
* the remote browser element.
*
* Used primarly for input events (mouse, keyboard)
*/
const unsigned long EVENT_MODE_NORMAL_DISPATCH = 0x00000000;
/**
* With this event mode, it's the application's responsability to
* convert and forward events to the content process
*/
const unsigned long EVENT_MODE_DONT_FORWARD_TO_CHILD = 0x00000001;
[Pure]
attribute unsigned long eventMode;
/**
* If false, then the subdocument is not clipped to its CSS viewport, and the
* subdocument's viewport scrollbar(s) are not rendered.
* Defaults to true.
*/
attribute boolean clipSubdocument;
/**
* If false, then the subdocument's scroll coordinates will not be clamped
* to their scroll boundaries.
* Defaults to true.
*/
attribute boolean clampScrollPosition;
/**
* The element which owns this frame loader.
*
* For example, if this is a frame loader for an <iframe>, this attribute
* returns the iframe element.
*/
[Pure]
readonly attribute Element? ownerElement;
/**
* Cached childID of the ContentParent owning the TabParent in this frame
* loader. This can be used to obtain the childID after the TabParent died.
*/
[Pure]
readonly attribute unsigned long long childID;
/**
* Find out whether the owner content really is a mozbrowser. <xul:browser>
* is not considered to be a mozbrowser frame.
*/
[Pure]
readonly attribute boolean ownerIsMozBrowserFrame;
/**
* The last known width of the frame. Reading this property will not trigger
* a reflow, and therefore may not reflect the current state of things. It
* should only be used in asynchronous APIs where values are not guaranteed
* to be up-to-date when received.
*/
[Pure]
readonly attribute unsigned long lazyWidth;
/**
* The last known height of the frame. Reading this property will not trigger
* a reflow, and therefore may not reflect the current state of things. It
* should only be used in asynchronous APIs where values are not guaranteed
* to be up-to-date when received.
*/
[Pure]
readonly attribute unsigned long lazyHeight;
/**
* The partial session history.
*/
readonly attribute nsIPartialSHistory? partialSHistory;
/**
* The grouped session history composed of multiple session history objects
* across root docshells.
*/
readonly attribute nsIGroupedSHistory? groupedSHistory;
/**
* Is `true` if the frameloader is dead (destroy has been called on it)
*/
[Pure]
readonly attribute boolean isDead;
};
[NoInterfaceObject]
interface WebBrowserPersistable
{
[Throws]
void startPersistence(unsigned long long aOuterWindowID,
nsIWebBrowserPersistDocumentReceiver aRecv);
};
FrameLoader implements WebBrowserPersistable;

View File

@ -40,6 +40,7 @@ Element implements LegacyQueryInterface;
Event implements LegacyQueryInterface;
EventSource implements LegacyQueryInterface;
FileList implements LegacyQueryInterface;
FrameLoader implements LegacyQueryInterface;
FormData implements LegacyQueryInterface;
HTMLCollection implements LegacyQueryInterface;
History implements LegacyQueryInterface;

View File

@ -5,7 +5,6 @@
*/
interface XULControllers;
interface MozFrameLoader;
interface MozRDFCompositeDataSource;
interface MozRDFResource;
@ -116,7 +115,7 @@ interface XULElement : Element {
[NoInterfaceObject]
interface MozFrameLoaderOwner {
[ChromeOnly]
readonly attribute MozFrameLoader? frameLoader;
readonly attribute FrameLoader? frameLoader;
[ChromeOnly]
void setIsPrerendered();

View File

@ -538,6 +538,7 @@ WEBIDL_FILES = [
'FontFaceSet.webidl',
'FontFaceSource.webidl',
'FormData.webidl',
'FrameLoader.webidl',
'Function.webidl',
'GainNode.webidl',
'Gamepad.webidl',

View File

@ -42,6 +42,7 @@
#if defined(XP_WIN)
# include "mozilla/gfx/DeviceManagerDx.h"
# include <process.h>
# include <dwrite.h>
#endif
#ifdef MOZ_WIDGET_GTK
# include <gtk/gtk.h>
@ -182,6 +183,9 @@ GPUParent::RecvInit(nsTArray<GfxPrefSetting>&& prefs,
if (gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING)) {
DeviceManagerDx::Get()->CreateCompositorDevices();
}
if (gfxVars::UseWebRender()) {
Factory::EnsureDWriteFactory();
}
#endif
#if defined(MOZ_WIDGET_GTK)

View File

@ -350,38 +350,6 @@ ImageBridgeChild::GetSingleton()
return sImageBridgeChildSingleton;
}
void
ImageBridgeChild::ReleaseTextureClientNow(TextureClient* aClient)
{
MOZ_ASSERT(InImageBridgeChildThread());
RELEASE_MANUALLY(aClient);
}
/* static */ void
ImageBridgeChild::DispatchReleaseTextureClient(TextureClient* aClient)
{
if (!aClient) {
return;
}
RefPtr<ImageBridgeChild> imageBridge = ImageBridgeChild::GetSingleton();
if (!imageBridge) {
// TextureClient::Release should normally happen in the ImageBridgeChild
// thread because it usually generate some IPDL messages.
// However, if we take this branch it means that the ImageBridgeChild
// has already shut down, along with the TextureChild, which means no
// message will be sent and it is safe to run this code from any thread.
RELEASE_MANUALLY(aClient);
return;
}
RefPtr<Runnable> runnable = WrapRunnable(
imageBridge,
&ImageBridgeChild::ReleaseTextureClientNow,
aClient);
imageBridge->GetMessageLoop()->PostTask(runnable.forget());
}
void
ImageBridgeChild::UpdateImageClient(RefPtr<ImageContainer> aContainer)
{

View File

@ -205,7 +205,6 @@ public:
TextureFlags aFlag);
void UpdateAsyncCanvasRenderer(AsyncCanvasRenderer* aClient);
void UpdateImageClient(RefPtr<ImageContainer> aContainer);
static void DispatchReleaseTextureClient(TextureClient* aClient);
/**
* Flush all Images sent to CompositableHost.
@ -238,8 +237,6 @@ private:
CompositableType aType,
ImageContainer* aImageContainer);
void ReleaseTextureClientNow(TextureClient* aClient);
void UpdateAsyncCanvasRendererNow(AsyncCanvasRenderer* aClient);
void UpdateAsyncCanvasRendererSync(
SynchronousTask* aTask,

View File

@ -35,14 +35,6 @@ SharedPlanarYCbCrImage::SharedPlanarYCbCrImage(ImageClient* aCompositable)
SharedPlanarYCbCrImage::~SharedPlanarYCbCrImage() {
MOZ_COUNT_DTOR(SharedPlanarYCbCrImage);
if (mCompositable->GetAsyncHandle() && !InImageBridgeChildThread()) {
if (mTextureClient) {
ADDREF_MANUALLY(mTextureClient);
ImageBridgeChild::DispatchReleaseTextureClient(mTextureClient);
mTextureClient = nullptr;
}
}
}
size_t

View File

@ -27,7 +27,7 @@ public:
explicit SharedPlanarYCbCrImage(ImageClient* aCompositable);
protected:
~SharedPlanarYCbCrImage();
virtual ~SharedPlanarYCbCrImage();
public:
virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;

View File

@ -62,12 +62,6 @@ SharedRGBImage::SharedRGBImage(ImageClient* aCompositable)
SharedRGBImage::~SharedRGBImage()
{
MOZ_COUNT_DTOR(SharedRGBImage);
if (mCompositable->GetAsyncHandle() && !InImageBridgeChildThread()) {
ADDREF_MANUALLY(mTextureClient);
ImageBridgeChild::DispatchReleaseTextureClient(mTextureClient);
mTextureClient = nullptr;
}
}
bool

View File

@ -35,7 +35,7 @@ public:
explicit SharedRGBImage(ImageClient* aCompositable);
protected:
~SharedRGBImage();
virtual ~SharedRGBImage();
public:
virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;

View File

@ -27,7 +27,7 @@ typedef struct FT_FaceRec_* FT_Face;
* as that may accidentally try to re-lock the face within Cairo itself
* and thus deadlock.
*/
class gfxFT2LockedFace {
class MOZ_STACK_CLASS gfxFT2LockedFace {
public:
explicit gfxFT2LockedFace(gfxFT2FontBase *aFont) :
mGfxFont(aFont),
@ -59,7 +59,7 @@ protected:
FT_ULong variantSelector);
CharVariantFunction FindCharVariantFunction();
RefPtr<gfxFT2FontBase> mGfxFont;
gfxFT2FontBase* MOZ_NON_OWNING_REF mGfxFont; // owned by caller
FT_Face mFace;
};

View File

@ -178,6 +178,8 @@ private:
void AddFamily(const nsAString& aFamilyName, bool aSystemFont);
void ActivateFontsFromDir(nsIFile* aDir);
#ifdef MOZ_BUNDLED_FONTS
void ActivateBundledFonts();
#endif

View File

@ -699,6 +699,12 @@ gfxSingleFaceMacFontFamily::ReadOtherFamilyNames(gfxPlatformFontList *aPlatformF
/* gfxMacPlatformFontList */
#pragma mark-
// A bunch of fonts for "additional language support" are shipped in a
// "Language Support" directory, and don't show up in the standard font
// list returned by CTFontManagerCopyAvailableFontFamilyNames unless
// we explicitly activate them.
#define LANG_FONTS_DIR "/Library/Application Support/Apple/Fonts/Language Support"
gfxMacPlatformFontList::gfxMacPlatformFontList() :
gfxPlatformFontList(false),
mDefaultFont(nullptr),
@ -708,6 +714,15 @@ gfxMacPlatformFontList::gfxMacPlatformFontList() :
ActivateBundledFonts();
#endif
nsresult rv;
nsCOMPtr<nsIFile> langFonts(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv)) {
rv = langFonts->InitWithNativePath(NS_LITERAL_CSTRING(LANG_FONTS_DIR));
if (NS_SUCCEEDED(rv)) {
ActivateFontsFromDir(langFonts);
}
}
::CFNotificationCenterAddObserver(::CFNotificationCenterGetLocalCenter(),
this,
RegisteredFontsChangedNotificationCallback,
@ -1493,27 +1508,16 @@ gfxMacPlatformFontList::CreateFontInfoData()
return fi.forget();
}
#ifdef MOZ_BUNDLED_FONTS
void
gfxMacPlatformFontList::ActivateBundledFonts()
gfxMacPlatformFontList::ActivateFontsFromDir(nsIFile* aDir)
{
nsCOMPtr<nsIFile> localDir;
nsresult rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(localDir));
if (NS_FAILED(rv)) {
return;
}
if (NS_FAILED(localDir->Append(NS_LITERAL_STRING("fonts")))) {
return;
}
bool isDir;
if (NS_FAILED(localDir->IsDirectory(&isDir)) || !isDir) {
if (NS_FAILED(aDir->IsDirectory(&isDir)) || !isDir) {
return;
}
nsCOMPtr<nsISimpleEnumerator> e;
rv = localDir->GetDirectoryEntries(getter_AddRefs(e));
if (NS_FAILED(rv)) {
if (NS_FAILED(aDir->GetDirectoryEntries(getter_AddRefs(e)))) {
return;
}
@ -1546,4 +1550,21 @@ gfxMacPlatformFontList::ActivateBundledFonts()
}
}
#ifdef MOZ_BUNDLED_FONTS
void
gfxMacPlatformFontList::ActivateBundledFonts()
{
nsCOMPtr<nsIFile> localDir;
if (NS_FAILED(NS_GetSpecialDirectory(NS_GRE_DIR,
getter_AddRefs(localDir)))) {
return;
}
if (NS_FAILED(localDir->Append(NS_LITERAL_STRING("fonts")))) {
return;
}
ActivateFontsFromDir(localDir);
}
#endif

View File

@ -336,8 +336,7 @@ this.OnRefTestLoad = function OnRefTestLoad(win)
logger.warning("Could not get test plugin tags.");
}
gBrowserMessageManager = gBrowser.QueryInterface(CI.nsIFrameLoaderOwner)
.frameLoader.messageManager;
gBrowserMessageManager = gBrowser.frameLoader.messageManager;
// The content script waits for the initial onload, then notifies
// us.
RegisterMessageListenersAndLoadContentScript();

View File

@ -5,4 +5,4 @@ Makefile.in build files for the Mozilla build system.
The nestegg git repository is: https://github.com/kinetiknz/nestegg
The git commit ID used was af26fc354ec9eadf5fcd34fb01223be3f6f8a773.
The git commit ID used was 369d153d5d176f58e2742fc843b3ed134d7c64f4.

View File

@ -249,6 +249,7 @@ int nestegg_track_type(nestegg * context, unsigned int track);
@param track Zero based track number.
@retval #NESTEGG_CODEC_VP8 Track codec is VP8.
@retval #NESTEGG_CODEC_VP9 Track codec is VP9.
@retval #NESTEGG_CODEC_AV1 Track codec is AV1.
@retval #NESTEGG_CODEC_VORBIS Track codec is Vorbis.
@retval #NESTEGG_CODEC_OPUS Track codec is Opus.
@retval #NESTEGG_CODEC_UNKNOWN Track codec is unknown.

View File

@ -2174,7 +2174,7 @@ nestegg_duration(nestegg * ctx, uint64_t * duration)
return -1;
if (unscaled_duration != unscaled_duration ||
unscaled_duration < 0 || unscaled_duration > (double) UINT64_MAX ||
unscaled_duration < 0 || unscaled_duration >= (double) UINT64_MAX ||
(uint64_t) unscaled_duration > UINT64_MAX / tc_scale)
return -1;

View File

@ -94,7 +94,6 @@ var wrapper = {
let iframe = document.getElementById("remote");
this.iframe = iframe;
this.iframe.QueryInterface(Ci.nsIFrameLoaderOwner);
let docShell = this.iframe.frameLoader.docShell;
docShell.QueryInterface(Ci.nsIWebProgress);
docShell.addProgressListener(this.iframeListener,

View File

@ -3426,10 +3426,7 @@ nsBrowserAccess.prototype = {
//
// We also ignore aName if it is set, as it is currently only used on the
// e10s codepath.
let browser = this._getBrowser(aURI, null, aWhere, aFlags, null);
if (browser)
return browser.QueryInterface(Ci.nsIFrameLoaderOwner);
return null;
return this._getBrowser(aURI, null, aWhere, aFlags, null);
},
isTabContentWindow: function(aWindow) {

View File

@ -123,7 +123,7 @@ class GeckoViewNavigation extends GeckoViewModule {
if (aWhere === Ci.nsIBrowserDOMWindow.OPEN_DEFAULTWINDOW ||
aWhere === Ci.nsIBrowserDOMWindow.OPEN_CURRENTWINDOW) {
return this.browser.QueryInterface(Ci.nsIFrameLoaderOwner);
return this.browser;
}
throw Cr.NS_ERROR_ABORT;

View File

@ -36,14 +36,6 @@ pref("general.warnOnAboutConfig", true);
// maximum number of dated backups to keep at any time
pref("browser.bookmarks.max_backups", 5);
// Delete HTTP cache v1 data
pref("browser.cache.auto_delete_cache_version", 0);
// Preference for switching the cache backend, can be changed freely at runtime
// 0 - use the old (Darin's) cache
// 1 - use the new cache back-end (cache v2)
pref("browser.cache.use_new_backend", 0);
pref("browser.cache.use_new_backend_temp", true);
pref("browser.cache.disk.enable", true);
// Is this the first-time smartsizing has been introduced?
pref("browser.cache.disk.smart_size.first_run", true);

View File

@ -963,25 +963,13 @@ nsLoadGroup::TelemetryReportChannel(nsITimedChannel *aTimedChannel,
} \
\
if (!cacheReadStart.IsNull() && !cacheReadEnd.IsNull()) { \
if (!CacheObserver::UseNewCache()) { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_OPEN_TO_FIRST_FROM_CACHE, \
asyncOpen, cacheReadStart); \
} else { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_OPEN_TO_FIRST_FROM_CACHE_V2, \
asyncOpen, cacheReadStart); \
} \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_OPEN_TO_FIRST_FROM_CACHE_V2, \
asyncOpen, cacheReadStart); \
\
if (!CacheObserver::UseNewCache()) { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_CACHE_READ_TIME, \
cacheReadStart, cacheReadEnd); \
} else { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_CACHE_READ_TIME_V2, \
cacheReadStart, cacheReadEnd); \
} \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_CACHE_READ_TIME_V2, \
cacheReadStart, cacheReadEnd); \
\
if (!requestStart.IsNull() && !responseEnd.IsNull()) { \
Telemetry::AccumulateTimeDelta( \
@ -991,38 +979,20 @@ nsLoadGroup::TelemetryReportChannel(nsITimedChannel *aTimedChannel,
} \
\
if (!cacheReadEnd.IsNull()) { \
if (!CacheObserver::UseNewCache()) { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD, \
asyncOpen, cacheReadEnd); \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_CACHED, \
asyncOpen, cacheReadEnd); \
} else { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_V2, \
asyncOpen, cacheReadEnd); \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_CACHED_V2, \
asyncOpen, cacheReadEnd); \
} \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_V2, \
asyncOpen, cacheReadEnd); \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_CACHED_V2, \
asyncOpen, cacheReadEnd); \
} \
else if (!responseEnd.IsNull()) { \
if (!CacheObserver::UseNewCache()) { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD, \
asyncOpen, responseEnd); \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_NET, \
asyncOpen, responseEnd); \
} else { \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_V2, \
asyncOpen, responseEnd); \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_NET_V2, \
asyncOpen, responseEnd); \
} \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_V2, \
asyncOpen, responseEnd); \
Telemetry::AccumulateTimeDelta( \
Telemetry::HTTP_##prefix##_COMPLETE_LOAD_NET_V2, \
asyncOpen, responseEnd); \
}
if (aDefaultRequest) {

View File

@ -1314,10 +1314,7 @@ nsCacheService::CreateSession(const char * clientID,
{
*result = nullptr;
if (net::CacheObserver::UseNewCache())
return NS_ERROR_NOT_IMPLEMENTED;
return CreateSessionInternal(clientID, storagePolicy, streamBased, result);
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
@ -1475,10 +1472,7 @@ nsCacheService::IsStorageEnabledForPolicy_Locked(nsCacheStoragePolicy storagePo
NS_IMETHODIMP nsCacheService::VisitEntries(nsICacheVisitor *visitor)
{
if (net::CacheObserver::UseNewCache())
return NS_ERROR_NOT_IMPLEMENTED;
return VisitEntriesInternal(visitor);
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult nsCacheService::VisitEntriesInternal(nsICacheVisitor *visitor)
@ -1537,10 +1531,7 @@ void nsCacheService::FireClearNetworkCacheStoredAnywhereNotification()
NS_IMETHODIMP nsCacheService::EvictEntries(nsCacheStoragePolicy storagePolicy)
{
if (net::CacheObserver::UseNewCache())
return NS_ERROR_NOT_IMPLEMENTED;
return EvictEntriesInternal(storagePolicy);
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult nsCacheService::EvictEntriesInternal(nsCacheStoragePolicy storagePolicy)
@ -3108,33 +3099,7 @@ nsCacheService::SetDiskSmartSize()
nsresult
nsCacheService::SetDiskSmartSize_Locked()
{
nsresult rv;
if (mozilla::net::CacheObserver::UseNewCache()) {
return NS_ERROR_NOT_AVAILABLE;
}
if (!mObserver->DiskCacheParentDirectory())
return NS_ERROR_NOT_AVAILABLE;
if (!mDiskDevice)
return NS_ERROR_NOT_AVAILABLE;
if (!mObserver->SmartSizeEnabled())
return NS_ERROR_NOT_AVAILABLE;
nsAutoString cachePath;
rv = mObserver->DiskCacheParentDirectory()->GetPath(cachePath);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIRunnable> event =
new nsGetSmartSizeEvent(cachePath, mDiskDevice->getCacheSize(),
mObserver->ShouldUseOldMaxSmartSize());
DispatchToCacheIOThread(event);
} else {
return NS_ERROR_FAILURE;
}
return NS_OK;
return NS_ERROR_NOT_AVAILABLE;
}
void

View File

@ -4265,10 +4265,6 @@ CacheFileIOManager::UpdateSmartCacheSize(int64_t aFreeSpace)
nsresult rv;
if (!CacheObserver::UseNewCache()) {
return NS_ERROR_NOT_AVAILABLE;
}
if (!CacheObserver::SmartCacheSizeEnabled()) {
return NS_ERROR_NOT_AVAILABLE;
}

View File

@ -23,14 +23,6 @@ namespace net {
CacheObserver* CacheObserver::sSelf = nullptr;
static uint32_t const kDefaultUseNewCache = 1; // Use the new cache by default
uint32_t CacheObserver::sUseNewCache = kDefaultUseNewCache;
static bool sUseNewCacheTemp = false; // Temp trigger to not lose early adopters
static int32_t const kAutoDeleteCacheVersion = -1; // Auto-delete off by default
static int32_t sAutoDeleteCacheVersion = kAutoDeleteCacheVersion;
static int32_t const kDefaultHalfLifeExperiment = -1; // Disabled
int32_t CacheObserver::sHalfLifeExperiment = kDefaultHalfLifeExperiment;
@ -150,14 +142,6 @@ CacheObserver::Shutdown()
void
CacheObserver::AttachToPreferences()
{
sAutoDeleteCacheVersion = mozilla::Preferences::GetInt(
"browser.cache.auto_delete_cache_version", kAutoDeleteCacheVersion);
mozilla::Preferences::AddUintVarCache(
&sUseNewCache, "browser.cache.use_new_backend", kDefaultUseNewCache);
mozilla::Preferences::AddBoolVarCache(
&sUseNewCacheTemp, "browser.cache.use_new_backend_temp", false);
mozilla::Preferences::AddBoolVarCache(
&sUseDiskCache, "browser.cache.disk.enable", kDefaultUseDiskCache);
mozilla::Preferences::AddBoolVarCache(
@ -292,25 +276,6 @@ uint32_t CacheObserver::MemoryCacheCapacity()
return sAutoMemoryCacheCapacity = capacity;
}
// static
bool CacheObserver::UseNewCache()
{
uint32_t useNewCache = sUseNewCache;
if (sUseNewCacheTemp)
useNewCache = 1;
switch (useNewCache) {
case 0: // use the old cache backend
return false;
case 1: // use the new cache backend
return true;
}
return true;
}
// static
void
CacheObserver::SetDiskCacheCapacity(uint32_t aCapacity)
@ -528,8 +493,7 @@ CacheObserver::Observe(nsISupports* aSubject,
}
if (!strcmp(aTopic, "browser-delayed-startup-finished")) {
uint32_t activeVersion = UseNewCache() ? 1 : 0;
CacheStorageService::CleaupCacheDirectories(sAutoDeleteCacheVersion, activeVersion);
CacheStorageService::CleaupCacheDirectories();
return NS_OK;
}

View File

@ -27,7 +27,6 @@ class CacheObserver : public nsIObserver
static CacheObserver* Self() { return sSelf; }
// Access to preferences
static bool UseNewCache();
static bool UseDiskCache()
{ return sUseDiskCache; }
static bool UseMemoryCache()
@ -86,7 +85,6 @@ private:
void StoreHashStatsReported();
void AttachToPreferences();
static uint32_t sUseNewCache;
static bool sUseMemoryCache;
static bool sUseDiskCache;
static uint32_t sMetadataMemoryLimit;

View File

@ -571,13 +571,11 @@ class CleaupCacheDirectoriesRunnable : public Runnable
{
public:
NS_DECL_NSIRUNNABLE
static bool Post(uint32_t aVersion, uint32_t aActive);
static bool Post();
private:
CleaupCacheDirectoriesRunnable(uint32_t aVersion, uint32_t aActive)
CleaupCacheDirectoriesRunnable()
: Runnable("net::CleaupCacheDirectoriesRunnable")
, mVersion(aVersion)
, mActive(aActive)
{
nsCacheService::GetDiskCacheDirectory(getter_AddRefs(mCache1Dir));
CacheFileIOManager::GetCacheDirectory(getter_AddRefs(mCache2Dir));
@ -587,7 +585,6 @@ private:
}
virtual ~CleaupCacheDirectoriesRunnable() {}
uint32_t mVersion, mActive;
nsCOMPtr<nsIFile> mCache1Dir, mCache2Dir;
#if defined(MOZ_WIDGET_ANDROID)
nsCOMPtr<nsIFile> mCache2Profileless;
@ -595,11 +592,10 @@ private:
};
// static
bool CleaupCacheDirectoriesRunnable::Post(uint32_t aVersion, uint32_t aActive)
bool CleaupCacheDirectoriesRunnable::Post()
{
// CleaupCacheDirectories is called regardless what cache version is set up to use.
// To obtain the cache1 directory we must unfortunately instantiate the old cache
// service despite it may not be used at all... This also initialize nsDeleteDir.
// service despite it may not be used at all... This also initializes nsDeleteDir.
nsCOMPtr<nsICacheService> service = do_GetService(NS_CACHESERVICE_CONTRACTID);
if (!service)
return false;
@ -609,8 +605,7 @@ bool CleaupCacheDirectoriesRunnable::Post(uint32_t aVersion, uint32_t aActive)
if (!thread)
return false;
RefPtr<CleaupCacheDirectoriesRunnable> r =
new CleaupCacheDirectoriesRunnable(aVersion, aActive);
RefPtr<CleaupCacheDirectoriesRunnable> r = new CleaupCacheDirectoriesRunnable();
thread->Dispatch(r, NS_DISPATCH_NORMAL);
return true;
}
@ -633,22 +628,8 @@ NS_IMETHODIMP CleaupCacheDirectoriesRunnable::Run()
}
#endif
// Delete the non-active version cache data right now
if (mVersion == mActive) {
return NS_OK;
}
switch (mVersion) {
case 0:
if (mCache1Dir) {
nsDeleteDir::DeleteDir(mCache1Dir, true, 30000);
}
break;
case 1:
if (mCache2Dir) {
nsDeleteDir::DeleteDir(mCache2Dir, true, 30000);
}
break;
if (mCache1Dir) {
nsDeleteDir::DeleteDir(mCache1Dir, true, 30000);
}
return NS_OK;
@ -657,11 +638,11 @@ NS_IMETHODIMP CleaupCacheDirectoriesRunnable::Run()
} // namespace
// static
void CacheStorageService::CleaupCacheDirectories(uint32_t aVersion, uint32_t aActive)
void CacheStorageService::CleaupCacheDirectories()
{
// Make sure we schedule just once in case CleaupCacheDirectories gets called
// multiple times from some reason.
static bool runOnce = CleaupCacheDirectoriesRunnable::Post(aVersion, aActive);
static bool runOnce = CleaupCacheDirectoriesRunnable::Post();
if (!runOnce) {
NS_WARNING("Could not start cache trashes cleanup");
}
@ -707,14 +688,8 @@ NS_IMETHODIMP CacheStorageService::MemoryCacheStorage(nsILoadContextInfo *aLoadC
NS_ENSURE_ARG(aLoadContextInfo);
NS_ENSURE_ARG(_retval);
nsCOMPtr<nsICacheStorage> storage;
if (CacheObserver::UseNewCache()) {
storage = new CacheStorage(aLoadContextInfo, false, false, false, false);
}
else {
storage = new _OldStorage(aLoadContextInfo, false, false, false, nullptr);
}
nsCOMPtr<nsICacheStorage> storage = new CacheStorage(
aLoadContextInfo, false, false, false, false);
storage.forget(_retval);
return NS_OK;
}
@ -732,14 +707,8 @@ NS_IMETHODIMP CacheStorageService::DiskCacheStorage(nsILoadContextInfo *aLoadCon
// in memory.
bool useDisk = CacheObserver::UseDiskCache();
nsCOMPtr<nsICacheStorage> storage;
if (CacheObserver::UseNewCache()) {
storage = new CacheStorage(aLoadContextInfo, useDisk, aLookupAppCache, false /* size limit */, false /* don't pin */);
}
else {
storage = new _OldStorage(aLoadContextInfo, useDisk, aLookupAppCache, false, nullptr);
}
nsCOMPtr<nsICacheStorage> storage = new CacheStorage(
aLoadContextInfo, useDisk, aLookupAppCache, false /* size limit */, false /* don't pin */);
storage.forget(_retval);
return NS_OK;
}
@ -750,10 +719,6 @@ NS_IMETHODIMP CacheStorageService::PinningCacheStorage(nsILoadContextInfo *aLoad
NS_ENSURE_ARG(aLoadContextInfo);
NS_ENSURE_ARG(_retval);
if (!CacheObserver::UseNewCache()) {
return NS_ERROR_NOT_IMPLEMENTED;
}
// When disk cache is disabled don't pretend we cache.
if (!CacheObserver::UseDiskCache()) {
return NS_ERROR_NOT_AVAILABLE;
@ -773,14 +738,9 @@ NS_IMETHODIMP CacheStorageService::AppCacheStorage(nsILoadContextInfo *aLoadCont
NS_ENSURE_ARG(_retval);
nsCOMPtr<nsICacheStorage> storage;
if (CacheObserver::UseNewCache()) {
// Using classification since cl believes we want to instantiate this method
// having the same name as the desired class...
storage = new mozilla::net::AppCacheStorage(aLoadContextInfo, aApplicationCache);
}
else {
storage = new _OldStorage(aLoadContextInfo, true, false, true, aApplicationCache);
}
// Using classification since cl believes we want to instantiate this method
// having the same name as the desired class...
storage = new mozilla::net::AppCacheStorage(aLoadContextInfo, aApplicationCache);
storage.forget(_retval);
return NS_OK;
@ -792,14 +752,8 @@ NS_IMETHODIMP CacheStorageService::SynthesizedCacheStorage(nsILoadContextInfo *a
NS_ENSURE_ARG(aLoadContextInfo);
NS_ENSURE_ARG(_retval);
nsCOMPtr<nsICacheStorage> storage;
if (CacheObserver::UseNewCache()) {
storage = new CacheStorage(aLoadContextInfo, false, false, true /* skip size checks for synthesized cache */, false /* no pinning */);
}
else {
storage = new _OldStorage(aLoadContextInfo, false, false, false, nullptr);
}
nsCOMPtr<nsICacheStorage> storage = new CacheStorage(
aLoadContextInfo, false, false, true /* skip size checks for synthesized cache */, false /* no pinning */);
storage.forget(_retval);
return NS_OK;
}
@ -808,45 +762,34 @@ NS_IMETHODIMP CacheStorageService::Clear()
{
nsresult rv;
if (CacheObserver::UseNewCache()) {
// Tell the index to block notification to AsyncGetDiskConsumption.
// Will be allowed again from CacheFileContextEvictor::EvictEntries()
// when all the context have been removed from disk.
CacheIndex::OnAsyncEviction(true);
// Tell the index to block notification to AsyncGetDiskConsumption.
// Will be allowed again from CacheFileContextEvictor::EvictEntries()
// when all the context have been removed from disk.
CacheIndex::OnAsyncEviction(true);
{
mozilla::MutexAutoLock lock(mLock);
mozilla::MutexAutoLock lock(mLock);
{
mozilla::MutexAutoLock forcedValidEntriesLock(mForcedValidEntriesLock);
mForcedValidEntries.Clear();
}
NS_ENSURE_TRUE(!mShutdown, NS_ERROR_NOT_INITIALIZED);
nsTArray<nsCString> keys;
for (auto iter = sGlobalEntryTables->Iter(); !iter.Done(); iter.Next()) {
keys.AppendElement(iter.Key());
}
for (uint32_t i = 0; i < keys.Length(); ++i) {
DoomStorageEntries(keys[i], nullptr, true, false, nullptr);
}
// Passing null as a load info means to evict all contexts.
// EvictByContext() respects the entry pinning. EvictAll() does not.
rv = CacheFileIOManager::EvictByContext(nullptr, false);
NS_ENSURE_SUCCESS(rv, rv);
}
} else {
nsCOMPtr<nsICacheService> serv =
do_GetService(NS_CACHESERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = serv->EvictEntries(nsICache::STORE_ANYWHERE);
NS_ENSURE_SUCCESS(rv, rv);
{
mozilla::MutexAutoLock forcedValidEntriesLock(mForcedValidEntriesLock);
mForcedValidEntries.Clear();
}
NS_ENSURE_TRUE(!mShutdown, NS_ERROR_NOT_INITIALIZED);
nsTArray<nsCString> keys;
for (auto iter = sGlobalEntryTables->Iter(); !iter.Done(); iter.Next()) {
keys.AppendElement(iter.Key());
}
for (uint32_t i = 0; i < keys.Length(); ++i) {
DoomStorageEntries(keys[i], nullptr, true, false, nullptr);
}
// Passing null as a load info means to evict all contexts.
// EvictByContext() respects the entry pinning. EvictAll() does not.
rv = CacheFileIOManager::EvictByContext(nullptr, false);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
@ -907,13 +850,8 @@ NS_IMETHODIMP CacheStorageService::AsyncGetDiskConsumption(
nsresult rv;
if (CacheObserver::UseNewCache()) {
rv = CacheIndex::AsyncGetDiskConsumption(aObserver);
NS_ENSURE_SUCCESS(rv, rv);
} else {
rv = _OldGetDiskConsumption::Get(aObserver);
NS_ENSURE_SUCCESS(rv, rv);
}
rv = CacheIndex::AsyncGetDiskConsumption(aObserver);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
@ -922,20 +860,8 @@ NS_IMETHODIMP CacheStorageService::GetIoTarget(nsIEventTarget** aEventTarget)
{
NS_ENSURE_ARG(aEventTarget);
if (CacheObserver::UseNewCache()) {
nsCOMPtr<nsIEventTarget> ioTarget = CacheFileIOManager::IOTarget();
ioTarget.forget(aEventTarget);
}
else {
nsresult rv;
nsCOMPtr<nsICacheService> serv =
do_GetService(NS_CACHESERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = serv->GetCacheIOTarget(aEventTarget);
NS_ENSURE_SUCCESS(rv, rv);
}
nsCOMPtr<nsIEventTarget> ioTarget = CacheFileIOManager::IOTarget();
ioTarget.forget(aEventTarget);
return NS_OK;
}

View File

@ -85,8 +85,8 @@ public:
void DropPrivateBrowsingEntries();
// Takes care of deleting any pending trashes for both cache1 and cache2
// as well as the cache directory of an inactive cache version when requested.
static void CleaupCacheDirectories(uint32_t aVersion, uint32_t aActive);
// as well as old cache directory.
static void CleaupCacheDirectories();
static CacheStorageService* Self() { return sSelf; }
static nsISupports* SelfISupports() { return static_cast<nsICacheStorageService*>(Self()); }

View File

@ -105,16 +105,14 @@ nsAboutCache::Channel::Init(nsIURI* aURI, nsILoadInfo* aLoadInfo)
"<label><input id='anon' type='checkbox'/> Anonymous</label>\n"
);
if (CacheObserver::UseNewCache()) {
// Visit scoping by browser and appid is not implemented for
// the old cache, simply don't add these controls.
// The appid/inbrowser entries are already mixed in the default
// view anyway.
mBuffer.AppendLiteral(
"<label><input id='appid' type='text' size='6'/> AppID</label>\n"
"<label><input id='inbrowser' type='checkbox'/> In Browser Element</label>\n"
);
}
// Visit scoping by browser and appid is not implemented for
// the old cache, simply don't add these controls.
// The appid/inbrowser entries are already mixed in the default
// view anyway.
mBuffer.AppendLiteral(
"<label><input id='appid' type='text' size='6'/> AppID</label>\n"
"<label><input id='inbrowser' type='checkbox'/> In Browser Element</label>\n"
);
mBuffer.AppendLiteral(
"<label><input id='submit' type='button' value='Update' onclick='navigate()'/></label>\n"

View File

@ -188,14 +188,6 @@ nsAboutCacheEntry::Channel::OpenCacheEntry(nsIURI *uri)
mEnhanceId, getter_AddRefs(mCacheURI));
if (NS_FAILED(rv)) return rv;
if (!CacheObserver::UseNewCache() &&
mLoadInfo->IsPrivate() &&
mStorageName.EqualsLiteral("disk")) {
// The cache v1 is storing all private entries in the memory-only
// cache, so it would not be found in the v1 disk cache.
mStorageName = NS_LITERAL_CSTRING("memory");
}
return OpenCacheEntry();
}
@ -307,20 +299,6 @@ nsAboutCacheEntry::Channel::OnCacheEntryAvailable(nsICacheEntry *entry,
mWaitingForData = false;
if (entry) {
rv = WriteCacheEntryDescription(entry);
} else if (!CacheObserver::UseNewCache() &&
!mLoadInfo->IsPrivate() &&
mStorageName.EqualsLiteral("memory")) {
// If we were not able to find the entry in the memory storage
// try again in the disk storage.
// This is a workaround for cache v1: when an originally disk
// cache entry is recreated as memory-only, it's clientID doesn't
// change and we cannot find it in "HTTP-memory-only" session.
// "Disk" cache storage looks at "HTTP".
mStorageName = NS_LITERAL_CSTRING("disk");
rv = OpenCacheEntry();
if (NS_SUCCEEDED(rv)) {
return NS_OK;
}
} else {
rv = WriteCacheEntryUnavailable();
}

View File

@ -156,17 +156,12 @@ enum CacheDisposition {
void
AccumulateCacheHitTelemetry(CacheDisposition hitOrMiss)
{
if (!CacheObserver::UseNewCache()) {
Telemetry::Accumulate(Telemetry::HTTP_CACHE_DISPOSITION_2, hitOrMiss);
}
else {
Telemetry::Accumulate(Telemetry::HTTP_CACHE_DISPOSITION_2_V2, hitOrMiss);
Telemetry::Accumulate(Telemetry::HTTP_CACHE_DISPOSITION_2_V2, hitOrMiss);
int32_t experiment = CacheObserver::HalfLifeExperiment();
if (experiment > 0 && hitOrMiss == kCacheMissed) {
Telemetry::Accumulate(Telemetry::HTTP_CACHE_MISS_HALFLIFE_EXPERIMENT_2,
experiment - 1);
}
int32_t experiment = CacheObserver::HalfLifeExperiment();
if (experiment > 0 && hitOrMiss == kCacheMissed) {
Telemetry::Accumulate(Telemetry::HTTP_CACHE_MISS_HALFLIFE_EXPERIMENT_2,
experiment - 1);
}
}
@ -5534,27 +5529,11 @@ nsHttpChannel::InstallCacheListener(int64_t offset)
do_CreateInstance(kStreamListenerTeeCID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIEventTarget> cacheIOTarget;
if (!CacheObserver::UseNewCache()) {
nsCOMPtr<nsICacheStorageService> serv(services::GetCacheStorageService());
if (!serv) {
return NS_ERROR_NOT_AVAILABLE;
}
serv->GetIoTarget(getter_AddRefs(cacheIOTarget));
}
if (!cacheIOTarget) {
LOG(("nsHttpChannel::InstallCacheListener sync tee %p rv=%" PRIx32
" cacheIOTarget=%p",
tee.get(), static_cast<uint32_t>(rv), cacheIOTarget.get()));
rv = tee->Init(mListener, out, nullptr);
} else {
LOG(("nsHttpChannel::InstallCacheListener async tee %p", tee.get()));
rv = tee->InitAsync(mListener, cacheIOTarget, out, nullptr);
}
LOG(("nsHttpChannel::InstallCacheListener sync tee %p rv=%" PRIx32,
tee.get(), static_cast<uint32_t>(rv)));
rv = tee->Init(mListener, out, nullptr);
if (NS_FAILED(rv)) return rv;
mListener = tee;
return NS_OK;
}

View File

@ -97,7 +97,7 @@ function asyncOpenCacheEntry(key, where, flags, lci, callback, appcache)
function syncWithCacheIOThread(callback, force)
{
if (!newCacheBackEndUsed() || force) {
if (force) {
asyncOpenCacheEntry(
"http://nonexistententry/", "disk", Ci.nsICacheStorage.OPEN_READONLY, null,
function(status, entry) {

View File

@ -3,16 +3,6 @@ var Ci = Components.interfaces;
var Cu = Components.utils;
var Cr = Components.results;
function newCacheBackEndUsed()
{
var cache1srv = Components.classes["@mozilla.org/network/cache-service;1"]
.getService(Components.interfaces.nsICacheService);
var cache2srv = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
return cache1srv.cacheIOTarget != cache2srv.ioTarget;
}
var callbacks = new Array();
// Expect an existing entry
@ -133,17 +123,15 @@ OpenCallback.prototype =
if (this.behavior & COMPLETE) {
LOG_C2(this, "onCacheEntryCheck DONE, return RECHECK_AFTER_WRITE_FINISHED");
if (newCacheBackEndUsed()) {
// Specific to the new backend because of concurrent read/write:
// when a consumer returns RECHECK_AFTER_WRITE_FINISHED from onCacheEntryCheck
// the cache calls this callback again after the entry write has finished.
// This gives the consumer a chance to recheck completeness of the entry
// again.
// Thus, we reset state as onCheck would have never been called.
this.onCheckPassed = false;
// Don't return RECHECK_AFTER_WRITE_FINISHED on second call of onCacheEntryCheck.
this.behavior &= ~COMPLETE;
}
// Specific to the new backend because of concurrent read/write:
// when a consumer returns RECHECK_AFTER_WRITE_FINISHED from onCacheEntryCheck
// the cache calls this callback again after the entry write has finished.
// This gives the consumer a chance to recheck completeness of the entry
// again.
// Thus, we reset state as onCheck would have never been called.
this.onCheckPassed = false;
// Don't return RECHECK_AFTER_WRITE_FINISHED on second call of onCacheEntryCheck.
this.behavior &= ~COMPLETE;
return Ci.nsICacheEntryOpenCallback.RECHECK_AFTER_WRITE_FINISHED;
}
@ -310,10 +298,7 @@ VisitCallback.prototype =
{
LOG_C2(this, "onCacheStorageInfo: num=" + num + ", size=" + consumption);
do_check_eq(this.num, num);
if (newCacheBackEndUsed()) {
// Consumption is as expected only in the new backend
do_check_eq(this.consumption, consumption);
}
do_check_eq(this.consumption, consumption);
if (!this.entries)
this.notify();
},

View File

@ -75,11 +75,6 @@ function run_test()
do_get_profile();
evict_cache_entries();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since it depends on the new APIs.");
return;
}
do_test_pending();
cache_storage = getCacheStorage("disk");

View File

@ -86,11 +86,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since it depends on the new APIs.");
return;
}
do_test_pending();
Services.prefs.setBoolPref("network.http.rcwn.enabled", false);

View File

@ -2,11 +2,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
return;
}
// Open for write, delay the actual write
asyncOpenCacheEntry("http://a/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
new OpenCallback(NEW|DONTFILL, "a1m", "a1d", function(entry) {

View File

@ -2,11 +2,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
return;
}
var storage = getCacheStorage("disk");
var entry = storage.openTruncate(createURI("http://new1/"), "");
do_check_true(!!entry);

View File

@ -13,9 +13,7 @@ function run_test()
do_execute_soon(function() {
syncWithCacheIOThread(function() {
var expectedConsumption = newCacheBackEndUsed()
? 4096
: 48;
var expectedConsumption = 4096;
storage.asyncVisitStorage(
// Test should store 4 entries
@ -32,7 +30,7 @@ function run_test()
);
});
});
}, !newCacheBackEndUsed());
});
asyncOpenCacheEntry("http://a/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
new OpenCallback(NEW, "a1m", "a1d", function(entry) {

View File

@ -2,11 +2,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
return;
}
// Add entry to the memory storage
var mc = new MultipleCallbacks(5, function() {
// Check it's there by visiting the storage

View File

@ -2,11 +2,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
return;
}
// First check how behaves the memory storage.
asyncOpenCacheEntry("http://mem-first/", "memory", Ci.nsICacheStorage.OPEN_NORMALLY, null,

View File

@ -2,11 +2,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
return;
}
asyncOpenCacheEntry("http://b/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
new OpenCallback(NEW|DOOMED, "b1m", "b1d", function(entry) {
entry.asyncDoom(

View File

@ -10,9 +10,7 @@ function run_test()
new VisitCallback(0, 0, [], function() {
var storage = getCacheStorage("disk");
var expectedConsumption = newCacheBackEndUsed()
? 2048
: 24;
var expectedConsumption = 2048;
storage.asyncVisitStorage(
new VisitCallback(2, expectedConsumption, ["http://a/", "http://b/"], function() {
@ -25,7 +23,7 @@ function run_test()
);
})
);
}, !newCacheBackEndUsed());
});
asyncOpenCacheEntry("http://mem1/", "memory", Ci.nsICacheStorage.OPEN_NORMALLY, null,
new OpenCallback(NEW, "m2m", "m2d", function(entry) {

View File

@ -2,11 +2,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
return;
}
var mc = new MultipleCallbacks(3, function() {
var storage = getCacheStorage("disk");
storage.asyncEvictStorage(
@ -25,7 +20,7 @@ function run_test()
);
})
);
}, !newCacheBackEndUsed());
});
asyncOpenCacheEntry("http://mem1/", "memory", Ci.nsICacheStorage.OPEN_NORMALLY, null,
new OpenCallback(NEW, "m2m", "m2d", function(entry) {

View File

@ -17,7 +17,7 @@ function run_test()
new OpenCallback(NORMAL|COMPLETE|NOTIFYBEFOREREAD, "x1m", "x1d", function(entry, beforeReading) {
if (beforeReading) {
++order;
do_check_eq(order, newCacheBackEndUsed() ? 3 : 1);
do_check_eq(order, 3);
} else {
mc.fired();
}
@ -27,7 +27,7 @@ function run_test()
new OpenCallback(NORMAL|NOTIFYBEFOREREAD, "x1m", "x1d", function(entry, beforeReading) {
if (beforeReading) {
++order;
do_check_eq(order, newCacheBackEndUsed() ? 1 : 2);
do_check_eq(order, 1);
} else {
mc.fired();
}
@ -37,7 +37,7 @@ function run_test()
new OpenCallback(NORMAL|NOTIFYBEFOREREAD, "x1m", "x1d", function(entry, beforeReading) {
if (beforeReading) {
++order;
do_check_eq(order, newCacheBackEndUsed() ? 2 : 3);
do_check_eq(order, 2);
} else {
mc.fired();
}

View File

@ -2,11 +2,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
return;
}
// Open for write, write
asyncOpenCacheEntry("http://200/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
new OpenCallback(NEW, "21m", "21d", function(entry) {

View File

@ -2,11 +2,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
return;
}
// Open for write, write but expect it to fail, since other callback will recreate (and doom)
// the first entry before it opens output stream (note: in case of problems the DOOMED flag
// can be removed, it is not the test failure when opening the output stream on recreated entry.

View File

@ -2,11 +2,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
return;
}
// Open for write, write
asyncOpenCacheEntry("http://r206/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
new OpenCallback(NEW, "206m", "206part1-", function(entry) {

View File

@ -2,11 +2,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
return;
}
// Open for write, write
asyncOpenCacheEntry("http://r200/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
new OpenCallback(NEW, "200m1", "200part1a-", function(entry) {

View File

@ -4,11 +4,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
return;
}
// Create and check an entry anon disk storage
asyncOpenCacheEntry("http://anon1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.anonymous,
new OpenCallback(NEW, "an1", "an1", function(entry) {

View File

@ -4,8 +4,7 @@ function run_test()
{
do_get_profile();
function checkNewBackEnd()
{
var mc = new MultipleCallbacks(2, function() {
var storage = getCacheStorage("disk", LoadContextInfo.default);
storage.asyncVisitStorage(
new VisitCallback(1, 1024, ["http://an2/"], function() {
@ -19,28 +18,8 @@ function run_test()
}),
true
);
}
});
function checkOldBackEnd()
{
syncWithCacheIOThread(function() {
var storage = getCacheStorage("disk", LoadContextInfo.default);
storage.asyncVisitStorage(
new VisitCallback(2, 24, ["http://an2/"], function() {
storage = getCacheStorage("disk", LoadContextInfo.anonymous);
storage.asyncVisitStorage(
new VisitCallback(0, 0, ["http://an2/"], function() {
finish_cache2_test();
}),
true
);
}),
true
);
});
}
var mc = new MultipleCallbacks(2, newCacheBackEndUsed() ? checkNewBackEnd : checkOldBackEnd, !newCacheBackEndUsed());
asyncOpenCacheEntry("http://an2/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default,
new OpenCallback(NEW|WAITFORWRITE, "an2", "an2", function(entry) {

View File

@ -4,11 +4,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test checks only cache2 specific behavior.");
return;
}
const kChunkSize = (256 * 1024);
var payload = "";

View File

@ -4,11 +4,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test checks only cache2 specific behavior.");
return;
}
var mc = new MultipleCallbacks(2, function() {
var mem = getCacheStorage("memory");
var disk = getCacheStorage("disk");

View File

@ -18,11 +18,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
return;
}
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);

View File

@ -2,11 +2,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
return;
}
// Open for write, but never write and never mark valid
asyncOpenCacheEntry("http://no-data/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
new OpenCallback(NEW|METAONLY|DONTSETVALID|WAITFORWRITE, "meta", "", function(entry) {

View File

@ -4,11 +4,6 @@ function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test checks only cache2 specific behavior.");
return;
}
var mc = new MultipleCallbacks(2, function() {
finish_cache2_test();
});

View File

@ -65,11 +65,6 @@ function run_test()
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
return;
}
Services.prefs.setIntPref("browser.cache.disk.max_entry_size", 1);
Services.prefs.setBoolPref("network.http.rcwn.enabled", false);

View File

@ -60,11 +60,6 @@ function run_test()
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different");
return;
}
Services.prefs.setIntPref("browser.cache.disk.max_entry_size", 1);
Services.prefs.setBoolPref("network.http.rcwn.enabled", false);

View File

@ -1,10 +1,6 @@
function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test checks only cache2 specific behavior.");
return;
}
// Open for write, write
asyncOpenCacheEntry("http://a/", "pin", Ci.nsICacheStorage.OPEN_TRUNCATE, LoadContextInfo.default,

View File

@ -1,10 +1,7 @@
function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test checks only cache2 specific behavior.");
return;
}
var lci = LoadContextInfo.default;
// Open a pinned entry for write, write

View File

@ -26,10 +26,6 @@ function log_(msg) { if (true) dump(">>>>>>>>>>>>> " + msg + "\n"); }
function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test checks only cache2 specific behavior.");
return;
}
var lci = LoadContextInfo.default;
var testingInterface = get_cache_service().QueryInterface(Ci.nsICacheTesting);

View File

@ -22,10 +22,7 @@ function log_(msg) { if (true) dump(">>>>>>>>>>>>> " + msg + "\n"); }
function run_test()
{
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test checks only cache2 specific behavior.");
return;
}
var lci = LoadContextInfo.default;
var testingInterface = get_cache_service().QueryInterface(Ci.nsICacheTesting);
do_check_true(testingInterface);

View File

@ -7,10 +7,6 @@ function run_test()
LoadContextInfo.custom(false, { userContextId: 3 })];
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test checks only cache2 specific behavior.");
return;
}
var mc = new MultipleCallbacks(8, function() {
do_execute_soon(function() {

View File

@ -89,10 +89,7 @@ async function run_all_tests() {
function run_test() {
do_get_profile();
if (!newCacheBackEndUsed()) {
do_check_true(true, "This test checks only cache2 specific behavior.");
return;
}
do_test_pending();
Services.prefs.setBoolPref("network.http.rcwn.enabled", false);

View File

@ -137,8 +137,7 @@ frame.Manager = class {
getFrameMM(winId, frameId) {
let oopFrame = this.getOopFrame(winId, frameId);
let mm = oopFrame.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader.messageManager;
let mm = oopFrame.frameLoader.messageManager;
return mm;
}

View File

@ -233,9 +233,7 @@ SpecialPowersObserver.prototype.receiveMessage = function(aMessage) {
switch (aMessage.name) {
case "SPPingService":
if (aMessage.json.op == "ping") {
aMessage.target
.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader
aMessage.target.frameLoader
.messageManager
.sendAsyncMessage("SPPingService", { op: "pong" });
}
@ -277,22 +275,16 @@ SpecialPowersObserver.prototype.receiveMessage = function(aMessage) {
});
Promise.all(promises).then(function() {
aMessage.target
.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader
aMessage.target.frameLoader
.messageManager
.sendAsyncMessage("SpecialPowers.FilesCreated", filePaths);
}, function(e) {
aMessage.target
.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader
aMessage.target.frameLoader
.messageManager
.sendAsyncMessage("SpecialPowers.FilesError", e.toString());
});
} catch (e) {
aMessage.target
.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader
aMessage.target.frameLoader
.messageManager
.sendAsyncMessage("SpecialPowers.FilesError", e.toString());
}

View File

@ -248,9 +248,7 @@ SpecialPowersObserverAPI.prototype = {
},
_sendReply(aMessage, aReplyName, aReplyMsg) {
let mm = aMessage.target
.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader
let mm = aMessage.target.frameLoader
.messageManager;
mm.sendAsyncMessage(aReplyName, aReplyMsg);
},
@ -471,9 +469,7 @@ SpecialPowersObserverAPI.prototype = {
sandboxOptions = {}
}
let sb = Components.utils.Sandbox(systemPrincipal, sandboxOptions);
let mm = aMessage.target
.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader
let mm = aMessage.target.frameLoader
.messageManager;
sb.sendAsyncMessage = (name, message) => {
mm.sendAsyncMessage("SPChromeScriptMessage",

View File

@ -202,7 +202,7 @@ SpecialPowers.prototype.nestedFrameSetup = function() {
if (frameId === "nested-parent-frame") {
Services.obs.removeObserver(onRemoteBrowserShown, "remote-browser-shown");
let mm = frame.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader.messageManager;
let mm = frame.frameLoader.messageManager;
self._grandChildFrameMM = mm;
self.SP_SYNC_MESSAGES.forEach(function(msgname) {

View File

@ -1804,9 +1804,7 @@ SpecialPowersAPI.prototype = {
* Get the message manager associated with an <iframe mozbrowser>.
*/
getBrowserFrameMessageManager(aFrameElement) {
return this.wrap(aFrameElement.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader
.messageManager);
return this.wrap(aFrameElement.frameLoader.messageManager);
},
_getPrincipalFromArg(arg) {

View File

@ -370,7 +370,7 @@ _ContextualIdentityService.prototype = {
return new Promise(resolve => {
let tabParentIds = new Set();
this._forEachContainerTab((tab, tabbrowser) => {
let frameLoader = tab.linkedBrowser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
let frameLoader = tab.linkedBrowser.frameLoader;
// We don't have tabParent in non-e10s mode.
if (frameLoader.tabParent) {

View File

@ -406,8 +406,8 @@ function promiseObserved(topic, test = () => true) {
}
function getMessageManager(target) {
if (target instanceof Ci.nsIFrameLoaderOwner) {
return target.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader.messageManager;
if (target.frameLoader) {
return target.frameLoader.messageManager;
}
return target.QueryInterface(Ci.nsIMessageSender);
}

View File

@ -1977,14 +1977,6 @@
"n_buckets": 50,
"description": "HTTP page channel: Open -> first byte of reply received (ms)"
},
"HTTP_PAGE_OPEN_TO_FIRST_FROM_CACHE": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
"kind": "exponential",
"high": 30000,
"n_buckets": 50,
"description": "HTTP page channel: Open -> cache read start (ms)"
},
"HTTP_PAGE_OPEN_TO_FIRST_FROM_CACHE_V2": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
@ -1993,14 +1985,6 @@
"n_buckets": 50,
"description": "HTTP page channel: Open -> cache read start (ms), [cache2]"
},
"HTTP_PAGE_CACHE_READ_TIME": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
"kind": "exponential",
"high": 30000,
"n_buckets": 50,
"description": "HTTP page channel: Cache read time (ms)"
},
"HTTP_PAGE_CACHE_READ_TIME_V2": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
@ -2017,14 +2001,6 @@
"n_buckets": 50,
"description": "HTTP page channel: Positive cache validation time (ms)"
},
"HTTP_PAGE_COMPLETE_LOAD": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
"kind": "exponential",
"high": 30000,
"n_buckets": 50,
"description": "HTTP page channel: Overall load time - all (ms)"
},
"HTTP_PAGE_COMPLETE_LOAD_V2": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
@ -2033,14 +2009,6 @@
"n_buckets": 50,
"description": "HTTP page channel: Overall load time - all (ms) [cache2]"
},
"HTTP_PAGE_COMPLETE_LOAD_CACHED": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
"kind": "exponential",
"high": 30000,
"n_buckets": 50,
"description": "HTTP page channel: Overall load time - cache hits (ms)"
},
"HTTP_PAGE_COMPLETE_LOAD_CACHED_V2": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
@ -2049,14 +2017,6 @@
"n_buckets": 50,
"description": "HTTP page channel: Overall load time - cache hits (ms) [cache2]"
},
"HTTP_PAGE_COMPLETE_LOAD_NET": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
"kind": "exponential",
"high": 30000,
"n_buckets": 50,
"description": "HTTP page channel: Overall load time - network (ms)"
},
"HTTP_PAGE_COMPLETE_LOAD_NET_V2": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
@ -2125,14 +2085,6 @@
"n_buckets": 50,
"description": "HTTP subitem channel: Open -> first byte of reply received (ms)"
},
"HTTP_SUB_OPEN_TO_FIRST_FROM_CACHE": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
"kind": "exponential",
"high": 30000,
"n_buckets": 50,
"description": "HTTP subitem channel: Open -> cache read start (ms)"
},
"HTTP_SUB_OPEN_TO_FIRST_FROM_CACHE_V2": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
@ -2141,14 +2093,6 @@
"n_buckets": 50,
"description": "HTTP subitem channel: Open -> cache read start (ms) [cache2]"
},
"HTTP_SUB_CACHE_READ_TIME": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
"kind": "exponential",
"high": 30000,
"n_buckets": 50,
"description": "HTTP subitem channel: Cache read time (ms)"
},
"HTTP_SUB_CACHE_READ_TIME_V2": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
@ -2165,14 +2109,6 @@
"n_buckets": 50,
"description": "HTTP subitem channel: Positive cache validation time (ms)"
},
"HTTP_SUB_COMPLETE_LOAD": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
"kind": "exponential",
"high": 30000,
"n_buckets": 50,
"description": "HTTP subitem channel: Overall load time - all (ms)"
},
"HTTP_SUB_COMPLETE_LOAD_V2": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
@ -2181,14 +2117,6 @@
"n_buckets": 50,
"description": "HTTP subitem channel: Overall load time - all (ms) [cache2]"
},
"HTTP_SUB_COMPLETE_LOAD_CACHED": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
"kind": "exponential",
"high": 30000,
"n_buckets": 50,
"description": "HTTP subitem channel: Overall load time - cache hits (ms)"
},
"HTTP_SUB_COMPLETE_LOAD_CACHED_V2": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
@ -2197,14 +2125,6 @@
"n_buckets": 50,
"description": "HTTP subitem channel: Overall load time - cache hits (ms) [cache2]"
},
"HTTP_SUB_COMPLETE_LOAD_NET": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
"kind": "exponential",
"high": 30000,
"n_buckets": 50,
"description": "HTTP subitem channel: Overall load time - network (ms)"
},
"HTTP_SUB_COMPLETE_LOAD_NET_V2": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
@ -3003,13 +2923,6 @@
"kind": "boolean",
"description": "Fraction of sockets that used a nsConnectionEntry with history - size 300."
},
"HTTP_CACHE_DISPOSITION_2": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 5,
"description": "HTTP Cache Hit, Reval, Failed-Reval, Miss"
},
"HTTP_CACHE_DISPOSITION_2_V2": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",

View File

@ -253,7 +253,6 @@
"HTTPCONNMGR_TOTAL_SPECULATIVE_CONN",
"HTTPCONNMGR_UNUSED_SPECULATIVE_CONN",
"HTTPCONNMGR_USED_SPECULATIVE_CONN",
"HTTP_CACHE_DISPOSITION_2",
"HTTP_CACHE_DISPOSITION_2_V2",
"HTTP_CACHE_ENTRY_ALIVE_TIME",
"HTTP_CACHE_ENTRY_RELOAD_TIME",
@ -263,18 +262,13 @@
"HTTP_DISK_CACHE_OVERHEAD",
"HTTP_KBREAD_PER_CONN",
"HTTP_OFFLINE_CACHE_DOCUMENT_LOAD",
"HTTP_PAGE_CACHE_READ_TIME",
"HTTP_PAGE_CACHE_READ_TIME_V2",
"HTTP_PAGE_COMPLETE_LOAD",
"HTTP_PAGE_COMPLETE_LOAD_CACHED",
"HTTP_PAGE_COMPLETE_LOAD_CACHED_V2",
"HTTP_PAGE_COMPLETE_LOAD_NET",
"HTTP_PAGE_COMPLETE_LOAD_NET_V2",
"HTTP_PAGE_COMPLETE_LOAD_V2",
"HTTP_PAGE_DNS_ISSUE_TIME",
"HTTP_PAGE_DNS_LOOKUP_TIME",
"HTTP_PAGE_FIRST_SENT_TO_LAST_RECEIVED",
"HTTP_PAGE_OPEN_TO_FIRST_FROM_CACHE",
"HTTP_PAGE_OPEN_TO_FIRST_FROM_CACHE_V2",
"HTTP_PAGE_OPEN_TO_FIRST_RECEIVED",
"HTTP_PAGE_OPEN_TO_FIRST_SENT",
@ -285,18 +279,13 @@
"HTTP_REQUEST_PER_PAGE_FROM_CACHE",
"HTTP_SUBITEM_FIRST_BYTE_LATENCY_TIME",
"HTTP_SUBITEM_OPEN_LATENCY_TIME",
"HTTP_SUB_CACHE_READ_TIME",
"HTTP_SUB_CACHE_READ_TIME_V2",
"HTTP_SUB_COMPLETE_LOAD",
"HTTP_SUB_COMPLETE_LOAD_CACHED",
"HTTP_SUB_COMPLETE_LOAD_CACHED_V2",
"HTTP_SUB_COMPLETE_LOAD_NET",
"HTTP_SUB_COMPLETE_LOAD_NET_V2",
"HTTP_SUB_COMPLETE_LOAD_V2",
"HTTP_SUB_DNS_ISSUE_TIME",
"HTTP_SUB_DNS_LOOKUP_TIME",
"HTTP_SUB_FIRST_SENT_TO_LAST_RECEIVED",
"HTTP_SUB_OPEN_TO_FIRST_FROM_CACHE",
"HTTP_SUB_OPEN_TO_FIRST_FROM_CACHE_V2",
"HTTP_SUB_OPEN_TO_FIRST_RECEIVED",
"HTTP_SUB_OPEN_TO_FIRST_SENT",
@ -927,7 +916,6 @@
"HTTPCONNMGR_TOTAL_SPECULATIVE_CONN",
"HTTPCONNMGR_UNUSED_SPECULATIVE_CONN",
"HTTPCONNMGR_USED_SPECULATIVE_CONN",
"HTTP_CACHE_DISPOSITION_2",
"HTTP_CACHE_DISPOSITION_2_V2",
"HTTP_CACHE_ENTRY_ALIVE_TIME",
"HTTP_CACHE_ENTRY_RELOAD_TIME",
@ -938,18 +926,13 @@
"HTTP_DISK_CACHE_OVERHEAD",
"HTTP_KBREAD_PER_CONN",
"HTTP_OFFLINE_CACHE_DOCUMENT_LOAD",
"HTTP_PAGE_CACHE_READ_TIME",
"HTTP_PAGE_CACHE_READ_TIME_V2",
"HTTP_PAGE_COMPLETE_LOAD",
"HTTP_PAGE_COMPLETE_LOAD_CACHED",
"HTTP_PAGE_COMPLETE_LOAD_CACHED_V2",
"HTTP_PAGE_COMPLETE_LOAD_NET",
"HTTP_PAGE_COMPLETE_LOAD_NET_V2",
"HTTP_PAGE_COMPLETE_LOAD_V2",
"HTTP_PAGE_DNS_ISSUE_TIME",
"HTTP_PAGE_DNS_LOOKUP_TIME",
"HTTP_PAGE_FIRST_SENT_TO_LAST_RECEIVED",
"HTTP_PAGE_OPEN_TO_FIRST_FROM_CACHE",
"HTTP_PAGE_OPEN_TO_FIRST_FROM_CACHE_V2",
"HTTP_PAGE_OPEN_TO_FIRST_RECEIVED",
"HTTP_PAGE_OPEN_TO_FIRST_SENT",
@ -962,18 +945,13 @@
"HTTP_SAW_QUIC_ALT_PROTOCOL",
"HTTP_SUBITEM_FIRST_BYTE_LATENCY_TIME",
"HTTP_SUBITEM_OPEN_LATENCY_TIME",
"HTTP_SUB_CACHE_READ_TIME",
"HTTP_SUB_CACHE_READ_TIME_V2",
"HTTP_SUB_COMPLETE_LOAD",
"HTTP_SUB_COMPLETE_LOAD_CACHED",
"HTTP_SUB_COMPLETE_LOAD_CACHED_V2",
"HTTP_SUB_COMPLETE_LOAD_NET",
"HTTP_SUB_COMPLETE_LOAD_NET_V2",
"HTTP_SUB_COMPLETE_LOAD_V2",
"HTTP_SUB_DNS_ISSUE_TIME",
"HTTP_SUB_DNS_LOOKUP_TIME",
"HTTP_SUB_FIRST_SENT_TO_LAST_RECEIVED",
"HTTP_SUB_OPEN_TO_FIRST_FROM_CACHE",
"HTTP_SUB_OPEN_TO_FIRST_FROM_CACHE_V2",
"HTTP_SUB_OPEN_TO_FIRST_RECEIVED",
"HTTP_SUB_OPEN_TO_FIRST_SENT",

View File

@ -11,11 +11,7 @@ const nsISupportsString = Components.interfaces.nsISupportsString;
const nsIPrefBranch = Components.interfaces.nsIPrefBranch;
const nsIClipboardHelper = Components.interfaces.nsIClipboardHelper;
const nsSupportsString_CONTRACTID = "@mozilla.org/supports-string;1";
const nsPrompt_CONTRACTID = "@mozilla.org/embedcomp/prompt-service;1";
const nsPrefService_CONTRACTID = "@mozilla.org/preferences-service;1";
const nsClipboardHelper_CONTRACTID = "@mozilla.org/widget/clipboardhelper;1";
const nsAtomService_CONTRACTID = "@mozilla.org/atom-service;1";
const gPrefBranch = Services.prefs;
const gClipboardHelper = Components.classes[nsClipboardHelper_CONTRACTID].getService(nsIClipboardHelper);

View File

@ -169,15 +169,13 @@ function saveImageURL(aURL, aFileName, aFilePickerTitleKey, aShouldBypassCache,
}
// This is like saveDocument, but takes any browser/frame-like element
// (nsIFrameLoaderOwner) and saves the current document inside it,
// and saves the current document inside it,
// whether in-process or out-of-process.
function saveBrowser(aBrowser, aSkipPrompt, aOuterWindowID = 0) {
if (!aBrowser) {
throw "Must have a browser when calling saveBrowser";
}
let persistable = aBrowser.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader
.QueryInterface(Ci.nsIWebBrowserPersistable);
let persistable = aBrowser.frameLoader;
let stack = Components.stack.caller;
persistable.startPersistence(aOuterWindowID, {
onDocumentReady(document) {

View File

@ -1328,16 +1328,6 @@ function compareArrays(arr1, arr2) {
return true;
}
function convertProperties(arr) {
var results = [];
var count = arr.Count();
for (let i = 0; i < count; i++)
results.push(arr.GetElementAt(i).QueryInterface(Components.interfaces.nsIAtom).toString());
results.sort();
return results.join(" ");
}
function convertDOMtoTreeRowInfo(treechildren, level, rowidx) {
var obj = { rows: [] };

View File

@ -251,7 +251,7 @@
if (this._docShell)
return this._docShell;
let frameLoader = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader;
let {frameLoader} = this;
if (!frameLoader)
return null;
this._docShell = frameLoader.docShell;
@ -266,7 +266,7 @@
if (this._loadContext)
return this._loadContext;
let frameLoader = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader;
let {frameLoader} = this;
if (!frameLoader)
return null;
this._loadContext = frameLoader.loadContext;
@ -347,11 +347,10 @@
readonly="true">
<getter>
<![CDATA[
var owner = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner);
if (!owner.frameLoader) {
return null;
if (this.frameLoader) {
return this.frameLoader.messageManager;
}
return owner.frameLoader.messageManager;
return null;
]]>
</getter>
@ -1569,14 +1568,13 @@
<parameter name="aPrintProgressListener"/>
<body>
<![CDATA[
var owner = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner);
if (!owner.frameLoader) {
if (!this.frameLoader) {
throw Components.Exception("No frame loader.",
Components.results.NS_ERROR_FAILURE);
}
owner.frameLoader.print(aOuterWindowID, aPrintSettings,
aPrintProgressListener);
this.frameLoader.print(aOuterWindowID, aPrintSettings,
aPrintProgressListener);
]]>
</body>
</method>

View File

@ -130,7 +130,7 @@
onget="return this.webNavigation.document;"/>
<property name="docShell" readonly="true">
<getter><![CDATA[
let frameLoader = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader;
let {frameLoader} = this;
return frameLoader ? frameLoader.docShell : null;
]]></getter>
</property>
@ -168,11 +168,10 @@
readonly="true">
<getter>
<![CDATA[
var owner = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner);
if (!owner.frameLoader) {
return null;
if (this.frameLoader) {
return this.frameLoader.messageManager;
}
return owner.frameLoader.messageManager;
return null;
]]>
</getter>
</property>

View File

@ -87,7 +87,7 @@
<implementation>
<property name="docShell" readonly="true">
<getter><![CDATA[
let frameLoader = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader;
let {frameLoader} = this;
return frameLoader ? frameLoader.docShell : null;
]]></getter>
</property>

View File

@ -212,8 +212,7 @@
<property name="hasContentOpener">
<getter><![CDATA[
let {frameLoader} = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner);
return frameLoader.tabParent.hasContentOpener;
return this.frameLoader.tabParent.hasContentOpener;
]]></getter>
</property>
@ -232,14 +231,12 @@
<property name="docShellIsActive">
<getter>
<![CDATA[
let {frameLoader} = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner);
return frameLoader.tabParent.docShellIsActive;
return this.frameLoader.tabParent.docShellIsActive;
]]>
</getter>
<setter>
<![CDATA[
let {frameLoader} = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner);
frameLoader.tabParent.docShellIsActive = val;
this.frameLoader.tabParent.docShellIsActive = val;
return val;
]]>
</setter>
@ -248,7 +245,7 @@
<method name="preserveLayers">
<parameter name="preserve"/>
<body><![CDATA[
let {frameLoader} = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner);
let {frameLoader} = this;
if (frameLoader.tabParent) {
frameLoader.tabParent.preserveLayers(preserve);
}
@ -284,8 +281,7 @@
<method name="permitUnload">
<body>
<![CDATA[
let { frameLoader } = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner);
let tabParent = frameLoader.tabParent;
let {tabParent} = this.frameLoader;
if (!tabParent.hasBeforeUnload) {
return { permitUnload: true, timedOut: false };
@ -561,8 +557,7 @@
// needed to create a document with the given principal.
let permissionPrincipal =
BrowserUtils.principalWithMatchingOA(aPrincipal, this.contentPrincipal);
let {frameLoader} = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner);
frameLoader.tabParent.transmitPermissionsForPrincipal(permissionPrincipal);
this.frameLoader.tabParent.transmitPermissionsForPrincipal(permissionPrincipal);
// Create the about blank content viewer in the content process
this.messageManager.sendAsyncMessage("Browser:CreateAboutBlank", aPrincipal);

View File

@ -28,20 +28,20 @@
// There are two kinds of atoms handled by this module.
//
// - DynamicAtom: the atom itself is heap allocated, as is the nsStringBuffer it
// points to. |gAtomTable| holds weak references to them DynamicAtoms. When
// the refcount of a DynamicAtom drops to zero, we increment a static counter.
// When that counter reaches a certain threshold, we iterate over the atom
// table, removing and deleting DynamicAtoms with refcount zero. This allows
// - Dynamic: the Atom itself is heap allocated, as is the nsStringBuffer it
// points to. |gAtomTable| holds weak references to dynamic Atoms. When the
// refcount of a dynamic Atom drops to zero, we increment a static counter.
// When that counter reaches a certain threshold, we iterate over the Atom
// table, removing and deleting dynamic Atoms with refcount zero. This allows
// us to avoid acquiring the atom table lock during normal refcounting.
//
// - StaticAtom: the atom itself is heap allocated, but it points to a static
// nsStringBuffer. |gAtomTable| effectively owns StaticAtoms, because such
// atoms ignore all AddRef/Release calls, which ensures they stay alive until
// - Static: the Atom itself is heap allocated, but it points to a static
// nsStringBuffer. |gAtomTable| effectively owns static Atoms, because such
// Atoms ignore all AddRef/Release calls, which ensures they stay alive until
// |gAtomTable| itself is destroyed whereupon they are explicitly deleted.
//
// Note that gAtomTable is used on multiple threads, and callers must
// acquire gAtomTableLock before touching it.
// Note that gAtomTable is used on multiple threads, and callers must acquire
// gAtomTableLock before touching it.
using namespace mozilla;
@ -69,77 +69,6 @@ class CheckStaticAtomSizes
static Atomic<uint32_t, ReleaseAcquire> gUnusedAtomCount(0);
class DynamicAtom final : public nsIAtom
{
public:
static already_AddRefed<DynamicAtom> Create(const nsAString& aString, uint32_t aHash)
{
// The refcount is appropriately initialized in the constructor.
return dont_AddRef(new DynamicAtom(aString, aHash));
}
static void GCAtomTable();
enum class GCKind {
RegularOperation,
Shutdown,
};
static void GCAtomTableLocked(const MutexAutoLock& aProofOfLock,
GCKind aKind);
private:
DynamicAtom(const nsAString& aString, uint32_t aHash)
: mRefCnt(1)
{
mLength = aString.Length();
SetKind(AtomKind::DynamicAtom);
RefPtr<nsStringBuffer> buf = nsStringBuffer::FromString(aString);
if (buf) {
mString = static_cast<char16_t*>(buf->Data());
} else {
const size_t size = (mLength + 1) * sizeof(char16_t);
buf = nsStringBuffer::Alloc(size);
if (MOZ_UNLIKELY(!buf)) {
// We OOM because atom allocations should be small and it's hard to
// handle them more gracefully in a constructor.
NS_ABORT_OOM(size);
}
mString = static_cast<char16_t*>(buf->Data());
CopyUnicodeTo(aString, 0, mString, mLength);
mString[mLength] = char16_t(0);
}
mHash = aHash;
MOZ_ASSERT(mHash == HashString(mString, mLength));
NS_ASSERTION(mString[mLength] == char16_t(0), "null terminated");
NS_ASSERTION(buf && buf->StorageSize() >= (mLength + 1) * sizeof(char16_t),
"enough storage");
NS_ASSERTION(Equals(aString), "correct data");
// Take ownership of buffer
mozilla::Unused << buf.forget();
}
private:
// We don't need a virtual destructor because we always delete via a
// DynamicAtom* pointer (in GCAtomTable()), not an nsIAtom* pointer.
~DynamicAtom();
public:
NS_DECL_NSIATOM
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) final;
typedef mozilla::TrueType HasThreadSafeRefCnt;
MozExternalRefCountType DoAddRef();
MozExternalRefCountType DoRelease();
protected:
ThreadSafeAutoRefCnt mRefCnt;
NS_DECL_OWNINGTHREAD
};
#if defined(NS_BUILD_REFCNT_LOGGING)
// nsFakeStringBuffers don't really use the refcounting system, but we
// have to give a coherent series of addrefs and releases to the
@ -173,10 +102,69 @@ private:
UniquePtr<nsTArray<FakeBufferRefcountHelper>> gFakeBuffers;
#endif
class StaticAtom final : public nsIAtom
class Atom final : public nsIAtom
{
public:
StaticAtom(nsStringBuffer* aStringBuffer, uint32_t aLength, uint32_t aHash)
static already_AddRefed<Atom> CreateDynamic(const nsAString& aString,
uint32_t aHash)
{
// The refcount is appropriately initialized in the constructor.
return dont_AddRef(new Atom(aString, aHash));
}
static Atom* CreateStatic(nsStringBuffer* aStringBuffer, uint32_t aLength,
uint32_t aHash)
{
return new Atom(aStringBuffer, aLength, aHash);
}
static void GCAtomTable();
enum class GCKind {
RegularOperation,
Shutdown,
};
static void GCAtomTableLocked(const MutexAutoLock& aProofOfLock,
GCKind aKind);
private:
// This constructor is for dynamic Atoms.
Atom(const nsAString& aString, uint32_t aHash)
: mRefCnt(1)
{
mLength = aString.Length();
SetKind(AtomKind::DynamicAtom);
RefPtr<nsStringBuffer> buf = nsStringBuffer::FromString(aString);
if (buf) {
mString = static_cast<char16_t*>(buf->Data());
} else {
const size_t size = (mLength + 1) * sizeof(char16_t);
buf = nsStringBuffer::Alloc(size);
if (MOZ_UNLIKELY(!buf)) {
// We OOM because atom allocations should be small and it's hard to
// handle them more gracefully in a constructor.
NS_ABORT_OOM(size);
}
mString = static_cast<char16_t*>(buf->Data());
CopyUnicodeTo(aString, 0, mString, mLength);
mString[mLength] = char16_t(0);
}
mHash = aHash;
MOZ_ASSERT(mHash == HashString(mString, mLength));
NS_ASSERTION(mString[mLength] == char16_t(0), "null terminated");
NS_ASSERTION(buf && buf->StorageSize() >= (mLength + 1) * sizeof(char16_t),
"enough storage");
NS_ASSERTION(Equals(aString), "correct data");
// Take ownership of buffer
mozilla::Unused << buf.forget();
}
// This constructor is for static Atoms.
Atom(nsStringBuffer* aStringBuffer, uint32_t aLength, uint32_t aHash)
{
mLength = aLength;
SetKind(AtomKind::StaticAtom);
@ -203,73 +191,65 @@ public:
"correct storage");
}
// We don't need a virtual destructor because we always delete via a
// StaticAtom* pointer (in AtomTableClearEntry()), not an nsIAtom* pointer.
~StaticAtom() {}
public:
// We don't need a virtual destructor because we always delete via an Atom*
// pointer (in AtomTableClearEntry() for static Atoms, and in
// GCAtomTableLocked() for dynamic Atoms), not an nsIAtom* pointer.
~Atom() {
if (IsDynamicAtom()) {
nsStringBuffer::FromData(mString)->Release();
} else {
MOZ_ASSERT(IsStaticAtom());
}
}
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) final;
NS_DECL_NSIATOM
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) final;
typedef mozilla::TrueType HasThreadSafeRefCnt;
MozExternalRefCountType DynamicAddRef();
MozExternalRefCountType DynamicRelease();
protected:
ThreadSafeAutoRefCnt mRefCnt;
NS_DECL_OWNINGTHREAD
};
NS_IMPL_QUERY_INTERFACE(StaticAtom, nsIAtom);
NS_IMPL_QUERY_INTERFACE(Atom, nsIAtom);
NS_IMETHODIMP
DynamicAtom::ScriptableToString(nsAString& aBuf)
Atom::ScriptableToString(nsAString& aBuf)
{
nsStringBuffer::FromData(mString)->ToString(mLength, aBuf);
return NS_OK;
}
NS_IMETHODIMP
StaticAtom::ScriptableToString(nsAString& aBuf)
{
nsStringBuffer::FromData(mString)->ToString(mLength, aBuf);
return NS_OK;
}
NS_IMETHODIMP
DynamicAtom::ToUTF8String(nsACString& aBuf)
Atom::ToUTF8String(nsACString& aBuf)
{
CopyUTF16toUTF8(nsDependentString(mString, mLength), aBuf);
return NS_OK;
}
NS_IMETHODIMP
StaticAtom::ToUTF8String(nsACString& aBuf)
{
CopyUTF16toUTF8(nsDependentString(mString, mLength), aBuf);
return NS_OK;
}
NS_IMETHODIMP
DynamicAtom::ScriptableEquals(const nsAString& aString, bool* aResult)
{
*aResult = aString.Equals(nsDependentString(mString, mLength));
return NS_OK;
}
NS_IMETHODIMP
StaticAtom::ScriptableEquals(const nsAString& aString, bool* aResult)
Atom::ScriptableEquals(const nsAString& aString, bool* aResult)
{
*aResult = aString.Equals(nsDependentString(mString, mLength));
return NS_OK;
}
NS_IMETHODIMP_(size_t)
DynamicAtom::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf)
Atom::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf)
{
size_t n = aMallocSizeOf(this);
n += nsStringBuffer::FromData(mString)->SizeOfIncludingThisIfUnshared(
aMallocSizeOf);
return n;
}
NS_IMETHODIMP_(size_t)
StaticAtom::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf)
{
size_t n = aMallocSizeOf(this);
// Don't measure the string buffer pointed to by the StaticAtom because it's
// in static memory.
// String buffers pointed to by static atoms are in static memory, and so
// are not measured here.
if (IsDynamicAtom()) {
n += nsStringBuffer::FromData(mString)->SizeOfIncludingThisIfUnshared(
aMallocSizeOf);
} else {
MOZ_ASSERT(IsStaticAtom());
}
return n;
}
@ -283,7 +263,7 @@ nsIAtom::AddRef()
MOZ_ASSERT(IsStaticAtom());
return 2;
}
return static_cast<DynamicAtom*>(this)->DoAddRef();
return static_cast<Atom*>(this)->DynamicAddRef();
}
NS_IMETHODIMP_(MozExternalRefCountType)
@ -294,7 +274,7 @@ nsIAtom::Release()
MOZ_ASSERT(IsStaticAtom());
return 1;
}
return static_cast<DynamicAtom*>(this)->DoRelease();
return static_cast<Atom*>(this)->DynamicRelease();
}
//----------------------------------------------------------------------
@ -361,10 +341,10 @@ struct AtomTableKey
struct AtomTableEntry : public PLDHashEntryHdr
{
// These references are either to DynamicAtoms, in which case they are
// non-owning, or they are to StaticAtoms, which aren't really refcounted.
// These references are either to dynamic Atoms, in which case they are
// non-owning, or they are to static Atoms, which aren't really refcounted.
// See the comment at the top of this file for more details.
nsIAtom* MOZ_NON_OWNING_REF mAtom;
Atom* MOZ_NON_OWNING_REF mAtom;
};
static PLDHashNumber
@ -394,13 +374,12 @@ static void
AtomTableClearEntry(PLDHashTable* aTable, PLDHashEntryHdr* aEntry)
{
auto entry = static_cast<AtomTableEntry*>(aEntry);
nsIAtom* atom = entry->mAtom;
Atom* atom = entry->mAtom;
if (atom->IsStaticAtom()) {
// This case -- when the entry being cleared holds a StaticAtom -- only
// occurs when gAtomTable is destroyed, whereupon all StaticAtoms within it
// must be explicitly deleted. The cast is required because StaticAtom
// doesn't have a virtual destructor.
delete static_cast<StaticAtom*>(atom);
// This case -- when the entry being cleared holds a static Atom -- only
// occurs when gAtomTable is destroyed, whereupon all static Atoms within it
// must be explicitly deleted.
delete atom;
}
}
@ -421,11 +400,11 @@ static const PLDHashTableOps AtomTableOps = {
//----------------------------------------------------------------------
#define RECENTLY_USED_MAIN_THREAD_ATOM_CACHE_SIZE 31
static nsIAtom*
static Atom*
sRecentlyUsedMainThreadAtoms[RECENTLY_USED_MAIN_THREAD_ATOM_CACHE_SIZE] = {};
void
DynamicAtom::GCAtomTable()
Atom::GCAtomTable()
{
if (NS_IsMainThread()) {
MutexAutoLock lock(*gAtomTableLock);
@ -434,8 +413,7 @@ DynamicAtom::GCAtomTable()
}
void
DynamicAtom::GCAtomTableLocked(const MutexAutoLock& aProofOfLock,
GCKind aKind)
Atom::GCAtomTableLocked(const MutexAutoLock& aProofOfLock, GCKind aKind)
{
MOZ_ASSERT(NS_IsMainThread());
for (uint32_t i = 0; i < RECENTLY_USED_MAIN_THREAD_ATOM_CACHE_SIZE; ++i) {
@ -451,7 +429,7 @@ DynamicAtom::GCAtomTableLocked(const MutexAutoLock& aProofOfLock,
continue;
}
auto atom = static_cast<DynamicAtom*>(entry->mAtom);
Atom* atom = entry->mAtom;
if (atom->mRefCnt == 0) {
i.Remove();
delete atom;
@ -502,11 +480,10 @@ DynamicAtom::GCAtomTableLocked(const MutexAutoLock& aProofOfLock,
gUnusedAtomCount -= removedCount;
}
NS_IMPL_QUERY_INTERFACE(DynamicAtom, nsIAtom)
MozExternalRefCountType
DynamicAtom::DoAddRef()
Atom::DynamicAddRef()
{
MOZ_ASSERT(IsDynamicAtom());
nsrefcnt count = ++mRefCnt;
if (count == 1) {
gUnusedAtomCount--;
@ -523,8 +500,9 @@ static const uint32_t kAtomGCThreshold = 10000;
#endif
MozExternalRefCountType
DynamicAtom::DoRelease()
Atom::DynamicRelease()
{
MOZ_ASSERT(IsDynamicAtom());
MOZ_ASSERT(mRefCnt > 0);
nsrefcnt count = --mRefCnt;
if (count == 0) {
@ -536,11 +514,6 @@ DynamicAtom::DoRelease()
return count;
}
DynamicAtom::~DynamicAtom()
{
nsStringBuffer::FromData(mString)->Release();
}
//----------------------------------------------------------------------
class StaticAtomEntry : public PLDHashEntryHdr
@ -570,9 +543,9 @@ public:
enum { ALLOW_MEMMOVE = true };
// StaticAtoms aren't really refcounted. Because these entries live in a
// Static Atoms aren't really refcounted. Because these entries live in a
// global hashtable, this reference is essentially owning.
StaticAtom* MOZ_OWNING_REF mAtom;
Atom* MOZ_OWNING_REF mAtom;
};
/**
@ -637,7 +610,7 @@ NS_ShutdownAtomTable()
// builds.
{
MutexAutoLock lock(*gAtomTableLock);
DynamicAtom::GCAtomTableLocked(lock, DynamicAtom::GCKind::Shutdown);
Atom::GCAtomTableLocked(lock, Atom::GCKind::Shutdown);
}
#endif
@ -708,7 +681,7 @@ RegisterStaticAtoms(const nsStaticAtom* aAtoms, uint32_t aAtomCount)
GetAtomHashEntry(static_cast<char16_t*>(stringBuffer->Data()),
stringLen, &hash);
nsIAtom* atom = he->mAtom;
Atom* atom = he->mAtom;
if (atom) {
// Disallow creating a dynamic atom, and then later, while the
// dynamic atom is still alive, registering that same atom as a
@ -721,7 +694,7 @@ RegisterStaticAtoms(const nsStaticAtom* aAtoms, uint32_t aAtomCount)
"Static atom registration for %s should be pushed back", name.get());
}
} else {
atom = new StaticAtom(stringBuffer, stringLen, hash);
atom = Atom::CreateStatic(stringBuffer, stringLen, hash);
he->mAtom = atom;
}
*atomp = atom;
@ -730,7 +703,7 @@ RegisterStaticAtoms(const nsStaticAtom* aAtoms, uint32_t aAtomCount)
StaticAtomEntry* entry =
gStaticAtomTable->PutEntry(nsDependentAtomString(atom));
MOZ_ASSERT(atom->IsStaticAtom());
entry->mAtom = static_cast<StaticAtom*>(atom);
entry->mAtom = atom;
}
}
}
@ -761,7 +734,7 @@ NS_Atomize(const nsACString& aUTF8String)
// Actually, now there is, sort of: ForgetSharedBuffer.
nsString str;
CopyUTF8toUTF16(aUTF8String, str);
RefPtr<DynamicAtom> atom = DynamicAtom::Create(str, hash);
RefPtr<Atom> atom = Atom::CreateDynamic(str, hash);
he->mAtom = atom;
@ -789,7 +762,7 @@ NS_Atomize(const nsAString& aUTF16String)
return atom.forget();
}
RefPtr<DynamicAtom> atom = DynamicAtom::Create(aUTF16String, hash);
RefPtr<Atom> atom = Atom::CreateDynamic(aUTF16String, hash);
he->mAtom = atom;
return atom.forget();
@ -803,8 +776,7 @@ NS_AtomizeMainThread(const nsAString& aUTF16String)
uint32_t hash;
AtomTableKey key(aUTF16String.Data(), aUTF16String.Length(), &hash);
uint32_t index = hash % RECENTLY_USED_MAIN_THREAD_ATOM_CACHE_SIZE;
nsIAtom* atom =
sRecentlyUsedMainThreadAtoms[index];
Atom* atom = sRecentlyUsedMainThreadAtoms[index];
if (atom) {
uint32_t length = atom->GetLength();
if (length == key.mLength &&
@ -821,18 +793,19 @@ NS_AtomizeMainThread(const nsAString& aUTF16String)
if (he->mAtom) {
retVal = he->mAtom;
} else {
retVal = DynamicAtom::Create(aUTF16String, hash);
he->mAtom = retVal;
RefPtr<Atom> newAtom = Atom::CreateDynamic(aUTF16String, hash);
he->mAtom = newAtom;
retVal = newAtom.forget();
}
sRecentlyUsedMainThreadAtoms[index] = retVal;
sRecentlyUsedMainThreadAtoms[index] = he->mAtom;
return retVal.forget();
}
nsrefcnt
NS_GetNumberOfAtoms(void)
{
DynamicAtom::GCAtomTable(); // Trigger a GC so that we return a deterministic result.
Atom::GCAtomTable(); // Trigger a GC so that we return a deterministic result.
MutexAutoLock lock(*gAtomTableLock);
return gAtomTable->EntryCount();
}

Some files were not shown because too many files have changed in this diff Show More