зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to fx-team on a CLOSED TREEx
This commit is contained in:
Коммит
60f46579a5
|
@ -1257,7 +1257,11 @@ nsAccessibilityService::Init()
|
|||
logging::CheckEnv();
|
||||
#endif
|
||||
|
||||
gApplicationAccessible = new ApplicationAccessibleWrap();
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default)
|
||||
gApplicationAccessible = new ApplicationAccessibleWrap();
|
||||
else
|
||||
gApplicationAccessible = new ApplicationAccessible();
|
||||
|
||||
NS_ADDREF(gApplicationAccessible); // will release in Shutdown()
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
|
@ -1274,7 +1278,8 @@ nsAccessibilityService::Init()
|
|||
gIsShutdown = false;
|
||||
|
||||
// Now its safe to start platform accessibility.
|
||||
PlatformInit();
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default)
|
||||
PlatformInit();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1316,7 +1321,9 @@ nsAccessibilityService::Shutdown()
|
|||
|
||||
gIsShutdown = true;
|
||||
|
||||
PlatformShutdown();
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default)
|
||||
PlatformShutdown();
|
||||
|
||||
gApplicationAccessible->Shutdown();
|
||||
NS_RELEASE(gApplicationAccessible);
|
||||
gApplicationAccessible = nullptr;
|
||||
|
|
|
@ -328,6 +328,7 @@ pref("media.eme.apiVisible", true);
|
|||
pref("media.video-queue.default-size", 3);
|
||||
|
||||
// optimize images' memory usage
|
||||
pref("image.downscale-during-decode.enabled", true);
|
||||
pref("image.decode-only-on-draw.enabled", false);
|
||||
pref("image.mem.allow_locking_in_content_processes", true);
|
||||
// Limit the surface cache to 1/8 of main memory or 128MB, whichever is smaller.
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="2eda36a4795012a5d1275b77ebb20ac377c8cd26">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="426fe6450ab8da92bb473fef12ccb39c6c920dd0"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="83b27f522642ea573c57e882657ab5c73d4b07f4"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d3868ff4bb3a4b81382795e2784258c210fe6cb8"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="426fe6450ab8da92bb473fef12ccb39c6c920dd0"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="83b27f522642ea573c57e882657ab5c73d4b07f4"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d3868ff4bb3a4b81382795e2784258c210fe6cb8"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="9a9797062c6001d6346504161c51187a2968466b"/>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="426fe6450ab8da92bb473fef12ccb39c6c920dd0"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="83b27f522642ea573c57e882657ab5c73d4b07f4"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d3868ff4bb3a4b81382795e2784258c210fe6cb8"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="adb24954bf8068f21705b570450475d183336b2d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0627790166dccd8dd370fa7d9f434ed9fc027fb4"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="2eda36a4795012a5d1275b77ebb20ac377c8cd26">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="426fe6450ab8da92bb473fef12ccb39c6c920dd0"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="83b27f522642ea573c57e882657ab5c73d4b07f4"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d3868ff4bb3a4b81382795e2784258c210fe6cb8"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="426fe6450ab8da92bb473fef12ccb39c6c920dd0"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="83b27f522642ea573c57e882657ab5c73d4b07f4"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d3868ff4bb3a4b81382795e2784258c210fe6cb8"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="426fe6450ab8da92bb473fef12ccb39c6c920dd0"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="83b27f522642ea573c57e882657ab5c73d4b07f4"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d3868ff4bb3a4b81382795e2784258c210fe6cb8"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="9a9797062c6001d6346504161c51187a2968466b"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="2eda36a4795012a5d1275b77ebb20ac377c8cd26">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="426fe6450ab8da92bb473fef12ccb39c6c920dd0"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="83b27f522642ea573c57e882657ab5c73d4b07f4"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d3868ff4bb3a4b81382795e2784258c210fe6cb8"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
</project>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="426fe6450ab8da92bb473fef12ccb39c6c920dd0"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="83b27f522642ea573c57e882657ab5c73d4b07f4"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d3868ff4bb3a4b81382795e2784258c210fe6cb8"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="adb24954bf8068f21705b570450475d183336b2d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0627790166dccd8dd370fa7d9f434ed9fc027fb4"/>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"git": {
|
||||
"git_revision": "426fe6450ab8da92bb473fef12ccb39c6c920dd0",
|
||||
"git_revision": "83b27f522642ea573c57e882657ab5c73d4b07f4",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "b48088c5abd6ad5a64b9b870e52d6de14b3f2bc3",
|
||||
"revision": "6f889f462ec6387626570bab40a0f032a205edf6",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="426fe6450ab8da92bb473fef12ccb39c6c920dd0"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="83b27f522642ea573c57e882657ab5c73d4b07f4"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d3868ff4bb3a4b81382795e2784258c210fe6cb8"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="adb24954bf8068f21705b570450475d183336b2d"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0627790166dccd8dd370fa7d9f434ed9fc027fb4"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="426fe6450ab8da92bb473fef12ccb39c6c920dd0"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="83b27f522642ea573c57e882657ab5c73d4b07f4"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d3868ff4bb3a4b81382795e2784258c210fe6cb8"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
|
|
@ -206,6 +206,7 @@ let gEMEHandler = {
|
|||
let options = {
|
||||
dismissed: true,
|
||||
eventCallback: aTopic => aTopic == "swapping",
|
||||
learnMoreURL: Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content",
|
||||
};
|
||||
PopupNotifications.show(browser, "drmContentPlaying", message, anchorId, mainAction, null, options);
|
||||
},
|
||||
|
|
|
@ -238,7 +238,7 @@ skip-if = e10s && debug
|
|||
[browser_bug624734.js]
|
||||
[browser_bug633691.js]
|
||||
[browser_bug647886.js]
|
||||
skip-if = buildapp == 'mulet' || e10s # Bug 1093373 - Relies on browser.sessionHistory
|
||||
skip-if = buildapp == 'mulet'
|
||||
[browser_bug655584.js]
|
||||
[browser_bug664672.js]
|
||||
[browser_bug676619.js]
|
||||
|
|
|
@ -1,36 +1,25 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function () {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
add_task(function* () {
|
||||
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com");
|
||||
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
content.history.pushState({}, "2", "2.html");
|
||||
});
|
||||
|
||||
testBackButton();
|
||||
}, true);
|
||||
|
||||
loadURI("http://example.com");
|
||||
}
|
||||
|
||||
function testBackButton() {
|
||||
var backButton = document.getElementById("back-button");
|
||||
var rect = backButton.getBoundingClientRect();
|
||||
|
||||
info("waiting for the history menu to open");
|
||||
|
||||
backButton.addEventListener("popupshown", function (event) {
|
||||
backButton.removeEventListener("popupshown", arguments.callee, false);
|
||||
|
||||
ok(true, "history menu opened");
|
||||
event.target.hidePopup();
|
||||
gBrowser.removeTab(gBrowser.selectedTab);
|
||||
finish();
|
||||
}, false);
|
||||
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(backButton, "popupshown");
|
||||
EventUtils.synthesizeMouseAtCenter(backButton, {type: "mousedown"});
|
||||
EventUtils.synthesizeMouse(backButton, rect.width / 2, rect.height, {type: "mouseup"});
|
||||
}
|
||||
let event = yield popupShownPromise;
|
||||
|
||||
ok(true, "history menu opened");
|
||||
|
||||
event.target.hidePopup();
|
||||
gBrowser.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
|
|
@ -11,7 +11,8 @@ namespace mozilla {
|
|||
|
||||
NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor)
|
||||
|
||||
LoadContext::LoadContext(nsIPrincipal* aPrincipal, nsILoadContext* aOptionalBase)
|
||||
LoadContext::LoadContext(nsIPrincipal* aPrincipal,
|
||||
nsILoadContext* aOptionalBase)
|
||||
: mTopFrameElement(nullptr)
|
||||
, mNestedFrameId(0)
|
||||
, mIsContent(true)
|
||||
|
@ -22,17 +23,18 @@ LoadContext::LoadContext(nsIPrincipal* aPrincipal, nsILoadContext* aOptionalBase
|
|||
#endif
|
||||
{
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aPrincipal->GetAppId(&mAppId)));
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||
aPrincipal->GetIsInBrowserElement(&mIsInBrowserElement)));
|
||||
MOZ_ALWAYS_TRUE(
|
||||
NS_SUCCEEDED(aPrincipal->GetIsInBrowserElement(&mIsInBrowserElement)));
|
||||
|
||||
if (!aOptionalBase) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aOptionalBase->GetIsContent(&mIsContent)));
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||
aOptionalBase->GetUsePrivateBrowsing(&mUsePrivateBrowsing)));
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aOptionalBase->GetUseRemoteTabs(&mUseRemoteTabs)));
|
||||
MOZ_ALWAYS_TRUE(
|
||||
NS_SUCCEEDED(aOptionalBase->GetUsePrivateBrowsing(&mUsePrivateBrowsing)));
|
||||
MOZ_ALWAYS_TRUE(
|
||||
NS_SUCCEEDED(aOptionalBase->GetUseRemoteTabs(&mUseRemoteTabs)));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -53,7 +53,8 @@ public:
|
|||
#ifdef DEBUG
|
||||
, mIsNotNull(aToCopy.mIsNotNull)
|
||||
#endif
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
// AppId/inBrowser arguments override those in SerializedLoadContext provided
|
||||
// by child process.
|
||||
|
@ -70,7 +71,8 @@ public:
|
|||
#ifdef DEBUG
|
||||
, mIsNotNull(aToCopy.mIsNotNull)
|
||||
#endif
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
LoadContext(dom::Element* aTopFrameElement,
|
||||
uint32_t aAppId,
|
||||
|
@ -88,7 +90,8 @@ public:
|
|||
#ifdef DEBUG
|
||||
, mIsNotNull(true)
|
||||
#endif
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
// Constructor taking reserved appId for the safebrowsing cookie.
|
||||
explicit LoadContext(uint32_t aAppId)
|
||||
|
@ -102,7 +105,8 @@ public:
|
|||
#ifdef DEBUG
|
||||
, mIsNotNull(true)
|
||||
#endif
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
// Constructor for creating a LoadContext with a given principal's appId and
|
||||
// browser flag.
|
||||
|
@ -127,4 +131,3 @@ private:
|
|||
} // namespace mozilla
|
||||
|
||||
#endif // LoadContext_h
|
||||
|
||||
|
|
|
@ -77,4 +77,3 @@ SerializedLoadContext::Init(nsILoadContext* aLoadContext)
|
|||
}
|
||||
|
||||
} // namespace IPC
|
||||
|
||||
|
|
|
@ -72,11 +72,11 @@ struct ParamTraits<SerializedLoadContext>
|
|||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &aResult->mIsNotNull) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsContent) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsPrivateBitValid) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mUsePrivateBrowsing) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mUseRemoteTabs) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mAppId) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsContent) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsPrivateBitValid) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mUsePrivateBrowsing) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mUseRemoteTabs) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mAppId) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsInBrowserElement)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -88,4 +88,3 @@ struct ParamTraits<SerializedLoadContext>
|
|||
} // namespace IPC
|
||||
|
||||
#endif // SerializedLoadContext_h
|
||||
|
||||
|
|
|
@ -26,10 +26,6 @@
|
|||
|
||||
using namespace mozilla;
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsDSURIContentListener: Object Management
|
||||
//*****************************************************************************
|
||||
|
||||
nsDSURIContentListener::nsDSURIContentListener(nsDocShell* aDocShell)
|
||||
: mDocShell(aDocShell)
|
||||
, mExistingJPEGRequest(nullptr)
|
||||
|
@ -50,10 +46,6 @@ nsDSURIContentListener::Init()
|
|||
return rv;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDSURIContentListener::nsISupports
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMPL_ADDREF(nsDSURIContentListener)
|
||||
NS_IMPL_RELEASE(nsDSURIContentListener)
|
||||
|
||||
|
@ -63,16 +55,11 @@ NS_INTERFACE_MAP_BEGIN(nsDSURIContentListener)
|
|||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDSURIContentListener::nsIURIContentListener
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDSURIContentListener::OnStartURIOpen(nsIURI* aURI, bool* aAbortOpen)
|
||||
{
|
||||
// If mDocShell is null here, that means someone's starting a load
|
||||
// in our docshell after it's already been destroyed. Don't let
|
||||
// that happen.
|
||||
// If mDocShell is null here, that means someone's starting a load in our
|
||||
// docshell after it's already been destroyed. Don't let that happen.
|
||||
if (!mDocShell) {
|
||||
*aAbortOpen = true;
|
||||
return NS_OK;
|
||||
|
@ -188,17 +175,16 @@ nsDSURIContentListener::IsPreferred(const char* aContentType,
|
|||
aDesiredContentType,
|
||||
aCanHandle);
|
||||
}
|
||||
// we used to return false here if we didn't have a parent properly
|
||||
// registered at the top of the docshell hierarchy to dictate what
|
||||
// content types this docshell should be a preferred handler for. But
|
||||
// this really makes it hard for developers using iframe or browser tags
|
||||
// because then they need to make sure they implement
|
||||
// nsIURIContentListener otherwise all link clicks would get sent to
|
||||
// another window because we said we weren't the preferred handler type.
|
||||
// I'm going to change the default now...if we can handle the content,
|
||||
// and someone didn't EXPLICITLY set a nsIURIContentListener at the top
|
||||
// of our docshell chain, then we'll now always attempt to process the
|
||||
// content ourselves...
|
||||
// we used to return false here if we didn't have a parent properly registered
|
||||
// at the top of the docshell hierarchy to dictate what content types this
|
||||
// docshell should be a preferred handler for. But this really makes it hard
|
||||
// for developers using iframe or browser tags because then they need to make
|
||||
// sure they implement nsIURIContentListener otherwise all link clicks would
|
||||
// get sent to another window because we said we weren't the preferred handler
|
||||
// type. I'm going to change the default now... if we can handle the content,
|
||||
// and someone didn't EXPLICITLY set a nsIURIContentListener at the top of our
|
||||
// docshell chain, then we'll now always attempt to process the content
|
||||
// ourselves...
|
||||
return CanHandleContent(aContentType, true, aDesiredContentType, aCanHandle);
|
||||
}
|
||||
|
||||
|
|
|
@ -970,7 +970,8 @@ nsDefaultURIFixup::KeywordURIFixup(const nsACString& aURIString,
|
|||
|
||||
// If we're at the end of the string or this is the first slash,
|
||||
// check if the thing before the slash looks like ipv4:
|
||||
if ((iter.size_forward() == 1 || (lastSlashLoc == uint32_t(kNotFound) && *iter == '/')) &&
|
||||
if ((iter.size_forward() == 1 ||
|
||||
(lastSlashLoc == uint32_t(kNotFound) && *iter == '/')) &&
|
||||
// Need 2 or 3 dots + only digits
|
||||
(foundDots == 2 || foundDots == 3) &&
|
||||
// and they should be all that came before now:
|
||||
|
|
|
@ -712,7 +712,8 @@ SendPing(void* aClosure, nsIContent* aContent, nsIURI* aURI,
|
|||
nsPingListener* pingListener =
|
||||
new nsPingListener(info->requireSameHost, aContent, loadGroup);
|
||||
|
||||
nsCOMPtr<nsINetworkInterceptController> interceptController = do_QueryInterface(info->docShell);
|
||||
nsCOMPtr<nsINetworkInterceptController> interceptController =
|
||||
do_QueryInterface(info->docShell);
|
||||
pingListener->SetInterceptController(interceptController);
|
||||
nsCOMPtr<nsIStreamListener> listener(pingListener);
|
||||
|
||||
|
@ -845,10 +846,6 @@ DecreasePrivateDocShellCount()
|
|||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsDocShell: Object Management
|
||||
//*****************************************************************************
|
||||
|
||||
static uint64_t gDocshellIDCounter = 0;
|
||||
|
||||
nsDocShell::nsDocShell()
|
||||
|
@ -1032,10 +1029,6 @@ nsDocShell::DestroyChildren()
|
|||
nsDocLoader::DestroyChildren();
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShell::nsISupports
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDocShell, nsDocLoader)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDocShell, nsDocLoader)
|
||||
|
||||
|
@ -1061,9 +1054,6 @@ NS_INTERFACE_MAP_BEGIN(nsDocShell)
|
|||
NS_INTERFACE_MAP_ENTRY(nsINetworkInterceptController)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDocLoader)
|
||||
|
||||
///*****************************************************************************
|
||||
// nsDocShell::nsIInterfaceRequestor
|
||||
//*****************************************************************************
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
|
||||
{
|
||||
|
@ -1361,9 +1351,6 @@ nsDocShell::ConvertLoadTypeToDocShellLoadInfo(uint32_t aLoadType)
|
|||
return docShellLoadType;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShell::nsIDocShell
|
||||
//*****************************************************************************
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::LoadURI(nsIURI* aURI,
|
||||
nsIDocShellLoadInfo* aLoadInfo,
|
||||
|
@ -2610,14 +2597,16 @@ nsDocShell::SetAllowContentRetargeting(bool aAllowContentRetargeting)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAllowContentRetargetingOnChildren(bool* aAllowContentRetargetingOnChildren)
|
||||
nsDocShell::GetAllowContentRetargetingOnChildren(
|
||||
bool* aAllowContentRetargetingOnChildren)
|
||||
{
|
||||
*aAllowContentRetargetingOnChildren = mAllowContentRetargetingOnChildren;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetAllowContentRetargetingOnChildren(bool aAllowContentRetargetingOnChildren)
|
||||
nsDocShell::SetAllowContentRetargetingOnChildren(
|
||||
bool aAllowContentRetargetingOnChildren)
|
||||
{
|
||||
mAllowContentRetargetingOnChildren = aAllowContentRetargetingOnChildren;
|
||||
return NS_OK;
|
||||
|
@ -3489,7 +3478,8 @@ nsDocShell::SetDocLoaderParent(nsDocLoader* aParent)
|
|||
if (NS_SUCCEEDED(parentAsDocShell->GetAllowWindowControl(&value))) {
|
||||
SetAllowWindowControl(value);
|
||||
}
|
||||
SetAllowContentRetargeting(parentAsDocShell->GetAllowContentRetargetingOnChildren());
|
||||
SetAllowContentRetargeting(
|
||||
parentAsDocShell->GetAllowContentRetargetingOnChildren());
|
||||
if (NS_SUCCEEDED(parentAsDocShell->GetIsActive(&value))) {
|
||||
SetIsActive(value);
|
||||
}
|
||||
|
@ -5611,6 +5601,7 @@ nsDocShell::GetSessionHistory(nsISHistory** aSessionHistory)
|
|||
//*****************************************************************************
|
||||
// nsDocShell::nsIWebPageDescriptor
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::LoadPage(nsISupports* aPageDescriptor, uint32_t aDisplayType)
|
||||
{
|
||||
|
@ -7174,7 +7165,7 @@ nsDocShell::RefreshURIFromQueue()
|
|||
timer->InitWithCallback(refreshInfo, delay, nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
}
|
||||
} // while
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -7821,20 +7812,19 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
|
|||
aStatus == NS_ERROR_PROXY_CONNECTION_REFUSED) &&
|
||||
(isTopFrame || UseErrorPages())) {
|
||||
DisplayLoadError(aStatus, url, nullptr, aChannel);
|
||||
}
|
||||
else if (aStatus == NS_ERROR_NET_TIMEOUT ||
|
||||
aStatus == NS_ERROR_REDIRECT_LOOP ||
|
||||
aStatus == NS_ERROR_UNKNOWN_SOCKET_TYPE ||
|
||||
aStatus == NS_ERROR_NET_INTERRUPT ||
|
||||
aStatus == NS_ERROR_NET_RESET ||
|
||||
aStatus == NS_ERROR_OFFLINE ||
|
||||
aStatus == NS_ERROR_MALWARE_URI ||
|
||||
aStatus == NS_ERROR_PHISHING_URI ||
|
||||
aStatus == NS_ERROR_UNWANTED_URI ||
|
||||
aStatus == NS_ERROR_UNSAFE_CONTENT_TYPE ||
|
||||
aStatus == NS_ERROR_REMOTE_XUL ||
|
||||
aStatus == NS_ERROR_OFFLINE ||
|
||||
NS_ERROR_GET_MODULE(aStatus) == NS_ERROR_MODULE_SECURITY) {
|
||||
} else if (aStatus == NS_ERROR_NET_TIMEOUT ||
|
||||
aStatus == NS_ERROR_REDIRECT_LOOP ||
|
||||
aStatus == NS_ERROR_UNKNOWN_SOCKET_TYPE ||
|
||||
aStatus == NS_ERROR_NET_INTERRUPT ||
|
||||
aStatus == NS_ERROR_NET_RESET ||
|
||||
aStatus == NS_ERROR_OFFLINE ||
|
||||
aStatus == NS_ERROR_MALWARE_URI ||
|
||||
aStatus == NS_ERROR_PHISHING_URI ||
|
||||
aStatus == NS_ERROR_UNWANTED_URI ||
|
||||
aStatus == NS_ERROR_UNSAFE_CONTENT_TYPE ||
|
||||
aStatus == NS_ERROR_REMOTE_XUL ||
|
||||
aStatus == NS_ERROR_OFFLINE ||
|
||||
NS_ERROR_GET_MODULE(aStatus) == NS_ERROR_MODULE_SECURITY) {
|
||||
// Errors to be shown for any frame
|
||||
DisplayLoadError(aStatus, url, nullptr, aChannel);
|
||||
} else if (aStatus == NS_ERROR_DOCUMENT_NOT_CACHED) {
|
||||
|
@ -7846,8 +7836,7 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
|
|||
}
|
||||
DisplayLoadError(aStatus, url, nullptr, aChannel);
|
||||
}
|
||||
}
|
||||
else if (url && NS_SUCCEEDED(aStatus)) {
|
||||
} else if (url && NS_SUCCEEDED(aStatus)) {
|
||||
// If we have a host
|
||||
mozilla::net::PredictorLearnRedirect(url, aChannel, this);
|
||||
}
|
||||
|
@ -8001,9 +7990,9 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
|
|||
blankDoc->SetSandboxFlags(mSandboxFlags);
|
||||
|
||||
// create a content viewer for us and the new document
|
||||
docFactory->CreateInstanceForDocument(NS_ISUPPORTS_CAST(nsIDocShell*, this),
|
||||
blankDoc, "view",
|
||||
getter_AddRefs(viewer));
|
||||
docFactory->CreateInstanceForDocument(
|
||||
NS_ISUPPORTS_CAST(nsIDocShell*, this), blankDoc, "view",
|
||||
getter_AddRefs(viewer));
|
||||
|
||||
// hook 'em up
|
||||
if (viewer) {
|
||||
|
@ -8405,8 +8394,8 @@ class MOZ_STACK_CLASS PresentationEventForgetter
|
|||
{
|
||||
public:
|
||||
explicit PresentationEventForgetter(
|
||||
nsRevocableEventPtr<nsDocShell::RestorePresentationEvent>&
|
||||
aRestorePresentationEvent)
|
||||
nsRevocableEventPtr<nsDocShell::RestorePresentationEvent>&
|
||||
aRestorePresentationEvent)
|
||||
: mRestorePresentationEvent(aRestorePresentationEvent)
|
||||
, mEvent(aRestorePresentationEvent.get())
|
||||
{
|
||||
|
@ -8785,7 +8774,8 @@ nsDocShell::RestoreFromHistory()
|
|||
childShell->GetAllowDNSPrefetch(&allowDNSPrefetch);
|
||||
|
||||
bool allowContentRetargeting = childShell->GetAllowContentRetargeting();
|
||||
bool allowContentRetargetingOnChildren = childShell->GetAllowContentRetargetingOnChildren();
|
||||
bool allowContentRetargetingOnChildren =
|
||||
childShell->GetAllowContentRetargetingOnChildren();
|
||||
|
||||
uint32_t defaultLoadFlags;
|
||||
childShell->GetDefaultLoadFlags(&defaultLoadFlags);
|
||||
|
@ -8804,7 +8794,8 @@ nsDocShell::RestoreFromHistory()
|
|||
childShell->SetAllowMedia(allowMedia);
|
||||
childShell->SetAllowDNSPrefetch(allowDNSPrefetch);
|
||||
childShell->SetAllowContentRetargeting(allowContentRetargeting);
|
||||
childShell->SetAllowContentRetargetingOnChildren(allowContentRetargetingOnChildren);
|
||||
childShell->SetAllowContentRetargetingOnChildren(
|
||||
allowContentRetargetingOnChildren);
|
||||
childShell->SetDefaultLoadFlags(defaultLoadFlags);
|
||||
|
||||
rv = childShell->BeginRestore(nullptr, false);
|
||||
|
@ -9085,8 +9076,9 @@ nsDocShell::CreateContentViewer(const nsACString& aContentType,
|
|||
aOpenedChannel->SetLoadFlags(loadFlags);
|
||||
|
||||
mLoadGroup->AddRequest(aRequest, nullptr);
|
||||
if (currentLoadGroup)
|
||||
if (currentLoadGroup) {
|
||||
currentLoadGroup->RemoveRequest(aRequest, nullptr, NS_BINDING_RETARGETED);
|
||||
}
|
||||
|
||||
// Update the notification callbacks, so that progress and
|
||||
// status information are sent to the right docshell...
|
||||
|
@ -9405,6 +9397,7 @@ nsDocShell::CheckLoadingPermissions()
|
|||
//*****************************************************************************
|
||||
// nsDocShell: Site Loading
|
||||
//*****************************************************************************
|
||||
|
||||
namespace {
|
||||
|
||||
#ifdef MOZ_PLACES
|
||||
|
@ -9515,7 +9508,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
NS_IMETHOD
|
||||
Run()
|
||||
{
|
||||
return mDocShell->InternalLoad(mURI, mReferrer,
|
||||
mReferrerPolicy,
|
||||
|
@ -11222,7 +11216,7 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel, nsISupports* aOwner,
|
|||
updateSHistory = false;
|
||||
updateGHistory = false; // XXX Why global history too?
|
||||
}
|
||||
} // rootSH
|
||||
}
|
||||
|
||||
// Check if the url to be loaded is the same as the one already loaded.
|
||||
if (mCurrentURI) {
|
||||
|
@ -11823,9 +11817,9 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
|
|||
nsCOMPtr<nsISHEntry> child;
|
||||
shContainer->GetChildAt(i, getter_AddRefs(child));
|
||||
shContainer->RemoveChild(child);
|
||||
} // for
|
||||
}
|
||||
entry->AbandonBFCacheEntry();
|
||||
} // shContainer
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new entry if necessary.
|
||||
|
@ -12166,7 +12160,8 @@ nsDocShell::WalkHistoryEntries(nsISHEntry* aRootEntry,
|
|||
if (aRootShell) {
|
||||
// Walk the children of aRootShell and see if one of them
|
||||
// has srcChild as a SHEntry.
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(aRootShell->mChildList);
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(
|
||||
aRootShell->mChildList);
|
||||
while (iter.HasMore()) {
|
||||
nsDocShell* child = static_cast<nsDocShell*>(iter.GetNext());
|
||||
|
||||
|
@ -12939,10 +12934,6 @@ nsDocShell::SetLayoutHistoryState(nsILayoutHistoryState* aLayoutHistoryState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsRefreshTimer: Object Management
|
||||
//*****************************************************************************
|
||||
|
||||
nsRefreshTimer::nsRefreshTimer()
|
||||
: mDelay(0), mRepeat(false), mMetaRefresh(false)
|
||||
{
|
||||
|
@ -12952,10 +12943,6 @@ nsRefreshTimer::~nsRefreshTimer()
|
|||
{
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsRefreshTimer::nsISupports
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMPL_ADDREF(nsRefreshTimer)
|
||||
NS_IMPL_RELEASE(nsRefreshTimer)
|
||||
|
||||
|
@ -12964,9 +12951,6 @@ NS_INTERFACE_MAP_BEGIN(nsRefreshTimer)
|
|||
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
|
||||
NS_INTERFACE_MAP_END_THREADSAFE
|
||||
|
||||
///*****************************************************************************
|
||||
// nsRefreshTimer::nsITimerCallback
|
||||
//******************************************************************************
|
||||
NS_IMETHODIMP
|
||||
nsRefreshTimer::Notify(nsITimer* aTimer)
|
||||
{
|
||||
|
@ -12981,9 +12965,6 @@ nsRefreshTimer::Notify(nsITimer* aTimer)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShell::InterfaceRequestorProxy
|
||||
//*****************************************************************************
|
||||
nsDocShell::InterfaceRequestorProxy::InterfaceRequestorProxy(
|
||||
nsIInterfaceRequestor* aRequestor)
|
||||
{
|
||||
|
@ -13022,8 +13003,9 @@ nsDocShell::SetBaseUrlForWyciwyg(nsIContentViewer* aContentViewer)
|
|||
nsCOMPtr<nsIURI> baseURI;
|
||||
nsresult rv = NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
if (sURIFixup)
|
||||
if (sURIFixup) {
|
||||
rv = sURIFixup->CreateExposableURI(mCurrentURI, getter_AddRefs(baseURI));
|
||||
}
|
||||
|
||||
// Get the current document and set the base uri
|
||||
if (baseURI) {
|
||||
|
@ -13069,6 +13051,7 @@ nsDocShell::GetAuthPrompt(uint32_t aPromptReason, const nsIID& aIID,
|
|||
//*****************************************************************************
|
||||
// nsDocShell::nsILoadContext
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAssociatedWindow(nsIDOMWindow** aWindow)
|
||||
{
|
||||
|
@ -13321,8 +13304,6 @@ nsDocShell::SelectNone(void)
|
|||
return DoCommand("cmd_selectNone");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// link handling
|
||||
|
||||
class OnLinkClickEvent : public nsRunnable
|
||||
|
@ -13382,8 +13363,6 @@ OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler,
|
|||
{
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::OnLinkClick(nsIContent* aContent,
|
||||
nsIURI* aURI,
|
||||
|
@ -13934,7 +13913,6 @@ nsDocShell::GetURLSearchParams()
|
|||
class JavascriptTimelineMarker : public TimelineMarker
|
||||
{
|
||||
public:
|
||||
|
||||
JavascriptTimelineMarker(nsDocShell* aDocShell, const char* aName,
|
||||
const char* aReason)
|
||||
: TimelineMarker(aDocShell, aName, TRACING_INTERVAL_START,
|
||||
|
@ -13949,7 +13927,7 @@ public:
|
|||
};
|
||||
|
||||
void
|
||||
nsDocShell::NotifyJSRunToCompletionStart(const char *aReason)
|
||||
nsDocShell::NotifyJSRunToCompletionStart(const char* aReason)
|
||||
{
|
||||
bool timelineOn = nsIDocShell::GetRecordProfileTimelineMarkers();
|
||||
|
||||
|
@ -14009,7 +13987,8 @@ nsDocShell::MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate, bool* aShouldIntercept)
|
||||
nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate,
|
||||
bool* aShouldIntercept)
|
||||
{
|
||||
*aShouldIntercept = false;
|
||||
if (mSandboxFlags) {
|
||||
|
@ -14017,7 +13996,7 @@ nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate, bool* aSho
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager();
|
||||
nsCOMPtr<nsIServiceWorkerManager> swm = services::GetServiceWorkerManager();
|
||||
if (!swm) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -14037,7 +14016,7 @@ nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate, bool* aSho
|
|||
NS_IMETHODIMP
|
||||
nsDocShell::ChannelIntercepted(nsIInterceptedChannel* aChannel)
|
||||
{
|
||||
nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager();
|
||||
nsCOMPtr<nsIServiceWorkerManager> swm = services::GetServiceWorkerManager();
|
||||
if (!swm) {
|
||||
aChannel->Cancel();
|
||||
return NS_OK;
|
||||
|
|
|
@ -89,9 +89,6 @@ class nsIURILoader;
|
|||
class nsIWebBrowserFind;
|
||||
class nsIWidget;
|
||||
|
||||
/* load commands were moved to nsIDocShell.h */
|
||||
/* load types were moved to nsDocShellLoadTypes.h */
|
||||
|
||||
/* internally used ViewMode types */
|
||||
enum ViewMode
|
||||
{
|
||||
|
@ -99,10 +96,6 @@ enum ViewMode
|
|||
viewSource = 0x1
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsRefreshTimer
|
||||
//*****************************************************************************
|
||||
|
||||
class nsRefreshTimer : public nsITimerCallback
|
||||
{
|
||||
public:
|
||||
|
@ -130,10 +123,6 @@ enum eCharsetReloadState
|
|||
eCharsetReloadStopOrigional
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsDocShell
|
||||
//*****************************************************************************
|
||||
|
||||
class nsDocShell final
|
||||
: public nsDocLoader
|
||||
, public nsIDocShell
|
||||
|
@ -159,7 +148,7 @@ class nsDocShell final
|
|||
|
||||
public:
|
||||
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(nsDocShell)
|
||||
// Object Management
|
||||
|
||||
nsDocShell();
|
||||
|
||||
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
||||
|
@ -186,7 +175,8 @@ public:
|
|||
NS_DECL_NSINETWORKINTERCEPTCONTROLLER
|
||||
NS_FORWARD_SAFE_NSIDOMSTORAGEMANAGER(TopSessionStorageManager())
|
||||
|
||||
NS_IMETHOD Stop() override {
|
||||
NS_IMETHOD Stop() override
|
||||
{
|
||||
// Need this here because otherwise nsIWebNavigation::Stop
|
||||
// overrides the docloader's Stop()
|
||||
return nsDocLoader::Stop();
|
||||
|
@ -219,7 +209,7 @@ public:
|
|||
|
||||
nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(uint32_t aLoadType);
|
||||
uint32_t ConvertDocShellLoadInfoToLoadType(
|
||||
nsDocShellInfoLoadType aDocShellLoadType);
|
||||
nsDocShellInfoLoadType aDocShellLoadType);
|
||||
|
||||
// Don't use NS_DECL_NSILOADCONTEXT because some of nsILoadContext's methods
|
||||
// are shared with nsIDocShell (appID, etc.) and can't be declared twice.
|
||||
|
@ -237,10 +227,10 @@ public:
|
|||
|
||||
// Restores a cached presentation from history (mLSHE).
|
||||
// This method swaps out the content viewer and simulates loads for
|
||||
// subframes. It then simulates the completion of the toplevel load.
|
||||
// subframes. It then simulates the completion of the toplevel load.
|
||||
nsresult RestoreFromHistory();
|
||||
|
||||
// Perform a URI load from a refresh timer. This is just like the
|
||||
// Perform a URI load from a refresh timer. This is just like the
|
||||
// ForceRefreshURI method on nsIRefreshURI, but makes sure to take
|
||||
// the timer involved out of mRefreshURIList if it's there.
|
||||
// aTimer must not be null.
|
||||
|
@ -269,8 +259,7 @@ public:
|
|||
// Add new profile timeline markers to this docShell. This will only add
|
||||
// markers if the docShell is currently recording profile timeline markers.
|
||||
// See nsIDocShell::recordProfileTimelineMarkers
|
||||
void AddProfileTimelineMarker(const char* aName,
|
||||
TracingMetadata aMetaData);
|
||||
void AddProfileTimelineMarker(const char* aName, TracingMetadata aMetaData);
|
||||
void AddProfileTimelineMarker(mozilla::UniquePtr<TimelineMarker>&& aMarker);
|
||||
|
||||
// Global counter for how many docShells are currently recording profile
|
||||
|
@ -283,13 +272,12 @@ public:
|
|||
bool aInPrivateBrowsing);
|
||||
|
||||
protected:
|
||||
// Object Management
|
||||
virtual ~nsDocShell();
|
||||
virtual void DestroyChildren() override;
|
||||
|
||||
// Content Viewer Management
|
||||
nsresult EnsureContentViewer();
|
||||
// aPrincipal can be passed in if the caller wants. If null is
|
||||
// aPrincipal can be passed in if the caller wants. If null is
|
||||
// passed in, the about:blank principal will end up being used.
|
||||
nsresult CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
|
||||
nsIURI* aBaseURI,
|
||||
|
@ -307,16 +295,16 @@ protected:
|
|||
|
||||
nsresult GetEldestPresContext(nsPresContext** aPresContext);
|
||||
|
||||
// Get the principal that we'll set on the channel if we're inheriting. If
|
||||
// Get the principal that we'll set on the channel if we're inheriting. If
|
||||
// aConsiderCurrentDocument is true, we try to use the current document if
|
||||
// at all possible. If that fails, we fall back on the parent document.
|
||||
// at all possible. If that fails, we fall back on the parent document.
|
||||
// If that fails too, we force creation of a content viewer and use the
|
||||
// resulting principal. If aConsiderCurrentDocument is false, we just look
|
||||
// resulting principal. If aConsiderCurrentDocument is false, we just look
|
||||
// at the parent.
|
||||
nsIPrincipal* GetInheritedPrincipal(bool aConsiderCurrentDocument);
|
||||
|
||||
// Actually open a channel and perform a URI load. Note: whatever owner is
|
||||
// passed to this function will be set on the channel. Callers who wish to
|
||||
// Actually open a channel and perform a URI load. Note: whatever owner is
|
||||
// passed to this function will be set on the channel. Callers who wish to
|
||||
// not have an owner on the channel should just pass null.
|
||||
// If aSrcdoc is not void, the load will be considered as a srcdoc load,
|
||||
// and the contents of aSrcdoc will be loaded instead of aURI.
|
||||
|
@ -361,7 +349,7 @@ protected:
|
|||
// In this case it is the caller's responsibility to ensure
|
||||
// FireOnLocationChange is called.
|
||||
// In all other cases false is returned.
|
||||
// Either aChannel or aOwner must be null. If aChannel is
|
||||
// Either aChannel or aOwner must be null. If aChannel is
|
||||
// present, the owner should be gotten from it.
|
||||
// If OnNewURI calls AddToSessionHistory, it will pass its
|
||||
// aCloneSHChildren argument as aCloneChildren.
|
||||
|
@ -376,10 +364,10 @@ protected:
|
|||
|
||||
// Session History
|
||||
bool ShouldAddToSessionHistory(nsIURI* aURI);
|
||||
// Either aChannel or aOwner must be null. If aChannel is
|
||||
// Either aChannel or aOwner must be null. If aChannel is
|
||||
// present, the owner should be gotten from it.
|
||||
// If aCloneChildren is true, then our current session history's
|
||||
// children will be cloned onto the new entry. This should be
|
||||
// children will be cloned onto the new entry. This should be
|
||||
// used when we aren't actually changing the document while adding
|
||||
// the new session history entry.
|
||||
nsresult AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
|
||||
|
@ -399,7 +387,7 @@ protected:
|
|||
// Clone a session history tree for subframe navigation.
|
||||
// The tree rooted at |aSrcEntry| will be cloned into |aDestEntry|, except
|
||||
// for the entry with id |aCloneID|, which will be replaced with
|
||||
// |aReplaceEntry|. |aSrcShell| is a (possibly null) docshell which
|
||||
// |aReplaceEntry|. |aSrcShell| is a (possibly null) docshell which
|
||||
// corresponds to |aSrcEntry| via its mLSHE or mOHE pointers, and will
|
||||
// have that pointer updated to point to the cloned history entry.
|
||||
// If aCloneChildren is true then the children of the entry with id
|
||||
|
@ -430,7 +418,7 @@ protected:
|
|||
void SwapHistoryEntries(nsISHEntry* aOldEntry, nsISHEntry* aNewEntry);
|
||||
|
||||
// Call this method to swap in a new history entry to m[OL]SHE, rather than
|
||||
// setting it directly. This completes the navigation in all docshells
|
||||
// setting it directly. This completes the navigation in all docshells
|
||||
// in the case of a subframe navigation.
|
||||
void SetHistoryEntry(nsCOMPtr<nsISHEntry>* aPtr, nsISHEntry* aEntry);
|
||||
|
||||
|
@ -448,7 +436,7 @@ protected:
|
|||
void* aData);
|
||||
|
||||
// For each child of aRootEntry, find the corresponding docshell which is
|
||||
// a child of aRootShell, and call aCallback. The opaque pointer aData
|
||||
// a child of aRootShell, and call aCallback. The opaque pointer aData
|
||||
// is passed to the callback.
|
||||
static nsresult WalkHistoryEntries(nsISHEntry* aRootEntry,
|
||||
nsDocShell* aRootShell,
|
||||
|
@ -477,7 +465,7 @@ protected:
|
|||
* channel.
|
||||
*
|
||||
* This method first checks the channel's property bag to see if previous
|
||||
* info has been saved. If not, it gives back the referrer of the channel.
|
||||
* info has been saved. If not, it gives back the referrer of the channel.
|
||||
*
|
||||
* @param aChannel
|
||||
* The channel we are transitioning to
|
||||
|
@ -506,7 +494,7 @@ protected:
|
|||
uint32_t aChannelRedirectFlags);
|
||||
|
||||
/**
|
||||
* Helper function for adding a URI visit using IHistory. If IHistory is
|
||||
* Helper function for adding a URI visit using IHistory. If IHistory is
|
||||
* not available, the method tries nsIGlobalHistory2.
|
||||
*
|
||||
* The IHistory API maintains chains of visits, tracking both HTTP referrers
|
||||
|
@ -514,7 +502,7 @@ protected:
|
|||
* the previous URI in the chain.
|
||||
*
|
||||
* Visits can be saved either during a redirect or when the request has
|
||||
* reached its final destination. The previous URI in the visit may be
|
||||
* reached its final destination. The previous URI in the visit may be
|
||||
* from another redirect or it may be the referrer.
|
||||
*
|
||||
* @pre aURI is not null.
|
||||
|
@ -583,13 +571,13 @@ protected:
|
|||
nsresult aResult);
|
||||
|
||||
// Sets the current document's current state object to the given SHEntry's
|
||||
// state object. The current state object is eventually given to the page
|
||||
// state object. The current state object is eventually given to the page
|
||||
// in the PopState event.
|
||||
nsresult SetDocCurrentStateObj(nsISHEntry* aShEntry);
|
||||
|
||||
nsresult CheckLoadingPermissions();
|
||||
|
||||
// Security checks to prevent frameset spoofing. See comments at
|
||||
// Security checks to prevent frameset spoofing. See comments at
|
||||
// implementation sites.
|
||||
static bool CanAccessItem(nsIDocShellTreeItem* aTargetItem,
|
||||
nsIDocShellTreeItem* aAccessingItem,
|
||||
|
@ -610,33 +598,33 @@ protected:
|
|||
// in session history.
|
||||
|
||||
// mContentViewer points to the current content viewer associated with
|
||||
// this docshell. When loading a new document, the content viewer is
|
||||
// either destroyed or stored into a session history entry. To make sure
|
||||
// this docshell. When loading a new document, the content viewer is
|
||||
// either destroyed or stored into a session history entry. To make sure
|
||||
// that destruction happens in a controlled fashion, a given content viewer
|
||||
// is always owned in exactly one of these ways:
|
||||
// 1) The content viewer is active and owned by a docshell's
|
||||
// mContentViewer.
|
||||
// 2) The content viewer is still being displayed while we begin loading
|
||||
// a new document. The content viewer is owned by the _new_
|
||||
// a new document. The content viewer is owned by the _new_
|
||||
// content viewer's mPreviousViewer, and has a pointer to the
|
||||
// nsISHEntry where it will eventually be stored. The content viewer
|
||||
// nsISHEntry where it will eventually be stored. The content viewer
|
||||
// has been close()d by the docshell, which detaches the document from
|
||||
// the window object.
|
||||
// 3) The content viewer is cached in session history. The nsISHEntry
|
||||
// has the only owning reference to the content viewer. The viewer
|
||||
// 3) The content viewer is cached in session history. The nsISHEntry
|
||||
// has the only owning reference to the content viewer. The viewer
|
||||
// has released its nsISHEntry pointer to prevent circular ownership.
|
||||
//
|
||||
// When restoring a content viewer from session history, open() is called
|
||||
// to reattach the document to the window object. The content viewer is
|
||||
// to reattach the document to the window object. The content viewer is
|
||||
// then placed into mContentViewer and removed from the history entry.
|
||||
// (mContentViewer is put into session history as described above, if
|
||||
// applicable).
|
||||
|
||||
// Determines whether we can safely cache the current mContentViewer in
|
||||
// session history. This checks a number of factors such as cache policy,
|
||||
// session history. This checks a number of factors such as cache policy,
|
||||
// pending requests, and unload handlers.
|
||||
// |aLoadType| should be the load type that will replace the current
|
||||
// presentation. |aNewRequest| should be the request for the document to
|
||||
// presentation. |aNewRequest| should be the request for the document to
|
||||
// be loaded in place of the current document, or null if such a request
|
||||
// has not been created yet. |aNewDocument| should be the document that will
|
||||
// replace the current document.
|
||||
|
@ -662,7 +650,7 @@ protected:
|
|||
int32_t* aHeight);
|
||||
|
||||
// Call this when a URI load is handed to us (via OnLinkClick or
|
||||
// InternalLoad). This makes sure that we're not inside unload, or that if
|
||||
// InternalLoad). This makes sure that we're not inside unload, or that if
|
||||
// we are it's still OK to load this URI.
|
||||
bool IsOKToLoadURI(nsIURI* aURI);
|
||||
|
||||
|
@ -680,7 +668,7 @@ protected:
|
|||
|
||||
bool ShouldBlockLoadingForBackButton();
|
||||
|
||||
// Convenience method for getting our parent docshell. Can return null
|
||||
// Convenience method for getting our parent docshell. Can return null
|
||||
already_AddRefed<nsDocShell> GetParentDocshell();
|
||||
|
||||
// Check if we have an app redirect registered for the URI and redirect if
|
||||
|
@ -788,7 +776,7 @@ protected:
|
|||
nsCOMPtr<nsISHEntry> mLSHE;
|
||||
|
||||
// Holds a weak pointer to a RestorePresentationEvent object if any that
|
||||
// holds a weak pointer back to us. We use this pointer to possibly revoke
|
||||
// holds a weak pointer back to us. We use this pointer to possibly revoke
|
||||
// the event whenever necessary.
|
||||
nsRevocableEventPtr<RestorePresentationEvent> mRestorePresentationEvent;
|
||||
|
||||
|
@ -801,9 +789,9 @@ protected:
|
|||
// Secure browser UI object
|
||||
nsCOMPtr<nsISecureBrowserUI> mSecurityUI;
|
||||
|
||||
// The URI we're currently loading. This is only relevant during the
|
||||
// firing of a pagehide/unload. The caller of FirePageHideNotification()
|
||||
// is responsible for setting it and unsetting it. It may be null if the
|
||||
// The URI we're currently loading. This is only relevant during the
|
||||
// firing of a pagehide/unload. The caller of FirePageHideNotification()
|
||||
// is responsible for setting it and unsetting it. It may be null if the
|
||||
// pagehide/unload is happening for some reason other than just loading a
|
||||
// new URI.
|
||||
nsCOMPtr<nsIURI> mLoadingURI;
|
||||
|
@ -824,11 +812,11 @@ protected:
|
|||
nsCOMPtr<nsIChannel> mMixedContentChannel;
|
||||
|
||||
// WEAK REFERENCES BELOW HERE.
|
||||
// Note these are intentionally not addrefd. Doing so will create a cycle.
|
||||
// Note these are intentionally not addrefd. Doing so will create a cycle.
|
||||
// For that reasons don't use nsCOMPtr.
|
||||
|
||||
nsIDocShellTreeOwner* mTreeOwner; // Weak Reference
|
||||
mozilla::dom::EventTarget* mChromeEventHandler; //Weak Reference
|
||||
mozilla::dom::EventTarget* mChromeEventHandler; // Weak Reference
|
||||
|
||||
eCharsetReloadState mCharsetReloadState;
|
||||
|
||||
|
@ -842,7 +830,7 @@ protected:
|
|||
int32_t mMarginWidth;
|
||||
int32_t mMarginHeight;
|
||||
|
||||
// This can either be a content docshell or a chrome docshell. After
|
||||
// This can either be a content docshell or a chrome docshell. After
|
||||
// Create() is called, the type is not expected to change.
|
||||
int32_t mItemType;
|
||||
|
||||
|
@ -910,7 +898,7 @@ protected:
|
|||
void RecomputeCanExecuteScripts();
|
||||
|
||||
// This boolean is set to true right before we fire pagehide and generally
|
||||
// unset when we embed a new content viewer. While it's true no navigation
|
||||
// unset when we embed a new content viewer. While it's true no navigation
|
||||
// is allowed in this docshell.
|
||||
bool mFiredUnloadEvent;
|
||||
|
||||
|
@ -957,7 +945,7 @@ protected:
|
|||
FrameType mFrameType;
|
||||
|
||||
// We only expect mOwnOrContainingAppId to be something other than
|
||||
// UNKNOWN_APP_ID if mFrameType != eFrameTypeRegular. For vanilla iframes
|
||||
// UNKNOWN_APP_ID if mFrameType != eFrameTypeRegular. For vanilla iframes
|
||||
// inside an app, we'll retrieve the containing app-id by walking up the
|
||||
// docshell hierarchy.
|
||||
//
|
||||
|
|
|
@ -58,7 +58,6 @@ protected:
|
|||
// Backup for the corresponding nsIHTMLDocument's editing state while
|
||||
// the editor is detached.
|
||||
nsIHTMLDocument::EditingState mDetachedEditingState;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsDocShellEditorData_h__
|
||||
|
|
|
@ -89,7 +89,6 @@ public:
|
|||
protected:
|
||||
virtual nsresult BuildArrayRecursive(nsIDocShellTreeItem* aItem,
|
||||
nsTArray<nsWeakPtr>& aItemArray);
|
||||
|
||||
};
|
||||
|
||||
class nsDocShellBackwardsEnumerator : public nsDocShellEnumerator
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* 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/. */
|
||||
|
||||
// Local Includes
|
||||
#include "nsDocShellLoadInfo.h"
|
||||
#include "nsISHEntry.h"
|
||||
#include "nsIInputStream.h"
|
||||
|
@ -12,10 +11,6 @@
|
|||
#include "nsIDocShell.h"
|
||||
#include "mozilla/net/ReferrerPolicy.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsDocShellLoadInfo: Object Management
|
||||
//*****************************************************************************
|
||||
|
||||
nsDocShellLoadInfo::nsDocShellLoadInfo()
|
||||
: mInheritOwner(false)
|
||||
, mOwnerIsExplicit(false)
|
||||
|
@ -30,10 +25,6 @@ nsDocShellLoadInfo::~nsDocShellLoadInfo()
|
|||
{
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShellLoadInfo::nsISupports
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMPL_ADDREF(nsDocShellLoadInfo)
|
||||
NS_IMPL_RELEASE(nsDocShellLoadInfo)
|
||||
|
||||
|
@ -42,10 +33,6 @@ NS_INTERFACE_MAP_BEGIN(nsDocShellLoadInfo)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIDocShellLoadInfo)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShellLoadInfo::nsIDocShellLoadInfo
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShellLoadInfo::GetReferrer(nsIURI** aReferrer)
|
||||
{
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
* above 0xffff (e.g. LOAD_FLAGS_BYPASS_CLASSIFIER), since MAKE_LOAD_TYPE would
|
||||
* just shift them out anyway.
|
||||
*/
|
||||
#define EXTRA_LOAD_FLAGS (LOAD_FLAGS_FIRST_LOAD | \
|
||||
LOAD_FLAGS_ALLOW_POPUPS | \
|
||||
#define EXTRA_LOAD_FLAGS (LOAD_FLAGS_FIRST_LOAD | \
|
||||
LOAD_FLAGS_ALLOW_POPUPS | \
|
||||
0xffff0000)
|
||||
|
||||
/* load types are legal combinations of load commands and flags
|
||||
|
@ -65,7 +65,8 @@ enum LoadType
|
|||
* Docshell. Instead, Docshell triggers the load itself when a
|
||||
* consumer-triggered load failed.
|
||||
*/
|
||||
LOAD_ERROR_PAGE = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, LOAD_FLAGS_ERROR_PAGE)
|
||||
LOAD_ERROR_PAGE = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL,
|
||||
LOAD_FLAGS_ERROR_PAGE)
|
||||
|
||||
// NOTE: Adding a new value? Remember to update IsValidLoadType!
|
||||
};
|
||||
|
|
|
@ -17,10 +17,6 @@ nsTransferableHookData::~nsTransferableHookData()
|
|||
{
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsIClipboardDragDropHookList
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsTransferableHookData, nsIClipboardDragDropHookList)
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -12,14 +12,8 @@
|
|||
#include "nsIURI.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// nsDownloadHistory
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsDownloadHistory, nsIDownloadHistory)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// nsIDownloadHistory
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDownloadHistory::AddDownload(nsIURI* aSource,
|
||||
nsIURI* aReferrer,
|
||||
|
@ -42,8 +36,7 @@ nsDownloadHistory::AddDownload(nsIURI* aSource,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!visited) {
|
||||
nsCOMPtr<nsIObserverService> os =
|
||||
mozilla::services::GetObserverService();
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
if (os) {
|
||||
os->NotifyObservers(aSource, NS_LINK_VISITED_EVENT_TOPIC, nullptr);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ class nsIDocShell;
|
|||
class nsIInputStream;
|
||||
class nsIRequest;
|
||||
|
||||
// Interface ID for nsILinkHandler
|
||||
#define NS_ILINKHANDLER_IID \
|
||||
{ 0xceb9aade, 0x43da, 0x4f1a, \
|
||||
{ 0xac, 0x8a, 0xc7, 0x09, 0xfb, 0x22, 0x46, 0x64 } }
|
||||
|
|
|
@ -9,20 +9,16 @@
|
|||
#include "nsISupports.h"
|
||||
#include "nsCharsetSource.h"
|
||||
|
||||
// Interface ID for nsIWebShellServices
|
||||
|
||||
/* 0c628af0-5638-4703-8f99-ed6134c9de18 */
|
||||
#define NS_IWEB_SHELL_SERVICES_IID \
|
||||
{ 0x0c628af0, 0x5638, 0x4703, {0x8f, 0x99, 0xed, 0x61, 0x34, 0xc9, 0xde, 0x18} }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class nsIWebShellServices : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IWEB_SHELL_SERVICES_IID)
|
||||
|
||||
NS_IMETHOD ReloadDocument(const char* aCharset = nullptr ,
|
||||
NS_IMETHOD ReloadDocument(const char* aCharset = nullptr,
|
||||
int32_t aSource = kCharsetUninitialized) = 0;
|
||||
NS_IMETHOD StopDocumentLoad(void) = 0;
|
||||
};
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
class nsCString;
|
||||
|
||||
// Class ID for webnavigationinfo
|
||||
#define NS_WEBNAVIGATION_INFO_CID \
|
||||
{ 0xf30bc0a2, 0x958b, 0x4287,{0xbf, 0x62, 0xce, 0x38, 0xba, 0x0c, 0x81, 0x1e}}
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
#ifndef nsDocShellCID_h__
|
||||
#define nsDocShellCID_h__
|
||||
|
||||
#define NS_GLOBALHISTORY2_CONTRACTID \
|
||||
"@mozilla.org/browser/global-history;2"
|
||||
#define NS_GLOBALHISTORY2_CONTRACTID "@mozilla.org/browser/global-history;2"
|
||||
|
||||
/**
|
||||
* A contract for a service that will track download history. This can be
|
||||
|
@ -17,16 +16,14 @@
|
|||
*
|
||||
* @implements nsIDownloadHistory
|
||||
*/
|
||||
#define NS_DOWNLOADHISTORY_CONTRACTID \
|
||||
"@mozilla.org/browser/download-history;1"
|
||||
#define NS_DOWNLOADHISTORY_CONTRACTID "@mozilla.org/browser/download-history;1"
|
||||
|
||||
/**
|
||||
* A contract that can be used to get a service that provides
|
||||
* meta-information about nsIWebNavigation objects' capabilities.
|
||||
* @implements nsIWebNavigationInfo
|
||||
*/
|
||||
#define NS_WEBNAVIGATION_INFO_CONTRACTID \
|
||||
"@mozilla.org/webnavigation-info;1"
|
||||
#define NS_WEBNAVIGATION_INFO_CONTRACTID "@mozilla.org/webnavigation-info;1"
|
||||
|
||||
/**
|
||||
* Class and contract ID for the docshell. This is the container for a web
|
||||
|
@ -34,9 +31,9 @@
|
|||
* exact ones keep changing; if they stabilize somewhat that will get
|
||||
* documented.
|
||||
*/
|
||||
#define NS_DOCSHELL_CID \
|
||||
{ 0xf1eac762, 0x87e9, 0x11d3, \
|
||||
{ 0xaf, 0x80, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c } }
|
||||
#define NS_DOCSHELL_CID \
|
||||
{ 0xf1eac762, 0x87e9, 0x11d3, \
|
||||
{ 0xaf, 0x80, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c } }
|
||||
#define NS_DOCSHELL_CONTRACTID "@mozilla.org/docshell/html;1"
|
||||
|
||||
/**
|
||||
|
@ -51,7 +48,8 @@
|
|||
*
|
||||
* @implements nsIExternalURLHandlerService
|
||||
*/
|
||||
#define NS_EXTERNALURLHANDLERSERVICE_CONTRACTID "@mozilla.org/uriloader/external-url-handler-service;1"
|
||||
#define NS_EXTERNALURLHANDLERSERVICE_CONTRACTID \
|
||||
"@mozilla.org/uriloader/external-url-handler-service;1"
|
||||
|
||||
/**
|
||||
* An observer service topic that can be listened to to catch creation
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "nsLocalHandlerApp.h"
|
||||
#ifdef MOZ_ENABLE_DBUS
|
||||
#include "nsDBusHandlerApp.h"
|
||||
#endif
|
||||
#endif
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
#include "nsExternalSharingAppService.h"
|
||||
#include "nsExternalURLHandlerService.h"
|
||||
|
@ -81,7 +81,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsOfflineCacheUpdate)
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(PlatformLocalHandlerApp_t)
|
||||
#ifdef MOZ_ENABLE_DBUS
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDBusHandlerApp)
|
||||
#endif
|
||||
#endif
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalSharingAppService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalURLHandlerService)
|
||||
|
@ -120,7 +120,6 @@ NS_DEFINE_NAMED_CID(NS_SHISTORY_CID);
|
|||
NS_DEFINE_NAMED_CID(NS_SHISTORY_INTERNAL_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_DOWNLOADHISTORY_CID);
|
||||
|
||||
|
||||
const mozilla::Module::CIDEntry kDocShellCIDs[] = {
|
||||
{ &kNS_DOCSHELL_CID, false, nullptr, nsDocShellConstructor },
|
||||
{ &kNS_DEFAULTURIFIXUP_CID, false, nullptr, nsDefaultURIFixupConstructor },
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* 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/. */
|
||||
|
||||
// Local Includes
|
||||
#include "nsSHEntry.h"
|
||||
#include "nsIDocShellLoadInfo.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
|
@ -22,13 +21,9 @@ namespace dom = mozilla::dom;
|
|||
|
||||
static uint32_t gEntryID = 0;
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsSHEntry: Object Management
|
||||
//*****************************************************************************
|
||||
|
||||
|
||||
nsSHEntry::nsSHEntry()
|
||||
: mReferrerPolicy(mozilla::net::RP_Default)
|
||||
: mShared(new nsSHEntryShared())
|
||||
, mReferrerPolicy(mozilla::net::RP_Default)
|
||||
, mLoadType(0)
|
||||
, mID(gEntryID++)
|
||||
, mScrollPositionX(0)
|
||||
|
@ -37,26 +32,25 @@ nsSHEntry::nsSHEntry()
|
|||
, mURIWasModified(false)
|
||||
, mIsSrcdocEntry(false)
|
||||
{
|
||||
mShared = new nsSHEntryShared();
|
||||
}
|
||||
|
||||
nsSHEntry::nsSHEntry(const nsSHEntry &other)
|
||||
: mShared(other.mShared)
|
||||
, mURI(other.mURI)
|
||||
, mReferrerURI(other.mReferrerURI)
|
||||
, mReferrerPolicy(other.mReferrerPolicy)
|
||||
, mTitle(other.mTitle)
|
||||
, mPostData(other.mPostData)
|
||||
nsSHEntry::nsSHEntry(const nsSHEntry& aOther)
|
||||
: mShared(aOther.mShared)
|
||||
, mURI(aOther.mURI)
|
||||
, mReferrerURI(aOther.mReferrerURI)
|
||||
, mReferrerPolicy(aOther.mReferrerPolicy)
|
||||
, mTitle(aOther.mTitle)
|
||||
, mPostData(aOther.mPostData)
|
||||
, mLoadType(0) // XXX why not copy?
|
||||
, mID(other.mID)
|
||||
, mID(aOther.mID)
|
||||
, mScrollPositionX(0) // XXX why not copy?
|
||||
, mScrollPositionY(0) // XXX why not copy?
|
||||
, mParent(other.mParent)
|
||||
, mURIWasModified(other.mURIWasModified)
|
||||
, mStateData(other.mStateData)
|
||||
, mIsSrcdocEntry(other.mIsSrcdocEntry)
|
||||
, mSrcdocData(other.mSrcdocData)
|
||||
, mBaseURI(other.mBaseURI)
|
||||
, mParent(aOther.mParent)
|
||||
, mURIWasModified(aOther.mURIWasModified)
|
||||
, mStateData(aOther.mStateData)
|
||||
, mIsSrcdocEntry(aOther.mIsSrcdocEntry)
|
||||
, mSrcdocData(aOther.mSrcdocData)
|
||||
, mBaseURI(aOther.mBaseURI)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -75,88 +69,90 @@ nsSHEntry::~nsSHEntry()
|
|||
mChildren.EnumerateForwards(ClearParentPtr, nullptr);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsSHEntry: nsISupports
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsSHEntry, nsISHContainer, nsISHEntry, nsISHEntryInternal)
|
||||
|
||||
//*****************************************************************************
|
||||
// nsSHEntry: nsISHEntry
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::SetScrollPosition(int32_t x, int32_t y)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetScrollPosition(int32_t aX, int32_t aY)
|
||||
{
|
||||
mScrollPositionX = x;
|
||||
mScrollPositionY = y;
|
||||
mScrollPositionX = aX;
|
||||
mScrollPositionY = aY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::GetScrollPosition(int32_t *x, int32_t *y)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetScrollPosition(int32_t* aX, int32_t* aY)
|
||||
{
|
||||
*x = mScrollPositionX;
|
||||
*y = mScrollPositionY;
|
||||
*aX = mScrollPositionX;
|
||||
*aY = mScrollPositionY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::GetURIWasModified(bool* aOut)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetURIWasModified(bool* aOut)
|
||||
{
|
||||
*aOut = mURIWasModified;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::SetURIWasModified(bool aIn)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetURIWasModified(bool aIn)
|
||||
{
|
||||
mURIWasModified = aIn;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::GetURI(nsIURI** aURI)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetURI(nsIURI** aURI)
|
||||
{
|
||||
*aURI = mURI;
|
||||
NS_IF_ADDREF(*aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::SetURI(nsIURI* aURI)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetURI(nsIURI* aURI)
|
||||
{
|
||||
mURI = aURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::GetReferrerURI(nsIURI **aReferrerURI)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetReferrerURI(nsIURI** aReferrerURI)
|
||||
{
|
||||
*aReferrerURI = mReferrerURI;
|
||||
NS_IF_ADDREF(*aReferrerURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::SetReferrerURI(nsIURI *aReferrerURI)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetReferrerURI(nsIURI* aReferrerURI)
|
||||
{
|
||||
mReferrerURI = aReferrerURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::GetReferrerPolicy(uint32_t *aReferrerPolicy)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetReferrerPolicy(uint32_t* aReferrerPolicy)
|
||||
{
|
||||
*aReferrerPolicy = mReferrerPolicy;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::SetReferrerPolicy(uint32_t aReferrerPolicy)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetReferrerPolicy(uint32_t aReferrerPolicy)
|
||||
{
|
||||
mReferrerPolicy = aReferrerPolicy;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetContentViewer(nsIContentViewer *aViewer)
|
||||
nsSHEntry::SetContentViewer(nsIContentViewer* aViewer)
|
||||
{
|
||||
return mShared->SetContentViewer(aViewer);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetContentViewer(nsIContentViewer **aResult)
|
||||
nsSHEntry::GetContentViewer(nsIContentViewer** aResult)
|
||||
{
|
||||
*aResult = mShared->mContentViewer;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
@ -164,15 +160,15 @@ nsSHEntry::GetContentViewer(nsIContentViewer **aResult)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetAnyContentViewer(nsISHEntry **aOwnerEntry,
|
||||
nsIContentViewer **aResult)
|
||||
nsSHEntry::GetAnyContentViewer(nsISHEntry** aOwnerEntry,
|
||||
nsIContentViewer** aResult)
|
||||
{
|
||||
// Find a content viewer in the root node or any of its children,
|
||||
// assuming that there is only one content viewer total in any one
|
||||
// nsSHEntry tree
|
||||
GetContentViewer(aResult);
|
||||
if (*aResult) {
|
||||
#ifdef DEBUG_PAGE_CACHE
|
||||
#ifdef DEBUG_PAGE_CACHE
|
||||
printf("Found content viewer\n");
|
||||
#endif
|
||||
*aOwnerEntry = this;
|
||||
|
@ -203,124 +199,142 @@ nsSHEntry::SetSticky(bool aSticky)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetSticky(bool *aSticky)
|
||||
nsSHEntry::GetSticky(bool* aSticky)
|
||||
{
|
||||
*aSticky = mShared->mSticky;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::GetTitle(char16_t** aTitle)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetTitle(char16_t** aTitle)
|
||||
{
|
||||
// Check for empty title...
|
||||
if (mTitle.IsEmpty() && mURI) {
|
||||
// Default title is the URL.
|
||||
nsAutoCString spec;
|
||||
if (NS_SUCCEEDED(mURI->GetSpec(spec)))
|
||||
if (NS_SUCCEEDED(mURI->GetSpec(spec))) {
|
||||
AppendUTF8toUTF16(spec, mTitle);
|
||||
}
|
||||
}
|
||||
|
||||
*aTitle = ToNewUnicode(mTitle);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::SetTitle(const nsAString &aTitle)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetTitle(const nsAString& aTitle)
|
||||
{
|
||||
mTitle = aTitle;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::GetPostData(nsIInputStream** aResult)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetPostData(nsIInputStream** aResult)
|
||||
{
|
||||
*aResult = mPostData;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::SetPostData(nsIInputStream* aPostData)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetPostData(nsIInputStream* aPostData)
|
||||
{
|
||||
mPostData = aPostData;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::GetLayoutHistoryState(nsILayoutHistoryState** aResult)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetLayoutHistoryState(nsILayoutHistoryState** aResult)
|
||||
{
|
||||
*aResult = mShared->mLayoutHistoryState;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::SetLayoutHistoryState(nsILayoutHistoryState* aState)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetLayoutHistoryState(nsILayoutHistoryState* aState)
|
||||
{
|
||||
mShared->mLayoutHistoryState = aState;
|
||||
if (mShared->mLayoutHistoryState) {
|
||||
mShared->mLayoutHistoryState->
|
||||
SetScrollPositionOnly(!mShared->mSaveLayoutState);
|
||||
mShared->mLayoutHistoryState->SetScrollPositionOnly(
|
||||
!mShared->mSaveLayoutState);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::GetLoadType(uint32_t * aResult)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetLoadType(uint32_t* aResult)
|
||||
{
|
||||
*aResult = mLoadType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::SetLoadType(uint32_t aLoadType)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetLoadType(uint32_t aLoadType)
|
||||
{
|
||||
mLoadType = aLoadType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::GetID(uint32_t * aResult)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetID(uint32_t* aResult)
|
||||
{
|
||||
*aResult = mID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::SetID(uint32_t aID)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetID(uint32_t aID)
|
||||
{
|
||||
mID = aID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsSHEntryShared* nsSHEntry::GetSharedState()
|
||||
nsSHEntryShared*
|
||||
nsSHEntry::GetSharedState()
|
||||
{
|
||||
return mShared;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::GetIsSubFrame(bool * aFlag)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetIsSubFrame(bool* aFlag)
|
||||
{
|
||||
*aFlag = mShared->mIsFrameNavigation;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::SetIsSubFrame(bool aFlag)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetIsSubFrame(bool aFlag)
|
||||
{
|
||||
mShared->mIsFrameNavigation = aFlag;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::GetCacheKey(nsISupports** aResult)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetCacheKey(nsISupports** aResult)
|
||||
{
|
||||
*aResult = mShared->mCacheKey;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::SetCacheKey(nsISupports* aCacheKey)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetCacheKey(nsISupports* aCacheKey)
|
||||
{
|
||||
mShared->mCacheKey = aCacheKey;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::GetSaveLayoutStateFlag(bool * aFlag)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetSaveLayoutStateFlag(bool* aFlag)
|
||||
{
|
||||
*aFlag = mShared->mSaveLayoutState;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::SetSaveLayoutStateFlag(bool aFlag)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetSaveLayoutStateFlag(bool aFlag)
|
||||
{
|
||||
mShared->mSaveLayoutState = aFlag;
|
||||
if (mShared->mLayoutHistoryState) {
|
||||
|
@ -330,44 +344,48 @@ NS_IMETHODIMP nsSHEntry::SetSaveLayoutStateFlag(bool aFlag)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::GetExpirationStatus(bool * aFlag)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetExpirationStatus(bool* aFlag)
|
||||
{
|
||||
*aFlag = mShared->mExpired;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::SetExpirationStatus(bool aFlag)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetExpirationStatus(bool aFlag)
|
||||
{
|
||||
mShared->mExpired = aFlag;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::GetContentType(nsACString& aContentType)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetContentType(nsACString& aContentType)
|
||||
{
|
||||
aContentType = mShared->mContentType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSHEntry::SetContentType(const nsACString& aContentType)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetContentType(const nsACString& aContentType)
|
||||
{
|
||||
mShared->mContentType = aContentType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::Create(nsIURI * aURI, const nsAString &aTitle,
|
||||
nsIInputStream * aInputStream,
|
||||
nsILayoutHistoryState * aLayoutHistoryState,
|
||||
nsISupports * aCacheKey, const nsACString& aContentType,
|
||||
nsISupports* aOwner,
|
||||
uint64_t aDocShellID, bool aDynamicCreation)
|
||||
nsSHEntry::Create(nsIURI* aURI, const nsAString& aTitle,
|
||||
nsIInputStream* aInputStream,
|
||||
nsILayoutHistoryState* aLayoutHistoryState,
|
||||
nsISupports* aCacheKey, const nsACString& aContentType,
|
||||
nsISupports* aOwner, uint64_t aDocShellID,
|
||||
bool aDynamicCreation)
|
||||
{
|
||||
mURI = aURI;
|
||||
mTitle = aTitle;
|
||||
mPostData = aInputStream;
|
||||
|
||||
// Set the LoadType by default to loadHistory during creation
|
||||
mLoadType = (uint32_t) nsIDocShellLoadInfo::loadHistory;
|
||||
mLoadType = (uint32_t)nsIDocShellLoadInfo::loadHistory;
|
||||
|
||||
mShared->mCacheKey = aCacheKey;
|
||||
mShared->mContentType = aContentType;
|
||||
|
@ -375,7 +393,7 @@ nsSHEntry::Create(nsIURI * aURI, const nsAString &aTitle,
|
|||
mShared->mDocShellID = aDocShellID;
|
||||
mShared->mDynamicallyCreated = aDynamicCreation;
|
||||
|
||||
// By default all entries are set false for subframe flag.
|
||||
// By default all entries are set false for subframe flag.
|
||||
// nsDocShell::CloneAndReplace() which creates entries for
|
||||
// all subframe navigations, sets the flag to true.
|
||||
mShared->mIsFrameNavigation = false;
|
||||
|
@ -384,7 +402,7 @@ nsSHEntry::Create(nsIURI * aURI, const nsAString &aTitle,
|
|||
mShared->mSaveLayoutState = true;
|
||||
mShared->mLayoutHistoryState = aLayoutHistoryState;
|
||||
|
||||
//By default the page is not expired
|
||||
// By default the page is not expired
|
||||
mShared->mExpired = false;
|
||||
|
||||
mIsSrcdocEntry = false;
|
||||
|
@ -394,7 +412,7 @@ nsSHEntry::Create(nsIURI * aURI, const nsAString &aTitle,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::Clone(nsISHEntry ** aResult)
|
||||
nsSHEntry::Clone(nsISHEntry** aResult)
|
||||
{
|
||||
*aResult = new nsSHEntry(*this);
|
||||
NS_ADDREF(*aResult);
|
||||
|
@ -402,7 +420,7 @@ nsSHEntry::Clone(nsISHEntry ** aResult)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetParent(nsISHEntry ** aResult)
|
||||
nsSHEntry::GetParent(nsISHEntry** aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = mParent;
|
||||
|
@ -411,7 +429,7 @@ nsSHEntry::GetParent(nsISHEntry ** aResult)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetParent(nsISHEntry * aParent)
|
||||
nsSHEntry::SetParent(nsISHEntry* aParent)
|
||||
{
|
||||
/* parent not Addrefed on purpose to avoid cyclic reference
|
||||
* Null parent is OK
|
||||
|
@ -423,49 +441,49 @@ nsSHEntry::SetParent(nsISHEntry * aParent)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetWindowState(nsISupports *aState)
|
||||
nsSHEntry::SetWindowState(nsISupports* aState)
|
||||
{
|
||||
mShared->mWindowState = aState;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetWindowState(nsISupports **aState)
|
||||
nsSHEntry::GetWindowState(nsISupports** aState)
|
||||
{
|
||||
NS_IF_ADDREF(*aState = mShared->mWindowState);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetViewerBounds(const nsIntRect &aBounds)
|
||||
nsSHEntry::SetViewerBounds(const nsIntRect& aBounds)
|
||||
{
|
||||
mShared->mViewerBounds = aBounds;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetViewerBounds(nsIntRect &aBounds)
|
||||
nsSHEntry::GetViewerBounds(nsIntRect& aBounds)
|
||||
{
|
||||
aBounds = mShared->mViewerBounds;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetOwner(nsISupports **aOwner)
|
||||
nsSHEntry::GetOwner(nsISupports** aOwner)
|
||||
{
|
||||
NS_IF_ADDREF(*aOwner = mShared->mOwner);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetOwner(nsISupports *aOwner)
|
||||
nsSHEntry::SetOwner(nsISupports* aOwner)
|
||||
{
|
||||
mShared->mOwner = aOwner;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetBFCacheEntry(nsIBFCacheEntry **aEntry)
|
||||
nsSHEntry::GetBFCacheEntry(nsIBFCacheEntry** aEntry)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEntry);
|
||||
NS_IF_ADDREF(*aEntry = mShared);
|
||||
|
@ -473,18 +491,18 @@ nsSHEntry::GetBFCacheEntry(nsIBFCacheEntry **aEntry)
|
|||
}
|
||||
|
||||
bool
|
||||
nsSHEntry::HasBFCacheEntry(nsIBFCacheEntry *aEntry)
|
||||
nsSHEntry::HasBFCacheEntry(nsIBFCacheEntry* aEntry)
|
||||
{
|
||||
return static_cast<nsIBFCacheEntry*>(mShared) == aEntry;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::AdoptBFCacheEntry(nsISHEntry *aEntry)
|
||||
nsSHEntry::AdoptBFCacheEntry(nsISHEntry* aEntry)
|
||||
{
|
||||
nsCOMPtr<nsISHEntryInternal> shEntry = do_QueryInterface(aEntry);
|
||||
NS_ENSURE_STATE(shEntry);
|
||||
|
||||
nsSHEntryShared *shared = shEntry->GetSharedState();
|
||||
nsSHEntryShared* shared = shEntry->GetSharedState();
|
||||
NS_ENSURE_STATE(shared);
|
||||
|
||||
mShared = shared;
|
||||
|
@ -492,11 +510,11 @@ nsSHEntry::AdoptBFCacheEntry(nsISHEntry *aEntry)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SharesDocumentWith(nsISHEntry *aEntry, bool *aOut)
|
||||
nsSHEntry::SharesDocumentWith(nsISHEntry* aEntry, bool* aOut)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOut);
|
||||
|
||||
nsCOMPtr<nsISHEntryInternal> internal = do_QueryInterface(aEntry);
|
||||
nsCOMPtr<nsISHEntryInternal> internal = do_QueryInterface(aEntry);
|
||||
NS_ENSURE_STATE(internal);
|
||||
|
||||
*aOut = mShared == internal->GetSharedState();
|
||||
|
@ -518,14 +536,14 @@ nsSHEntry::GetIsSrcdocEntry(bool* aIsSrcdocEntry)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetSrcdocData(nsAString &aSrcdocData)
|
||||
nsSHEntry::GetSrcdocData(nsAString& aSrcdocData)
|
||||
{
|
||||
aSrcdocData = mSrcdocData;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetSrcdocData(const nsAString &aSrcdocData)
|
||||
nsSHEntry::SetSrcdocData(const nsAString& aSrcdocData)
|
||||
{
|
||||
mSrcdocData = aSrcdocData;
|
||||
mIsSrcdocEntry = true;
|
||||
|
@ -533,7 +551,7 @@ nsSHEntry::SetSrcdocData(const nsAString &aSrcdocData)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetBaseURI(nsIURI **aBaseURI)
|
||||
nsSHEntry::GetBaseURI(nsIURI** aBaseURI)
|
||||
{
|
||||
*aBaseURI = mBaseURI;
|
||||
NS_IF_ADDREF(*aBaseURI);
|
||||
|
@ -541,25 +559,21 @@ nsSHEntry::GetBaseURI(nsIURI **aBaseURI)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetBaseURI(nsIURI *aBaseURI)
|
||||
nsSHEntry::SetBaseURI(nsIURI* aBaseURI)
|
||||
{
|
||||
mBaseURI = aBaseURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsSHEntry: nsISHContainer
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetChildCount(int32_t * aCount)
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetChildCount(int32_t* aCount)
|
||||
{
|
||||
*aCount = mChildren.Count();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::AddChild(nsISHEntry * aChild, int32_t aOffset)
|
||||
nsSHEntry::AddChild(nsISHEntry* aChild, int32_t aOffset)
|
||||
{
|
||||
if (aChild) {
|
||||
NS_ENSURE_SUCCESS(aChild->SetParent(this), NS_ERROR_FAILURE);
|
||||
|
@ -579,7 +593,7 @@ nsSHEntry::AddChild(nsISHEntry * aChild, int32_t aOffset)
|
|||
//
|
||||
// Assert that aOffset will not be so high as to grow us a lot.
|
||||
//
|
||||
NS_ASSERTION(aOffset < (mChildren.Count()+1023), "Large frames array!\n");
|
||||
NS_ASSERTION(aOffset < (mChildren.Count() + 1023), "Large frames array!\n");
|
||||
|
||||
bool newChildIsDyn = false;
|
||||
if (aChild) {
|
||||
|
@ -634,7 +648,7 @@ nsSHEntry::AddChild(nsISHEntry * aChild, int32_t aOffset)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (dynEntry) {
|
||||
nsCOMArray<nsISHEntry> tmp;
|
||||
tmp.SetCount(aOffset - dynEntryIndex + 1);
|
||||
|
@ -642,7 +656,6 @@ nsSHEntry::AddChild(nsISHEntry * aChild, int32_t aOffset)
|
|||
NS_ASSERTION(mChildren[aOffset + 1] == dynEntry, "Whaat?");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Make sure there isn't anything at aOffset.
|
||||
if (aOffset < mChildren.Count()) {
|
||||
|
@ -664,7 +677,7 @@ nsSHEntry::AddChild(nsISHEntry * aChild, int32_t aOffset)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::RemoveChild(nsISHEntry * aChild)
|
||||
nsSHEntry::RemoveChild(nsISHEntry* aChild)
|
||||
{
|
||||
NS_ENSURE_TRUE(aChild, NS_ERROR_FAILURE);
|
||||
bool childRemoved = false;
|
||||
|
@ -692,7 +705,7 @@ nsSHEntry::RemoveChild(nsISHEntry * aChild)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetChildAt(int32_t aIndex, nsISHEntry ** aResult)
|
||||
nsSHEntry::GetChildAt(int32_t aIndex, nsISHEntry** aResult)
|
||||
{
|
||||
if (aIndex >= 0 && aIndex < mChildren.Count()) {
|
||||
*aResult = mChildren[aIndex];
|
||||
|
@ -727,7 +740,7 @@ nsSHEntry::ReplaceChild(nsISHEntry* aNewEntry)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::AddChildShell(nsIDocShellTreeItem *aShell)
|
||||
nsSHEntry::AddChildShell(nsIDocShellTreeItem* aShell)
|
||||
{
|
||||
NS_ASSERTION(aShell, "Null child shell added to history entry");
|
||||
mShared->mChildShells.AppendObject(aShell);
|
||||
|
@ -735,7 +748,7 @@ nsSHEntry::AddChildShell(nsIDocShellTreeItem *aShell)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::ChildShellAt(int32_t aIndex, nsIDocShellTreeItem **aShell)
|
||||
nsSHEntry::ChildShellAt(int32_t aIndex, nsIDocShellTreeItem** aShell)
|
||||
{
|
||||
NS_IF_ADDREF(*aShell = mShared->mChildShells.SafeObjectAt(aIndex));
|
||||
return NS_OK;
|
||||
|
@ -749,14 +762,14 @@ nsSHEntry::ClearChildShells()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetRefreshURIList(nsISupportsArray **aList)
|
||||
nsSHEntry::GetRefreshURIList(nsISupportsArray** aList)
|
||||
{
|
||||
NS_IF_ADDREF(*aList = mShared->mRefreshURIList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetRefreshURIList(nsISupportsArray *aList)
|
||||
nsSHEntry::SetRefreshURIList(nsISupportsArray* aList)
|
||||
{
|
||||
mShared->mRefreshURIList = aList;
|
||||
return NS_OK;
|
||||
|
@ -804,7 +817,7 @@ nsSHEntry::HasDetachedEditor()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetStateData(nsIStructuredCloneContainer **aContainer)
|
||||
nsSHEntry::GetStateData(nsIStructuredCloneContainer** aContainer)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContainer);
|
||||
NS_IF_ADDREF(*aContainer = mStateData);
|
||||
|
@ -812,7 +825,7 @@ nsSHEntry::GetStateData(nsIStructuredCloneContainer **aContainer)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetStateData(nsIStructuredCloneContainer *aContainer)
|
||||
nsSHEntry::SetStateData(nsIStructuredCloneContainer* aContainer)
|
||||
{
|
||||
mStateData = aContainer;
|
||||
return NS_OK;
|
||||
|
@ -855,9 +868,8 @@ nsSHEntry::SetDocshellID(uint64_t aID)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetLastTouched(uint32_t *aLastTouched)
|
||||
nsSHEntry::GetLastTouched(uint32_t* aLastTouched)
|
||||
{
|
||||
*aLastTouched = mShared->mLastTouched;
|
||||
return NS_OK;
|
||||
|
|
|
@ -26,9 +26,9 @@ class nsSHEntry final : public nsISHEntry,
|
|||
public nsISHContainer,
|
||||
public nsISHEntryInternal
|
||||
{
|
||||
public:
|
||||
public:
|
||||
nsSHEntry();
|
||||
nsSHEntry(const nsSHEntry &other);
|
||||
nsSHEntry(const nsSHEntry& aOther);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISHENTRY
|
||||
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
static nsresult Startup();
|
||||
static void Shutdown();
|
||||
|
||||
|
||||
private:
|
||||
~nsSHEntry();
|
||||
|
||||
|
@ -48,22 +48,22 @@ private:
|
|||
nsRefPtr<nsSHEntryShared> mShared;
|
||||
|
||||
// See nsSHEntry.idl for comments on these members.
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> mReferrerURI;
|
||||
uint32_t mReferrerPolicy;
|
||||
nsString mTitle;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> mReferrerURI;
|
||||
uint32_t mReferrerPolicy;
|
||||
nsString mTitle;
|
||||
nsCOMPtr<nsIInputStream> mPostData;
|
||||
uint32_t mLoadType;
|
||||
uint32_t mID;
|
||||
int32_t mScrollPositionX;
|
||||
int32_t mScrollPositionY;
|
||||
nsISHEntry* mParent;
|
||||
nsCOMArray<nsISHEntry> mChildren;
|
||||
bool mURIWasModified;
|
||||
uint32_t mLoadType;
|
||||
uint32_t mID;
|
||||
int32_t mScrollPositionX;
|
||||
int32_t mScrollPositionY;
|
||||
nsISHEntry* mParent;
|
||||
nsCOMArray<nsISHEntry> mChildren;
|
||||
bool mURIWasModified;
|
||||
nsCOMPtr<nsIStructuredCloneContainer> mStateData;
|
||||
bool mIsSrcdocEntry;
|
||||
nsString mSrcdocData;
|
||||
nsCOMPtr<nsIURI> mBaseURI;
|
||||
bool mIsSrcdocEntry;
|
||||
nsString mSrcdocData;
|
||||
nsCOMPtr<nsIURI> mBaseURI;
|
||||
};
|
||||
|
||||
#endif /* nsSHEntry_h */
|
||||
|
|
|
@ -29,10 +29,11 @@ uint64_t gSHEntrySharedID = 0;
|
|||
|
||||
#define CONTENT_VIEWER_TIMEOUT_SECONDS "browser.sessionhistory.contentViewerTimeout"
|
||||
// Default this to time out unused content viewers after 30 minutes
|
||||
#define CONTENT_VIEWER_TIMEOUT_SECONDS_DEFAULT (30*60)
|
||||
#define CONTENT_VIEWER_TIMEOUT_SECONDS_DEFAULT (30 * 60)
|
||||
|
||||
typedef nsExpirationTracker<nsSHEntryShared, 3> HistoryTrackerBase;
|
||||
class HistoryTracker final : public HistoryTrackerBase {
|
||||
class HistoryTracker final : public HistoryTrackerBase
|
||||
{
|
||||
public:
|
||||
explicit HistoryTracker(uint32_t aTimeout)
|
||||
: HistoryTrackerBase(1000 * aTimeout / 2)
|
||||
|
@ -40,13 +41,14 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
virtual void NotifyExpired(nsSHEntryShared *aObj) {
|
||||
virtual void NotifyExpired(nsSHEntryShared* aObj)
|
||||
{
|
||||
RemoveObject(aObj);
|
||||
aObj->Expire();
|
||||
}
|
||||
};
|
||||
|
||||
static HistoryTracker *gHistoryTracker = nullptr;
|
||||
static HistoryTracker* gHistoryTracker = nullptr;
|
||||
|
||||
void
|
||||
nsSHEntryShared::EnsureHistoryTracker()
|
||||
|
@ -88,10 +90,9 @@ nsSHEntryShared::~nsSHEntryShared()
|
|||
if (gHistoryTracker) {
|
||||
// Check that we're not still on track to expire. We shouldn't be, because
|
||||
// we just removed ourselves!
|
||||
nsExpirationTracker<nsSHEntryShared, 3>::Iterator
|
||||
iterator(gHistoryTracker);
|
||||
nsExpirationTracker<nsSHEntryShared, 3>::Iterator iterator(gHistoryTracker);
|
||||
|
||||
nsSHEntryShared *elem;
|
||||
nsSHEntryShared* elem;
|
||||
while ((elem = iterator.Next()) != nullptr) {
|
||||
NS_ASSERTION(elem != this, "Found dead entry still in the tracker!");
|
||||
}
|
||||
|
@ -106,7 +107,7 @@ nsSHEntryShared::~nsSHEntryShared()
|
|||
NS_IMPL_ISUPPORTS(nsSHEntryShared, nsIBFCacheEntry, nsIMutationObserver)
|
||||
|
||||
already_AddRefed<nsSHEntryShared>
|
||||
nsSHEntryShared::Duplicate(nsSHEntryShared *aEntry)
|
||||
nsSHEntryShared::Duplicate(nsSHEntryShared* aEntry)
|
||||
{
|
||||
nsRefPtr<nsSHEntryShared> newEntry = new nsSHEntryShared();
|
||||
|
||||
|
@ -124,7 +125,8 @@ nsSHEntryShared::Duplicate(nsSHEntryShared *aEntry)
|
|||
return newEntry.forget();
|
||||
}
|
||||
|
||||
void nsSHEntryShared::RemoveFromExpirationTracker()
|
||||
void
|
||||
nsSHEntryShared::RemoveFromExpirationTracker()
|
||||
{
|
||||
if (gHistoryTracker && GetExpirationState()->IsTracked()) {
|
||||
gHistoryTracker->RemoveObject(this);
|
||||
|
@ -197,7 +199,7 @@ nsSHEntryShared::Expire()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsSHEntryShared::SetContentViewer(nsIContentViewer *aViewer)
|
||||
nsSHEntryShared::SetContentViewer(nsIContentViewer* aViewer)
|
||||
{
|
||||
NS_PRECONDITION(!aViewer || !mContentViewer,
|
||||
"SHEntryShared already contains viewer");
|
||||
|
@ -229,8 +231,7 @@ nsSHEntryShared::SetContentViewer(nsIContentViewer *aViewer)
|
|||
nsresult
|
||||
nsSHEntryShared::RemoveFromBFCacheSync()
|
||||
{
|
||||
NS_ASSERTION(mContentViewer && mDocument,
|
||||
"we're not in the bfcache!");
|
||||
NS_ASSERTION(mContentViewer && mDocument, "we're not in the bfcache!");
|
||||
|
||||
nsCOMPtr<nsIContentViewer> viewer = mContentViewer;
|
||||
DropPresentationState();
|
||||
|
@ -249,9 +250,10 @@ class DestroyViewerEvent : public nsRunnable
|
|||
{
|
||||
public:
|
||||
DestroyViewerEvent(nsIContentViewer* aViewer, nsIDocument* aDocument)
|
||||
: mViewer(aViewer),
|
||||
mDocument(aDocument)
|
||||
{}
|
||||
: mViewer(aViewer)
|
||||
, mDocument(aDocument)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
|
@ -268,14 +270,12 @@ public:
|
|||
nsresult
|
||||
nsSHEntryShared::RemoveFromBFCacheAsync()
|
||||
{
|
||||
NS_ASSERTION(mContentViewer && mDocument,
|
||||
"we're not in the bfcache!");
|
||||
NS_ASSERTION(mContentViewer && mDocument, "we're not in the bfcache!");
|
||||
|
||||
// Release the reference to the contentviewer asynchronously so that the
|
||||
// document doesn't get nuked mid-mutation.
|
||||
|
||||
nsCOMPtr<nsIRunnable> evt =
|
||||
new DestroyViewerEvent(mContentViewer, mDocument);
|
||||
nsCOMPtr<nsIRunnable> evt = new DestroyViewerEvent(mContentViewer, mDocument);
|
||||
nsresult rv = NS_DispatchToCurrentThread(evt);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("failed to dispatch DestroyViewerEvent");
|
||||
|
@ -293,16 +293,12 @@ nsSHEntryShared::RemoveFromBFCacheAsync()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsSHEntryShared::GetID(uint64_t *aID)
|
||||
nsSHEntryShared::GetID(uint64_t* aID)
|
||||
{
|
||||
*aID = mID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsSHEntryShared: nsIMutationObserver
|
||||
//*****************************************************************************
|
||||
|
||||
void
|
||||
nsSHEntryShared::NodeWillBeDestroyed(const nsINode* aNode)
|
||||
{
|
||||
|
@ -372,6 +368,6 @@ nsSHEntryShared::ContentRemoved(nsIDocument* aDocument,
|
|||
}
|
||||
|
||||
void
|
||||
nsSHEntryShared::ParentChainChanged(nsIContent *aContent)
|
||||
nsSHEntryShared::ParentChainChanged(nsIContent* aContent)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -30,64 +30,65 @@ class nsISupportsArray;
|
|||
// back/forward cache.
|
||||
//
|
||||
// nsSHEntryShared is the vehicle for this sharing.
|
||||
class nsSHEntryShared final : public nsIBFCacheEntry,
|
||||
public nsIMutationObserver
|
||||
class nsSHEntryShared final
|
||||
: public nsIBFCacheEntry
|
||||
, public nsIMutationObserver
|
||||
{
|
||||
public:
|
||||
static void EnsureHistoryTracker();
|
||||
static void Shutdown();
|
||||
public:
|
||||
static void EnsureHistoryTracker();
|
||||
static void Shutdown();
|
||||
|
||||
nsSHEntryShared();
|
||||
nsSHEntryShared();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMUTATIONOBSERVER
|
||||
NS_DECL_NSIBFCACHEENTRY
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMUTATIONOBSERVER
|
||||
NS_DECL_NSIBFCACHEENTRY
|
||||
|
||||
private:
|
||||
~nsSHEntryShared();
|
||||
private:
|
||||
~nsSHEntryShared();
|
||||
|
||||
friend class nsSHEntry;
|
||||
friend class nsSHEntry;
|
||||
|
||||
friend class HistoryTracker;
|
||||
friend class nsExpirationTracker<nsSHEntryShared, 3>;
|
||||
nsExpirationState *GetExpirationState() { return &mExpirationState; }
|
||||
friend class HistoryTracker;
|
||||
friend class nsExpirationTracker<nsSHEntryShared, 3>;
|
||||
nsExpirationState *GetExpirationState() { return &mExpirationState; }
|
||||
|
||||
static already_AddRefed<nsSHEntryShared> Duplicate(nsSHEntryShared *aEntry);
|
||||
static already_AddRefed<nsSHEntryShared> Duplicate(nsSHEntryShared* aEntry);
|
||||
|
||||
void RemoveFromExpirationTracker();
|
||||
void Expire();
|
||||
nsresult SyncPresentationState();
|
||||
void DropPresentationState();
|
||||
void RemoveFromExpirationTracker();
|
||||
void Expire();
|
||||
nsresult SyncPresentationState();
|
||||
void DropPresentationState();
|
||||
|
||||
nsresult SetContentViewer(nsIContentViewer *aViewer);
|
||||
nsresult SetContentViewer(nsIContentViewer* aViewer);
|
||||
|
||||
// See nsISHEntry.idl for an explanation of these members.
|
||||
// See nsISHEntry.idl for an explanation of these members.
|
||||
|
||||
// These members are copied by nsSHEntryShared::Duplicate(). If you add a
|
||||
// member here, be sure to update the Duplicate() implementation.
|
||||
uint64_t mDocShellID;
|
||||
nsCOMArray<nsIDocShellTreeItem> mChildShells;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
nsCString mContentType;
|
||||
bool mIsFrameNavigation;
|
||||
bool mSaveLayoutState;
|
||||
bool mSticky;
|
||||
bool mDynamicallyCreated;
|
||||
nsCOMPtr<nsISupports> mCacheKey;
|
||||
uint32_t mLastTouched;
|
||||
// These members are copied by nsSHEntryShared::Duplicate(). If you add a
|
||||
// member here, be sure to update the Duplicate() implementation.
|
||||
uint64_t mDocShellID;
|
||||
nsCOMArray<nsIDocShellTreeItem> mChildShells;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
nsCString mContentType;
|
||||
bool mIsFrameNavigation;
|
||||
bool mSaveLayoutState;
|
||||
bool mSticky;
|
||||
bool mDynamicallyCreated;
|
||||
nsCOMPtr<nsISupports> mCacheKey;
|
||||
uint32_t mLastTouched;
|
||||
|
||||
// These members aren't copied by nsSHEntryShared::Duplicate() because
|
||||
// they're specific to a particular content viewer.
|
||||
uint64_t mID;
|
||||
nsCOMPtr<nsIContentViewer> mContentViewer;
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
nsCOMPtr<nsILayoutHistoryState> mLayoutHistoryState;
|
||||
bool mExpired;
|
||||
nsCOMPtr<nsISupports> mWindowState;
|
||||
nsIntRect mViewerBounds;
|
||||
nsCOMPtr<nsISupportsArray> mRefreshURIList;
|
||||
nsExpirationState mExpirationState;
|
||||
nsAutoPtr<nsDocShellEditorData> mEditorData;
|
||||
// These members aren't copied by nsSHEntryShared::Duplicate() because
|
||||
// they're specific to a particular content viewer.
|
||||
uint64_t mID;
|
||||
nsCOMPtr<nsIContentViewer> mContentViewer;
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
nsCOMPtr<nsILayoutHistoryState> mLayoutHistoryState;
|
||||
bool mExpired;
|
||||
nsCOMPtr<nsISupports> mWindowState;
|
||||
nsIntRect mViewerBounds;
|
||||
nsCOMPtr<nsISupportsArray> mRefreshURIList;
|
||||
nsExpirationState mExpirationState;
|
||||
nsAutoPtr<nsDocShellEditorData> mEditorData;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,80 +4,66 @@
|
|||
* 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/. */
|
||||
|
||||
// Local Includes
|
||||
#include "nsSHTransaction.h"
|
||||
#include "nsISHEntry.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsSHTransaction: Object Management
|
||||
//*****************************************************************************
|
||||
|
||||
nsSHTransaction::nsSHTransaction() : mPersist(true), mPrev(nullptr)
|
||||
nsSHTransaction::nsSHTransaction()
|
||||
: mPersist(true)
|
||||
, mPrev(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
nsSHTransaction::~nsSHTransaction()
|
||||
{
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsSHTransaction: nsISupports
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMPL_ADDREF(nsSHTransaction)
|
||||
NS_IMPL_RELEASE(nsSHTransaction)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSHTransaction)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISHTransaction)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISHTransaction)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISHTransaction)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISHTransaction)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
//*****************************************************************************
|
||||
// nsSHTransaction: nsISHTransaction
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHTransaction::Create(nsISHEntry* aSHEntry, nsISHTransaction* aPrev)
|
||||
{
|
||||
SetSHEntry(aSHEntry);
|
||||
if(aPrev)
|
||||
aPrev->SetNext(this);
|
||||
SetSHEntry(aSHEntry);
|
||||
if (aPrev) {
|
||||
aPrev->SetNext(this);
|
||||
}
|
||||
|
||||
SetPrev(aPrev);
|
||||
return NS_OK;
|
||||
SetPrev(aPrev);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHTransaction::GetSHEntry(nsISHEntry ** aResult)
|
||||
nsSHTransaction::GetSHEntry(nsISHEntry** aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = mSHEntry;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = mSHEntry;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHTransaction::SetSHEntry(nsISHEntry * aSHEntry)
|
||||
nsSHTransaction::SetSHEntry(nsISHEntry* aSHEntry)
|
||||
{
|
||||
mSHEntry = aSHEntry;
|
||||
return NS_OK;
|
||||
mSHEntry = aSHEntry;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHTransaction::GetNext(nsISHTransaction * * aResult)
|
||||
nsSHTransaction::GetNext(nsISHTransaction** aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = mNext;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = mNext;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHTransaction::SetNext(nsISHTransaction * aNext)
|
||||
nsSHTransaction::SetNext(nsISHTransaction* aNext)
|
||||
{
|
||||
if (aNext) {
|
||||
NS_ENSURE_SUCCESS(aNext->SetPrev(this), NS_ERROR_FAILURE);
|
||||
|
@ -88,34 +74,34 @@ nsSHTransaction::SetNext(nsISHTransaction * aNext)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHTransaction::SetPrev(nsISHTransaction * aPrev)
|
||||
nsSHTransaction::SetPrev(nsISHTransaction* aPrev)
|
||||
{
|
||||
/* This is weak reference to parent. Do not Addref it */
|
||||
mPrev = aPrev;
|
||||
return NS_OK;
|
||||
/* This is weak reference to parent. Do not Addref it */
|
||||
mPrev = aPrev;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSHTransaction::GetPrev(nsISHTransaction ** aResult)
|
||||
nsSHTransaction::GetPrev(nsISHTransaction** aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = mPrev;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = mPrev;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHTransaction::SetPersist(bool aPersist)
|
||||
{
|
||||
mPersist = aPersist;
|
||||
return NS_OK;
|
||||
mPersist = aPersist;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHTransaction::GetPersist(bool* aPersist)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPersist);
|
||||
NS_ENSURE_ARG_POINTER(aPersist);
|
||||
|
||||
*aPersist = mPersist;
|
||||
return NS_OK;
|
||||
*aPersist = mPersist;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -15,25 +15,23 @@
|
|||
|
||||
class nsISHEntry;
|
||||
|
||||
class nsSHTransaction: public nsISHTransaction
|
||||
class nsSHTransaction : public nsISHTransaction
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISHTRANSACTION
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISHTRANSACTION
|
||||
|
||||
nsSHTransaction();
|
||||
nsSHTransaction();
|
||||
|
||||
protected:
|
||||
virtual ~nsSHTransaction();
|
||||
|
||||
virtual ~nsSHTransaction();
|
||||
|
||||
protected:
|
||||
bool mPersist;
|
||||
bool mPersist;
|
||||
|
||||
nsISHTransaction * mPrev; // Weak Reference
|
||||
nsCOMPtr<nsISHTransaction> mNext;
|
||||
nsCOMPtr<nsISHEntry> mSHEntry;
|
||||
nsISHTransaction* mPrev; // Weak Reference
|
||||
nsCOMPtr<nsISHTransaction> mNext;
|
||||
nsCOMPtr<nsISHEntry> mSHEntry;
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsSHTransaction_h */
|
||||
#endif /* nsSHTransaction_h */
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -7,10 +7,7 @@
|
|||
#ifndef nsSHistory_h
|
||||
#define nsSHistory_h
|
||||
|
||||
// Helper Classes
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
//Interfaces Needed
|
||||
#include "nsISHistory.h"
|
||||
#include "nsISHistoryInternal.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
|
@ -18,7 +15,6 @@
|
|||
#include "nsTObserverArray.h"
|
||||
#include "nsWeakPtr.h"
|
||||
|
||||
// Needed to maintain global list of all SHistory objects
|
||||
#include "prclist.h"
|
||||
|
||||
class nsIDocShell;
|
||||
|
@ -34,7 +30,6 @@ class nsSHistory final : public PRCList,
|
|||
{
|
||||
public:
|
||||
nsSHistory();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISHISTORY
|
||||
NS_DECL_NSISHISTORYINTERNAL
|
||||
|
@ -56,15 +51,18 @@ protected:
|
|||
friend class nsSHEnumerator;
|
||||
friend class nsSHistoryObserver;
|
||||
|
||||
// Could become part of nsIWebNavigation
|
||||
NS_IMETHOD GetTransactionAtIndex(int32_t aIndex, nsISHTransaction ** aResult);
|
||||
nsresult CompareFrames(nsISHEntry * prevEntry, nsISHEntry * nextEntry, nsIDocShell * rootDocShell, long aLoadType, bool * aIsFrameFound);
|
||||
nsresult InitiateLoad(nsISHEntry * aFrameEntry, nsIDocShell * aFrameDS, long aLoadType);
|
||||
// Could become part of nsIWebNavigation
|
||||
NS_IMETHOD GetTransactionAtIndex(int32_t aIndex, nsISHTransaction** aResult);
|
||||
nsresult CompareFrames(nsISHEntry* aPrevEntry, nsISHEntry* aNextEntry,
|
||||
nsIDocShell* aRootDocShell, long aLoadType,
|
||||
bool* aIsFrameFound);
|
||||
nsresult InitiateLoad(nsISHEntry* aFrameEntry, nsIDocShell* aFrameDS,
|
||||
long aLoadType);
|
||||
|
||||
NS_IMETHOD LoadEntry(int32_t aIndex, long aLoadType, uint32_t histCmd);
|
||||
NS_IMETHOD LoadEntry(int32_t aIndex, long aLoadType, uint32_t aHistCmd);
|
||||
|
||||
#ifdef DEBUG
|
||||
nsresult PrintHistory();
|
||||
nsresult PrintHistory();
|
||||
#endif
|
||||
|
||||
// Evict content viewers in this window which don't lie in the "safe" range
|
||||
|
@ -79,7 +77,9 @@ protected:
|
|||
|
||||
void RemoveDynEntries(int32_t aOldIndex, int32_t aNewIndex);
|
||||
|
||||
nsresult LoadNextPossibleEntry(int32_t aNewIndex, long aLoadType, uint32_t aHistCmd);
|
||||
nsresult LoadNextPossibleEntry(int32_t aNewIndex, long aLoadType,
|
||||
uint32_t aHistCmd);
|
||||
|
||||
protected:
|
||||
// aIndex is the index of the transaction which may be removed.
|
||||
// If aKeepNext is true, aIndex is compared to aIndex + 1,
|
||||
|
@ -93,29 +93,27 @@ protected:
|
|||
// Session History listeners
|
||||
nsAutoTObserverArray<nsWeakPtr, 2> mListeners;
|
||||
// Weak reference. Do not refcount this.
|
||||
nsIDocShell * mRootDocShell;
|
||||
nsIDocShell* mRootDocShell;
|
||||
|
||||
// Max viewers allowed total, across all SHistory objects
|
||||
static int32_t sHistoryMaxTotalViewers;
|
||||
static int32_t sHistoryMaxTotalViewers;
|
||||
};
|
||||
//*****************************************************************************
|
||||
//*** nsSHEnumerator: Object Management
|
||||
//*****************************************************************************
|
||||
|
||||
class nsSHEnumerator : public nsISimpleEnumerator
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISIMPLEENUMERATOR
|
||||
|
||||
explicit nsSHEnumerator(nsSHistory * aHistory);
|
||||
|
||||
explicit nsSHEnumerator(nsSHistory* aHistory);
|
||||
|
||||
protected:
|
||||
friend class nsSHistory;
|
||||
virtual ~nsSHEnumerator();
|
||||
|
||||
private:
|
||||
int32_t mIndex;
|
||||
nsSHistory * mSHistory;
|
||||
int32_t mIndex;
|
||||
nsSHistory* mSHistory;
|
||||
};
|
||||
|
||||
#endif /* nsSHistory */
|
||||
#endif /* nsSHistory */
|
||||
|
|
|
@ -270,14 +270,14 @@ nsIdentifierMapEntry::Traverse(nsCycleCollectionTraversalCallback* aCallback)
|
|||
bool
|
||||
nsIdentifierMapEntry::IsEmpty()
|
||||
{
|
||||
return mIdContentList.Count() == 0 && !mNameContentList &&
|
||||
return mIdContentList.IsEmpty() && !mNameContentList &&
|
||||
!mChangeCallbacks && !mImageElement;
|
||||
}
|
||||
|
||||
Element*
|
||||
nsIdentifierMapEntry::GetIdElement()
|
||||
{
|
||||
return static_cast<Element*>(mIdContentList.SafeElementAt(0));
|
||||
return mIdContentList.SafeElementAt(0);
|
||||
}
|
||||
|
||||
Element*
|
||||
|
@ -289,8 +289,8 @@ nsIdentifierMapEntry::GetImageIdElement()
|
|||
void
|
||||
nsIdentifierMapEntry::AppendAllIdContent(nsCOMArray<nsIContent>* aElements)
|
||||
{
|
||||
for (int32_t i = 0; i < mIdContentList.Count(); ++i) {
|
||||
aElements->AppendObject(static_cast<Element*>(mIdContentList[i]));
|
||||
for (size_t i = 0; i < mIdContentList.Length(); ++i) {
|
||||
aElements->AppendObject(mIdContentList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -592,16 +592,15 @@ bool
|
|||
nsIdentifierMapEntry::AddIdElement(Element* aElement)
|
||||
{
|
||||
NS_PRECONDITION(aElement, "Must have element");
|
||||
NS_PRECONDITION(mIdContentList.IndexOf(nullptr) < 0,
|
||||
NS_PRECONDITION(!mIdContentList.Contains(nullptr),
|
||||
"Why is null in our list?");
|
||||
|
||||
#ifdef DEBUG
|
||||
Element* currentElement =
|
||||
static_cast<Element*>(mIdContentList.SafeElementAt(0));
|
||||
Element* currentElement = mIdContentList.SafeElementAt(0);
|
||||
#endif
|
||||
|
||||
// Common case
|
||||
if (mIdContentList.Count() == 0) {
|
||||
if (mIdContentList.IsEmpty()) {
|
||||
if (!mIdContentList.AppendElement(aElement))
|
||||
return false;
|
||||
NS_ASSERTION(currentElement == nullptr, "How did that happen?");
|
||||
|
@ -613,7 +612,7 @@ nsIdentifierMapEntry::AddIdElement(Element* aElement)
|
|||
// with us. Search for the right place to insert the content.
|
||||
|
||||
size_t idx;
|
||||
if (BinarySearchIf(mIdContentList, 0, mIdContentList.Count(),
|
||||
if (BinarySearchIf(mIdContentList, 0, mIdContentList.Length(),
|
||||
PositionComparator(aElement), &idx)) {
|
||||
// Already in the list, so already in the right spot. Get out of here.
|
||||
// XXXbz this only happens because XUL does all sorts of random
|
||||
|
@ -621,12 +620,12 @@ nsIdentifierMapEntry::AddIdElement(Element* aElement)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!mIdContentList.InsertElementAt(aElement, idx))
|
||||
if (!mIdContentList.InsertElementAt(idx, aElement)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (idx == 0) {
|
||||
Element* oldElement =
|
||||
static_cast<Element*>(mIdContentList.SafeElementAt(1));
|
||||
Element* oldElement = mIdContentList.SafeElementAt(1);
|
||||
NS_ASSERTION(currentElement == oldElement, "How did that happen?");
|
||||
FireChangeCallbacks(oldElement, aElement);
|
||||
}
|
||||
|
@ -645,17 +644,15 @@ nsIdentifierMapEntry::RemoveIdElement(Element* aElement)
|
|||
// Only assert this in HTML documents for now as XUL does all sorts of weird
|
||||
// crap.
|
||||
NS_ASSERTION(!aElement->OwnerDoc()->IsHTMLDocument() ||
|
||||
mIdContentList.IndexOf(aElement) >= 0,
|
||||
mIdContentList.Contains(aElement),
|
||||
"Removing id entry that doesn't exist");
|
||||
|
||||
// XXXbz should this ever Compact() I guess when all the content is gone
|
||||
// we'll just get cleaned up in the natural order of things...
|
||||
Element* currentElement =
|
||||
static_cast<Element*>(mIdContentList.SafeElementAt(0));
|
||||
Element* currentElement = mIdContentList.SafeElementAt(0);
|
||||
mIdContentList.RemoveElement(aElement);
|
||||
if (currentElement == aElement) {
|
||||
FireChangeCallbacks(currentElement,
|
||||
static_cast<Element*>(mIdContentList.SafeElementAt(0)));
|
||||
FireChangeCallbacks(currentElement, mIdContentList.SafeElementAt(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5048,7 +5045,7 @@ nsDocument::GetElementById(const nsAString& aElementId)
|
|||
return entry ? entry->GetIdElement() : nullptr;
|
||||
}
|
||||
|
||||
const nsSmallVoidArray*
|
||||
const nsTArray<Element*>*
|
||||
nsDocument::GetAllElementsForId(const nsAString& aElementId) const
|
||||
{
|
||||
if (aElementId.IsEmpty()) {
|
||||
|
@ -5056,7 +5053,7 @@ nsDocument::GetAllElementsForId(const nsAString& aElementId) const
|
|||
}
|
||||
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.GetEntry(aElementId);
|
||||
return entry ? entry->GetIdElements() : nullptr;
|
||||
return entry ? &entry->GetIdElements() : nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nsCRT.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIDOMXMLDocument.h"
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
|
@ -151,8 +150,8 @@ public:
|
|||
/**
|
||||
* Returns the list of all elements associated with this id.
|
||||
*/
|
||||
const nsSmallVoidArray* GetIdElements() const {
|
||||
return &mIdContentList;
|
||||
const nsTArray<Element*>& GetIdElements() const {
|
||||
return mIdContentList;
|
||||
}
|
||||
/**
|
||||
* If this entry has a non-null image element set (using SetImageElement),
|
||||
|
@ -228,7 +227,7 @@ private:
|
|||
|
||||
// empty if there are no elements with this ID.
|
||||
// The elements are stored as weak pointers.
|
||||
nsSmallVoidArray mIdContentList;
|
||||
nsTArray<Element*> mIdContentList;
|
||||
nsRefPtr<nsBaseContentList> mNameContentList;
|
||||
nsAutoPtr<nsTHashtable<ChangeCallbackEntry> > mChangeCallbacks;
|
||||
nsRefPtr<Element> mImageElement;
|
||||
|
@ -1141,7 +1140,7 @@ public:
|
|||
virtual void SetChangeScrollPosWhenScrollingToRef(bool aValue) override;
|
||||
|
||||
virtual Element *GetElementById(const nsAString& aElementId) override;
|
||||
virtual const nsSmallVoidArray* GetAllElementsForId(const nsAString& aElementId) const override;
|
||||
virtual const nsTArray<Element*>* GetAllElementsForId(const nsAString& aElementId) const override;
|
||||
|
||||
virtual Element *LookupImageElement(const nsAString& aElementId) override;
|
||||
virtual void MozSetImageElement(const nsAString& aImageElementId,
|
||||
|
|
|
@ -78,7 +78,6 @@ class nsSMILAnimationController;
|
|||
class nsStyleSet;
|
||||
class nsTextNode;
|
||||
class nsWindowSizes;
|
||||
class nsSmallVoidArray;
|
||||
class nsDOMCaretPosition;
|
||||
class nsViewportInfo;
|
||||
class nsIGlobalObject;
|
||||
|
@ -2078,9 +2077,8 @@ public:
|
|||
/**
|
||||
* This method returns _all_ the elements in this document which
|
||||
* have id aElementId, if there are any. Otherwise it returns null.
|
||||
* The entries of the nsSmallVoidArray are Element*
|
||||
*/
|
||||
virtual const nsSmallVoidArray* GetAllElementsForId(const nsAString& aElementId) const = 0;
|
||||
virtual const nsTArray<Element*>* GetAllElementsForId(const nsAString& aElementId) const = 0;
|
||||
|
||||
/**
|
||||
* Lookup an image element using its associated ID, which is usually provided
|
||||
|
|
|
@ -2478,8 +2478,7 @@ FindMatchingElementsWithId(const nsAString& aId, nsINode* aRoot,
|
|||
"document if it's in the document. Note that document fragments "
|
||||
"can't be IsInDoc(), so should never show up here.");
|
||||
|
||||
const nsSmallVoidArray* elements = aRoot->OwnerDoc()->GetAllElementsForId(aId);
|
||||
|
||||
const nsTArray<Element*>* elements = aRoot->OwnerDoc()->GetAllElementsForId(aId);
|
||||
if (!elements) {
|
||||
// Nothing to do; we're done
|
||||
return;
|
||||
|
@ -2487,8 +2486,8 @@ FindMatchingElementsWithId(const nsAString& aId, nsINode* aRoot,
|
|||
|
||||
// XXXbz: Should we fall back to the tree walk if aRoot is not the
|
||||
// document and |elements| is long, for some value of "long"?
|
||||
for (int32_t i = 0; i < elements->Count(); ++i) {
|
||||
Element *element = static_cast<Element*>(elements->ElementAt(i));
|
||||
for (size_t i = 0; i < elements->Length(); ++i) {
|
||||
Element* element = (*elements)[i];
|
||||
if (!aRoot->IsElement() ||
|
||||
(element != aRoot &&
|
||||
nsContentUtils::ContentIsDescendantOf(element, aRoot))) {
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#include "mozilla/net/NeckoChild.h"
|
||||
#include "mozilla/plugins/PluginInstanceParent.h"
|
||||
#include "mozilla/plugins/PluginModuleParent.h"
|
||||
#include "mozilla/media/webrtc/WebrtcGlobalChild.h"
|
||||
#include "mozilla/widget/WidgetMessageUtils.h"
|
||||
|
||||
#if defined(MOZ_CONTENT_SANDBOX)
|
||||
|
@ -121,6 +120,10 @@
|
|||
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
|
||||
#ifdef MOZ_WEBRTC
|
||||
#include "signaling/src/peerconnection/WebrtcGlobalChild.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_PERMISSIONS
|
||||
#include "nsPermission.h"
|
||||
#include "nsPermissionManager.h"
|
||||
|
@ -1821,15 +1824,23 @@ ContentChild::DeallocPSpeechSynthesisChild(PSpeechSynthesisChild* aActor)
|
|||
PWebrtcGlobalChild *
|
||||
ContentChild::AllocPWebrtcGlobalChild()
|
||||
{
|
||||
#ifdef MOZ_WEBRTC
|
||||
WebrtcGlobalChild *child = new WebrtcGlobalChild();
|
||||
return child;
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::DeallocPWebrtcGlobalChild(PWebrtcGlobalChild *aActor)
|
||||
{
|
||||
#ifdef MOZ_WEBRTC
|
||||
delete static_cast<WebrtcGlobalChild*>(aActor);
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -87,7 +87,6 @@
|
|||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/media/webrtc/WebrtcGlobalParent.h"
|
||||
#include "nsAnonymousTemporaryFile.h"
|
||||
#include "nsAppRunner.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
@ -167,6 +166,10 @@
|
|||
|
||||
#include "nsIBidiKeyboard.h"
|
||||
|
||||
#ifdef MOZ_WEBRTC
|
||||
#include "signaling/src/peerconnection/WebrtcGlobalParent.h"
|
||||
#endif
|
||||
|
||||
#if defined(ANDROID) || defined(LINUX)
|
||||
#include "nsSystemInfo.h"
|
||||
#endif
|
||||
|
@ -4950,14 +4953,22 @@ ContentParent::DeallocPOfflineCacheUpdateParent(POfflineCacheUpdateParent* aActo
|
|||
PWebrtcGlobalParent *
|
||||
ContentParent::AllocPWebrtcGlobalParent()
|
||||
{
|
||||
#ifdef MOZ_WEBRTC
|
||||
return WebrtcGlobalParent::Alloc();
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::DeallocPWebrtcGlobalParent(PWebrtcGlobalParent *aActor)
|
||||
{
|
||||
#ifdef MOZ_WEBRTC
|
||||
WebrtcGlobalParent::Dealloc(static_cast<WebrtcGlobalParent*>(aActor));
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -139,6 +139,7 @@ LOCAL_INCLUDES += [
|
|||
'/gfx/2d',
|
||||
'/hal/sandbox',
|
||||
'/layout/base',
|
||||
'/media/webrtc',
|
||||
'/netwerk/base',
|
||||
'/toolkit/xre',
|
||||
'/uriloader/exthandler',
|
||||
|
|
|
@ -0,0 +1,525 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef INTERVALS_H
|
||||
#define INTERVALS_H
|
||||
|
||||
#include <algorithm>
|
||||
#include "mozilla/TypeTraits.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace media {
|
||||
|
||||
/* Interval defines an interval between two points. Unlike a traditional
|
||||
interval [A,B] where A <= x <= B, the upper boundary B is exclusive: A <= x < B
|
||||
(e.g [A,B[ or [A,B) depending on where you're living)
|
||||
It provides basic interval arithmetic and fuzzy edges.
|
||||
The type T must provides a default constructor and +, -, <, <= and ==
|
||||
operators.
|
||||
*/
|
||||
template<typename T>
|
||||
class Interval
|
||||
{
|
||||
public:
|
||||
typedef Interval<T> SelfType;
|
||||
|
||||
Interval()
|
||||
: mStart(T())
|
||||
, mEnd(T())
|
||||
, mFuzz(T())
|
||||
{}
|
||||
|
||||
template<typename StartArg, typename EndArg>
|
||||
Interval(StartArg&& aStart, EndArg&& aEnd)
|
||||
: mStart(Forward<StartArg>(aStart))
|
||||
, mEnd(Forward<EndArg>(aEnd))
|
||||
, mFuzz()
|
||||
{
|
||||
MOZ_ASSERT(aStart <= aEnd);
|
||||
}
|
||||
|
||||
template<typename StartArg, typename EndArg, typename FuzzArg>
|
||||
Interval(StartArg&& aStart, EndArg&& aEnd, FuzzArg&& aFuzz)
|
||||
: mStart(Forward<StartArg>(aStart))
|
||||
, mEnd(Forward<EndArg>(aEnd))
|
||||
, mFuzz(Forward<FuzzArg>(aFuzz))
|
||||
{
|
||||
MOZ_ASSERT(aStart <= aEnd);
|
||||
}
|
||||
|
||||
Interval(const SelfType& aOther)
|
||||
: mStart(aOther.mStart)
|
||||
, mEnd(aOther.mEnd)
|
||||
, mFuzz(aOther.mFuzz)
|
||||
{}
|
||||
|
||||
Interval(SelfType&& aOther)
|
||||
: mStart(Move(aOther.mStart))
|
||||
, mEnd(Move(aOther.mEnd))
|
||||
, mFuzz(Move(aOther.mFuzz))
|
||||
{ }
|
||||
|
||||
SelfType& operator= (const SelfType& aOther)
|
||||
{
|
||||
mStart = aOther.mStart;
|
||||
mEnd = aOther.mEnd;
|
||||
mFuzz = aOther.mFuzz;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SelfType& operator= (SelfType&& aOther)
|
||||
{
|
||||
MOZ_ASSERT(&aOther != this, "self-moves are prohibited");
|
||||
this->~Interval();
|
||||
new(this) Interval(Move(aOther));
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Basic interval arithmetic operator definition.
|
||||
SelfType operator+ (const SelfType& aOther) const
|
||||
{
|
||||
return SelfType(mStart + aOther.mStart,
|
||||
mEnd + aOther.mEnd,
|
||||
mFuzz + aOther.mFuzz);
|
||||
}
|
||||
|
||||
// Basic interval arithmetic operator definition.
|
||||
SelfType operator- (const SelfType& aOther) const
|
||||
{
|
||||
return SelfType(mStart - aOther.mEnd,
|
||||
mEnd - aOther.mStart,
|
||||
mFuzz + aOther.mFuzz);
|
||||
}
|
||||
|
||||
bool operator== (const SelfType& aOther) const
|
||||
{
|
||||
return mStart == aOther.mStart && mEnd == aOther.mEnd;
|
||||
}
|
||||
|
||||
bool operator!= (const SelfType& aOther) const
|
||||
{
|
||||
return !(*this == aOther);
|
||||
}
|
||||
|
||||
bool Contains(const T& aX) const
|
||||
{
|
||||
return mStart - mFuzz <= aX && aX < mEnd + mFuzz;
|
||||
}
|
||||
|
||||
bool ContainsStrict(const T& aX) const
|
||||
{
|
||||
return mStart <= aX && aX < mEnd;
|
||||
}
|
||||
|
||||
bool Contains(const SelfType& aOther) const
|
||||
{
|
||||
return (mStart - mFuzz <= aOther.mStart + aOther.mFuzz) &&
|
||||
(aOther.mEnd + aOther.mFuzz <= mEnd - mFuzz);
|
||||
}
|
||||
|
||||
bool ContainsStrict(const SelfType& aOther) const
|
||||
{
|
||||
return mStart <= aOther.mStart && aOther.mEnd <= mEnd;
|
||||
}
|
||||
|
||||
bool Intersects(const SelfType& aOther) const
|
||||
{
|
||||
return (mStart - mFuzz <= aOther.mEnd + aOther.mFuzz) &&
|
||||
(aOther.mStart - aOther.mFuzz <= mEnd + mFuzz);
|
||||
}
|
||||
|
||||
// Returns true if aOther is strictly to the right of this and contiguous.
|
||||
// This operation isn't commutative.
|
||||
bool Contiguous(const SelfType& aOther) const
|
||||
{
|
||||
return mEnd <= aOther.mStart && aOther.mStart - mEnd <= mFuzz + aOther.mFuzz;
|
||||
}
|
||||
|
||||
SelfType Union(const SelfType& aOther) const
|
||||
{
|
||||
SelfType result(*this);
|
||||
if (aOther.mStart < mStart) {
|
||||
result.mStart = aOther.mStart;
|
||||
}
|
||||
if (mEnd < aOther.mEnd) {
|
||||
result.mEnd = aOther.mEnd;
|
||||
}
|
||||
if (mFuzz < aOther.mFuzz) {
|
||||
result.mFuzz = aOther.mFuzz;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
SelfType Intersection(const SelfType& aOther) const
|
||||
{
|
||||
const T& s = std::max(mStart, aOther.mStart);
|
||||
const T& e = std::min(mEnd, aOther.mEnd);
|
||||
const T& f = std::max(mFuzz, aOther.mFuzz);
|
||||
if (s < e) {
|
||||
return SelfType(s, e, f);
|
||||
}
|
||||
// Return an empty interval.
|
||||
return SelfType();
|
||||
}
|
||||
|
||||
T Length() const
|
||||
{
|
||||
return mEnd - mStart;
|
||||
}
|
||||
|
||||
bool IsEmpty() const
|
||||
{
|
||||
return mStart == mEnd;
|
||||
}
|
||||
|
||||
T mStart;
|
||||
T mEnd;
|
||||
T mFuzz;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class IntervalSet
|
||||
{
|
||||
public:
|
||||
typedef IntervalSet<T> SelfType;
|
||||
typedef Interval<T> ElemType;
|
||||
typedef nsAutoTArray<ElemType,4> ContainerType;
|
||||
typedef typename ContainerType::index_type IndexType;
|
||||
|
||||
IntervalSet()
|
||||
{
|
||||
}
|
||||
~IntervalSet()
|
||||
{
|
||||
}
|
||||
|
||||
IntervalSet(const SelfType& aOther)
|
||||
: mIntervals(aOther.mIntervals)
|
||||
{
|
||||
}
|
||||
|
||||
IntervalSet(SelfType&& aOther)
|
||||
: mIntervals(Move(aOther.mIntervals))
|
||||
{
|
||||
}
|
||||
|
||||
explicit IntervalSet(const ElemType& aOther)
|
||||
{
|
||||
mIntervals.AppendElement(aOther);
|
||||
}
|
||||
|
||||
explicit IntervalSet(ElemType&& aOther)
|
||||
{
|
||||
mIntervals.AppendElement(Move(aOther));
|
||||
}
|
||||
|
||||
SelfType& operator= (const SelfType& aOther)
|
||||
{
|
||||
mIntervals = aOther.mIntervals;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SelfType& operator= (SelfType&& aOther)
|
||||
{
|
||||
MOZ_ASSERT(&aOther != this, "self-moves are prohibited");
|
||||
this->~IntervalSet();
|
||||
new(this) IntervalSet(Move(aOther));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SelfType& operator= (const ElemType& aInterval)
|
||||
{
|
||||
mIntervals.Clear();
|
||||
mIntervals.AppendElement(aInterval);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SelfType& operator= (ElemType&& aInterval)
|
||||
{
|
||||
mIntervals.Clear();
|
||||
mIntervals.AppendElement(Move(aInterval));
|
||||
return *this;
|
||||
}
|
||||
|
||||
// + and += operator will append the provided interval or intervalset.
|
||||
// Note that the result is not normalized. Call Normalize() as required.
|
||||
// Alternatively, use Union()
|
||||
|
||||
SelfType& Add(const SelfType& aIntervals)
|
||||
{
|
||||
mIntervals.AppendElements(aIntervals.mIntervals);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SelfType& Add(const ElemType& aInterval)
|
||||
{
|
||||
mIntervals.AppendElement(aInterval);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SelfType& operator+= (const SelfType& aIntervals)
|
||||
{
|
||||
Add(aIntervals);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SelfType& operator+= (const ElemType& aInterval)
|
||||
{
|
||||
Add(aInterval);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SelfType operator+ (const SelfType& aIntervals) const
|
||||
{
|
||||
SelfType intervals(*this);
|
||||
intervals.Add(aIntervals);
|
||||
return intervals;
|
||||
}
|
||||
|
||||
SelfType operator+ (const ElemType& aInterval)
|
||||
{
|
||||
SelfType intervals(*this);
|
||||
intervals.Add(aInterval);
|
||||
return intervals;
|
||||
}
|
||||
|
||||
friend SelfType operator+ (const ElemType& aInterval,
|
||||
const SelfType& aIntervals)
|
||||
{
|
||||
SelfType intervals;
|
||||
intervals.Add(aInterval);
|
||||
intervals.Add(aIntervals);
|
||||
return intervals;
|
||||
}
|
||||
|
||||
// Mutate this IntervalSet to be the union of this and aOther.
|
||||
// Resulting IntervalSet is normalized.
|
||||
SelfType& Union(const SelfType& aOther)
|
||||
{
|
||||
Add(aOther);
|
||||
Normalize();
|
||||
return *this;
|
||||
}
|
||||
|
||||
SelfType& Union(const ElemType& aInterval)
|
||||
{
|
||||
Add(aInterval);
|
||||
Normalize();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Mutate this TimeRange to be the intersection of this and aOther.
|
||||
SelfType& Intersection(const SelfType& aOther)
|
||||
{
|
||||
ContainerType intersection;
|
||||
|
||||
const ContainerType& other = aOther.mIntervals;
|
||||
IndexType i = 0, j = 0;
|
||||
for (; i < mIntervals.Length() && j < other.Length();) {
|
||||
if (mIntervals[i].Intersects(other[j])) {
|
||||
intersection.AppendElement(mIntervals[i].Intersection(other[j]));
|
||||
}
|
||||
if (mIntervals[i].mEnd < other[j].mEnd) {
|
||||
i++;
|
||||
} else {
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
mIntervals = intersection;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SelfType& Intersection(const ElemType& aInterval)
|
||||
{
|
||||
SelfType intervals(aInterval);
|
||||
return Intersection(intervals);
|
||||
}
|
||||
|
||||
const ElemType& operator[] (IndexType aIndex) const
|
||||
{
|
||||
return mIntervals[aIndex];
|
||||
}
|
||||
|
||||
// Returns the start boundary of the first interval. Or a default constructed
|
||||
// T if IntervalSet is empty (and aExists if provided will be set to false).
|
||||
T GetStart(bool* aExists = nullptr) const
|
||||
{
|
||||
bool exists = !mIntervals.IsEmpty();
|
||||
|
||||
if (aExists) {
|
||||
*aExists = exists;
|
||||
}
|
||||
|
||||
if (exists) {
|
||||
return mIntervals[0].mStart;
|
||||
} else {
|
||||
return T();
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the end boundary of the last interval. Or a default constructed T
|
||||
// if IntervalSet is empty (and aExists if provided will be set to false).
|
||||
T GetEnd(bool* aExists = nullptr) const
|
||||
{
|
||||
bool exists = !mIntervals.IsEmpty();
|
||||
if (aExists) {
|
||||
*aExists = exists;
|
||||
}
|
||||
|
||||
if (exists) {
|
||||
return mIntervals.LastElement().mEnd;
|
||||
} else {
|
||||
return T();
|
||||
}
|
||||
}
|
||||
|
||||
IndexType Length() const
|
||||
{
|
||||
return mIntervals.Length();
|
||||
}
|
||||
|
||||
T Start(IndexType aIndex) const
|
||||
{
|
||||
return mIntervals[aIndex].mStart;
|
||||
}
|
||||
|
||||
T Start(IndexType aIndex, bool& aExists) const
|
||||
{
|
||||
aExists = aIndex < mIntervals.Length();
|
||||
|
||||
if (aExists) {
|
||||
return mIntervals[aIndex].mStart;
|
||||
} else {
|
||||
return T();
|
||||
}
|
||||
}
|
||||
|
||||
T End(IndexType aIndex) const
|
||||
{
|
||||
return mIntervals[aIndex].mEnd;
|
||||
}
|
||||
|
||||
T End(IndexType aIndex, bool& aExists) const
|
||||
{
|
||||
aExists = aIndex < mIntervals.Length();
|
||||
|
||||
if (aExists) {
|
||||
return mIntervals[aIndex].mEnd;
|
||||
} else {
|
||||
return T();
|
||||
}
|
||||
}
|
||||
|
||||
bool Contains(const T& aX) {
|
||||
for (const auto& interval : mIntervals) {
|
||||
if (interval.Contains(aX)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ContainsStrict(const T& aX) {
|
||||
for (const auto& interval : mIntervals) {
|
||||
if (interval.ContainsStrict(aX)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Normalize()
|
||||
{
|
||||
if (mIntervals.Length() >= 2) {
|
||||
ContainerType normalized;
|
||||
|
||||
mIntervals.Sort(CompareIntervals());
|
||||
|
||||
// This merges the intervals.
|
||||
ElemType current(mIntervals[0]);
|
||||
for (IndexType i = 1; i < mIntervals.Length(); i++) {
|
||||
if (current.Contains(mIntervals[i])) {
|
||||
continue;
|
||||
}
|
||||
if (current.Intersects(mIntervals[i])) {
|
||||
current = current.Union(mIntervals[i]);
|
||||
} else {
|
||||
normalized.AppendElement(current);
|
||||
current = mIntervals[i];
|
||||
}
|
||||
}
|
||||
|
||||
normalized.AppendElement(current);
|
||||
|
||||
mIntervals = normalized;
|
||||
}
|
||||
}
|
||||
|
||||
// Shift all values by aOffset.
|
||||
void Shift(T aOffset)
|
||||
{
|
||||
for (auto& interval : mIntervals) {
|
||||
interval.mStart += aOffset;
|
||||
interval.mEnd += aOffset;
|
||||
}
|
||||
}
|
||||
|
||||
static const IndexType NoIndex = IndexType(-1);
|
||||
|
||||
IndexType Find(T aValue) const
|
||||
{
|
||||
for (IndexType i = 0; i < mIntervals.Length(); i++) {
|
||||
if (mIntervals[i].Contains(aValue)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return NoIndex;
|
||||
}
|
||||
|
||||
protected:
|
||||
ContainerType mIntervals;
|
||||
|
||||
private:
|
||||
struct CompareIntervals
|
||||
{
|
||||
bool Equals(const ElemType& aT1, const ElemType& aT2) const
|
||||
{
|
||||
return aT1.mStart == aT2.mStart && aT1.mEnd == aT2.mEnd;
|
||||
}
|
||||
|
||||
bool LessThan(const ElemType& aT1, const ElemType& aT2) const {
|
||||
return aT1.mStart - aT1.mFuzz < aT2.mStart + aT2.mFuzz;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// clang doesn't allow for this to be defined inline of IntervalSet.
|
||||
template<typename T>
|
||||
IntervalSet<T> Union(const IntervalSet<T>& aIntervals1,
|
||||
const IntervalSet<T>& aIntervals2)
|
||||
{
|
||||
IntervalSet<T> intervals(aIntervals1);
|
||||
intervals.Union(aIntervals2);
|
||||
return intervals;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
IntervalSet<T> Intersection(const IntervalSet<T>& aIntervals1,
|
||||
const IntervalSet<T>& aIntervals2)
|
||||
{
|
||||
IntervalSet<T> intersection(aIntervals1);
|
||||
intersection.Intersection(aIntervals2);
|
||||
return intersection;
|
||||
}
|
||||
|
||||
} // namespace media
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // INTERVALS_H
|
|
@ -7,9 +7,11 @@
|
|||
#ifndef TIME_UNITS_H
|
||||
#define TIME_UNITS_H
|
||||
|
||||
#include "Intervals.h"
|
||||
#include "VideoUtils.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/dom/TimeRanges.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace media {
|
||||
|
@ -40,6 +42,9 @@ struct Microseconds {
|
|||
}
|
||||
}
|
||||
|
||||
bool operator == (const Microseconds& aOther) const {
|
||||
return mValue == aOther.mValue;
|
||||
}
|
||||
bool operator > (const Microseconds& aOther) const {
|
||||
return mValue > aOther.mValue;
|
||||
}
|
||||
|
@ -87,6 +92,10 @@ public:
|
|||
return double(mValue.value()) / USECS_PER_S;
|
||||
}
|
||||
|
||||
bool operator == (const TimeUnit& aOther) const {
|
||||
MOZ_ASSERT(IsValid() && aOther.IsValid());
|
||||
return mValue.value() == aOther.mValue.value();
|
||||
}
|
||||
bool operator >= (const TimeUnit& aOther) const {
|
||||
MOZ_ASSERT(IsValid() && aOther.IsValid());
|
||||
return mValue.value() >= aOther.mValue.value();
|
||||
|
@ -113,9 +122,18 @@ public:
|
|||
return mValue.isValid();
|
||||
}
|
||||
|
||||
TimeUnit()
|
||||
: mValue(CheckedInt64(0))
|
||||
{}
|
||||
|
||||
explicit TimeUnit(const Microseconds& aMicroseconds)
|
||||
: mValue(aMicroseconds.mValue)
|
||||
{}
|
||||
TimeUnit& operator = (const Microseconds& aMicroseconds)
|
||||
{
|
||||
mValue = aMicroseconds.mValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TimeUnit(const TimeUnit&) = default;
|
||||
|
||||
|
@ -130,6 +148,64 @@ private:
|
|||
CheckedInt64 mValue;
|
||||
};
|
||||
|
||||
typedef Interval<TimeUnit> TimeInterval;
|
||||
|
||||
class TimeIntervals : public IntervalSet<TimeUnit>
|
||||
{
|
||||
public:
|
||||
typedef IntervalSet<TimeUnit> BaseType;
|
||||
|
||||
// We can't use inherited constructors yet. So we have to duplicate all the
|
||||
// constructors found in IntervalSet base class.
|
||||
// all this could be later replaced with:
|
||||
// using IntervalSet<TimeUnit>::IntervalSet;
|
||||
|
||||
// MOZ_IMPLICIT as we want to enable initialization in the form:
|
||||
// TimeIntervals i = ... like we would do with IntervalSet<T> i = ...
|
||||
MOZ_IMPLICIT TimeIntervals(const BaseType& aOther)
|
||||
: BaseType(aOther)
|
||||
{}
|
||||
MOZ_IMPLICIT TimeIntervals(BaseType&& aOther)
|
||||
: BaseType(Move(aOther))
|
||||
{}
|
||||
explicit TimeIntervals(const BaseType::ElemType& aOther)
|
||||
: BaseType(aOther)
|
||||
{}
|
||||
explicit TimeIntervals(BaseType::ElemType&& aOther)
|
||||
: BaseType(Move(aOther))
|
||||
{}
|
||||
|
||||
TimeIntervals() = default;
|
||||
|
||||
// Make TimeIntervals interchangeable with dom::TimeRanges.
|
||||
explicit TimeIntervals(dom::TimeRanges* aRanges)
|
||||
{
|
||||
for (uint32_t i = 0; i < aRanges->Length(); i++) {
|
||||
ErrorResult rv;
|
||||
*this +=
|
||||
TimeInterval(TimeUnit::FromSeconds(aRanges->Start(i, rv)),
|
||||
TimeUnit::FromSeconds(aRanges->End(i, rv)));
|
||||
}
|
||||
}
|
||||
TimeIntervals& operator = (dom::TimeRanges* aRanges)
|
||||
{
|
||||
*this = TimeIntervals(aRanges);
|
||||
return *this;
|
||||
}
|
||||
|
||||
static TimeIntervals FromTimeRanges(dom::TimeRanges* aRanges)
|
||||
{
|
||||
return TimeIntervals(aRanges);
|
||||
}
|
||||
|
||||
void ToTimeRanges(dom::TimeRanges* aRanges) const
|
||||
{
|
||||
for (IndexType i = 0; i < Length(); i++) {
|
||||
aRanges->Add(Start(i).ToSeconds(), End(i).ToSeconds());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace media
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -164,6 +164,9 @@ private:
|
|||
virtual void ReleaseMediaResources() override {
|
||||
mReader->ReleaseMediaResources();
|
||||
}
|
||||
virtual bool OnReaderTaskQueue() override {
|
||||
return mReader->OnTaskQueue();
|
||||
}
|
||||
private:
|
||||
MP4Reader* mReader;
|
||||
TrackType mType;
|
||||
|
|
|
@ -182,6 +182,8 @@ public:
|
|||
virtual void NotifyResourcesStatusChanged() {};
|
||||
|
||||
virtual void ReleaseMediaResources() {};
|
||||
|
||||
virtual bool OnReaderTaskQueue() = 0;
|
||||
};
|
||||
|
||||
// MediaDataDecoder is the interface exposed by decoders created by the
|
||||
|
@ -189,9 +191,13 @@ public:
|
|||
// media data that the decoder accepts as valid input and produces as
|
||||
// output is determined when the MediaDataDecoder is created.
|
||||
//
|
||||
// All functions are only called on the decode task queue. Don't block
|
||||
// inside these functions, unless it's explicitly noted that you should
|
||||
// (like in Flush() and Drain()).
|
||||
// Unless otherwise noted, all functions are only called on the decode task
|
||||
// queue. An exception is the MediaDataDecoder in
|
||||
// MP4Reader::IsVideoAccelerated() for which all calls (Init(),
|
||||
// IsHardwareAccelerated(), and Shutdown()) are from the main thread.
|
||||
//
|
||||
// Don't block inside these functions, unless it's explicitly noted that you
|
||||
// should (like in Flush()).
|
||||
//
|
||||
// Decoding is done asynchronously. Any async work can be done on the
|
||||
// MediaTaskQueue passed into the PlatformDecoderModules's Create*Decoder()
|
||||
|
@ -245,6 +251,7 @@ public:
|
|||
// returned.
|
||||
virtual nsresult Shutdown() = 0;
|
||||
|
||||
// Called from the state machine task queue or main thread.
|
||||
virtual bool IsHardwareAccelerated() const { return false; }
|
||||
|
||||
// ConfigurationChanged will be called to inform the video or audio decoder
|
||||
|
|
|
@ -52,6 +52,11 @@ public:
|
|||
mManager->mActiveCallback->ReleaseMediaResources();
|
||||
}
|
||||
}
|
||||
virtual bool OnReaderTaskQueue() override
|
||||
{
|
||||
MOZ_ASSERT(mManager->mActiveCallback);
|
||||
return mManager->mActiveCallback->OnReaderTaskQueue();
|
||||
}
|
||||
|
||||
SharedDecoderManager* mManager;
|
||||
};
|
||||
|
@ -186,6 +191,9 @@ SharedDecoderManager::DrainComplete()
|
|||
void
|
||||
SharedDecoderManager::Shutdown()
|
||||
{
|
||||
// Shutdown() should have been called on any proxies.
|
||||
MOZ_ASSERT(!mActiveProxy);
|
||||
|
||||
if (mDecoder) {
|
||||
mDecoder->Shutdown();
|
||||
mDecoder = nullptr;
|
||||
|
|
|
@ -116,6 +116,11 @@ public:
|
|||
|
||||
virtual void FlushComplete();
|
||||
|
||||
virtual bool OnReaderTaskQueue() override
|
||||
{
|
||||
return mProxyCallback->OnReaderTaskQueue();
|
||||
}
|
||||
|
||||
private:
|
||||
MediaDataDecoderProxy* mProxyDecoder;
|
||||
MediaDataDecoderCallback* mProxyCallback;
|
||||
|
|
|
@ -30,6 +30,7 @@ WMFMediaDataDecoder::WMFMediaDataDecoder(MFTManager* aMFTManager,
|
|||
, mMonitor("WMFMediaDataDecoder")
|
||||
, mIsDecodeTaskDispatched(false)
|
||||
, mIsFlushing(false)
|
||||
, mIsShutDown(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -40,6 +41,9 @@ WMFMediaDataDecoder::~WMFMediaDataDecoder()
|
|||
nsresult
|
||||
WMFMediaDataDecoder::Init()
|
||||
{
|
||||
MOZ_ASSERT(!mDecoder);
|
||||
MOZ_ASSERT(!mIsShutDown);
|
||||
|
||||
mDecoder = mMFTManager->Init();
|
||||
NS_ENSURE_TRUE(mDecoder, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -49,6 +53,8 @@ WMFMediaDataDecoder::Init()
|
|||
nsresult
|
||||
WMFMediaDataDecoder::Shutdown()
|
||||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown);
|
||||
|
||||
if (mTaskQueue) {
|
||||
mTaskQueue->Dispatch(
|
||||
NS_NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessShutdown));
|
||||
|
@ -62,6 +68,7 @@ WMFMediaDataDecoder::Shutdown()
|
|||
MOZ_ASSERT(!mIsDecodeTaskDispatched);
|
||||
}
|
||||
#endif
|
||||
mIsShutDown = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -91,6 +98,9 @@ WMFMediaDataDecoder::EnsureDecodeTaskDispatched()
|
|||
nsresult
|
||||
WMFMediaDataDecoder::Input(MediaRawData* aSample)
|
||||
{
|
||||
MOZ_ASSERT(mCallback->OnReaderTaskQueue());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown);
|
||||
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
mInput.push(aSample);
|
||||
EnsureDecodeTaskDispatched();
|
||||
|
@ -172,6 +182,9 @@ WMFMediaDataDecoder::PurgeInputQueue()
|
|||
nsresult
|
||||
WMFMediaDataDecoder::Flush()
|
||||
{
|
||||
MOZ_ASSERT(mCallback->OnReaderTaskQueue());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown);
|
||||
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
PurgeInputQueue();
|
||||
mIsFlushing = true;
|
||||
|
@ -199,12 +212,17 @@ WMFMediaDataDecoder::ProcessDrain()
|
|||
nsresult
|
||||
WMFMediaDataDecoder::Drain()
|
||||
{
|
||||
MOZ_ASSERT(mCallback->OnReaderTaskQueue());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown);
|
||||
|
||||
mTaskQueue->Dispatch(NS_NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessDrain));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
WMFMediaDataDecoder::IsHardwareAccelerated() const {
|
||||
MOZ_ASSERT(!mIsShutDown);
|
||||
|
||||
return mMFTManager && mMFTManager->IsHardwareAccelerated();
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ private:
|
|||
std::queue<nsRefPtr<MediaRawData>> mInput;
|
||||
bool mIsDecodeTaskDispatched;
|
||||
bool mIsFlushing;
|
||||
bool mIsShutDown;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -0,0 +1,591 @@
|
|||
/* -*- Mode: C++; 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/. */
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "mozilla/dom/TimeRanges.h"
|
||||
#include "TimeUnits.h"
|
||||
#include "Intervals.h"
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
typedef media::Interval<uint8_t> ByteInterval;
|
||||
typedef media::Interval<int> IntInterval;
|
||||
|
||||
ByteInterval CreateByteInterval(int32_t aStart, int32_t aEnd)
|
||||
{
|
||||
ByteInterval test(aStart, aEnd);
|
||||
return test;
|
||||
}
|
||||
|
||||
media::IntervalSet<uint8_t> CreateByteIntervalSet(int32_t aStart, int32_t aEnd)
|
||||
{
|
||||
media::IntervalSet<uint8_t> test;
|
||||
test += ByteInterval(aStart, aEnd);
|
||||
return test;
|
||||
}
|
||||
|
||||
TEST(IntervalSet, Constructors)
|
||||
{
|
||||
const int32_t start = 1;
|
||||
const int32_t end = 2;
|
||||
const int32_t fuzz = 0;
|
||||
|
||||
// Compiler exercise.
|
||||
ByteInterval test1(start, end);
|
||||
ByteInterval test2(test1);
|
||||
ByteInterval test3(start, end, fuzz);
|
||||
ByteInterval test4(test3);
|
||||
ByteInterval test5 = CreateByteInterval(start, end);
|
||||
|
||||
media::IntervalSet<uint8_t> blah1(test1);
|
||||
media::IntervalSet<uint8_t> blah2 = blah1;
|
||||
media::IntervalSet<uint8_t> blah3 = blah1 + test1;
|
||||
media::IntervalSet<uint8_t> blah4 = test1 + blah1;
|
||||
media::IntervalSet<uint8_t> blah5 = CreateByteIntervalSet(start, end);
|
||||
(void)test1; (void)test2; (void)test3; (void)test4; (void)test5;
|
||||
(void)blah1; (void)blah2; (void)blah3; (void)blah4; (void)blah5;
|
||||
}
|
||||
|
||||
media::TimeInterval CreateTimeInterval(int32_t aStart, int32_t aEnd)
|
||||
{
|
||||
// Copy constructor test
|
||||
media::Microseconds startus(aStart);
|
||||
media::TimeUnit start(startus);
|
||||
media::TimeUnit end;
|
||||
// operator= test
|
||||
end = media::Microseconds(aEnd);
|
||||
media::TimeInterval ti(start, end);
|
||||
return ti;
|
||||
}
|
||||
|
||||
media::TimeIntervals CreateTimeIntervals(int32_t aStart, int32_t aEnd)
|
||||
{
|
||||
media::TimeIntervals test;
|
||||
test += CreateTimeInterval(aStart, aEnd);
|
||||
return test;
|
||||
}
|
||||
|
||||
TEST(IntervalSet, TimeIntervalsConstructors)
|
||||
{
|
||||
const media::Microseconds start(1);
|
||||
const media::Microseconds end(2);
|
||||
const media::Microseconds fuzz;
|
||||
|
||||
// Compiler exercise.
|
||||
media::TimeInterval test1(start, end);
|
||||
media::TimeInterval test2(test1);
|
||||
media::TimeInterval test3(start, end, fuzz);
|
||||
media::TimeInterval test4(test3);
|
||||
media::TimeInterval test5 = CreateTimeInterval(start.mValue, end.mValue);
|
||||
|
||||
media::TimeIntervals blah1(test1);
|
||||
media::TimeIntervals blah2(blah1);
|
||||
media::TimeIntervals blah3 = blah1 + test1;
|
||||
media::TimeIntervals blah4 = test1 + blah1;
|
||||
media::TimeIntervals blah5 = CreateTimeIntervals(start.mValue, end.mValue);
|
||||
(void)test1; (void)test2; (void)test3; (void)test4; (void)test5;
|
||||
(void)blah1; (void)blah2; (void)blah3; (void)blah4; (void)blah5;
|
||||
}
|
||||
|
||||
TEST(IntervalSet, Length)
|
||||
{
|
||||
IntInterval i(15, 25);
|
||||
EXPECT_EQ(10, i.Length());
|
||||
}
|
||||
|
||||
TEST(IntervalSet, Intersection)
|
||||
{
|
||||
IntInterval i0(10, 20);
|
||||
IntInterval i1(15, 25);
|
||||
IntInterval i = i0.Intersection(i1);
|
||||
EXPECT_EQ(15, i.mStart);
|
||||
EXPECT_EQ(20, i.mEnd);
|
||||
}
|
||||
|
||||
TEST(IntervalSet, Equals)
|
||||
{
|
||||
IntInterval i0(10, 20);
|
||||
IntInterval i1(10, 20);
|
||||
EXPECT_EQ(i0, i1);
|
||||
|
||||
IntInterval i2(5, 20);
|
||||
EXPECT_NE(i0, i2);
|
||||
|
||||
IntInterval i3(10, 15);
|
||||
EXPECT_NE(i0, i2);
|
||||
}
|
||||
|
||||
TEST(IntervalSet, IntersectionIntervalSet)
|
||||
{
|
||||
media::IntervalSet<int> i0;
|
||||
i0 += IntInterval(5, 10);
|
||||
i0 += IntInterval(20, 25);
|
||||
i0 += IntInterval(40, 60);
|
||||
|
||||
media::IntervalSet<int> i1;
|
||||
i1.Add(IntInterval(7, 15));
|
||||
i1.Add(IntInterval(16, 27));
|
||||
i1.Add(IntInterval(45, 50));
|
||||
i1.Add(IntInterval(53, 57));
|
||||
|
||||
media::IntervalSet<int> i = media::Intersection(i0, i1);
|
||||
|
||||
EXPECT_EQ(4u, i.Length());
|
||||
|
||||
EXPECT_EQ(7, i[0].mStart);
|
||||
EXPECT_EQ(10, i[0].mEnd);
|
||||
|
||||
EXPECT_EQ(20, i[1].mStart);
|
||||
EXPECT_EQ(25, i[1].mEnd);
|
||||
|
||||
EXPECT_EQ(45, i[2].mStart);
|
||||
EXPECT_EQ(50, i[2].mEnd);
|
||||
|
||||
EXPECT_EQ(53, i[3].mStart);
|
||||
EXPECT_EQ(57, i[3].mEnd);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static void Compare(media::IntervalSet<T> aI1, media::IntervalSet<T> aI2)
|
||||
{
|
||||
media::IntervalSet<T> i1(aI1);
|
||||
media::IntervalSet<T> i2(aI1);
|
||||
EXPECT_EQ(i1.Length(), i2.Length());
|
||||
if (i1.Length() != i2.Length()) {
|
||||
return;
|
||||
}
|
||||
for (uint32_t i = 0; i < i1.Length(); i++) {
|
||||
EXPECT_EQ(i1[i].mStart, i2[i].mStart);
|
||||
EXPECT_EQ(i1[i].mEnd, i2[i].mEnd);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(IntervalSet, IntersectionNormalizedIntervalSet)
|
||||
{
|
||||
media::IntervalSet<int> i0;
|
||||
i0 += IntInterval(5, 10);
|
||||
i0 += IntInterval(8, 25);
|
||||
i0 += IntInterval(24, 60);
|
||||
|
||||
media::IntervalSet<int> i1;
|
||||
i1.Add(IntInterval(7, 15));
|
||||
i1.Add(IntInterval(10, 27));
|
||||
i1.Add(IntInterval(45, 50));
|
||||
i1.Add(IntInterval(53, 57));
|
||||
|
||||
// Compare intersections to ensure an intersection of normalized intervalsets
|
||||
// is equal to the intersection of non-normalized intervalsets.
|
||||
media::IntervalSet<int> intersection = media::Intersection(i0, i1);
|
||||
|
||||
media::IntervalSet<int> i0_normalize(i0);
|
||||
i0_normalize.Normalize();
|
||||
media::IntervalSet<int> i1_normalize(i1);
|
||||
i1_normalize.Normalize();
|
||||
media::IntervalSet<int> intersection_normalize =
|
||||
media::Intersection(i0_normalize, i1_normalize);
|
||||
Compare(intersection, intersection_normalize);
|
||||
}
|
||||
|
||||
static void GeneratePermutations(media::IntervalSet<int> aI1,
|
||||
media::IntervalSet<int> aI2)
|
||||
{
|
||||
media::IntervalSet<int> i_ref = media::Intersection(aI1, aI2);
|
||||
// Test all permutations possible
|
||||
std::vector<uint32_t> comb1;
|
||||
for (uint32_t i = 0; i < aI1.Length(); i++) {
|
||||
comb1.push_back(i);
|
||||
}
|
||||
std::vector<uint32_t> comb2;
|
||||
for (uint32_t i = 0; i < aI2.Length(); i++) {
|
||||
comb2.push_back(i);
|
||||
}
|
||||
|
||||
do {
|
||||
do {
|
||||
// Create intervals according to new indexes.
|
||||
media::IntervalSet<int> i_0;
|
||||
for (uint32_t i = 0; i < comb1.size(); i++) {
|
||||
i_0 += aI1[comb1[i]];
|
||||
}
|
||||
media::IntervalSet<int> i_1;
|
||||
for (uint32_t i = 0; i < comb2.size(); i++) {
|
||||
i_1 += aI2[comb2[i]];
|
||||
}
|
||||
// Check intersections yield the same result.
|
||||
Compare(i_0.Intersection(i_1), i_ref);
|
||||
} while (std::next_permutation(comb2.begin(), comb2.end()));
|
||||
} while (std::next_permutation(comb1.begin(), comb1.end()));
|
||||
}
|
||||
|
||||
TEST(IntervalSet, IntersectionUnorderedIntervalSet)
|
||||
{
|
||||
media::IntervalSet<int> i0;
|
||||
i0 += IntInterval(5, 10);
|
||||
i0 += IntInterval(20, 25);
|
||||
i0 += IntInterval(40, 60);
|
||||
|
||||
media::IntervalSet<int> i1;
|
||||
i1.Add(IntInterval(7, 15));
|
||||
i1.Add(IntInterval(16, 27));
|
||||
i1.Add(IntInterval(45, 50));
|
||||
i1.Add(IntInterval(53, 57));
|
||||
|
||||
GeneratePermutations(i0, i1);
|
||||
}
|
||||
|
||||
TEST(IntervalSet, IntersectionUnorderedNonNormalizedIntervalSet)
|
||||
{
|
||||
media::IntervalSet<int> i0;
|
||||
i0 += IntInterval(5, 10);
|
||||
i0 += IntInterval(8, 25);
|
||||
i0 += IntInterval(24, 60);
|
||||
|
||||
media::IntervalSet<int> i1;
|
||||
i1.Add(IntInterval(7, 15));
|
||||
i1.Add(IntInterval(10, 27));
|
||||
i1.Add(IntInterval(45, 50));
|
||||
i1.Add(IntInterval(53, 57));
|
||||
|
||||
GeneratePermutations(i0, i1);
|
||||
}
|
||||
|
||||
static media::IntervalSet<int> Duplicate(const media::IntervalSet<int>& aValue)
|
||||
{
|
||||
media::IntervalSet<int> value(aValue);
|
||||
return value;
|
||||
}
|
||||
|
||||
TEST(IntervalSet, Normalize)
|
||||
{
|
||||
media::IntervalSet<int> i;
|
||||
// Test IntervalSet<T> + Interval<T> operator.
|
||||
i = i + IntInterval(20, 30);
|
||||
// Test Internal<T> + IntervalSet<T> operator.
|
||||
i = IntInterval(2, 7) + i;
|
||||
// Test Interval<T> + IntervalSet<T> operator
|
||||
i = IntInterval(1, 8) + i;
|
||||
media::IntervalSet<int> interval;
|
||||
interval += IntInterval(5, 10);
|
||||
// Test += with move.
|
||||
i += Duplicate(interval);
|
||||
// Test = with move and add with move.
|
||||
i = Duplicate(interval) + i;
|
||||
|
||||
media::IntervalSet<int> o(i);
|
||||
o.Normalize();
|
||||
|
||||
EXPECT_EQ(2u, o.Length());
|
||||
|
||||
EXPECT_EQ(1, o[0].mStart);
|
||||
EXPECT_EQ(10, o[0].mEnd);
|
||||
|
||||
EXPECT_EQ(20, o[1].mStart);
|
||||
EXPECT_EQ(30, o[1].mEnd);
|
||||
}
|
||||
|
||||
TEST(IntervalSet, Union)
|
||||
{
|
||||
media::IntervalSet<int> i0;
|
||||
i0 += IntInterval(5, 10);
|
||||
i0 += IntInterval(20, 25);
|
||||
i0 += IntInterval(40, 60);
|
||||
|
||||
media::IntervalSet<int> i1;
|
||||
i1.Add(IntInterval(7, 15));
|
||||
i1.Add(IntInterval(16, 27));
|
||||
i1.Add(IntInterval(45, 50));
|
||||
i1.Add(IntInterval(53, 57));
|
||||
|
||||
media::IntervalSet<int> i = media::Union(i0, i1);
|
||||
|
||||
EXPECT_EQ(3u, i.Length());
|
||||
|
||||
EXPECT_EQ(5, i[0].mStart);
|
||||
EXPECT_EQ(15, i[0].mEnd);
|
||||
|
||||
EXPECT_EQ(16, i[1].mStart);
|
||||
EXPECT_EQ(27, i[1].mEnd);
|
||||
|
||||
EXPECT_EQ(40, i[2].mStart);
|
||||
EXPECT_EQ(60, i[2].mEnd);
|
||||
}
|
||||
|
||||
TEST(IntervalSet, UnionNotOrdered)
|
||||
{
|
||||
media::IntervalSet<int> i0;
|
||||
i0 += IntInterval(20, 25);
|
||||
i0 += IntInterval(40, 60);
|
||||
i0 += IntInterval(5, 10);
|
||||
|
||||
media::IntervalSet<int> i1;
|
||||
i1.Add(IntInterval(16, 27));
|
||||
i1.Add(IntInterval(7, 15));
|
||||
i1.Add(IntInterval(53, 57));
|
||||
i1.Add(IntInterval(45, 50));
|
||||
|
||||
media::IntervalSet<int> i = media::Union(i0, i1);
|
||||
|
||||
EXPECT_EQ(3u, i.Length());
|
||||
|
||||
EXPECT_EQ(5, i[0].mStart);
|
||||
EXPECT_EQ(15, i[0].mEnd);
|
||||
|
||||
EXPECT_EQ(16, i[1].mStart);
|
||||
EXPECT_EQ(27, i[1].mEnd);
|
||||
|
||||
EXPECT_EQ(40, i[2].mStart);
|
||||
EXPECT_EQ(60, i[2].mEnd);
|
||||
}
|
||||
|
||||
TEST(IntervalSet, NormalizeFuzz)
|
||||
{
|
||||
media::IntervalSet<int> i0;
|
||||
i0 += IntInterval(11, 25, 0);
|
||||
i0 += IntInterval(5, 10, 1);
|
||||
i0 += IntInterval(40, 60, 1);
|
||||
i0.Normalize();
|
||||
|
||||
EXPECT_EQ(2u, i0.Length());
|
||||
|
||||
EXPECT_EQ(5, i0[0].mStart);
|
||||
EXPECT_EQ(25, i0[0].mEnd);
|
||||
|
||||
EXPECT_EQ(40, i0[1].mStart);
|
||||
EXPECT_EQ(60, i0[1].mEnd);
|
||||
}
|
||||
|
||||
TEST(IntervalSet, UnionFuzz)
|
||||
{
|
||||
media::IntervalSet<int> i0;
|
||||
i0 += IntInterval(5, 10, 1);
|
||||
i0 += IntInterval(11, 25, 0);
|
||||
i0 += IntInterval(40, 60, 1);
|
||||
|
||||
media::IntervalSet<int> i1;
|
||||
i1.Add(IntInterval(7, 15, 1));
|
||||
i1.Add(IntInterval(16, 27, 1));
|
||||
i1.Add(IntInterval(45, 50, 1));
|
||||
i1.Add(IntInterval(53, 57, 1));
|
||||
|
||||
media::IntervalSet<int> i = media::Union(i0, i1);
|
||||
|
||||
EXPECT_EQ(2u, i.Length());
|
||||
|
||||
EXPECT_EQ(5, i[0].mStart);
|
||||
EXPECT_EQ(27, i[0].mEnd);
|
||||
|
||||
EXPECT_EQ(40, i[1].mStart);
|
||||
EXPECT_EQ(60, i[1].mEnd);
|
||||
|
||||
i0.Normalize();
|
||||
EXPECT_EQ(2u, i0.Length());
|
||||
EXPECT_EQ(5, i0[0].mStart);
|
||||
EXPECT_EQ(25, i0[0].mEnd);
|
||||
EXPECT_EQ(40, i0[1].mStart);
|
||||
EXPECT_EQ(60, i0[1].mEnd);
|
||||
}
|
||||
|
||||
TEST(IntervalSet, Contiguous)
|
||||
{
|
||||
EXPECT_FALSE(IntInterval(5, 10).Contiguous(IntInterval(11, 25)));
|
||||
EXPECT_TRUE(IntInterval(5, 10).Contiguous(IntInterval(10, 25)));
|
||||
EXPECT_TRUE(IntInterval(5, 10, 1).Contiguous(IntInterval(11, 25)));
|
||||
EXPECT_TRUE(IntInterval(5, 10).Contiguous(IntInterval(11, 25, 1)));
|
||||
}
|
||||
|
||||
TEST(IntervalSet, TimeRangesSeconds)
|
||||
{
|
||||
media::TimeIntervals i0;
|
||||
i0 += media::TimeInterval(media::TimeUnit::FromSeconds(20), media::TimeUnit::FromSeconds(25));
|
||||
i0 += media::TimeInterval(media::TimeUnit::FromSeconds(40), media::TimeUnit::FromSeconds(60));
|
||||
i0 += media::TimeInterval(media::TimeUnit::FromSeconds(5), media::TimeUnit::FromSeconds(10));
|
||||
|
||||
media::TimeIntervals i1;
|
||||
i1.Add(media::TimeInterval(media::TimeUnit::FromSeconds(16), media::TimeUnit::FromSeconds(27)));
|
||||
i1.Add(media::TimeInterval(media::TimeUnit::FromSeconds(7), media::TimeUnit::FromSeconds(15)));
|
||||
i1.Add(media::TimeInterval(media::TimeUnit::FromSeconds(53), media::TimeUnit::FromSeconds(57)));
|
||||
i1.Add(media::TimeInterval(media::TimeUnit::FromSeconds(45), media::TimeUnit::FromSeconds(50)));
|
||||
|
||||
media::TimeIntervals i(i0 + i1);
|
||||
nsRefPtr<dom::TimeRanges> tr = new dom::TimeRanges();
|
||||
i.ToTimeRanges(tr);
|
||||
EXPECT_EQ(tr->Length(), i.Length());
|
||||
for (dom::TimeRanges::index_type index = 0; index < tr->Length(); index++) {
|
||||
ErrorResult rv;
|
||||
EXPECT_EQ(tr->Start(index, rv), i[index].mStart.ToSeconds());
|
||||
EXPECT_EQ(tr->Start(index, rv), i.Start(index).ToSeconds());
|
||||
EXPECT_EQ(tr->End(index, rv), i[index].mEnd.ToSeconds());
|
||||
EXPECT_EQ(tr->End(index, rv), i.End(index).ToSeconds());
|
||||
}
|
||||
|
||||
i.Normalize();
|
||||
tr->Normalize();
|
||||
EXPECT_EQ(tr->Length(), i.Length());
|
||||
for (dom::TimeRanges::index_type index = 0; index < tr->Length(); index++) {
|
||||
ErrorResult rv;
|
||||
EXPECT_EQ(tr->Start(index, rv), i[index].mStart.ToSeconds());
|
||||
EXPECT_EQ(tr->Start(index, rv), i.Start(index).ToSeconds());
|
||||
EXPECT_EQ(tr->End(index, rv), i[index].mEnd.ToSeconds());
|
||||
EXPECT_EQ(tr->End(index, rv), i.End(index).ToSeconds());
|
||||
}
|
||||
}
|
||||
|
||||
static void CheckTimeRanges(dom::TimeRanges* aTr, const media::TimeIntervals& aTi)
|
||||
{
|
||||
EXPECT_EQ(aTr->Length(), aTi.Length());
|
||||
for (dom::TimeRanges::index_type i = 0; i < aTr->Length(); i++) {
|
||||
ErrorResult rv;
|
||||
EXPECT_EQ(aTr->Start(i, rv), aTi[i].mStart.ToSeconds());
|
||||
EXPECT_EQ(aTr->Start(i, rv), aTi.Start(i).ToSeconds());
|
||||
EXPECT_EQ(aTr->End(i, rv), aTi[i].mEnd.ToSeconds());
|
||||
EXPECT_EQ(aTr->End(i, rv), aTi.End(i).ToSeconds());
|
||||
}
|
||||
}
|
||||
|
||||
TEST(IntervalSet, TimeRangesConversion)
|
||||
{
|
||||
nsRefPtr<dom::TimeRanges> tr = new dom::TimeRanges();
|
||||
tr->Add(20, 25);
|
||||
tr->Add(40, 60);
|
||||
tr->Add(5, 10);
|
||||
tr->Add(16, 27);
|
||||
tr->Add(53, 57);
|
||||
tr->Add(45, 50);
|
||||
|
||||
// explicit copy constructor
|
||||
media::TimeIntervals i1(tr);
|
||||
CheckTimeRanges(tr, i1);
|
||||
|
||||
// static FromTimeRanges
|
||||
media::TimeIntervals i2 = media::TimeIntervals::FromTimeRanges(tr);
|
||||
CheckTimeRanges(tr, i2);
|
||||
|
||||
media::TimeIntervals i3;
|
||||
// operator=(TimeRanges*)
|
||||
i3 = tr;
|
||||
CheckTimeRanges(tr, i3);
|
||||
|
||||
i1.Normalize();
|
||||
tr->Normalize();
|
||||
|
||||
CheckTimeRanges(tr, i1);
|
||||
|
||||
// operator= test
|
||||
i1 = tr.get();
|
||||
CheckTimeRanges(tr, i1);
|
||||
}
|
||||
|
||||
TEST(IntervalSet, TimeRangesMicroseconds)
|
||||
{
|
||||
media::TimeIntervals i0;
|
||||
|
||||
// Test media::Microseconds and TimeUnit interchangeability (compilation only)
|
||||
media::TimeUnit time1{media::Microseconds(5)};
|
||||
media::Microseconds microseconds(5);
|
||||
media::TimeUnit time2 = media::TimeUnit(microseconds);
|
||||
EXPECT_EQ(time1, time2);
|
||||
|
||||
i0 += media::TimeInterval(media::Microseconds(20), media::Microseconds(25));
|
||||
i0 += media::TimeInterval(media::Microseconds(40), media::Microseconds(60));
|
||||
i0 += media::TimeInterval(media::Microseconds(5), media::Microseconds(10));
|
||||
|
||||
media::TimeIntervals i1;
|
||||
i1.Add(media::TimeInterval(media::Microseconds(16), media::Microseconds(27)));
|
||||
i1.Add(media::TimeInterval(media::Microseconds(7), media::Microseconds(15)));
|
||||
i1.Add(media::TimeInterval(media::Microseconds(53), media::Microseconds(57)));
|
||||
i1.Add(media::TimeInterval(media::Microseconds(45), media::Microseconds(50)));
|
||||
|
||||
media::TimeIntervals i(i0 + i1);
|
||||
nsRefPtr<dom::TimeRanges> tr = new dom::TimeRanges();
|
||||
i.ToTimeRanges(tr);
|
||||
EXPECT_EQ(tr->Length(), i.Length());
|
||||
for (dom::TimeRanges::index_type index = 0; index < tr->Length(); index++) {
|
||||
ErrorResult rv;
|
||||
EXPECT_EQ(tr->Start(index, rv), i[index].mStart.ToSeconds());
|
||||
EXPECT_EQ(tr->Start(index, rv), i.Start(index).ToSeconds());
|
||||
EXPECT_EQ(tr->End(index, rv), i[index].mEnd.ToSeconds());
|
||||
EXPECT_EQ(tr->End(index, rv), i.End(index).ToSeconds());
|
||||
}
|
||||
|
||||
i.Normalize();
|
||||
tr->Normalize();
|
||||
EXPECT_EQ(tr->Length(), i.Length());
|
||||
for (dom::TimeRanges::index_type index = 0; index < tr->Length(); index++) {
|
||||
ErrorResult rv;
|
||||
EXPECT_EQ(tr->Start(index, rv), i[index].mStart.ToSeconds());
|
||||
EXPECT_EQ(tr->Start(index, rv), i.Start(index).ToSeconds());
|
||||
EXPECT_EQ(tr->End(index, rv), i[index].mEnd.ToSeconds());
|
||||
EXPECT_EQ(tr->End(index, rv), i.End(index).ToSeconds());
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
class Foo
|
||||
{
|
||||
public:
|
||||
Foo()
|
||||
: mArg1(1)
|
||||
, mArg2(2)
|
||||
, mArg3(3)
|
||||
{}
|
||||
|
||||
Foo(T a1, T a2, T a3)
|
||||
: mArg1(a1)
|
||||
, mArg2(a2)
|
||||
, mArg3(a3)
|
||||
{}
|
||||
|
||||
Foo<T> operator+ (const Foo<T>& aOther) const
|
||||
{
|
||||
Foo<T> blah;
|
||||
blah.mArg1 += aOther.mArg1;
|
||||
blah.mArg2 += aOther.mArg2;
|
||||
blah.mArg3 += aOther.mArg3;
|
||||
return blah;
|
||||
}
|
||||
Foo<T> operator- (const Foo<T>& aOther) const
|
||||
{
|
||||
Foo<T> blah;
|
||||
blah.mArg1 -= aOther.mArg1;
|
||||
blah.mArg2 -= aOther.mArg2;
|
||||
blah.mArg3 -= aOther.mArg3;
|
||||
return blah;
|
||||
}
|
||||
bool operator< (const Foo<T>& aOther) const
|
||||
{
|
||||
return mArg1 < aOther.mArg1;
|
||||
}
|
||||
bool operator== (const Foo<T>& aOther) const
|
||||
{
|
||||
return mArg1 == aOther.mArg1;
|
||||
}
|
||||
bool operator<= (const Foo<T>& aOther) const
|
||||
{
|
||||
return mArg1 <= aOther.mArg1;
|
||||
}
|
||||
|
||||
private:
|
||||
int32_t mArg1;
|
||||
int32_t mArg2;
|
||||
int32_t mArg3;
|
||||
};
|
||||
|
||||
TEST(IntervalSet, FooIntervalSet)
|
||||
{
|
||||
media::Interval<Foo<int>> i(Foo<int>(), Foo<int>(4,5,6));
|
||||
media::IntervalSet<Foo<int>> is;
|
||||
is += i;
|
||||
is += i;
|
||||
is.Add(i);
|
||||
is = is + i;
|
||||
is = i + is;
|
||||
EXPECT_EQ(5u, is.Length());
|
||||
is.Normalize();
|
||||
EXPECT_EQ(1u, is.Length());
|
||||
EXPECT_EQ(Foo<int>(), is[0].mStart);
|
||||
EXPECT_EQ(Foo<int>(4,5,6), is[0].mEnd);
|
||||
}
|
|
@ -9,6 +9,7 @@ UNIFIED_SOURCES += [
|
|||
'TestAudioCompactor.cpp',
|
||||
'TestGMPCrossOrigin.cpp',
|
||||
'TestGMPRemoveAndDelete.cpp',
|
||||
'TestIntervalSet.cpp',
|
||||
'TestMP4Demuxer.cpp',
|
||||
'TestMP4Reader.cpp',
|
||||
'TestTrackEncoder.cpp',
|
||||
|
|
|
@ -113,6 +113,7 @@ EXPORTS += [
|
|||
'EncodedBufferCache.h',
|
||||
'FileBlockCache.h',
|
||||
'GraphDriver.h',
|
||||
'Intervals.h',
|
||||
'Latency.h',
|
||||
'MediaCache.h',
|
||||
'MediaData.h',
|
||||
|
@ -156,6 +157,14 @@ EXPORTS.mozilla += [
|
|||
'MediaManager.h',
|
||||
]
|
||||
|
||||
EXPORTS.mozilla.media.webrtc += [
|
||||
'webrtc/WebrtcGlobal.h',
|
||||
]
|
||||
|
||||
IPDL_SOURCES += [
|
||||
'webrtc/PWebrtcGlobal.ipdl'
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_B2G']:
|
||||
EXPORTS.mozilla += [
|
||||
'MediaPermissionGonk.h',
|
||||
|
|
|
@ -43,6 +43,11 @@ public:
|
|||
virtual void InputExhausted() override;
|
||||
virtual void Error() override;
|
||||
|
||||
virtual bool OnReaderTaskQueue() override
|
||||
{
|
||||
return mReader->OnTaskQueue();
|
||||
}
|
||||
|
||||
IntelWebMVideoDecoder(WebMReader* aReader);
|
||||
~IntelWebMVideoDecoder();
|
||||
|
||||
|
|
|
@ -394,7 +394,9 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar,
|
|||
if (!CallNPN_GetValue_NPNVdocumentOrigin(&v, &result)) {
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
if (result == NPERR_NO_ERROR) {
|
||||
if (result == NPERR_NO_ERROR ||
|
||||
(GetQuirks() &
|
||||
PluginModuleChild::QUIRK_FLASH_RETURN_EMPTY_DOCUMENT_ORIGIN)) {
|
||||
*static_cast<char**>(aValue) = ToNewCString(v);
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -2124,15 +2124,18 @@ PluginModuleChild::InitQuirksModes(const nsCString& aMimeType)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef OS_WIN
|
||||
if (specialType == nsPluginHost::eSpecialType_Flash) {
|
||||
mQuirks |= QUIRK_FLASH_RETURN_EMPTY_DOCUMENT_ORIGIN;
|
||||
#ifdef OS_WIN
|
||||
mQuirks |= QUIRK_WINLESS_TRACKPOPUP_HOOK;
|
||||
mQuirks |= QUIRK_FLASH_THROTTLE_WMUSER_EVENTS;
|
||||
mQuirks |= QUIRK_FLASH_HOOK_SETLONGPTR;
|
||||
mQuirks |= QUIRK_FLASH_HOOK_GETWINDOWINFO;
|
||||
mQuirks |= QUIRK_FLASH_FIXUP_MOUSE_CAPTURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef OS_WIN
|
||||
// QuickTime plugin usually loaded with audio/mpeg mimetype
|
||||
NS_NAMED_LITERAL_CSTRING(quicktime, "npqtplugin");
|
||||
if (FindInReadable(quicktime, mPluginFilename)) {
|
||||
|
|
|
@ -282,6 +282,10 @@ public:
|
|||
// CGContextRef we pass to it in NPP_HandleEvent(NPCocoaEventDrawRect)
|
||||
// outside of that call. See bug 804606.
|
||||
QUIRK_FLASH_AVOID_CGMODE_CRASHES = 1 << 10,
|
||||
// Work around a Flash bug where it fails to check the error code of a
|
||||
// NPN_GetValue(NPNVdocumentOrigin) call before trying to dereference
|
||||
// its char* output.
|
||||
QUIRK_FLASH_RETURN_EMPTY_DOCUMENT_ORIGIN = 1 << 11,
|
||||
};
|
||||
|
||||
int GetQuirks() { return mQuirks; }
|
||||
|
|
|
@ -135,35 +135,37 @@ PRLogModuleInfo* XULDocument::gXULLog;
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
struct BroadcasterMapEntry : public PLDHashEntryHdr {
|
||||
Element* mBroadcaster; // [WEAK]
|
||||
nsSmallVoidArray mListeners; // [OWNING] of BroadcastListener objects
|
||||
};
|
||||
|
||||
struct BroadcastListener {
|
||||
nsWeakPtr mListener;
|
||||
nsCOMPtr<nsIAtom> mAttribute;
|
||||
};
|
||||
|
||||
struct BroadcasterMapEntry : public PLDHashEntryHdr
|
||||
{
|
||||
Element* mBroadcaster; // [WEAK]
|
||||
nsTArray<BroadcastListener*> mListeners; // [OWNING] of BroadcastListener objects
|
||||
};
|
||||
|
||||
Element*
|
||||
nsRefMapEntry::GetFirstElement()
|
||||
{
|
||||
return static_cast<Element*>(mRefContentList.SafeElementAt(0));
|
||||
return mRefContentList.SafeElementAt(0);
|
||||
}
|
||||
|
||||
void
|
||||
nsRefMapEntry::AppendAll(nsCOMArray<nsIContent>* aElements)
|
||||
{
|
||||
for (int32_t i = 0; i < mRefContentList.Count(); ++i) {
|
||||
aElements->AppendObject(static_cast<nsIContent*>(mRefContentList[i]));
|
||||
for (size_t i = 0; i < mRefContentList.Length(); ++i) {
|
||||
aElements->AppendObject(mRefContentList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
nsRefMapEntry::AddElement(Element* aElement)
|
||||
{
|
||||
if (mRefContentList.IndexOf(aElement) >= 0)
|
||||
if (mRefContentList.Contains(aElement)) {
|
||||
return true;
|
||||
}
|
||||
return mRefContentList.AppendElement(aElement);
|
||||
}
|
||||
|
||||
|
@ -171,7 +173,7 @@ bool
|
|||
nsRefMapEntry::RemoveElement(Element* aElement)
|
||||
{
|
||||
mRefContentList.RemoveElement(aElement);
|
||||
return mRefContentList.Count() == 0;
|
||||
return mRefContentList.IsEmpty();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -618,13 +620,14 @@ ClearBroadcasterMapEntry(PLDHashTable* aTable, PLDHashEntryHdr* aEntry)
|
|||
{
|
||||
BroadcasterMapEntry* entry =
|
||||
static_cast<BroadcasterMapEntry*>(aEntry);
|
||||
for (int32_t i = entry->mListeners.Count() - 1; i >= 0; --i) {
|
||||
delete (BroadcastListener*)entry->mListeners[i];
|
||||
for (size_t i = entry->mListeners.Length() - 1; i != (size_t)-1; --i) {
|
||||
delete entry->mListeners[i];
|
||||
}
|
||||
entry->mListeners.Clear();
|
||||
|
||||
// N.B. that we need to manually run the dtor because we
|
||||
// constructed the nsSmallVoidArray object in-place.
|
||||
entry->mListeners.~nsSmallVoidArray();
|
||||
// constructed the nsTArray object in-place.
|
||||
entry->mListeners.~nsTArray<BroadcastListener*>();
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -786,26 +789,22 @@ XULDocument::AddBroadcastListenerFor(Element& aBroadcaster, Element& aListener,
|
|||
|
||||
entry->mBroadcaster = &aBroadcaster;
|
||||
|
||||
// N.B. placement new to construct the nsSmallVoidArray object
|
||||
// in-place
|
||||
new (&entry->mListeners) nsSmallVoidArray();
|
||||
// N.B. placement new to construct the nsTArray object in-place
|
||||
new (&entry->mListeners) nsTArray<BroadcastListener*>();
|
||||
}
|
||||
|
||||
// Only add the listener if it's not there already!
|
||||
nsCOMPtr<nsIAtom> attr = do_GetAtom(aAttr);
|
||||
|
||||
BroadcastListener* bl;
|
||||
for (int32_t i = entry->mListeners.Count() - 1; i >= 0; --i) {
|
||||
bl = static_cast<BroadcastListener*>(entry->mListeners[i]);
|
||||
|
||||
for (size_t i = entry->mListeners.Length() - 1; i != (size_t)-1; --i) {
|
||||
BroadcastListener* bl = entry->mListeners[i];
|
||||
nsCOMPtr<Element> blListener = do_QueryReferent(bl->mListener);
|
||||
|
||||
if (blListener == &aListener && bl->mAttribute == attr)
|
||||
return;
|
||||
}
|
||||
|
||||
bl = new BroadcastListener;
|
||||
|
||||
BroadcastListener* bl = new BroadcastListener;
|
||||
bl->mListener = do_GetWeakReference(&aListener);
|
||||
bl->mAttribute = attr;
|
||||
|
||||
|
@ -842,17 +841,15 @@ XULDocument::RemoveBroadcastListenerFor(Element& aBroadcaster,
|
|||
|
||||
if (entry) {
|
||||
nsCOMPtr<nsIAtom> attr = do_GetAtom(aAttr);
|
||||
for (int32_t i = entry->mListeners.Count() - 1; i >= 0; --i) {
|
||||
BroadcastListener* bl =
|
||||
static_cast<BroadcastListener*>(entry->mListeners[i]);
|
||||
|
||||
for (size_t i = entry->mListeners.Length() - 1; i != (size_t)-1; --i) {
|
||||
BroadcastListener* bl = entry->mListeners[i];
|
||||
nsCOMPtr<Element> blListener = do_QueryReferent(bl->mListener);
|
||||
|
||||
if (blListener == &aListener && bl->mAttribute == attr) {
|
||||
entry->mListeners.RemoveElementAt(i);
|
||||
delete bl;
|
||||
|
||||
if (entry->mListeners.Count() == 0)
|
||||
if (entry->mListeners.IsEmpty())
|
||||
PL_DHashTableRemove(mBroadcasterMap, &aBroadcaster);
|
||||
|
||||
break;
|
||||
|
@ -967,11 +964,8 @@ XULDocument::AttributeChanged(nsIDocument* aDocument,
|
|||
nsAutoString value;
|
||||
bool attrSet = aElement->GetAttr(kNameSpaceID_None, aAttribute, value);
|
||||
|
||||
int32_t i;
|
||||
for (i = entry->mListeners.Count() - 1; i >= 0; --i) {
|
||||
BroadcastListener* bl =
|
||||
static_cast<BroadcastListener*>(entry->mListeners[i]);
|
||||
|
||||
for (size_t i = entry->mListeners.Length() - 1; i != (size_t)-1; --i) {
|
||||
BroadcastListener* bl = entry->mListeners[i];
|
||||
if ((bl->mAttribute == aAttribute) ||
|
||||
(bl->mAttribute == nsGkAtoms::_asterisk)) {
|
||||
nsCOMPtr<Element> listenerEl
|
||||
|
@ -4157,10 +4151,8 @@ XULDocument::BroadcastAttributeChangeFromOverlay(nsIContent* aNode,
|
|||
return rv;
|
||||
|
||||
// We've got listeners: push the value.
|
||||
int32_t i;
|
||||
for (i = entry->mListeners.Count() - 1; i >= 0; --i) {
|
||||
BroadcastListener* bl = static_cast<BroadcastListener*>
|
||||
(entry->mListeners[i]);
|
||||
for (size_t i = entry->mListeners.Length() - 1; i != (size_t)-1; --i) {
|
||||
BroadcastListener* bl = entry->mListeners[i];
|
||||
|
||||
if ((bl->mAttribute != aAttribute) &&
|
||||
(bl->mAttribute != nsGkAtoms::_asterisk))
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
bool RemoveElement(mozilla::dom::Element* aElement);
|
||||
|
||||
private:
|
||||
nsSmallVoidArray mRefContentList;
|
||||
nsTArray<mozilla::dom::Element*> mRefContentList;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -788,9 +788,21 @@ DrawTargetD2D1::Init(ID3D11Texture2D* aTexture, SurfaceFormat aFormat)
|
|||
return false;
|
||||
}
|
||||
|
||||
// This single solid color brush system is not very 'threadsafe', however,
|
||||
// issueing multiple drawing commands simultaneously to a single drawtarget
|
||||
// from multiple threads is unexpected since there's no way to guarantee
|
||||
// ordering in that situation anyway.
|
||||
hr = mDC->CreateSolidColorBrush(D2D1::ColorF(0, 0), byRef(mSolidColorBrush));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << "[D2D1.1] Failure creating solid color brush.";
|
||||
return false;
|
||||
}
|
||||
|
||||
mDC->SetTarget(mBitmap);
|
||||
|
||||
mDC->BeginDraw();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -843,6 +855,13 @@ DrawTargetD2D1::Init(const IntSize &aSize, SurfaceFormat aFormat)
|
|||
|
||||
mDC->SetTarget(mBitmap);
|
||||
|
||||
hr = mDC->CreateSolidColorBrush(D2D1::ColorF(0, 0), byRef(mSolidColorBrush));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << "[D2D1.1] Failure creating solid color brush.";
|
||||
return false;
|
||||
}
|
||||
|
||||
mDC->BeginDraw();
|
||||
|
||||
mDC->Clear();
|
||||
|
@ -1262,8 +1281,14 @@ DrawTargetD2D1::PopClipsFromDC(ID2D1DeviceContext *aDC)
|
|||
TemporaryRef<ID2D1Brush>
|
||||
DrawTargetD2D1::CreateTransparentBlackBrush()
|
||||
{
|
||||
RefPtr<ID2D1SolidColorBrush> brush;
|
||||
mDC->CreateSolidColorBrush(D2D1::ColorF(0, 0), byRef(brush));
|
||||
return GetSolidColorBrush(D2D1::ColorF(0, 0));
|
||||
}
|
||||
|
||||
TemporaryRef<ID2D1SolidColorBrush>
|
||||
DrawTargetD2D1::GetSolidColorBrush(const D2D_COLOR_F& aColor)
|
||||
{
|
||||
RefPtr<ID2D1SolidColorBrush> brush = mSolidColorBrush;
|
||||
brush->SetColor(aColor);
|
||||
return brush;
|
||||
}
|
||||
|
||||
|
@ -1271,19 +1296,12 @@ TemporaryRef<ID2D1Brush>
|
|||
DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
|
||||
{
|
||||
if (!IsPatternSupportedByD2D(aPattern)) {
|
||||
RefPtr<ID2D1SolidColorBrush> colBrush;
|
||||
mDC->CreateSolidColorBrush(D2D1::ColorF(1.0f, 1.0f, 1.0f, 1.0f), byRef(colBrush));
|
||||
return colBrush.forget();
|
||||
return GetSolidColorBrush(D2D1::ColorF(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
}
|
||||
|
||||
if (aPattern.GetType() == PatternType::COLOR) {
|
||||
RefPtr<ID2D1SolidColorBrush> colBrush;
|
||||
Color color = static_cast<const ColorPattern*>(&aPattern)->mColor;
|
||||
mDC->CreateSolidColorBrush(D2D1::ColorF(color.r, color.g,
|
||||
color.b, color.a),
|
||||
D2D1::BrushProperties(aAlpha),
|
||||
byRef(colBrush));
|
||||
return colBrush.forget();
|
||||
return GetSolidColorBrush(D2D1::ColorF(color.r, color.g, color.b, color.a * aAlpha));
|
||||
}
|
||||
if (aPattern.GetType() == PatternType::LINEAR_GRADIENT) {
|
||||
RefPtr<ID2D1LinearGradientBrush> gradBrush;
|
||||
|
@ -1298,14 +1316,11 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
|
|||
}
|
||||
|
||||
if (pat->mBegin == pat->mEnd) {
|
||||
RefPtr<ID2D1SolidColorBrush> colBrush;
|
||||
uint32_t stopCount = stops->mStopCollection->GetGradientStopCount();
|
||||
vector<D2D1_GRADIENT_STOP> d2dStops(stopCount);
|
||||
stops->mStopCollection->GetGradientStops(&d2dStops.front(), stopCount);
|
||||
mDC->CreateSolidColorBrush(d2dStops.back().color,
|
||||
D2D1::BrushProperties(aAlpha),
|
||||
byRef(colBrush));
|
||||
return colBrush.forget();
|
||||
d2dStops.back().color.a *= aAlpha;
|
||||
return GetSolidColorBrush(d2dStops.back().color);
|
||||
}
|
||||
|
||||
mDC->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties(D2DPoint(pat->mBegin),
|
||||
|
@ -1391,6 +1406,12 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
|
|||
D2DInterpolationMode(pat->mFilter)),
|
||||
D2D1::BrushProperties(aAlpha, D2DMatrix(mat)),
|
||||
byRef(imageBrush));
|
||||
|
||||
if (!imageBrush) {
|
||||
gfxWarning() << "Couldn't create image brush!";
|
||||
return CreateTransparentBlackBrush();
|
||||
}
|
||||
|
||||
return imageBrush.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -183,6 +183,7 @@ private:
|
|||
void PopClipsFromDC(ID2D1DeviceContext *aDC);
|
||||
|
||||
TemporaryRef<ID2D1Brush> CreateTransparentBlackBrush();
|
||||
TemporaryRef<ID2D1SolidColorBrush> GetSolidColorBrush(const D2D_COLOR_F& aColor);
|
||||
TemporaryRef<ID2D1Brush> CreateBrushForPattern(const Pattern &aPattern, Float aAlpha = 1.0f);
|
||||
|
||||
void PushD2DLayer(ID2D1DeviceContext *aDC, ID2D1Geometry *aGeometry, const D2D1_MATRIX_3X2_F &aTransform);
|
||||
|
@ -201,6 +202,8 @@ private:
|
|||
RefPtr<ID2D1Bitmap1> mTempBitmap;
|
||||
RefPtr<ID2D1Effect> mBlendEffect;
|
||||
|
||||
RefPtr<ID2D1SolidColorBrush> mSolidColorBrush;
|
||||
|
||||
// We store this to prevent excessive SetTextRenderingParams calls.
|
||||
RefPtr<IDWriteRenderingParams> mTextRenderingParams;
|
||||
|
||||
|
|
|
@ -661,7 +661,14 @@ CompositorParent::CompositorParent(nsIWidget* aWidget,
|
|||
sIndirectLayerTrees[mRootLayerTreeID].mParent = this;
|
||||
}
|
||||
|
||||
if (gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (gfxPrefs::AsyncPanZoomEnabled() &&
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_GTK)
|
||||
// For desktop platforms we only want to use APZ in e10s-enabled windows.
|
||||
// If we ever get input events off the main thread we can consider
|
||||
// relaxing this requirement.
|
||||
aWidget->IsMultiProcessWindow() &&
|
||||
#endif
|
||||
(aWidget->WindowType() == eWindowType_toplevel || aWidget->WindowType() == eWindowType_child)) {
|
||||
mApzcTreeManager = new APZCTreeManager();
|
||||
}
|
||||
|
||||
|
|
|
@ -1435,7 +1435,7 @@ FilterSupport::PostFilterExtentsForPrimitive(const FilterPrimitiveDescription& a
|
|||
switch (aDescription.Type()) {
|
||||
|
||||
case PrimitiveType::Empty:
|
||||
return nsIntRect();
|
||||
return IntRect();
|
||||
|
||||
case PrimitiveType::Composite:
|
||||
{
|
||||
|
@ -1472,7 +1472,7 @@ FilterSupport::PostFilterExtentsForPrimitive(const FilterPrimitiveDescription& a
|
|||
case PrimitiveType::Flood:
|
||||
{
|
||||
if (atts.GetColor(eFloodColor).a == 0.0f) {
|
||||
return nsIntRect();
|
||||
return IntRect();
|
||||
}
|
||||
return aDescription.PrimitiveSubregion();
|
||||
}
|
||||
|
@ -1583,7 +1583,7 @@ SourceNeededRegionForPrimitive(const FilterPrimitiveDescription& aDescription,
|
|||
}
|
||||
|
||||
case PrimitiveType::Tile:
|
||||
return nsIntRect(INT32_MIN/2, INT32_MIN/2, INT32_MAX, INT32_MAX);
|
||||
return IntRect(INT32_MIN/2, INT32_MIN/2, INT32_MAX, INT32_MAX);
|
||||
|
||||
case PrimitiveType::ConvolveMatrix:
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ static_assert((int(NS_SIDE_TOP) == 0) &&
|
|||
"The mozilla::css::Side sequence must match the nsMargin nscoord sequence");
|
||||
|
||||
nsRect
|
||||
ToAppUnits(const nsIntRect& aRect, nscoord aAppUnitsPerPixel)
|
||||
ToAppUnits(const mozilla::gfx::IntRect& aRect, nscoord aAppUnitsPerPixel)
|
||||
{
|
||||
return nsRect(NSIntPixelsToAppUnits(aRect.x, aAppUnitsPerPixel),
|
||||
NSIntPixelsToAppUnits(aRect.y, aAppUnitsPerPixel),
|
||||
|
@ -24,8 +24,8 @@ ToAppUnits(const nsIntRect& aRect, nscoord aAppUnitsPerPixel)
|
|||
NSIntPixelsToAppUnits(aRect.height, aAppUnitsPerPixel));
|
||||
}
|
||||
|
||||
const nsIntRect& GetMaxSizedIntRect() {
|
||||
static const nsIntRect r(0, 0, INT32_MAX, INT32_MAX);
|
||||
const mozilla::gfx::IntRect& GetMaxSizedIntRect() {
|
||||
static const mozilla::gfx::IntRect r(0, 0, INT32_MAX, INT32_MAX);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
@ -149,27 +149,27 @@ struct NS_GFX nsRect :
|
|||
MOZ_WARN_UNUSED_RESULT inline nsRect
|
||||
ScaleToOtherAppUnitsRoundIn(int32_t aFromAPP, int32_t aToAPP) const;
|
||||
|
||||
MOZ_WARN_UNUSED_RESULT inline nsIntRect
|
||||
MOZ_WARN_UNUSED_RESULT inline mozilla::gfx::IntRect
|
||||
ScaleToNearestPixels(float aXScale, float aYScale,
|
||||
nscoord aAppUnitsPerPixel) const;
|
||||
|
||||
MOZ_WARN_UNUSED_RESULT inline nsIntRect
|
||||
MOZ_WARN_UNUSED_RESULT inline mozilla::gfx::IntRect
|
||||
ToNearestPixels(nscoord aAppUnitsPerPixel) const;
|
||||
|
||||
// Note: this can turn an empty rectangle into a non-empty rectangle
|
||||
MOZ_WARN_UNUSED_RESULT inline nsIntRect
|
||||
MOZ_WARN_UNUSED_RESULT inline mozilla::gfx::IntRect
|
||||
ScaleToOutsidePixels(float aXScale, float aYScale,
|
||||
nscoord aAppUnitsPerPixel) const;
|
||||
|
||||
// Note: this can turn an empty rectangle into a non-empty rectangle
|
||||
MOZ_WARN_UNUSED_RESULT inline nsIntRect
|
||||
MOZ_WARN_UNUSED_RESULT inline mozilla::gfx::IntRect
|
||||
ToOutsidePixels(nscoord aAppUnitsPerPixel) const;
|
||||
|
||||
MOZ_WARN_UNUSED_RESULT inline nsIntRect
|
||||
MOZ_WARN_UNUSED_RESULT inline mozilla::gfx::IntRect
|
||||
ScaleToInsidePixels(float aXScale, float aYScale,
|
||||
nscoord aAppUnitsPerPixel) const;
|
||||
|
||||
MOZ_WARN_UNUSED_RESULT inline nsIntRect
|
||||
MOZ_WARN_UNUSED_RESULT inline mozilla::gfx::IntRect
|
||||
ToInsidePixels(nscoord aAppUnitsPerPixel) const;
|
||||
|
||||
// This is here only to keep IPDL-generated code happy. DO NOT USE.
|
||||
|
@ -220,11 +220,11 @@ nsRect::ScaleToOtherAppUnitsRoundIn(int32_t aFromAPP, int32_t aToAPP) const
|
|||
}
|
||||
|
||||
// scale the rect but round to preserve centers
|
||||
inline nsIntRect
|
||||
inline mozilla::gfx::IntRect
|
||||
nsRect::ScaleToNearestPixels(float aXScale, float aYScale,
|
||||
nscoord aAppUnitsPerPixel) const
|
||||
{
|
||||
nsIntRect rect;
|
||||
mozilla::gfx::IntRect rect;
|
||||
rect.x = NSToIntRoundUp(NSAppUnitsToDoublePixels(x, aAppUnitsPerPixel) * aXScale);
|
||||
rect.y = NSToIntRoundUp(NSAppUnitsToDoublePixels(y, aAppUnitsPerPixel) * aYScale);
|
||||
// Avoid negative widths and heights due to overflow
|
||||
|
@ -236,11 +236,11 @@ nsRect::ScaleToNearestPixels(float aXScale, float aYScale,
|
|||
}
|
||||
|
||||
// scale the rect but round to smallest containing rect
|
||||
inline nsIntRect
|
||||
inline mozilla::gfx::IntRect
|
||||
nsRect::ScaleToOutsidePixels(float aXScale, float aYScale,
|
||||
nscoord aAppUnitsPerPixel) const
|
||||
{
|
||||
nsIntRect rect;
|
||||
mozilla::gfx::IntRect rect;
|
||||
rect.x = NSToIntFloor(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel)) * aXScale);
|
||||
rect.y = NSToIntFloor(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel)) * aYScale);
|
||||
// Avoid negative widths and heights due to overflow
|
||||
|
@ -252,11 +252,11 @@ nsRect::ScaleToOutsidePixels(float aXScale, float aYScale,
|
|||
}
|
||||
|
||||
// scale the rect but round to largest contained rect
|
||||
inline nsIntRect
|
||||
inline mozilla::gfx::IntRect
|
||||
nsRect::ScaleToInsidePixels(float aXScale, float aYScale,
|
||||
nscoord aAppUnitsPerPixel) const
|
||||
{
|
||||
nsIntRect rect;
|
||||
mozilla::gfx::IntRect rect;
|
||||
rect.x = NSToIntCeil(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel)) * aXScale);
|
||||
rect.y = NSToIntCeil(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel)) * aYScale);
|
||||
// Avoid negative widths and heights due to overflow
|
||||
|
@ -267,29 +267,29 @@ nsRect::ScaleToInsidePixels(float aXScale, float aYScale,
|
|||
return rect;
|
||||
}
|
||||
|
||||
inline nsIntRect
|
||||
inline mozilla::gfx::IntRect
|
||||
nsRect::ToNearestPixels(nscoord aAppUnitsPerPixel) const
|
||||
{
|
||||
return ScaleToNearestPixels(1.0f, 1.0f, aAppUnitsPerPixel);
|
||||
}
|
||||
|
||||
inline nsIntRect
|
||||
inline mozilla::gfx::IntRect
|
||||
nsRect::ToOutsidePixels(nscoord aAppUnitsPerPixel) const
|
||||
{
|
||||
return ScaleToOutsidePixels(1.0f, 1.0f, aAppUnitsPerPixel);
|
||||
}
|
||||
|
||||
inline nsIntRect
|
||||
inline mozilla::gfx::IntRect
|
||||
nsRect::ToInsidePixels(nscoord aAppUnitsPerPixel) const
|
||||
{
|
||||
return ScaleToInsidePixels(1.0f, 1.0f, aAppUnitsPerPixel);
|
||||
}
|
||||
|
||||
const nsIntRect& GetMaxSizedIntRect();
|
||||
const mozilla::gfx::IntRect& GetMaxSizedIntRect();
|
||||
|
||||
// app units are integer multiples of pixels, so no rounding needed
|
||||
nsRect
|
||||
ToAppUnits(const nsIntRect& aRect, nscoord aAppUnitsPerPixel);
|
||||
ToAppUnits(const mozilla::gfx::IntRect& aRect, nscoord aAppUnitsPerPixel);
|
||||
|
||||
#ifdef DEBUG
|
||||
// Diagnostics
|
||||
|
|
|
@ -606,20 +606,20 @@ nsRegion& nsRegion::ScaleInverseRoundOut (float aXScale, float aYScale)
|
|||
return *this;
|
||||
}
|
||||
|
||||
static nsIntRect
|
||||
TransformRect(const nsIntRect& aRect, const gfx3DMatrix& aTransform)
|
||||
static mozilla::gfx::IntRect
|
||||
TransformRect(const mozilla::gfx::IntRect& aRect, const gfx3DMatrix& aTransform)
|
||||
{
|
||||
if (aRect.IsEmpty()) {
|
||||
return nsIntRect();
|
||||
return mozilla::gfx::IntRect();
|
||||
}
|
||||
|
||||
gfxRect rect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
rect = aTransform.TransformBounds(rect);
|
||||
rect.RoundOut();
|
||||
|
||||
nsIntRect intRect;
|
||||
mozilla::gfx::IntRect intRect;
|
||||
if (!gfxUtils::GfxRectToIntRect(rect, &intRect)) {
|
||||
return nsIntRect();
|
||||
return mozilla::gfx::IntRect();
|
||||
}
|
||||
|
||||
return intRect;
|
||||
|
@ -699,7 +699,7 @@ nsIntRegion nsRegion::ToPixels (nscoord aAppUnitsPerPixel, bool aOutsidePixels)
|
|||
pixman_box32_t *boxes = pixman_region32_rectangles(®ion.mImpl, &n);
|
||||
for (int i=0; i<n; i++) {
|
||||
nsRect rect = BoxToRect(boxes[i]);
|
||||
nsIntRect deviceRect;
|
||||
mozilla::gfx::IntRect deviceRect;
|
||||
if (aOutsidePixels)
|
||||
deviceRect = rect.ToOutsidePixels(aAppUnitsPerPixel);
|
||||
else
|
||||
|
@ -733,7 +733,7 @@ nsIntRegion nsRegion::ScaleToNearestPixels (float aScaleX, float aScaleY,
|
|||
nsRegionRectIterator rgnIter(*this);
|
||||
const nsRect* currentRect;
|
||||
while ((currentRect = rgnIter.Next())) {
|
||||
nsIntRect deviceRect =
|
||||
mozilla::gfx::IntRect deviceRect =
|
||||
currentRect->ScaleToNearestPixels(aScaleX, aScaleY, aAppUnitsPerPixel);
|
||||
result.Or(result, deviceRect);
|
||||
}
|
||||
|
@ -747,7 +747,7 @@ nsIntRegion nsRegion::ScaleToOutsidePixels (float aScaleX, float aScaleY,
|
|||
nsRegionRectIterator rgnIter(*this);
|
||||
const nsRect* currentRect;
|
||||
while ((currentRect = rgnIter.Next())) {
|
||||
nsIntRect deviceRect =
|
||||
mozilla::gfx::IntRect deviceRect =
|
||||
currentRect->ScaleToOutsidePixels(aScaleX, aScaleY, aAppUnitsPerPixel);
|
||||
result.Or(result, deviceRect);
|
||||
}
|
||||
|
@ -778,14 +778,14 @@ nsIntRegion nsRegion::ScaleToInsidePixels (float aScaleX, float aScaleY,
|
|||
nsIntRegion intRegion;
|
||||
if (n) {
|
||||
nsRect first = BoxToRect(boxes[0]);
|
||||
nsIntRect firstDeviceRect =
|
||||
mozilla::gfx::IntRect firstDeviceRect =
|
||||
first.ScaleToInsidePixels(aScaleX, aScaleY, aAppUnitsPerPixel);
|
||||
|
||||
for (int i=1; i<n; i++) {
|
||||
nsRect rect = nsRect(boxes[i].x1, boxes[i].y1,
|
||||
boxes[i].x2 - boxes[i].x1,
|
||||
boxes[i].y2 - boxes[i].y1);
|
||||
nsIntRect deviceRect =
|
||||
mozilla::gfx::IntRect deviceRect =
|
||||
rect.ScaleToInsidePixels(aScaleX, aScaleY, aAppUnitsPerPixel);
|
||||
|
||||
if (rect.y <= first.YMost()) {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "nsCoord.h" // for nscoord
|
||||
#include "nsError.h" // for nsresult
|
||||
#include "nsPoint.h" // for nsIntPoint, nsPoint
|
||||
#include "nsRect.h" // for nsIntRect, nsRect
|
||||
#include "nsRect.h" // for mozilla::gfx::IntRect, nsRect
|
||||
#include "nsMargin.h" // for nsIntMargin
|
||||
#include "nsStringGlue.h" // for nsCString
|
||||
#include "xpcom-config.h" // for CPP_THROW_NEW
|
||||
|
@ -394,7 +394,7 @@ private:
|
|||
return box;
|
||||
}
|
||||
|
||||
static inline pixman_box32_t RectToBox(const nsIntRect &aRect)
|
||||
static inline pixman_box32_t RectToBox(const mozilla::gfx::IntRect &aRect)
|
||||
{
|
||||
pixman_box32_t box = { aRect.x, aRect.y, aRect.XMost(), aRect.YMost() };
|
||||
return box;
|
||||
|
@ -815,12 +815,12 @@ private:
|
|||
} // namespace mozilla::gfx
|
||||
} // namespace mozilla
|
||||
|
||||
class NS_GFX nsIntRegion : public mozilla::gfx::BaseIntRegion<nsIntRegion, nsIntRect, nsIntPoint, nsIntMargin>
|
||||
class NS_GFX nsIntRegion : public mozilla::gfx::BaseIntRegion<nsIntRegion, mozilla::gfx::IntRect, nsIntPoint, nsIntMargin>
|
||||
{
|
||||
public:
|
||||
// Forward constructors.
|
||||
nsIntRegion() {}
|
||||
MOZ_IMPLICIT nsIntRegion(const nsIntRect& aRect) : BaseIntRegion(aRect) {}
|
||||
MOZ_IMPLICIT nsIntRegion(const mozilla::gfx::IntRect& aRect) : BaseIntRegion(aRect) {}
|
||||
nsIntRegion(const nsIntRegion& aRegion) : BaseIntRegion(aRegion) {}
|
||||
nsIntRegion(nsIntRegion&& aRegion) : BaseIntRegion(mozilla::Move(aRegion)) {}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
|
||||
#include "nsError.h" // for NS_OK, NS_ERROR_FAILURE, etc
|
||||
#include "nsID.h"
|
||||
#include "nsRect.h" // for nsIntRect
|
||||
#include "nsRect.h" // for mozilla::gfx::IntRect
|
||||
#include "nscore.h" // for NS_IMETHODIMP
|
||||
|
||||
class JSObject;
|
||||
|
@ -38,7 +38,7 @@ NS_IMETHODIMP nsScriptableRegion::SetToRegion(nsIScriptableRegion *aRegion)
|
|||
|
||||
NS_IMETHODIMP nsScriptableRegion::SetToRect(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight)
|
||||
{
|
||||
mRegion = nsIntRect(aX, aY, aWidth, aHeight);
|
||||
mRegion = mozilla::gfx::IntRect(aX, aY, aWidth, aHeight);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ NS_IMETHODIMP nsScriptableRegion::IntersectRegion(nsIScriptableRegion *aRegion)
|
|||
|
||||
NS_IMETHODIMP nsScriptableRegion::IntersectRect(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight)
|
||||
{
|
||||
mRegion.And(mRegion, nsIntRect(aX, aY, aWidth, aHeight));
|
||||
mRegion.And(mRegion, mozilla::gfx::IntRect(aX, aY, aWidth, aHeight));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ NS_IMETHODIMP nsScriptableRegion::UnionRegion(nsIScriptableRegion *aRegion)
|
|||
|
||||
NS_IMETHODIMP nsScriptableRegion::UnionRect(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight)
|
||||
{
|
||||
mRegion.Or(mRegion, nsIntRect(aX, aY, aWidth, aHeight));
|
||||
mRegion.Or(mRegion, mozilla::gfx::IntRect(aX, aY, aWidth, aHeight));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ NS_IMETHODIMP nsScriptableRegion::SubtractRegion(nsIScriptableRegion *aRegion)
|
|||
|
||||
NS_IMETHODIMP nsScriptableRegion::SubtractRect(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight)
|
||||
{
|
||||
mRegion.Sub(mRegion, nsIntRect(aX, aY, aWidth, aHeight));
|
||||
mRegion.Sub(mRegion, mozilla::gfx::IntRect(aX, aY, aWidth, aHeight));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ NS_IMETHODIMP nsScriptableRegion::IsEqualRegion(nsIScriptableRegion *aRegion, bo
|
|||
|
||||
NS_IMETHODIMP nsScriptableRegion::GetBoundingBox(int32_t *aX, int32_t *aY, int32_t *aWidth, int32_t *aHeight)
|
||||
{
|
||||
nsIntRect boundRect = mRegion.GetBounds();
|
||||
mozilla::gfx::IntRect boundRect = mRegion.GetBounds();
|
||||
*aX = boundRect.x;
|
||||
*aY = boundRect.y;
|
||||
*aWidth = boundRect.width;
|
||||
|
@ -116,7 +116,7 @@ NS_IMETHODIMP nsScriptableRegion::Offset(int32_t aXOffset, int32_t aYOffset)
|
|||
|
||||
NS_IMETHODIMP nsScriptableRegion::ContainsRect(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight, bool *containsRect)
|
||||
{
|
||||
*containsRect = mRegion.Contains(nsIntRect(aX, aY, aWidth, aHeight));
|
||||
*containsRect = mRegion.Contains(mozilla::gfx::IntRect(aX, aY, aWidth, aHeight));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ NS_IMETHODIMP nsScriptableRegion::GetRects(JSContext* aCx, JS::MutableHandle<JS:
|
|||
|
||||
uint32_t n = 0;
|
||||
nsIntRegionRectIterator iter(mRegion);
|
||||
const nsIntRect *rect;
|
||||
const mozilla::gfx::IntRect *rect;
|
||||
|
||||
while ((rect = iter.Next())) {
|
||||
if (!JS_DefineElement(aCx, destArray, n, rect->x, JSPROP_ENUMERATE) ||
|
||||
|
|
|
@ -250,7 +250,7 @@ private:
|
|||
DECL_GFX_PREF(Once, "image.cache.timeweight", ImageCacheTimeWeight, int32_t, 500);
|
||||
DECL_GFX_PREF(Live, "image.decode-only-on-draw.enabled", ImageDecodeOnlyOnDrawEnabled, bool, true);
|
||||
DECL_GFX_PREF(Live, "image.decode-immediately.enabled", ImageDecodeImmediatelyEnabled, bool, false);
|
||||
DECL_GFX_PREF(Live, "image.downscale-during-decode.enabled", ImageDownscaleDuringDecodeEnabled, bool, false);
|
||||
DECL_GFX_PREF(Live, "image.downscale-during-decode.enabled", ImageDownscaleDuringDecodeEnabled, bool, true);
|
||||
DECL_GFX_PREF(Live, "image.high_quality_downscaling.enabled", ImageHQDownscalingEnabled, bool, false);
|
||||
DECL_GFX_PREF(Live, "image.high_quality_downscaling.min_factor", ImageHQDownscalingMinFactor, uint32_t, 1000);
|
||||
DECL_GFX_PREF(Live, "image.high_quality_upscaling.max_size", ImageHQUpscalingMaxSize, uint32_t, 20971520);
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
# 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/.
|
||||
|
||||
DIRS += ['public', 'src', 'decoders', 'encoders']
|
||||
DIRS += ['build']
|
||||
DIRS += ['build', 'src', 'decoders', 'encoders']
|
||||
|
||||
with Files('**'):
|
||||
BUG_COMPONENT = ('Core', 'ImageLib')
|
||||
|
@ -17,3 +16,23 @@ MOCHITEST_MANIFESTS += ['test/mochitest/mochitest.ini']
|
|||
MOCHITEST_CHROME_MANIFESTS += ['test/mochitest/chrome.ini']
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'imgICache.idl',
|
||||
'imgIContainer.idl',
|
||||
'imgIContainerDebug.idl',
|
||||
'imgIEncoder.idl',
|
||||
'imgILoader.idl',
|
||||
'imgINotificationObserver.idl',
|
||||
'imgIOnloadBlocker.idl',
|
||||
'imgIRequest.idl',
|
||||
'imgIScriptedNotificationObserver.idl',
|
||||
'imgITools.idl',
|
||||
'nsIIconURI.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'imglib2'
|
||||
|
||||
EXPORTS += [
|
||||
'ImageLogging.h',
|
||||
]
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'imgICache.idl',
|
||||
'imgIContainer.idl',
|
||||
'imgIContainerDebug.idl',
|
||||
'imgIEncoder.idl',
|
||||
'imgILoader.idl',
|
||||
'imgINotificationObserver.idl',
|
||||
'imgIOnloadBlocker.idl',
|
||||
'imgIRequest.idl',
|
||||
'imgIScriptedNotificationObserver.idl',
|
||||
'imgITools.idl',
|
||||
'nsIIconURI.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'imglib2'
|
||||
|
||||
EXPORTS += [
|
||||
'ImageLogging.h',
|
||||
]
|
||||
|
|
@ -528,8 +528,8 @@ public:
|
|||
} else {
|
||||
// Our call to AddObject must have failed in StartTracking; most likely
|
||||
// we're in XPCOM shutdown right now.
|
||||
NS_WARN_IF_FALSE(ShutdownTracker::ShutdownHasStarted(),
|
||||
"Not expiration-tracking an unlocked surface!");
|
||||
NS_ASSERTION(ShutdownTracker::ShutdownHasStarted(),
|
||||
"Not expiration-tracking an unlocked surface!");
|
||||
}
|
||||
|
||||
DebugOnly<bool> foundInCosts = mCosts.RemoveElementSorted(costEntry);
|
||||
|
|
|
@ -46,4 +46,4 @@ load multiple-png-hassize.ico
|
|||
# Asserts in the debug build
|
||||
load 856616.gif
|
||||
|
||||
skip-if(AddressSanitizer) load 944353.jpg
|
||||
skip-if(AddressSanitizer) skip-if(B2G) load 944353.jpg
|
||||
|
|
|
@ -422,9 +422,6 @@ WasIncrementalGC(JSRuntime* rt);
|
|||
class JS_PUBLIC_API(AutoDisableGenerationalGC)
|
||||
{
|
||||
js::gc::GCRuntime* gc;
|
||||
#ifdef JS_GC_ZEAL
|
||||
bool restartVerifier;
|
||||
#endif
|
||||
|
||||
public:
|
||||
explicit AutoDisableGenerationalGC(JSRuntime* rt);
|
||||
|
|
|
@ -98,12 +98,14 @@ class JS_PUBLIC_API(JSTracer)
|
|||
WeakMapTraceKind eagerlyTraceWeakMaps() const { return eagerlyTraceWeakMaps_; }
|
||||
|
||||
// An intermediate state on the road from C to C++ style dispatch.
|
||||
enum TracerKindTag {
|
||||
MarkingTracer,
|
||||
CallbackTracer
|
||||
enum class TracerKindTag {
|
||||
Marking,
|
||||
Tenuring,
|
||||
Callback
|
||||
};
|
||||
bool isMarkingTracer() const { return tag_ == MarkingTracer; }
|
||||
bool isCallbackTracer() const { return tag_ == CallbackTracer; }
|
||||
bool isMarkingTracer() const { return tag_ == TracerKindTag::Marking; }
|
||||
bool isTenuringTracer() const { return tag_ == TracerKindTag::Tenuring; }
|
||||
bool isCallbackTracer() const { return tag_ == TracerKindTag::Callback; }
|
||||
inline JS::CallbackTracer* asCallbackTracer();
|
||||
|
||||
protected:
|
||||
|
@ -123,16 +125,14 @@ namespace JS {
|
|||
class AutoTracingName;
|
||||
class AutoTracingIndex;
|
||||
class AutoTracingCallback;
|
||||
class AutoOriginalTraceLocation;
|
||||
|
||||
class JS_PUBLIC_API(CallbackTracer) : public JSTracer
|
||||
{
|
||||
public:
|
||||
CallbackTracer(JSRuntime* rt, JSTraceCallback traceCallback,
|
||||
WeakMapTraceKind weakTraceKind = TraceWeakMapValues)
|
||||
: JSTracer(rt, JSTracer::CallbackTracer, weakTraceKind), callback(traceCallback),
|
||||
contextName_(nullptr), contextIndex_(InvalidIndex), contextFunctor_(nullptr),
|
||||
contextRealLocation_(nullptr)
|
||||
: JSTracer(rt, JSTracer::TracerKindTag::Callback, weakTraceKind), callback(traceCallback),
|
||||
contextName_(nullptr), contextIndex_(InvalidIndex), contextFunctor_(nullptr)
|
||||
{}
|
||||
|
||||
// Update the trace callback.
|
||||
|
@ -195,14 +195,6 @@ class JS_PUBLIC_API(CallbackTracer) : public JSTracer
|
|||
virtual void operator()(CallbackTracer* trc, char* buf, size_t bufsize) = 0;
|
||||
};
|
||||
|
||||
// Return the original heap tracing location if the raw thingp reference
|
||||
// has been moved. This is generally only useful for heap analyses that
|
||||
// need to build an accurate model of the heap, and thus is only accurate
|
||||
// when built with JS_GC_ZEAL.
|
||||
void*const* tracingLocation(void** thingp) {
|
||||
return contextRealLocation_ ? contextRealLocation_ : thingp;
|
||||
}
|
||||
|
||||
private:
|
||||
// Exposed publicly for several callers that need to check if the tracer
|
||||
// calling them is of the right type.
|
||||
|
@ -216,9 +208,6 @@ class JS_PUBLIC_API(CallbackTracer) : public JSTracer
|
|||
|
||||
friend class AutoTracingDetails;
|
||||
ContextFunctor* contextFunctor_;
|
||||
|
||||
friend class AutoOriginalTraceLocation;
|
||||
void*const* contextRealLocation_;
|
||||
};
|
||||
|
||||
// Set the name portion of the tracer's context for the current edge.
|
||||
|
@ -288,37 +277,6 @@ class AutoTracingDetails
|
|||
}
|
||||
};
|
||||
|
||||
// Some dynamic analyses depend on knowing the edge source location as it
|
||||
// exists in the object graph. When marking some types of things, e.g. Value
|
||||
// edges, it is necessary to copy into a temporary on the stack. This class
|
||||
// records the original location if we need to copy the tracee, so that the
|
||||
// relevant analyses can continue to operate correctly.
|
||||
class AutoOriginalTraceLocation
|
||||
{
|
||||
#ifdef JS_GC_ZEAL
|
||||
CallbackTracer* trc_;
|
||||
|
||||
public:
|
||||
template <typename T>
|
||||
AutoOriginalTraceLocation(JSTracer* trc, T*const* realLocation) : trc_(nullptr) {
|
||||
if (trc->isCallbackTracer() && trc->asCallbackTracer()->contextRealLocation_ == nullptr) {
|
||||
trc_ = trc->asCallbackTracer();
|
||||
trc_->contextRealLocation_ = reinterpret_cast<void*const*>(realLocation);
|
||||
}
|
||||
}
|
||||
~AutoOriginalTraceLocation() {
|
||||
if (trc_) {
|
||||
MOZ_ASSERT(trc_->contextRealLocation_);
|
||||
trc_->contextRealLocation_ = nullptr;
|
||||
}
|
||||
}
|
||||
#else
|
||||
public:
|
||||
template <typename T>
|
||||
AutoOriginalTraceLocation(JSTracer* trc, T*const* realLocation) {}
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace JS
|
||||
|
||||
JS::CallbackTracer*
|
||||
|
@ -381,7 +339,6 @@ inline void
|
|||
JS_CallHashSetObjectTracer(JSTracer* trc, HashSetEnum& e, JSObject* const& key, const char* name)
|
||||
{
|
||||
JSObject* updated = key;
|
||||
JS::AutoOriginalTraceLocation reloc(trc, &key);
|
||||
JS_CallUnbarrieredObjectTracer(trc, &updated, name);
|
||||
if (updated != key)
|
||||
e.rekeyFront(updated);
|
||||
|
|
|
@ -839,7 +839,6 @@ HashableValue
|
|||
HashableValue::mark(JSTracer* trc) const
|
||||
{
|
||||
HashableValue hv(*this);
|
||||
JS::AutoOriginalTraceLocation reloc(trc, (void**)this);
|
||||
TraceEdge(trc, &hv.value, "key");
|
||||
return hv;
|
||||
}
|
||||
|
|
|
@ -127,14 +127,13 @@
|
|||
* There are also special classes HeapValue and HeapId, which barrier js::Value
|
||||
* and jsid, respectively.
|
||||
*
|
||||
* One additional note: not all object writes need to be barriered. Writes to
|
||||
* newly allocated objects do not need a pre-barrier. In these cases, we use
|
||||
* One additional note: not all object writes need to be pre-barriered. Writes
|
||||
* to newly allocated objects do not need a pre-barrier. In these cases, we use
|
||||
* the "obj->field.init(value)" method instead of "obj->field = value". We use
|
||||
* the init naming idiom in many places to signify that a field is being
|
||||
* assigned for the first time.
|
||||
*
|
||||
* For each of pointers, Values and jsids this file implements four classes,
|
||||
* illustrated here for the pointer (Ptr) classes:
|
||||
* This file implements four classes, illustrated here:
|
||||
*
|
||||
* BarrieredBase abstract base class which provides common operations
|
||||
* | | |
|
||||
|
@ -144,9 +143,27 @@
|
|||
* |
|
||||
* RelocatablePtr provides pre- and post-barriers and is relocatable
|
||||
*
|
||||
* The implementation of the barrier logic is implemented on T::writeBarrier.*,
|
||||
* via:
|
||||
*
|
||||
* BarrieredBase<T>::pre
|
||||
* -> InternalGCMethods<T*>::preBarrier
|
||||
* -> T::writeBarrierPre
|
||||
* -> InternalGCMethods<Value>::preBarrier
|
||||
* -> InternalGCMethods<jsid>::preBarrier
|
||||
* -> InternalGCMethods<T*>::preBarrier
|
||||
* -> T::writeBarrierPre
|
||||
*
|
||||
* HeapPtr<T>::post and RelocatablePtr<T>::post
|
||||
* -> InternalGCMethods<T*>::postBarrier
|
||||
* -> T::writeBarrierPost
|
||||
* -> InternalGCMethods<Value>::postBarrier
|
||||
* -> StoreBuffer::put
|
||||
*
|
||||
* These classes are designed to be used by the internals of the JS engine.
|
||||
* Barriers designed to be used externally are provided in
|
||||
* js/public/RootingAPI.h.
|
||||
* Barriers designed to be used externally are provided in js/RootingAPI.h.
|
||||
* These external barriers call into the same post-barrier implementations at
|
||||
* InternalGCMethods<T>::post via an indirect call to Heap(.+)Barrier.
|
||||
*/
|
||||
|
||||
class JSAtom;
|
||||
|
|
|
@ -93,7 +93,6 @@ class AutoStopVerifyingBarriers
|
|||
{
|
||||
GCRuntime* gc;
|
||||
bool restartPreVerifier;
|
||||
bool restartPostVerifier;
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
|
||||
public:
|
||||
|
@ -102,8 +101,6 @@ class AutoStopVerifyingBarriers
|
|||
: gc(&rt->gc)
|
||||
{
|
||||
restartPreVerifier = gc->endVerifyPreBarriers() && !isShutdown;
|
||||
restartPostVerifier = gc->endVerifyPostBarriers() && !isShutdown &&
|
||||
JS::IsGenerationalGCEnabled(rt);
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
}
|
||||
|
||||
|
@ -121,8 +118,6 @@ class AutoStopVerifyingBarriers
|
|||
|
||||
if (restartPreVerifier)
|
||||
gc->startVerifyPreBarriers();
|
||||
if (restartPostVerifier)
|
||||
gc->startVerifyPostBarriers();
|
||||
|
||||
if (outer != gcstats::PHASE_NONE)
|
||||
gc->stats.beginPhase(outer);
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче