mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge mozilla-central to fx-team
This commit is contained in:
commit
a7ccf82b3f
@ -7419,6 +7419,11 @@ let gRemoteTabsUI = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Services.appinfo.inSafeMode) {
|
||||
// e10s isn't supported in safe mode, so don't show the menu items for it
|
||||
return;
|
||||
}
|
||||
|
||||
let newRemoteWindow = document.getElementById("menu_newRemoteWindow");
|
||||
let newNonRemoteWindow = document.getElementById("menu_newNonRemoteWindow");
|
||||
let autostart = Services.appinfo.browserTabsRemoteAutostart;
|
||||
|
@ -489,7 +489,6 @@ skip-if = e10s # Bug 1100687 - test directly manipulates content (content.docume
|
||||
[browser_blockHPKP.js]
|
||||
skip-if = e10s # bug 1100687 - test directly manipulates content (content.document.getElementById)
|
||||
[browser_mcb_redirect.js]
|
||||
skip-if = e10s # bug 1084504 - [e10s] Mixed content detection does not take redirection into account
|
||||
[browser_windowactivation.js]
|
||||
[browser_contextmenu_childprocess.js]
|
||||
[browser_bug963945.js]
|
||||
|
@ -163,18 +163,9 @@ AboutRedirector::NewChannel(nsIURI* aURI,
|
||||
rv = NS_NewURI(getter_AddRefs(tempURI),
|
||||
nsDependentCString(kRedirMap[i].url));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// Bug 1087720 (and Bug 1099296):
|
||||
// Once all callsites have been updated to call NewChannel2()
|
||||
// instead of NewChannel() we should have a non-null loadInfo
|
||||
// consistently. Until then we have to branch on the loadInfo.
|
||||
if (aLoadInfo) {
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(tempChannel),
|
||||
tempURI,
|
||||
aLoadInfo);
|
||||
}
|
||||
else {
|
||||
rv = ioService->NewChannelFromURI(tempURI, getter_AddRefs(tempChannel));
|
||||
}
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(tempChannel),
|
||||
tempURI,
|
||||
aLoadInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
tempChannel->SetOriginalURI(aURI);
|
||||
|
@ -1079,6 +1079,7 @@ CustomizableWidgets.push({
|
||||
id: "e10s-button",
|
||||
label: buttonLabel,
|
||||
tooltiptext: buttonLabel,
|
||||
disabled: Services.appinfo.inSafeMode,
|
||||
defaultArea: CustomizableUI.AREA_PANEL,
|
||||
onCommand: getCommandFunction(openRemote),
|
||||
});
|
||||
|
@ -147,20 +147,9 @@ nsChromeProtocolHandler::NewChannel2(nsIURI* aURI,
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Bug 1087720 (and Bug 1099296):
|
||||
// Once all callsites have been updated to call NewChannel2() instead of NewChannel()
|
||||
// we should have a non-null loadInfo consistently. Until then we have to branch on the
|
||||
// loadInfo.
|
||||
if (aLoadInfo) {
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(result),
|
||||
resolvedURI,
|
||||
aLoadInfo);
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIIOService> ioServ(do_GetIOService(&rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = ioServ->NewChannelFromURI(resolvedURI, getter_AddRefs(result));
|
||||
}
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(result),
|
||||
resolvedURI,
|
||||
aLoadInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -131,17 +131,9 @@ nsAboutRedirector::NewChannel(nsIURI* aURI,
|
||||
nsCOMPtr<nsIURI> tempURI;
|
||||
rv = NS_NewURI(getter_AddRefs(tempURI), kRedirMap[i].url);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// Bug 1087720 (and Bug 1099296):
|
||||
// Once all callsites have been updated to call NewChannel2()
|
||||
// instead of NewChannel() we should have a non-null loadInfo
|
||||
// consistently. Until then we have to branch on the loadInfo.
|
||||
if (aLoadInfo) {
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(tempChannel),
|
||||
tempURI,
|
||||
aLoadInfo);
|
||||
} else {
|
||||
rv = ioService->NewChannelFromURI(tempURI, getter_AddRefs(tempChannel));
|
||||
}
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(tempChannel),
|
||||
tempURI,
|
||||
aLoadInfo);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ let debug = Services.prefs.getBoolPref("dom.mozApps.debug")
|
||||
* "languages-target" : { "app://*.gaiamobile.org/manifest.webapp": "2.2" },
|
||||
* "languages-provided": {
|
||||
* "de": {
|
||||
* "version": 201411051234,
|
||||
* "revision": 201411051234,
|
||||
* "name": "Deutsch",
|
||||
* "apps": {
|
||||
* "app://calendar.gaiamobile.org/manifest.webapp": "/de/calendar",
|
||||
@ -81,7 +81,7 @@ this.Langpacks = {
|
||||
}
|
||||
let current = this._data[aManifestURL].langs[lang];
|
||||
langs[lang].push({
|
||||
version: current.version,
|
||||
revision: current.revision,
|
||||
name: current.name,
|
||||
target: current.target
|
||||
});
|
||||
@ -128,7 +128,7 @@ this.Langpacks = {
|
||||
"UnavailableLanguage");
|
||||
}
|
||||
|
||||
// Check that we have the right version.
|
||||
// Check that we have the langpack for the right app version.
|
||||
let item = this._data[aData.manifestURL].langs[aData.lang];
|
||||
if (item.target != aData.version) {
|
||||
return sendError("No version " + aData.version + " for this app.",
|
||||
@ -187,14 +187,14 @@ this.Langpacks = {
|
||||
for (let lang in aManifest["languages-provided"]) {
|
||||
let item = aManifest["languages-provided"][lang];
|
||||
|
||||
if (!item.version) {
|
||||
debug("Error: missing 'version' in languages-provided." + lang);
|
||||
if (!item.revision) {
|
||||
debug("Error: missing 'revision' in languages-provided." + lang);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof item.version !== "number") {
|
||||
if (typeof item.revision !== "number") {
|
||||
debug("Error: languages-provided." + lang +
|
||||
".version must be a number but is a " + (typeof item.version));
|
||||
".revision must be a number but is a " + (typeof item.revision));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -242,13 +242,13 @@ this.Langpacks = {
|
||||
|
||||
for (let lang in aManifest["languages-provided"]) {
|
||||
let item = aManifest["languages-provided"][lang];
|
||||
let version = item.version; // The langpack version, not the platform.
|
||||
let revision = item.revision;
|
||||
let name = item.name || lang; // If no name specified, default to lang.
|
||||
for (let app in item.apps) {
|
||||
let sendEvent = false;
|
||||
if (!this._data[app] ||
|
||||
!this._data[app].langs[lang] ||
|
||||
this._data[app].langs[lang].version > version) {
|
||||
this._data[app].langs[lang].revision > revision) {
|
||||
if (!this._data[app]) {
|
||||
this._data[app] = {
|
||||
appId: this._appIdFromManifestURL(app),
|
||||
@ -256,7 +256,7 @@ this.Langpacks = {
|
||||
};
|
||||
}
|
||||
this._data[app].langs[lang] = {
|
||||
version: version,
|
||||
revision: revision,
|
||||
target: platformVersion,
|
||||
name: name,
|
||||
url: origin.resolve(item.apps[app]),
|
||||
|
@ -3,7 +3,7 @@
|
||||
"languages-target" : { "app://*.gaiamobile.org/manifest.webapp": "2.2" },
|
||||
"languages-provided": {
|
||||
"fr": {
|
||||
"version": 201411051234,
|
||||
"revision": 201411051234,
|
||||
"name": "Français",
|
||||
"apps": {
|
||||
"http://mochi.test:8888/tests/dom/apps/tests/langpack/manifest.webapp": "tests/dom/apps/tests/langpack/fr/"
|
||||
|
@ -3,14 +3,14 @@
|
||||
"languages-target" : { "app://*.gaiamobile.org/manifest.webapp": "2.2" },
|
||||
"languages-provided": {
|
||||
"de": {
|
||||
"version": 201411051234,
|
||||
"revision": 201411051234,
|
||||
"name": "Deutsch",
|
||||
"apps": {
|
||||
"http://mochi.test:8888/tests/dom/apps/tests/langpack/manifest.webapp": "tests/dom/apps/tests/langpack/de/"
|
||||
}
|
||||
},
|
||||
"pl": {
|
||||
"version": 201411051234,
|
||||
"revision": 201411051234,
|
||||
"name": "Polski",
|
||||
"apps": {
|
||||
"http://mochi.test:8888/tests/dom/apps/tests/langpack/manifest.webapp": "tests/dom/apps/tests/langpack/pl/"
|
||||
|
@ -133,7 +133,7 @@ function runTest() {
|
||||
// Opens the iframe to the test page.
|
||||
// Only the French locale is available.
|
||||
openPage("index.html",
|
||||
[_({"fr":[{"version":201411051234,"name":"Français","target":"2.2"}]})]);
|
||||
[_({"fr":[{"revision":201411051234,"name":"Français","target":"2.2"}]})]);
|
||||
yield undefined;
|
||||
|
||||
// Install the de and pl langpack.
|
||||
@ -143,7 +143,7 @@ function runTest() {
|
||||
// Opens the iframe to the test page.
|
||||
// French, German and Polish locales are available.
|
||||
openPage("index.html",
|
||||
[_({"fr":[{"version":201411051234,"name":"Français","target":"2.2"}],"de":[{"version":201411051234,"name":"Deutsch","target":"2.2"}],"pl":[{"version":201411051234,"name":"Polski","target":"2.2"}]})]);
|
||||
[_({"fr":[{"revision":201411051234,"name":"Français","target":"2.2"}],"de":[{"revision":201411051234,"name":"Deutsch","target":"2.2"}],"pl":[{"revision":201411051234,"name":"Polski","target":"2.2"}]})]);
|
||||
yield undefined;
|
||||
|
||||
// Uninstall the second langpack.
|
||||
@ -159,7 +159,7 @@ function runTest() {
|
||||
// Opens the iframe to the test page.
|
||||
// Only the French locale is available.
|
||||
openPage("index.html",
|
||||
[_({"fr":[{"version":201411051234,"name":"Français","target":"2.2"}]})]);
|
||||
[_({"fr":[{"revision":201411051234,"name":"Français","target":"2.2"}]})]);
|
||||
yield undefined;
|
||||
|
||||
// Uninstall the first langpack.
|
||||
@ -181,9 +181,9 @@ function runTest() {
|
||||
// Opens the iframe to the event test page.
|
||||
// Will get additionallanguageschange events.
|
||||
openPage("event.html",
|
||||
[_({"fr":[{"version":201411051234,"name":"Français","target":"2.2"}]}),
|
||||
_({"fr":[{"version":201411051234,"name":"Français","target":"2.2"}],"de":[{"version":201411051234,"name":"Deutsch","target":"2.2"}]}),
|
||||
_({"fr":[{"version":201411051234,"name":"Français","target":"2.2"}],"de":[{"version":201411051234,"name":"Deutsch","target":"2.2"}],"pl":[{"version":201411051234,"name":"Polski","target":"2.2"}]})]);
|
||||
[_({"fr":[{"revision":201411051234,"name":"Français","target":"2.2"}]}),
|
||||
_({"fr":[{"revision":201411051234,"name":"Français","target":"2.2"}],"de":[{"revision":201411051234,"name":"Deutsch","target":"2.2"}]}),
|
||||
_({"fr":[{"revision":201411051234,"name":"Français","target":"2.2"}],"de":[{"revision":201411051234,"name":"Deutsch","target":"2.2"}],"pl":[{"revision":201411051234,"name":"Polski","target":"2.2"}]})]);
|
||||
yield undefined;
|
||||
|
||||
// Opens the iframe to the resource test page.
|
||||
|
@ -112,6 +112,10 @@
|
||||
|
||||
#include "mozilla/dom/FeatureList.h"
|
||||
|
||||
#ifdef MOZ_EME
|
||||
#include "mozilla/EMEUtils.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@ -2637,13 +2641,26 @@ Navigator::RequestMediaKeySystemAccess(const nsAString& aKeySystem,
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
MediaKeySystemStatus status = MediaKeySystemAccess::GetKeySystemStatus(aKeySystem);
|
||||
// Parse keysystem, split it out into keySystem prefix, and version suffix.
|
||||
nsAutoString keySystem;
|
||||
int32_t minCdmVersion = NO_CDM_VERSION;
|
||||
if (!ParseKeySystem(aKeySystem,
|
||||
keySystem,
|
||||
minCdmVersion)) {
|
||||
// Invalid keySystem string, or unsupported keySystem. Send notification
|
||||
// to chrome to show a failure notice.
|
||||
MediaKeySystemAccess::NotifyObservers(mWindow, aKeySystem, MediaKeySystemStatus::Cdm_not_supported);
|
||||
p->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
MediaKeySystemStatus status = MediaKeySystemAccess::GetKeySystemStatus(keySystem, minCdmVersion);
|
||||
if (status != MediaKeySystemStatus::Available) {
|
||||
if (status != MediaKeySystemStatus::Error) {
|
||||
// Failed due to user disabling something, send a notification to
|
||||
// chrome, so we can show some UI to explain how the user can rectify
|
||||
// the situation.
|
||||
MediaKeySystemAccess::NotifyObservers(mWindow, aKeySystem, status);
|
||||
MediaKeySystemAccess::NotifyObservers(mWindow, keySystem, status);
|
||||
}
|
||||
p->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return p.forget();
|
||||
@ -2652,8 +2669,8 @@ Navigator::RequestMediaKeySystemAccess(const nsAString& aKeySystem,
|
||||
// TODO: Wait (async) until the CDM is downloaded, if it's not already.
|
||||
|
||||
if (!aOptions.WasPassed() ||
|
||||
MediaKeySystemAccess::IsSupported(aKeySystem, aOptions.Value())) {
|
||||
nsRefPtr<MediaKeySystemAccess> access(new MediaKeySystemAccess(mWindow, aKeySystem));
|
||||
MediaKeySystemAccess::IsSupported(keySystem, aOptions.Value())) {
|
||||
nsRefPtr<MediaKeySystemAccess> access(new MediaKeySystemAccess(mWindow, keySystem));
|
||||
p->MaybeResolve(access);
|
||||
return p.forget();
|
||||
}
|
||||
|
102
dom/base/ProcessGlobal.cpp
Normal file
102
dom/base/ProcessGlobal.cpp
Normal file
@ -0,0 +1,102 @@
|
||||
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8; -*- */
|
||||
/* vim: set sw=4 ts=8 et 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/. */
|
||||
|
||||
#include "ProcessGlobal.h"
|
||||
|
||||
#include "nsContentCID.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
ProcessGlobal::ProcessGlobal(nsFrameMessageManager* aMessageManager)
|
||||
: mInitialized(false),
|
||||
mMessageManager(aMessageManager)
|
||||
{
|
||||
SetIsNotDOMBinding();
|
||||
mozilla::HoldJSObjects(this);
|
||||
}
|
||||
|
||||
ProcessGlobal::~ProcessGlobal()
|
||||
{
|
||||
mAnonymousGlobalScopes.Clear();
|
||||
mozilla::DropJSObjects(this);
|
||||
}
|
||||
|
||||
ProcessGlobal*
|
||||
ProcessGlobal::Get()
|
||||
{
|
||||
nsCOMPtr<nsISyncMessageSender> service = do_GetService(NS_CHILDPROCESSMESSAGEMANAGER_CONTRACTID);
|
||||
if (!service) {
|
||||
return nullptr;
|
||||
}
|
||||
return static_cast<ProcessGlobal*>(service.get());
|
||||
}
|
||||
|
||||
/* [notxpcom] boolean markForCC (); */
|
||||
// This method isn't automatically forwarded safely because it's notxpcom, so
|
||||
// the IDL binding doesn't know what value to return.
|
||||
NS_IMETHODIMP_(bool)
|
||||
ProcessGlobal::MarkForCC()
|
||||
{
|
||||
return mMessageManager ? mMessageManager->MarkForCC() : false;
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(ProcessGlobal)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(ProcessGlobal)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMessageManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGlobal)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(ProcessGlobal)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
|
||||
for (uint32_t i = 0; i < tmp->mAnonymousGlobalScopes.Length(); ++i) {
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mAnonymousGlobalScopes[i])
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ProcessGlobal)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mMessageManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mGlobal)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mAnonymousGlobalScopes)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ProcessGlobal)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContentProcessMessageManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMessageListenerManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMessageSender)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISyncMessageSender)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIContentProcessMessageManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ContentProcessMessageManager)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(ProcessGlobal)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(ProcessGlobal)
|
||||
|
||||
bool
|
||||
ProcessGlobal::Init()
|
||||
{
|
||||
if (mInitialized) {
|
||||
return true;
|
||||
}
|
||||
mInitialized = true;
|
||||
|
||||
nsISupports* scopeSupports = NS_ISUPPORTS_CAST(nsIContentProcessMessageManager*, this);
|
||||
return InitChildGlobalInternal(scopeSupports, NS_LITERAL_CSTRING("processChildGlobal"));
|
||||
}
|
||||
|
||||
void
|
||||
ProcessGlobal::LoadScript(const nsAString& aURL)
|
||||
{
|
||||
Init();
|
||||
LoadScriptInternal(aURL, false);
|
||||
}
|
77
dom/base/ProcessGlobal.h
Normal file
77
dom/base/ProcessGlobal.h
Normal file
@ -0,0 +1,77 @@
|
||||
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8; -*- */
|
||||
/* vim: set sw=4 ts=8 et 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 mozilla_dom_ProcessGlobal_h
|
||||
#define mozilla_dom_ProcessGlobal_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsFrameMessageManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIClassInfo.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsIGlobalObject.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class ProcessGlobal :
|
||||
public nsMessageManagerScriptExecutor,
|
||||
public nsIContentProcessMessageManager,
|
||||
public nsIGlobalObject,
|
||||
public nsIScriptObjectPrincipal,
|
||||
public nsSupportsWeakReference,
|
||||
public mozilla::dom::ipc::MessageManagerCallback,
|
||||
public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
explicit ProcessGlobal(nsFrameMessageManager* aMessageManager);
|
||||
|
||||
bool Init();
|
||||
|
||||
static ProcessGlobal* Get();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(ProcessGlobal, nsIContentProcessMessageManager)
|
||||
|
||||
NS_FORWARD_SAFE_NSIMESSAGELISTENERMANAGER(mMessageManager)
|
||||
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
|
||||
NS_FORWARD_SAFE_NSISYNCMESSAGESENDER(mMessageManager)
|
||||
NS_FORWARD_SAFE_NSIMESSAGEMANAGERGLOBAL(mMessageManager)
|
||||
|
||||
virtual void LoadScript(const nsAString& aURL);
|
||||
|
||||
virtual JSObject* GetGlobalJSObject() MOZ_OVERRIDE
|
||||
{
|
||||
if (!mGlobal) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return mGlobal->GetJSObject();
|
||||
}
|
||||
virtual nsIPrincipal* GetPrincipal() MOZ_OVERRIDE { return mPrincipal; }
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* cx) MOZ_OVERRIDE
|
||||
{
|
||||
MOZ_CRASH("ProcessGlobal doesn't use DOM bindings!");
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~ProcessGlobal();
|
||||
|
||||
private:
|
||||
bool mInitialized;
|
||||
nsRefPtr<nsFrameMessageManager> mMessageManager;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_ProcessGlobal_h
|
@ -183,6 +183,7 @@ EXPORTS.mozilla.dom += [
|
||||
'PerformanceMark.h',
|
||||
'PerformanceMeasure.h',
|
||||
'PerformanceResourceTiming.h',
|
||||
'ProcessGlobal.h',
|
||||
'ResponsiveImageSelector.h',
|
||||
'ScreenOrientation.h',
|
||||
'ScriptSettings.h',
|
||||
@ -318,6 +319,7 @@ UNIFIED_SOURCES += [
|
||||
'PerformanceMark.cpp',
|
||||
'PerformanceMeasure.cpp',
|
||||
'PerformanceResourceTiming.cpp',
|
||||
'ProcessGlobal.cpp',
|
||||
'ResponsiveImageSelector.cpp',
|
||||
'ScriptSettings.cpp',
|
||||
'ShadowRoot.cpp',
|
||||
|
@ -169,8 +169,8 @@ MarkMessageManagers()
|
||||
if (nsFrameMessageManager::sSameProcessParentManager) {
|
||||
nsFrameMessageManager::sSameProcessParentManager->MarkForCC();
|
||||
}
|
||||
if (nsFrameMessageManager::sChildProcessManager) {
|
||||
nsFrameMessageManager::sChildProcessManager->MarkForCC();
|
||||
if (nsFrameMessageManager::GetChildProcessManager()) {
|
||||
nsFrameMessageManager::GetChildProcessManager()->MarkForCC();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,6 +260,9 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentFrameMessageManager, nsEventTargetSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::IS_GLOBAL_OBJECT)
|
||||
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentProcessMessageManager, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::IS_GLOBAL_OBJECT)
|
||||
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ChromeMessageBroadcaster, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ChromeMessageSender, nsDOMGenericSH,
|
||||
@ -674,8 +677,16 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIContentFrameMessageManager)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ContentProcessMessageManager, nsISupports)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageListenerManager)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageSender)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsISyncMessageSender)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIContentProcessMessageManager)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ChromeMessageBroadcaster, nsISupports)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIFrameScriptLoader)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIProcessScriptLoader)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageListenerManager)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageBroadcaster)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
@ -683,6 +694,7 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ChromeMessageSender, nsISupports)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIProcessChecker)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIFrameScriptLoader)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIProcessScriptLoader)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageListenerManager)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageSender)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
@ -40,6 +40,7 @@ DOMCI_CLASS(MozMobileMessageThread)
|
||||
DOMCI_CLASS(CSSFontFaceRule)
|
||||
|
||||
DOMCI_CLASS(ContentFrameMessageManager)
|
||||
DOMCI_CLASS(ContentProcessMessageManager)
|
||||
DOMCI_CLASS(ChromeMessageBroadcaster)
|
||||
DOMCI_CLASS(ChromeMessageSender)
|
||||
|
||||
|
@ -2303,7 +2303,7 @@ nsFrameLoader::CreateStaticClone(nsIFrameLoader* aDest)
|
||||
}
|
||||
|
||||
bool
|
||||
nsFrameLoader::DoLoadFrameScript(const nsAString& aURL, bool aRunInGlobalScope)
|
||||
nsFrameLoader::DoLoadMessageManagerScript(const nsAString& aURL, bool aRunInGlobalScope)
|
||||
{
|
||||
auto* tabParent = TabParent::GetFrom(GetRemoteBrowser());
|
||||
if (tabParent) {
|
||||
|
@ -86,8 +86,8 @@ public:
|
||||
/**
|
||||
* MessageManagerCallback methods that we override.
|
||||
*/
|
||||
virtual bool DoLoadFrameScript(const nsAString& aURL,
|
||||
bool aRunInGlobalScope) MOZ_OVERRIDE;
|
||||
virtual bool DoLoadMessageManagerScript(const nsAString& aURL,
|
||||
bool aRunInGlobalScope) MOZ_OVERRIDE;
|
||||
virtual bool DoSendAsyncMessage(JSContext* aCx,
|
||||
const nsAString& aMessage,
|
||||
const mozilla::dom::StructuredCloneData& aData,
|
||||
|
@ -29,10 +29,12 @@
|
||||
#include "nsIDOMClassInfo.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "mozilla/CycleCollectedJSRuntime.h"
|
||||
#include "mozilla/IntentionalCrash.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/nsIContentParent.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/ProcessGlobal.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/StructuredCloneUtils.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
@ -120,6 +122,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameMessageManager)
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIFrameScriptLoader,
|
||||
mChrome && !mIsProcessManager)
|
||||
|
||||
/* Process message managers (process message managers) support nsIProcessScriptLoader. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIProcessScriptLoader,
|
||||
mChrome && mIsProcessManager)
|
||||
|
||||
/* Message senders in the chrome process support nsIProcessChecker. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIProcessChecker,
|
||||
mChrome && !mIsBroadcaster)
|
||||
@ -431,9 +437,9 @@ nsFrameMessageManager::RemoveWeakMessageListener(const nsAString& aMessage,
|
||||
// nsIFrameScriptLoader
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::LoadFrameScript(const nsAString& aURL,
|
||||
bool aAllowDelayedLoad,
|
||||
bool aRunInGlobalScope)
|
||||
nsFrameMessageManager::LoadScript(const nsAString& aURL,
|
||||
bool aAllowDelayedLoad,
|
||||
bool aRunInGlobalScope)
|
||||
{
|
||||
if (aAllowDelayedLoad) {
|
||||
if (IsGlobal() || IsBroadcaster()) {
|
||||
@ -452,7 +458,7 @@ nsFrameMessageManager::LoadFrameScript(const nsAString& aURL,
|
||||
#ifdef DEBUG_smaug
|
||||
printf("Will load %s \n", NS_ConvertUTF16toUTF8(aURL).get());
|
||||
#endif
|
||||
NS_ENSURE_TRUE(mCallback->DoLoadFrameScript(aURL, aRunInGlobalScope),
|
||||
NS_ENSURE_TRUE(mCallback->DoLoadMessageManagerScript(aURL, aRunInGlobalScope),
|
||||
NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
@ -462,14 +468,14 @@ nsFrameMessageManager::LoadFrameScript(const nsAString& aURL,
|
||||
if (mm) {
|
||||
// Use false here, so that child managers don't cache the script, which
|
||||
// is already cached in the parent.
|
||||
mm->LoadFrameScript(aURL, false, aRunInGlobalScope);
|
||||
mm->LoadScript(aURL, false, aRunInGlobalScope);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::RemoveDelayedFrameScript(const nsAString& aURL)
|
||||
nsFrameMessageManager::RemoveDelayedScript(const nsAString& aURL)
|
||||
{
|
||||
for (uint32_t i = 0; i < mPendingScripts.Length(); ++i) {
|
||||
if (mPendingScripts[i] == aURL) {
|
||||
@ -482,7 +488,7 @@ nsFrameMessageManager::RemoveDelayedFrameScript(const nsAString& aURL)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::GetDelayedFrameScripts(JSContext* aCx, JS::MutableHandle<JS::Value> aList)
|
||||
nsFrameMessageManager::GetDelayedScripts(JSContext* aCx, JS::MutableHandle<JS::Value> aList)
|
||||
{
|
||||
// Frame message managers may return an incomplete list because scripts
|
||||
// that were loaded after it was connected are not added to the list.
|
||||
@ -516,6 +522,49 @@ nsFrameMessageManager::GetDelayedFrameScripts(JSContext* aCx, JS::MutableHandle<
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIFrameScriptLoader
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::LoadFrameScript(const nsAString& aURL,
|
||||
bool aAllowDelayedLoad,
|
||||
bool aRunInGlobalScope)
|
||||
{
|
||||
return LoadScript(aURL, aAllowDelayedLoad, aRunInGlobalScope);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::RemoveDelayedFrameScript(const nsAString& aURL)
|
||||
{
|
||||
return RemoveDelayedScript(aURL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::GetDelayedFrameScripts(JSContext* aCx, JS::MutableHandle<JS::Value> aList)
|
||||
{
|
||||
return GetDelayedScripts(aCx, aList);
|
||||
}
|
||||
|
||||
// nsIProcessScriptLoader
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::LoadProcessScript(const nsAString& aURL,
|
||||
bool aAllowDelayedLoad)
|
||||
{
|
||||
return LoadScript(aURL, aAllowDelayedLoad, false);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::RemoveDelayedProcessScript(const nsAString& aURL)
|
||||
{
|
||||
return RemoveDelayedScript(aURL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::GetDelayedProcessScripts(JSContext* aCx, JS::MutableHandle<JS::Value> aList)
|
||||
{
|
||||
return GetDelayedScripts(aCx, aList);
|
||||
}
|
||||
|
||||
static bool
|
||||
JSONCreator(const char16_t* aBuf, uint32_t aLen, void* aData)
|
||||
{
|
||||
@ -775,7 +824,12 @@ nsFrameMessageManager::Dump(const nsAString& aStr)
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::PrivateNoteIntentionalCrash()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
mozilla::NoteIntentionalCrash("tab");
|
||||
return NS_OK;
|
||||
} else {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -796,14 +850,14 @@ NS_IMETHODIMP
|
||||
nsFrameMessageManager::Btoa(const nsAString& aBinaryData,
|
||||
nsAString& aAsciiBase64String)
|
||||
{
|
||||
return NS_OK;
|
||||
return nsContentUtils::Btoa(aBinaryData, aAsciiBase64String);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::Atob(const nsAString& aAsciiString,
|
||||
nsAString& aBinaryData)
|
||||
{
|
||||
return NS_OK;
|
||||
return nsContentUtils::Atob(aAsciiString, aBinaryData);
|
||||
}
|
||||
|
||||
// nsIProcessChecker
|
||||
@ -1393,17 +1447,17 @@ NS_NewGlobalMessageManager(nsIMessageBroadcaster** aResult)
|
||||
return CallQueryInterface(mm, aResult);
|
||||
}
|
||||
|
||||
nsDataHashtable<nsStringHashKey, nsFrameScriptObjectExecutorHolder*>*
|
||||
nsFrameScriptExecutor::sCachedScripts = nullptr;
|
||||
nsScriptCacheCleaner* nsFrameScriptExecutor::sScriptCacheCleaner = nullptr;
|
||||
nsDataHashtable<nsStringHashKey, nsMessageManagerScriptHolder*>*
|
||||
nsMessageManagerScriptExecutor::sCachedScripts = nullptr;
|
||||
nsScriptCacheCleaner* nsMessageManagerScriptExecutor::sScriptCacheCleaner = nullptr;
|
||||
|
||||
void
|
||||
nsFrameScriptExecutor::DidCreateGlobal()
|
||||
nsMessageManagerScriptExecutor::DidCreateGlobal()
|
||||
{
|
||||
NS_ASSERTION(mGlobal, "Should have mGlobal!");
|
||||
if (!sCachedScripts) {
|
||||
sCachedScripts =
|
||||
new nsDataHashtable<nsStringHashKey, nsFrameScriptObjectExecutorHolder*>;
|
||||
new nsDataHashtable<nsStringHashKey, nsMessageManagerScriptHolder*>;
|
||||
|
||||
nsRefPtr<nsScriptCacheCleaner> scriptCacheCleaner =
|
||||
new nsScriptCacheCleaner();
|
||||
@ -1413,7 +1467,7 @@ nsFrameScriptExecutor::DidCreateGlobal()
|
||||
|
||||
static PLDHashOperator
|
||||
RemoveCachedScriptEntry(const nsAString& aKey,
|
||||
nsFrameScriptObjectExecutorHolder*& aData,
|
||||
nsMessageManagerScriptHolder*& aData,
|
||||
void* aUserArg)
|
||||
{
|
||||
delete aData;
|
||||
@ -1422,7 +1476,7 @@ RemoveCachedScriptEntry(const nsAString& aKey,
|
||||
|
||||
// static
|
||||
void
|
||||
nsFrameScriptExecutor::Shutdown()
|
||||
nsMessageManagerScriptExecutor::Shutdown()
|
||||
{
|
||||
if (sCachedScripts) {
|
||||
AutoSafeJSContext cx;
|
||||
@ -1438,8 +1492,8 @@ nsFrameScriptExecutor::Shutdown()
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL,
|
||||
bool aRunInGlobalScope)
|
||||
nsMessageManagerScriptExecutor::LoadScriptInternal(const nsAString& aURL,
|
||||
bool aRunInGlobalScope)
|
||||
{
|
||||
if (!mGlobal || !sCachedScripts) {
|
||||
return;
|
||||
@ -1448,7 +1502,7 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL,
|
||||
JSRuntime* rt = CycleCollectedJSRuntime::Get()->Runtime();
|
||||
JS::Rooted<JSScript*> script(rt);
|
||||
|
||||
nsFrameScriptObjectExecutorHolder* holder = sCachedScripts->Get(aURL);
|
||||
nsMessageManagerScriptHolder* holder = sCachedScripts->Get(aURL);
|
||||
if (holder && holder->WillRunInGlobalScope() == aRunInGlobalScope) {
|
||||
script = holder->mScript;
|
||||
} else {
|
||||
@ -1480,10 +1534,11 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL,
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameScriptExecutor::TryCacheLoadAndCompileScript(const nsAString& aURL,
|
||||
bool aRunInGlobalScope,
|
||||
bool aShouldCache,
|
||||
JS::MutableHandle<JSScript*> aScriptp)
|
||||
nsMessageManagerScriptExecutor::TryCacheLoadAndCompileScript(
|
||||
const nsAString& aURL,
|
||||
bool aRunInGlobalScope,
|
||||
bool aShouldCache,
|
||||
JS::MutableHandle<JSScript*> aScriptp)
|
||||
{
|
||||
nsCString url = NS_ConvertUTF16toUTF8(aURL);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
@ -1565,11 +1620,11 @@ nsFrameScriptExecutor::TryCacheLoadAndCompileScript(const nsAString& aURL,
|
||||
uri->GetScheme(scheme);
|
||||
// We don't cache data: scripts!
|
||||
if (aShouldCache && !scheme.EqualsLiteral("data")) {
|
||||
nsFrameScriptObjectExecutorHolder* holder;
|
||||
nsMessageManagerScriptHolder* holder;
|
||||
|
||||
// Root the object also for caching.
|
||||
if (script) {
|
||||
holder = new nsFrameScriptObjectExecutorHolder(cx, script, aRunInGlobalScope);
|
||||
holder = new nsMessageManagerScriptHolder(cx, script, aRunInGlobalScope);
|
||||
}
|
||||
sCachedScripts->Put(aURL, holder);
|
||||
}
|
||||
@ -1577,8 +1632,9 @@ nsFrameScriptExecutor::TryCacheLoadAndCompileScript(const nsAString& aURL,
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameScriptExecutor::TryCacheLoadAndCompileScript(const nsAString& aURL,
|
||||
bool aRunInGlobalScope)
|
||||
nsMessageManagerScriptExecutor::TryCacheLoadAndCompileScript(
|
||||
const nsAString& aURL,
|
||||
bool aRunInGlobalScope)
|
||||
{
|
||||
AutoSafeJSContext cx;
|
||||
JS::Rooted<JSScript*> script(cx);
|
||||
@ -1586,8 +1642,9 @@ nsFrameScriptExecutor::TryCacheLoadAndCompileScript(const nsAString& aURL,
|
||||
}
|
||||
|
||||
bool
|
||||
nsFrameScriptExecutor::InitTabChildGlobalInternal(nsISupports* aScope,
|
||||
const nsACString& aID)
|
||||
nsMessageManagerScriptExecutor::InitChildGlobalInternal(
|
||||
nsISupports* aScope,
|
||||
const nsACString& aID)
|
||||
{
|
||||
|
||||
nsCOMPtr<nsIJSRuntimeService> runtimeSvc =
|
||||
@ -1647,7 +1704,7 @@ public:
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
nsFrameMessageManager* ppm = nsFrameMessageManager::sChildProcessManager;
|
||||
nsFrameMessageManager* ppm = nsFrameMessageManager::GetChildProcessManager();
|
||||
ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm), ppm);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1669,6 +1726,15 @@ public:
|
||||
MOZ_COUNT_DTOR(SameParentProcessMessageManagerCallback);
|
||||
}
|
||||
|
||||
virtual bool DoLoadMessageManagerScript(const nsAString& aURL,
|
||||
bool aRunInGlobalScope) MOZ_OVERRIDE
|
||||
{
|
||||
ProcessGlobal* global = ProcessGlobal::Get();
|
||||
MOZ_ASSERT(!aRunInGlobalScope);
|
||||
global->LoadScript(aURL);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool DoSendAsyncMessage(JSContext* aCx,
|
||||
const nsAString& aMessage,
|
||||
const StructuredCloneData& aData,
|
||||
@ -1911,7 +1977,7 @@ nsFrameMessageManager::NewProcessMessageManager(mozilla::dom::nsIContentParent*
|
||||
nsresult
|
||||
NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult)
|
||||
{
|
||||
NS_ASSERTION(!nsFrameMessageManager::sChildProcessManager,
|
||||
NS_ASSERTION(!nsFrameMessageManager::GetChildProcessManager(),
|
||||
"Re-creating sChildProcessManager");
|
||||
|
||||
MessageManagerCallback* cb;
|
||||
@ -1924,8 +1990,11 @@ NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult)
|
||||
nsFrameMessageManager* mm = new nsFrameMessageManager(cb,
|
||||
nullptr,
|
||||
MM_PROCESSMANAGER | MM_OWNSCALLBACK);
|
||||
nsFrameMessageManager::sChildProcessManager = mm;
|
||||
return CallQueryInterface(mm, aResult);
|
||||
nsFrameMessageManager::SetChildProcessManager(mm);
|
||||
ProcessGlobal* global = new ProcessGlobal(mm);
|
||||
NS_ENSURE_TRUE(global->Init(), NS_ERROR_UNEXPECTED);
|
||||
return CallQueryInterface(global, aResult);
|
||||
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
|
@ -54,7 +54,7 @@ class MessageManagerCallback
|
||||
public:
|
||||
virtual ~MessageManagerCallback() {}
|
||||
|
||||
virtual bool DoLoadFrameScript(const nsAString& aURL, bool aRunInGlobalScope)
|
||||
virtual bool DoLoadMessageManagerScript(const nsAString& aURL, bool aRunInGlobalScope)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -154,6 +154,7 @@ private:
|
||||
class nsFrameMessageManager MOZ_FINAL : public nsIContentFrameMessageManager,
|
||||
public nsIMessageBroadcaster,
|
||||
public nsIFrameScriptLoader,
|
||||
public nsIProcessScriptLoader,
|
||||
public nsIProcessChecker
|
||||
{
|
||||
friend class mozilla::dom::MessageManagerReporter;
|
||||
@ -217,8 +218,10 @@ public:
|
||||
NS_DECL_NSIMESSAGESENDER
|
||||
NS_DECL_NSIMESSAGEBROADCASTER
|
||||
NS_DECL_NSISYNCMESSAGESENDER
|
||||
NS_DECL_NSIMESSAGEMANAGERGLOBAL
|
||||
NS_DECL_NSICONTENTFRAMEMESSAGEMANAGER
|
||||
NS_DECL_NSIFRAMESCRIPTLOADER
|
||||
NS_DECL_NSIPROCESSSCRIPTLOADER
|
||||
NS_DECL_NSIPROCESSCHECKER
|
||||
|
||||
static nsFrameMessageManager*
|
||||
@ -273,6 +276,10 @@ public:
|
||||
{
|
||||
return sChildProcessManager;
|
||||
}
|
||||
static void SetChildProcessManager(nsFrameMessageManager* aManager)
|
||||
{
|
||||
sChildProcessManager = aManager;
|
||||
}
|
||||
private:
|
||||
nsresult SendMessage(const nsAString& aMessageName,
|
||||
JS::Handle<JS::Value> aJSON,
|
||||
@ -282,6 +289,13 @@ private:
|
||||
uint8_t aArgc,
|
||||
JS::MutableHandle<JS::Value> aRetval,
|
||||
bool aIsSync);
|
||||
|
||||
NS_IMETHOD LoadScript(const nsAString& aURL,
|
||||
bool aAllowDelayedLoad,
|
||||
bool aRunInGlobalScope);
|
||||
NS_IMETHOD RemoveDelayedScript(const nsAString& aURL);
|
||||
NS_IMETHOD GetDelayedScripts(JSContext* aCx, JS::MutableHandle<JS::Value> aList);
|
||||
|
||||
protected:
|
||||
friend class MMListenerRemover;
|
||||
// We keep the message listeners as arrays in a hastable indexed by the
|
||||
@ -306,10 +320,10 @@ protected:
|
||||
nsFrameMessageManager* aChildMM);
|
||||
public:
|
||||
static nsFrameMessageManager* sParentProcessManager;
|
||||
static nsFrameMessageManager* sChildProcessManager;
|
||||
static nsFrameMessageManager* sSameProcessParentManager;
|
||||
static nsTArray<nsCOMPtr<nsIRunnable> >* sPendingSameProcessAsyncMessages;
|
||||
private:
|
||||
static nsFrameMessageManager* sChildProcessManager;
|
||||
enum ProcessCheckerType {
|
||||
PROCESS_CHECKER_PERMISSION,
|
||||
PROCESS_CHECKER_MANIFEST_URL,
|
||||
@ -361,14 +375,16 @@ private:
|
||||
|
||||
class nsScriptCacheCleaner;
|
||||
|
||||
struct nsFrameScriptObjectExecutorHolder
|
||||
struct nsMessageManagerScriptHolder
|
||||
{
|
||||
nsFrameScriptObjectExecutorHolder(JSContext* aCx, JSScript* aScript, bool aRunInGlobalScope)
|
||||
nsMessageManagerScriptHolder(JSContext* aCx,
|
||||
JSScript* aScript,
|
||||
bool aRunInGlobalScope)
|
||||
: mScript(aCx, aScript), mRunInGlobalScope(aRunInGlobalScope)
|
||||
{ MOZ_COUNT_CTOR(nsFrameScriptObjectExecutorHolder); }
|
||||
{ MOZ_COUNT_CTOR(nsMessageManagerScriptHolder); }
|
||||
|
||||
~nsFrameScriptObjectExecutorHolder()
|
||||
{ MOZ_COUNT_DTOR(nsFrameScriptObjectExecutorHolder); }
|
||||
~nsMessageManagerScriptHolder()
|
||||
{ MOZ_COUNT_DTOR(nsMessageManagerScriptHolder); }
|
||||
|
||||
bool WillRunInGlobalScope() { return mRunInGlobalScope; }
|
||||
|
||||
@ -376,9 +392,7 @@ struct nsFrameScriptObjectExecutorHolder
|
||||
bool mRunInGlobalScope;
|
||||
};
|
||||
|
||||
class nsFrameScriptObjectExecutorStackHolder;
|
||||
|
||||
class nsFrameScriptExecutor
|
||||
class nsMessageManagerScriptExecutor
|
||||
{
|
||||
public:
|
||||
static void Shutdown();
|
||||
@ -388,24 +402,24 @@ public:
|
||||
return ref.forget();
|
||||
}
|
||||
protected:
|
||||
friend class nsFrameScriptCx;
|
||||
nsFrameScriptExecutor() { MOZ_COUNT_CTOR(nsFrameScriptExecutor); }
|
||||
~nsFrameScriptExecutor() { MOZ_COUNT_DTOR(nsFrameScriptExecutor); }
|
||||
friend class nsMessageManagerScriptCx;
|
||||
nsMessageManagerScriptExecutor() { MOZ_COUNT_CTOR(nsMessageManagerScriptExecutor); }
|
||||
~nsMessageManagerScriptExecutor() { MOZ_COUNT_DTOR(nsMessageManagerScriptExecutor); }
|
||||
|
||||
void DidCreateGlobal();
|
||||
void LoadFrameScriptInternal(const nsAString& aURL, bool aRunInGlobalScope);
|
||||
void LoadScriptInternal(const nsAString& aURL, bool aRunInGlobalScope);
|
||||
void TryCacheLoadAndCompileScript(const nsAString& aURL,
|
||||
bool aRunInGlobalScope,
|
||||
bool aShouldCache,
|
||||
JS::MutableHandle<JSScript*> aScriptp);
|
||||
void TryCacheLoadAndCompileScript(const nsAString& aURL,
|
||||
bool aRunInGlobalScope);
|
||||
bool InitTabChildGlobalInternal(nsISupports* aScope, const nsACString& aID);
|
||||
bool InitChildGlobalInternal(nsISupports* aScope, const nsACString& aID);
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> mGlobal;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
nsAutoTArray<JS::Heap<JSObject*>, 2> mAnonymousGlobalScopes;
|
||||
|
||||
static nsDataHashtable<nsStringHashKey, nsFrameScriptObjectExecutorHolder*>* sCachedScripts;
|
||||
static nsDataHashtable<nsStringHashKey, nsMessageManagerScriptHolder*>* sCachedScripts;
|
||||
static nsScriptCacheCleaner* sScriptCacheCleaner;
|
||||
};
|
||||
|
||||
@ -426,7 +440,7 @@ class nsScriptCacheCleaner MOZ_FINAL : public nsIObserver
|
||||
const char *aTopic,
|
||||
const char16_t *aData) MOZ_OVERRIDE
|
||||
{
|
||||
nsFrameScriptExecutor::Shutdown();
|
||||
nsMessageManagerScriptExecutor::Shutdown();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
@ -518,26 +518,12 @@ nsHostObjectProtocolHandler::NewChannel2(nsIURI* uri,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
// Bug 1087720 (and Bug 1099296):
|
||||
// Once all callsites have been updated to call NewChannel2() instead of NewChannel()
|
||||
// we should have a non-null loadInfo consistently. Until then we have to brach on the
|
||||
// loadInfo and provide default arguments to create a NewInputStreamChannel.
|
||||
if (aLoadInfo) {
|
||||
rv = NS_NewInputStreamChannelInternal(getter_AddRefs(channel),
|
||||
uri,
|
||||
stream,
|
||||
EmptyCString(), // aContentType
|
||||
EmptyCString(), // aContentCharset
|
||||
aLoadInfo);
|
||||
}
|
||||
else {
|
||||
rv = NS_NewInputStreamChannel(getter_AddRefs(channel),
|
||||
uri,
|
||||
stream,
|
||||
info->mPrincipal,
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
nsIContentPolicy::TYPE_OTHER);
|
||||
}
|
||||
rv = NS_NewInputStreamChannelInternal(getter_AddRefs(channel),
|
||||
uri,
|
||||
stream,
|
||||
EmptyCString(), // aContentType
|
||||
EmptyCString(), // aContentCharset
|
||||
aLoadInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsString type;
|
||||
|
@ -341,19 +341,9 @@ interface nsISyncMessageSender : nsIMessageSender
|
||||
[optional] in nsIPrincipal principal);
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(894ff2d4-39a3-4df8-9d76-8ee329975488)]
|
||||
interface nsIContentFrameMessageManager : nsISyncMessageSender
|
||||
[scriptable, builtinclass, uuid(e04a7ade-c61a-46ec-9f13-efeabedd9d3d)]
|
||||
interface nsIMessageManagerGlobal : nsISyncMessageSender
|
||||
{
|
||||
/**
|
||||
* The current top level window in the frame or null.
|
||||
*/
|
||||
readonly attribute nsIDOMWindow content;
|
||||
|
||||
/**
|
||||
* The top level docshell or null.
|
||||
*/
|
||||
readonly attribute nsIDocShell docShell;
|
||||
|
||||
/**
|
||||
* Print a string to stdout.
|
||||
*/
|
||||
@ -365,11 +355,25 @@ interface nsIContentFrameMessageManager : nsISyncMessageSender
|
||||
*/
|
||||
void privateNoteIntentionalCrash();
|
||||
|
||||
/**
|
||||
* Ascii base64 data to binary data and vice versa
|
||||
*/
|
||||
DOMString atob(in DOMString aAsciiString);
|
||||
DOMString btoa(in DOMString aBase64Data);
|
||||
/**
|
||||
* Ascii base64 data to binary data and vice versa
|
||||
*/
|
||||
DOMString atob(in DOMString aAsciiString);
|
||||
DOMString btoa(in DOMString aBase64Data);
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(fff36099-9f84-4c7c-b69a-1cbf103d1708)]
|
||||
interface nsIContentFrameMessageManager : nsIMessageManagerGlobal
|
||||
{
|
||||
/**
|
||||
* The current top level window in the frame or null.
|
||||
*/
|
||||
readonly attribute nsIDOMWindow content;
|
||||
|
||||
/**
|
||||
* The top level docshell or null.
|
||||
*/
|
||||
readonly attribute nsIDocShell docShell;
|
||||
};
|
||||
|
||||
[uuid(a2325927-9c0c-437d-9215-749c79235031)]
|
||||
@ -378,6 +382,11 @@ interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
|
||||
[notxpcom] nsIContent getOwnerContent();
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(9ca95410-b253-11e4-ab27-0800200c9a66)]
|
||||
interface nsIContentProcessMessageManager : nsIMessageManagerGlobal
|
||||
{
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(6fb78110-45ae-11e3-8f96-0800200c9a66)]
|
||||
interface nsIFrameScriptLoader : nsISupports
|
||||
{
|
||||
@ -405,6 +414,31 @@ interface nsIFrameScriptLoader : nsISupports
|
||||
jsval getDelayedFrameScripts();
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(7e1e1a20-b24f-11e4-ab27-0800200c9a66)]
|
||||
interface nsIProcessScriptLoader : nsISupports
|
||||
{
|
||||
/**
|
||||
* Load a script in the (possibly remote) process. aURL must be the absolute URL.
|
||||
* data: URLs are also supported. For example data:,dump("foo\n");
|
||||
* If aAllowDelayedLoad is true, script will be loaded when the
|
||||
* remote frame becomes available. Otherwise the script will be loaded
|
||||
* only if the frame is already available.
|
||||
*/
|
||||
void loadProcessScript(in AString aURL, in boolean aAllowDelayedLoad);
|
||||
|
||||
/**
|
||||
* Removes aURL from the list of scripts which support delayed load.
|
||||
*/
|
||||
void removeDelayedProcessScript(in AString aURL);
|
||||
|
||||
/**
|
||||
* Returns all delayed scripts that will be loaded once a (remote)
|
||||
* frame becomes available. The return value is a list of URLs.
|
||||
*/
|
||||
[implicit_jscontext]
|
||||
jsval getDelayedProcessScripts();
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(637e8538-4f8f-4a3d-8510-e74386233e19)]
|
||||
interface nsIProcessChecker : nsISupports
|
||||
{
|
||||
|
@ -205,27 +205,6 @@ nsInProcessTabChildGlobal::GetDocShell(nsIDocShell** aDocShell)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInProcessTabChildGlobal::Btoa(const nsAString& aBinaryData,
|
||||
nsAString& aAsciiBase64String)
|
||||
{
|
||||
return nsContentUtils::Btoa(aBinaryData, aAsciiBase64String);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInProcessTabChildGlobal::Atob(const nsAString& aAsciiString,
|
||||
nsAString& aBinaryData)
|
||||
{
|
||||
return nsContentUtils::Atob(aAsciiString, aBinaryData);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInProcessTabChildGlobal::PrivateNoteIntentionalCrash()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void
|
||||
nsInProcessTabChildGlobal::Disconnect()
|
||||
{
|
||||
@ -318,7 +297,7 @@ nsInProcessTabChildGlobal::InitTabChildGlobal()
|
||||
id.Append(u);
|
||||
}
|
||||
nsISupports* scopeSupports = NS_ISUPPORTS_CAST(EventTarget*, this);
|
||||
NS_ENSURE_STATE(InitTabChildGlobalInternal(scopeSupports, id));
|
||||
NS_ENSURE_STATE(InitChildGlobalInternal(scopeSupports, id));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -352,6 +331,6 @@ nsInProcessTabChildGlobal::LoadFrameScript(const nsAString& aURL, bool aRunInGlo
|
||||
}
|
||||
bool tmp = mLoadingScript;
|
||||
mLoadingScript = true;
|
||||
LoadFrameScriptInternal(aURL, aRunInGlobalScope);
|
||||
LoadScriptInternal(aURL, aRunInGlobalScope);
|
||||
mLoadingScript = tmp;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class EventChainPreVisitor;
|
||||
} // namespace mozilla
|
||||
|
||||
class nsInProcessTabChildGlobal : public mozilla::DOMEventTargetHelper,
|
||||
public nsFrameScriptExecutor,
|
||||
public nsMessageManagerScriptExecutor,
|
||||
public nsIInProcessContentFrameMessageManager,
|
||||
public nsIGlobalObject,
|
||||
public nsIScriptObjectPrincipal,
|
||||
@ -44,6 +44,7 @@ public:
|
||||
|
||||
NS_FORWARD_SAFE_NSIMESSAGELISTENERMANAGER(mMessageManager)
|
||||
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
|
||||
NS_FORWARD_SAFE_NSIMESSAGEMANAGERGLOBAL(mMessageManager)
|
||||
NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
|
||||
JS::Handle<JS::Value> aObject,
|
||||
JS::Handle<JS::Value> aRemote,
|
||||
@ -72,15 +73,6 @@ public:
|
||||
}
|
||||
NS_IMETHOD GetContent(nsIDOMWindow** aContent) MOZ_OVERRIDE;
|
||||
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell) MOZ_OVERRIDE;
|
||||
NS_IMETHOD Dump(const nsAString& aStr) MOZ_OVERRIDE
|
||||
{
|
||||
return mMessageManager ? mMessageManager->Dump(aStr) : NS_OK;
|
||||
}
|
||||
NS_IMETHOD PrivateNoteIntentionalCrash() MOZ_OVERRIDE;
|
||||
NS_IMETHOD Btoa(const nsAString& aBinaryData,
|
||||
nsAString& aAsciiBase64String) MOZ_OVERRIDE;
|
||||
NS_IMETHOD Atob(const nsAString& aAsciiString,
|
||||
nsAString& aBinaryData) MOZ_OVERRIDE;
|
||||
|
||||
NS_DECL_NSIINPROCESSCONTENTFRAMEMESSAGEMANAGER
|
||||
|
||||
|
@ -371,3 +371,9 @@ JSObject* GetDefaultScopeFromJSContext(JSContext *cx)
|
||||
nsIScriptContext *scx = GetScriptContextFromJSContext(cx);
|
||||
return scx ? scx->GetWindowProxy() : nullptr;
|
||||
}
|
||||
|
||||
bool nsAutoJSString::init(const JS::Value &v)
|
||||
{
|
||||
return init(nsContentUtils::RootingCxForThread(), v);
|
||||
}
|
||||
|
||||
|
@ -217,6 +217,8 @@ public:
|
||||
return JS_IdToValue(aContext, id, &v) && init(aContext, v);
|
||||
}
|
||||
|
||||
bool init(const JS::Value &v);
|
||||
|
||||
~nsAutoJSString() {}
|
||||
};
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class TabChildGlobal;
|
||||
class ProcessGlobal;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
class SandboxPrivate;
|
||||
@ -263,6 +264,7 @@ protected:
|
||||
|
||||
private:
|
||||
friend class mozilla::dom::TabChildGlobal;
|
||||
friend class mozilla::dom::ProcessGlobal;
|
||||
friend class SandboxPrivate;
|
||||
friend class nsInProcessTabChildGlobal;
|
||||
friend class nsWindowRoot;
|
||||
|
@ -4,6 +4,7 @@
|
||||
skip-if = e10s # Bug ?????? - test directly touches content (contentWindow.iframe.addEventListener)
|
||||
[browser_bug902350.js]
|
||||
skip-if = e10s # Bug ?????? - test e10s utils don't support load events from iframe etc, which this test relies on.
|
||||
[browser_messagemanager_loadprocessscript.js]
|
||||
[browser_state_notifications.js]
|
||||
# skip-if = e10s # Bug ?????? - content-document-* notifications come while document's URI is still about:blank, but test expects real URL.
|
||||
skip-if = true # Intermittent failures - bug 987493. Restore the skip-if above once fixed
|
||||
|
44
dom/base/test/browser_messagemanager_loadprocessscript.js
Normal file
44
dom/base/test/browser_messagemanager_loadprocessscript.js
Normal file
@ -0,0 +1,44 @@
|
||||
let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIMessageBroadcaster);
|
||||
ppmm.QueryInterface(Ci.nsIProcessScriptLoader);
|
||||
|
||||
function processScript() {
|
||||
let cpmm = Components.classes["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Components.interfaces.nsISyncMessageSender);
|
||||
if (cpmm !== this) {
|
||||
dump("Test failed: wrong global object\n");
|
||||
return;
|
||||
}
|
||||
|
||||
this.cpmm = cpmm;
|
||||
|
||||
addMessageListener("ProcessTest:Reply", function listener(msg) {
|
||||
removeMessageListener("ProcessTest:Reply", listener);
|
||||
sendAsyncMessage("ProcessTest:Finished");
|
||||
});
|
||||
sendSyncMessage("ProcessTest:Loaded");
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
let replyCount = 0;
|
||||
|
||||
function loadListener(msg) {
|
||||
replyCount++;
|
||||
msg.target.sendAsyncMessage("ProcessTest:Reply");
|
||||
}
|
||||
|
||||
ppmm.addMessageListener("ProcessTest:Loaded", loadListener);
|
||||
ppmm.addMessageListener("ProcessTest:Finished", function finishListener(msg) {
|
||||
if (replyCount < ppmm.childCount) {
|
||||
return;
|
||||
}
|
||||
info("Got " + replyCount + " replies");
|
||||
ok(replyCount, "Got message reply");
|
||||
ppmm.removeMessageListener("ProcessTest:Loaded", loadListener);
|
||||
ppmm.removeMessageListener("ProcessTest:Finished", finishListener);
|
||||
finish();
|
||||
});
|
||||
ppmm.loadProcessScript("data:,(" + processScript.toString() + ")()", true);
|
||||
}
|
@ -62,7 +62,7 @@ MSG_DEF(MSG_INVALID_HEADER_SEQUENCE, 0, JSEXN_TYPEERR, "Headers require name/val
|
||||
MSG_DEF(MSG_PERMISSION_DENIED_TO_PASS_ARG, 1, JSEXN_TYPEERR, "Permission denied to pass cross-origin object as {0}.")
|
||||
MSG_DEF(MSG_MISSING_REQUIRED_DICTIONARY_MEMBER, 1, JSEXN_TYPEERR, "Missing required {0}.")
|
||||
MSG_DEF(MSG_INVALID_REQUEST_METHOD, 1, JSEXN_TYPEERR, "Invalid request method {0}.")
|
||||
MSG_DEF(MSG_REQUEST_BODY_CONSUMED_ERROR, 0, JSEXN_TYPEERR, "Request body has already been consumed.")
|
||||
MSG_DEF(MSG_FETCH_BODY_CONSUMED_ERROR, 0, JSEXN_TYPEERR, "Body has already been consumed.")
|
||||
MSG_DEF(MSG_RESPONSE_INVALID_STATUSTEXT_ERROR, 0, JSEXN_TYPEERR, "Response statusText may not contain newline or carriage return.")
|
||||
MSG_DEF(MSG_FETCH_FAILED, 0, JSEXN_TYPEERR, "NetworkError when attempting to fetch resource.")
|
||||
MSG_DEF(MSG_NO_BODY_ALLOWED_FOR_GET_AND_HEAD, 0, JSEXN_TYPEERR, "HEAD or GET Request cannot have a body.")
|
||||
|
@ -335,7 +335,7 @@ public:
|
||||
|
||||
virtual bool Notify(JSContext* aCx, workers::Status aStatus) MOZ_OVERRIDE
|
||||
{
|
||||
if (aStatus >= Canceling) {
|
||||
if (aStatus >= Closing) {
|
||||
mChannel->Shutdown();
|
||||
}
|
||||
|
||||
@ -636,13 +636,6 @@ BroadcastChannel::Shutdown()
|
||||
{
|
||||
mState = StateClosed;
|
||||
|
||||
// If shutdown() is called we have to release the reference if we still keep
|
||||
// it.
|
||||
if (mIsKeptAlive) {
|
||||
mIsKeptAlive = false;
|
||||
Release();
|
||||
}
|
||||
|
||||
if (mWorkerFeature) {
|
||||
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
||||
workerPrivate->RemoveFeature(workerPrivate->GetJSContext(), mWorkerFeature);
|
||||
@ -657,6 +650,13 @@ BroadcastChannel::Shutdown()
|
||||
|
||||
mActor = nullptr;
|
||||
}
|
||||
|
||||
// If shutdown() is called we have to release the reference if we still keep
|
||||
// it.
|
||||
if (mIsKeptAlive) {
|
||||
mIsKeptAlive = false;
|
||||
Release();
|
||||
}
|
||||
}
|
||||
|
||||
EventHandlerNonNull*
|
||||
|
@ -1164,7 +1164,7 @@ FetchBody<Derived>::ConsumeBody(ConsumeType aType, ErrorResult& aRv)
|
||||
{
|
||||
mConsumeType = aType;
|
||||
if (BodyUsed()) {
|
||||
aRv.ThrowTypeError(MSG_REQUEST_BODY_CONSUMED_ERROR);
|
||||
aRv.ThrowTypeError(MSG_FETCH_BODY_CONSUMED_ERROR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ template <class Derived>
|
||||
class FetchBody {
|
||||
public:
|
||||
bool
|
||||
BodyUsed() { return mBodyUsed; }
|
||||
BodyUsed() const { return mBodyUsed; }
|
||||
|
||||
already_AddRefed<Promise>
|
||||
ArrayBuffer(ErrorResult& aRv)
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsStreamUtils.h"
|
||||
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
@ -43,6 +44,53 @@ InternalRequest::GetRequestConstructorCopy(nsIGlobalObject* aGlobal, ErrorResult
|
||||
return copy.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<InternalRequest>
|
||||
InternalRequest::Clone()
|
||||
{
|
||||
nsRefPtr<InternalRequest> clone = new InternalRequest(*this);
|
||||
|
||||
if (!mBodyStream) {
|
||||
return clone.forget();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInputStream> clonedBody;
|
||||
nsCOMPtr<nsIInputStream> replacementBody;
|
||||
|
||||
nsresult rv = NS_CloneInputStream(mBodyStream, getter_AddRefs(clonedBody),
|
||||
getter_AddRefs(replacementBody));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return nullptr; }
|
||||
|
||||
clone->mBodyStream.swap(clonedBody);
|
||||
if (replacementBody) {
|
||||
mBodyStream.swap(replacementBody);
|
||||
}
|
||||
|
||||
return clone.forget();
|
||||
}
|
||||
|
||||
InternalRequest::InternalRequest(const InternalRequest& aOther)
|
||||
: mMethod(aOther.mMethod)
|
||||
, mURL(aOther.mURL)
|
||||
, mHeaders(new InternalHeaders(*aOther.mHeaders))
|
||||
, mContentPolicyType(aOther.mContentPolicyType)
|
||||
, mReferrer(aOther.mReferrer)
|
||||
, mMode(aOther.mMode)
|
||||
, mCredentialsMode(aOther.mCredentialsMode)
|
||||
, mResponseTainting(aOther.mResponseTainting)
|
||||
, mCacheMode(aOther.mCacheMode)
|
||||
, mAuthenticationFlag(aOther.mAuthenticationFlag)
|
||||
, mForceOriginHeader(aOther.mForceOriginHeader)
|
||||
, mPreserveContentCodings(aOther.mPreserveContentCodings)
|
||||
, mSameOriginDataURL(aOther.mSameOriginDataURL)
|
||||
, mSandboxedStorageAreaURLs(aOther.mSandboxedStorageAreaURLs)
|
||||
, mSkipServiceWorker(aOther.mSkipServiceWorker)
|
||||
, mSynchronous(aOther.mSynchronous)
|
||||
, mUnsafeRequest(aOther.mUnsafeRequest)
|
||||
, mUseURLCredentials(aOther.mUseURLCredentials)
|
||||
{
|
||||
// NOTE: does not copy body stream... use the fallible Clone() for that
|
||||
}
|
||||
|
||||
InternalRequest::~InternalRequest()
|
||||
{
|
||||
}
|
||||
|
@ -67,28 +67,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
explicit InternalRequest(const InternalRequest& aOther)
|
||||
: mMethod(aOther.mMethod)
|
||||
, mURL(aOther.mURL)
|
||||
, mHeaders(aOther.mHeaders)
|
||||
, mBodyStream(aOther.mBodyStream)
|
||||
, mContentPolicyType(aOther.mContentPolicyType)
|
||||
, mReferrer(aOther.mReferrer)
|
||||
, mMode(aOther.mMode)
|
||||
, mCredentialsMode(aOther.mCredentialsMode)
|
||||
, mResponseTainting(aOther.mResponseTainting)
|
||||
, mCacheMode(aOther.mCacheMode)
|
||||
, mAuthenticationFlag(aOther.mAuthenticationFlag)
|
||||
, mForceOriginHeader(aOther.mForceOriginHeader)
|
||||
, mPreserveContentCodings(aOther.mPreserveContentCodings)
|
||||
, mSameOriginDataURL(aOther.mSameOriginDataURL)
|
||||
, mSandboxedStorageAreaURLs(aOther.mSandboxedStorageAreaURLs)
|
||||
, mSkipServiceWorker(aOther.mSkipServiceWorker)
|
||||
, mSynchronous(aOther.mSynchronous)
|
||||
, mUnsafeRequest(aOther.mUnsafeRequest)
|
||||
, mUseURLCredentials(aOther.mUseURLCredentials)
|
||||
{
|
||||
}
|
||||
already_AddRefed<InternalRequest> Clone();
|
||||
|
||||
void
|
||||
GetMethod(nsCString& aMethod) const
|
||||
@ -293,6 +272,9 @@ public:
|
||||
GetRequestConstructorCopy(nsIGlobalObject* aGlobal, ErrorResult& aRv) const;
|
||||
|
||||
private:
|
||||
// Does not copy mBodyStream. Use fallible Clone() for complete copy.
|
||||
explicit InternalRequest(const InternalRequest& aOther);
|
||||
|
||||
~InternalRequest();
|
||||
|
||||
nsCString mMethod;
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "nsIDOMFile.h"
|
||||
|
||||
#include "mozilla/dom/InternalHeaders.h"
|
||||
#include "nsStreamUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -22,7 +23,7 @@ InternalResponse::InternalResponse(uint16_t aStatus, const nsACString& aStatusTe
|
||||
}
|
||||
|
||||
// Headers are not copied since BasicResponse and CORSResponse both need custom
|
||||
// header handling.
|
||||
// header handling. Body is not copied as it cannot be shared directly.
|
||||
InternalResponse::InternalResponse(const InternalResponse& aOther)
|
||||
: mType(aOther.mType)
|
||||
, mTerminationReason(aOther.mTerminationReason)
|
||||
@ -30,11 +31,35 @@ InternalResponse::InternalResponse(const InternalResponse& aOther)
|
||||
, mFinalURL(aOther.mFinalURL)
|
||||
, mStatus(aOther.mStatus)
|
||||
, mStatusText(aOther.mStatusText)
|
||||
, mBody(aOther.mBody)
|
||||
, mContentType(aOther.mContentType)
|
||||
{
|
||||
}
|
||||
|
||||
already_AddRefed<InternalResponse>
|
||||
InternalResponse::Clone()
|
||||
{
|
||||
nsRefPtr<InternalResponse> clone = new InternalResponse(*this);
|
||||
clone->mHeaders = new InternalHeaders(*mHeaders);
|
||||
|
||||
if (!mBody) {
|
||||
return clone.forget();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInputStream> clonedBody;
|
||||
nsCOMPtr<nsIInputStream> replacementBody;
|
||||
|
||||
nsresult rv = NS_CloneInputStream(mBody, getter_AddRefs(clonedBody),
|
||||
getter_AddRefs(replacementBody));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return nullptr; }
|
||||
|
||||
clone->mBody.swap(clonedBody);
|
||||
if (replacementBody) {
|
||||
mBody.swap(replacementBody);
|
||||
}
|
||||
|
||||
return clone.forget();
|
||||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<InternalResponse>
|
||||
InternalResponse::BasicResponse(InternalResponse* aInner)
|
||||
@ -43,6 +68,7 @@ InternalResponse::BasicResponse(InternalResponse* aInner)
|
||||
nsRefPtr<InternalResponse> basic = new InternalResponse(*aInner);
|
||||
basic->mType = ResponseType::Basic;
|
||||
basic->mHeaders = InternalHeaders::BasicHeaders(aInner->mHeaders);
|
||||
basic->mBody.swap(aInner->mBody);
|
||||
return basic.forget();
|
||||
}
|
||||
|
||||
@ -54,6 +80,7 @@ InternalResponse::CORSResponse(InternalResponse* aInner)
|
||||
nsRefPtr<InternalResponse> cors = new InternalResponse(*aInner);
|
||||
cors->mType = ResponseType::Cors;
|
||||
cors->mHeaders = InternalHeaders::CORSHeaders(aInner->mHeaders);
|
||||
cors->mBody.swap(aInner->mBody);
|
||||
return cors.forget();
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,8 @@ public:
|
||||
|
||||
InternalResponse(uint16_t aStatus, const nsACString& aStatusText);
|
||||
|
||||
already_AddRefed<InternalResponse> Clone();
|
||||
|
||||
static already_AddRefed<InternalResponse>
|
||||
NetworkError()
|
||||
{
|
||||
@ -125,8 +127,8 @@ private:
|
||||
~InternalResponse()
|
||||
{ }
|
||||
|
||||
// Used to create filtered responses.
|
||||
// Does not copy headers.
|
||||
// Used to create filtered and cloned responses.
|
||||
// Does not copy headers or body stream.
|
||||
explicit InternalResponse(const InternalResponse& aOther);
|
||||
|
||||
ResponseType mType;
|
||||
|
@ -63,7 +63,7 @@ Request::Constructor(const GlobalObject& aGlobal,
|
||||
inputReq->GetBody(getter_AddRefs(body));
|
||||
if (body) {
|
||||
if (inputReq->BodyUsed()) {
|
||||
aRv.ThrowTypeError(MSG_REQUEST_BODY_CONSUMED_ERROR);
|
||||
aRv.ThrowTypeError(MSG_FETCH_BODY_CONSUMED_ERROR);
|
||||
return nullptr;
|
||||
} else {
|
||||
inputReq->SetBodyUsed();
|
||||
@ -255,12 +255,20 @@ Request::Constructor(const GlobalObject& aGlobal,
|
||||
}
|
||||
|
||||
already_AddRefed<Request>
|
||||
Request::Clone() const
|
||||
Request::Clone(ErrorResult& aRv) const
|
||||
{
|
||||
// FIXME(nsm): Bug 1073231. This is incorrect, but the clone method isn't
|
||||
// well defined yet.
|
||||
nsRefPtr<Request> request = new Request(mOwner,
|
||||
new InternalRequest(*mRequest));
|
||||
if (BodyUsed()) {
|
||||
aRv.ThrowTypeError(MSG_FETCH_BODY_CONSUMED_ERROR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<InternalRequest> ir = mRequest->Clone();
|
||||
if (!ir) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<Request> request = new Request(mOwner, ir);
|
||||
return request.forget();
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ public:
|
||||
}
|
||||
|
||||
already_AddRefed<Request>
|
||||
Clone() const;
|
||||
Clone(ErrorResult& aRv) const;
|
||||
|
||||
already_AddRefed<InternalRequest>
|
||||
GetInternalRequest();
|
||||
|
@ -190,19 +190,23 @@ Response::Constructor(const GlobalObject& aGlobal,
|
||||
return r.forget();
|
||||
}
|
||||
|
||||
// FIXME(nsm): Bug 1073231: This is currently unspecced!
|
||||
already_AddRefed<Response>
|
||||
Response::Clone()
|
||||
Response::Clone(ErrorResult& aRv) const
|
||||
{
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(mOwner);
|
||||
nsRefPtr<Response> response = new Response(global, mInternalResponse);
|
||||
if (BodyUsed()) {
|
||||
aRv.ThrowTypeError(MSG_FETCH_BODY_CONSUMED_ERROR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<InternalResponse> ir = mInternalResponse->Clone();
|
||||
nsRefPtr<Response> response = new Response(mOwner, ir);
|
||||
return response.forget();
|
||||
}
|
||||
|
||||
void
|
||||
Response::SetBody(nsIInputStream* aBody)
|
||||
{
|
||||
// FIXME(nsm): Do we flip bodyUsed here?
|
||||
MOZ_ASSERT(!BodyUsed());
|
||||
mInternalResponse->SetBody(aBody);
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
}
|
||||
|
||||
already_AddRefed<Response>
|
||||
Clone();
|
||||
Clone(ErrorResult& aRv) const;
|
||||
|
||||
void
|
||||
SetBody(nsIInputStream* aBody);
|
||||
|
@ -92,7 +92,7 @@ HTMLAnchorElement::TabIndexDefault()
|
||||
}
|
||||
|
||||
void
|
||||
HTMLAnchorElement::GetItemValueText(nsAString& aValue)
|
||||
HTMLAnchorElement::GetItemValueText(DOMString& aValue)
|
||||
{
|
||||
GetHref(aValue);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::target, aValue, rv);
|
||||
}
|
||||
void GetDownload(nsString& aValue)
|
||||
void GetDownload(DOMString& aValue)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::download, aValue);
|
||||
}
|
||||
@ -118,7 +118,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::ping, aValue, rv);
|
||||
}
|
||||
void GetRel(nsString& aValue)
|
||||
void GetRel(DOMString& aValue)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::rel, aValue);
|
||||
}
|
||||
@ -127,7 +127,7 @@ public:
|
||||
SetHTMLAttr(nsGkAtoms::rel, aValue, rv);
|
||||
}
|
||||
nsDOMTokenList* RelList();
|
||||
void GetHreflang(nsString& aValue)
|
||||
void GetHreflang(DOMString& aValue)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::hreflang, aValue);
|
||||
}
|
||||
@ -135,7 +135,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::hreflang, aValue, rv);
|
||||
}
|
||||
void GetType(nsString& aValue)
|
||||
void GetType(DOMString& aValue)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::type, aValue);
|
||||
}
|
||||
@ -179,7 +179,7 @@ public:
|
||||
using Link::SetHash;
|
||||
|
||||
// The XPCOM URI decomposition attributes are fine for us
|
||||
void GetCoords(nsString& aValue)
|
||||
void GetCoords(DOMString& aValue)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::coords, aValue);
|
||||
}
|
||||
@ -187,7 +187,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::coords, aValue, rv);
|
||||
}
|
||||
void GetCharset(nsString& aValue)
|
||||
void GetCharset(DOMString& aValue)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::charset, aValue);
|
||||
}
|
||||
@ -195,7 +195,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::charset, aValue, rv);
|
||||
}
|
||||
void GetName(nsString& aValue)
|
||||
void GetName(DOMString& aValue)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::name, aValue);
|
||||
}
|
||||
@ -203,7 +203,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::name, aValue, rv);
|
||||
}
|
||||
void GetRev(nsString& aValue)
|
||||
void GetRev(DOMString& aValue)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::rev, aValue);
|
||||
}
|
||||
@ -211,7 +211,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::rev, aValue, rv);
|
||||
}
|
||||
void GetShape(nsString& aValue)
|
||||
void GetShape(DOMString& aValue)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::shape, aValue);
|
||||
}
|
||||
@ -227,7 +227,7 @@ public:
|
||||
protected:
|
||||
virtual ~HTMLAnchorElement();
|
||||
|
||||
virtual void GetItemValueText(nsAString& text) MOZ_OVERRIDE;
|
||||
virtual void GetItemValueText(DOMString& text) MOZ_OVERRIDE;
|
||||
virtual void SetItemValueText(const nsAString& text) MOZ_OVERRIDE;
|
||||
virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
|
||||
nsRefPtr<nsDOMTokenList > mRelList;
|
||||
|
@ -67,7 +67,7 @@ HTMLAreaElement::TabIndexDefault()
|
||||
}
|
||||
|
||||
void
|
||||
HTMLAreaElement::GetItemValueText(nsAString& aValue)
|
||||
HTMLAreaElement::GetItemValueText(DOMString& aValue)
|
||||
{
|
||||
GetHref(aValue);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public:
|
||||
SetHTMLAttr(nsGkAtoms::ping, aPing, aError);
|
||||
}
|
||||
|
||||
void GetRel(nsString& aValue)
|
||||
void GetRel(DOMString& aValue)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::rel, aValue);
|
||||
}
|
||||
@ -180,7 +180,7 @@ protected:
|
||||
|
||||
virtual JSObject* WrapNode(JSContext* aCx) MOZ_OVERRIDE;
|
||||
|
||||
virtual void GetItemValueText(nsAString& text) MOZ_OVERRIDE;
|
||||
virtual void GetItemValueText(DOMString& text) MOZ_OVERRIDE;
|
||||
virtual void SetItemValueText(const nsAString& text) MOZ_OVERRIDE;
|
||||
nsRefPtr<nsDOMTokenList > mRelList;
|
||||
};
|
||||
|
@ -210,9 +210,9 @@ HTMLBodyElement::SetBackground(const nsAString& aBackground)
|
||||
NS_IMETHODIMP
|
||||
HTMLBodyElement::GetBackground(nsAString& aBackground)
|
||||
{
|
||||
nsString background;
|
||||
DOMString background;
|
||||
GetBackground(background);
|
||||
aBackground = background;
|
||||
background.ToString(aBackground);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -227,9 +227,9 @@ HTMLBodyElement::SetVLink(const nsAString& aVLink)
|
||||
NS_IMETHODIMP
|
||||
HTMLBodyElement::GetVLink(nsAString& aVLink)
|
||||
{
|
||||
nsString vLink;
|
||||
DOMString vLink;
|
||||
GetVLink(vLink);
|
||||
aVLink = vLink;
|
||||
vLink.ToString(aVLink);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -244,9 +244,9 @@ HTMLBodyElement::SetALink(const nsAString& aALink)
|
||||
NS_IMETHODIMP
|
||||
HTMLBodyElement::GetALink(nsAString& aALink)
|
||||
{
|
||||
nsString aLink;
|
||||
DOMString aLink;
|
||||
GetALink(aLink);
|
||||
aALink = aLink;
|
||||
aLink.ToString(aALink);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -261,9 +261,9 @@ HTMLBodyElement::SetLink(const nsAString& aLink)
|
||||
NS_IMETHODIMP
|
||||
HTMLBodyElement::GetLink(nsAString& aLink)
|
||||
{
|
||||
nsString link;
|
||||
DOMString link;
|
||||
GetLink(link);
|
||||
aLink = link;
|
||||
link.ToString(aLink);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -278,9 +278,9 @@ HTMLBodyElement::SetText(const nsAString& aText)
|
||||
NS_IMETHODIMP
|
||||
HTMLBodyElement::GetText(nsAString& aText)
|
||||
{
|
||||
nsString text;
|
||||
DOMString text;
|
||||
GetText(text);
|
||||
aText = text;
|
||||
text.ToString(aText);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -295,9 +295,9 @@ HTMLBodyElement::SetBgColor(const nsAString& aBgColor)
|
||||
NS_IMETHODIMP
|
||||
HTMLBodyElement::GetBgColor(nsAString& aBgColor)
|
||||
{
|
||||
nsString bgColor;
|
||||
DOMString bgColor;
|
||||
GetBgColor(bgColor);
|
||||
aBgColor = bgColor;
|
||||
bgColor.ToString(aBgColor);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
#undef WINDOW_EVENT_HELPER
|
||||
#undef EVENT
|
||||
|
||||
void GetText(nsString& aText)
|
||||
void GetText(DOMString& aText)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::text, aText);
|
||||
}
|
||||
@ -76,7 +76,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::text, aText, aError);
|
||||
}
|
||||
void GetLink(nsString& aLink)
|
||||
void GetLink(DOMString& aLink)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::link, aLink);
|
||||
}
|
||||
@ -84,7 +84,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::link, aLink, aError);
|
||||
}
|
||||
void GetVLink(nsString& aVLink)
|
||||
void GetVLink(DOMString& aVLink)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::vlink, aVLink);
|
||||
}
|
||||
@ -92,7 +92,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::vlink, aVLink, aError);
|
||||
}
|
||||
void GetALink(nsString& aALink)
|
||||
void GetALink(DOMString& aALink)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::alink, aALink);
|
||||
}
|
||||
@ -100,7 +100,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::alink, aALink, aError);
|
||||
}
|
||||
void GetBgColor(nsString& aBgColor)
|
||||
void GetBgColor(DOMString& aBgColor)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::bgcolor, aBgColor);
|
||||
}
|
||||
@ -108,7 +108,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::bgcolor, aBgColor, aError);
|
||||
}
|
||||
void GetBackground(nsString& aBackground)
|
||||
void GetBackground(DOMString& aBackground)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::background, aBackground);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ HTMLDataElement::WrapNode(JSContext* aCx)
|
||||
}
|
||||
|
||||
void
|
||||
HTMLDataElement::GetItemValueText(nsAString& text)
|
||||
HTMLDataElement::GetItemValueText(DOMString& text)
|
||||
{
|
||||
GetValue(text);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
explicit HTMLDataElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
||||
|
||||
// HTMLDataElement WebIDL
|
||||
void GetValue(nsAString& aValue)
|
||||
void GetValue(DOMString& aValue)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::value, aValue);
|
||||
}
|
||||
@ -30,7 +30,7 @@ public:
|
||||
SetHTMLAttr(nsGkAtoms::value, aValue, aError);
|
||||
}
|
||||
|
||||
virtual void GetItemValueText(nsAString& text) MOZ_OVERRIDE;
|
||||
virtual void GetItemValueText(DOMString& text) MOZ_OVERRIDE;
|
||||
virtual void SetItemValueText(const nsAString& text) MOZ_OVERRIDE;
|
||||
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE;
|
||||
|
||||
|
@ -27,9 +27,9 @@ public:
|
||||
// nsIDOMHTMLDivElement
|
||||
NS_IMETHOD GetAlign(nsAString& aAlign) MOZ_OVERRIDE
|
||||
{
|
||||
nsString align;
|
||||
DOMString align;
|
||||
GetAlign(align);
|
||||
aAlign = align;
|
||||
align.ToString(aAlign);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD SetAlign(const nsAString& aAlign) MOZ_OVERRIDE
|
||||
@ -39,7 +39,7 @@ public:
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
void GetAlign(nsString& aAlign)
|
||||
void GetAlign(DOMString& aAlign)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::align, aAlign);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void GetColor(nsString& aColor)
|
||||
void GetColor(DOMString& aColor)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::color, aColor);
|
||||
}
|
||||
@ -27,7 +27,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::color, aColor, aError);
|
||||
}
|
||||
void GetFace(nsString& aFace)
|
||||
void GetFace(DOMString& aFace)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::face, aFace);
|
||||
}
|
||||
@ -35,7 +35,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::face, aFace, aError);
|
||||
}
|
||||
void GetSize(nsString& aSize)
|
||||
void GetSize(DOMString& aSize)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::size, aSize);
|
||||
}
|
||||
|
@ -39,9 +39,9 @@ HTMLFrameSetElement::SetCols(const nsAString& aCols)
|
||||
NS_IMETHODIMP
|
||||
HTMLFrameSetElement::GetCols(nsAString& aCols)
|
||||
{
|
||||
nsString cols;
|
||||
DOMString cols;
|
||||
GetCols(cols);
|
||||
aCols = cols;
|
||||
cols.ToString(aCols);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -56,9 +56,9 @@ HTMLFrameSetElement::SetRows(const nsAString& aRows)
|
||||
NS_IMETHODIMP
|
||||
HTMLFrameSetElement::GetRows(nsAString& aRows)
|
||||
{
|
||||
nsString rows;
|
||||
DOMString rows;
|
||||
GetRows(rows);
|
||||
aRows = rows;
|
||||
rows.ToString(aRows);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
// nsIDOMHTMLFrameSetElement
|
||||
NS_DECL_NSIDOMHTMLFRAMESETELEMENT
|
||||
|
||||
void GetCols(nsString& aCols)
|
||||
void GetCols(DOMString& aCols)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::cols, aCols);
|
||||
}
|
||||
@ -71,7 +71,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::cols, aCols, aError);
|
||||
}
|
||||
void GetRows(nsString& aRows)
|
||||
void GetRows(DOMString& aRows)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::rows, aRows);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ NS_IMPL_BOOL_ATTR(HTMLIFrameElement, AllowFullscreen, allowfullscreen)
|
||||
NS_IMPL_STRING_ATTR(HTMLIFrameElement, Srcdoc, srcdoc)
|
||||
|
||||
void
|
||||
HTMLIFrameElement::GetItemValueText(nsAString& aValue)
|
||||
HTMLIFrameElement::GetItemValueText(DOMString& aValue)
|
||||
{
|
||||
GetSrc(aValue);
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ public:
|
||||
protected:
|
||||
virtual ~HTMLIFrameElement();
|
||||
|
||||
virtual void GetItemValueText(nsAString& text) MOZ_OVERRIDE;
|
||||
virtual void GetItemValueText(DOMString& text) MOZ_OVERRIDE;
|
||||
virtual void SetItemValueText(const nsAString& text) MOZ_OVERRIDE;
|
||||
|
||||
virtual JSObject* WrapNode(JSContext* aCx) MOZ_OVERRIDE;
|
||||
|
@ -181,7 +181,7 @@ HTMLImageElement::GetCurrentSrc(nsAString& aValue)
|
||||
}
|
||||
|
||||
void
|
||||
HTMLImageElement::GetItemValueText(nsAString& aValue)
|
||||
HTMLImageElement::GetItemValueText(DOMString& aValue)
|
||||
{
|
||||
GetSrc(aValue);
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ protected:
|
||||
const nsAString *aSizes = nullptr);
|
||||
|
||||
CSSIntPoint GetXY();
|
||||
virtual void GetItemValueText(nsAString& text) MOZ_OVERRIDE;
|
||||
virtual void GetItemValueText(DOMString& text) MOZ_OVERRIDE;
|
||||
virtual void SetItemValueText(const nsAString& text) MOZ_OVERRIDE;
|
||||
virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
|
||||
void UpdateFormOwner();
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
||||
|
||||
// WebIDL API
|
||||
void GetType(nsString& aType)
|
||||
void GetType(DOMString& aType)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::type, aType);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
|
||||
already_AddRefed<HTMLFormElement> GetForm();
|
||||
|
||||
void GetAlign(nsAString& aAlign)
|
||||
void GetAlign(DOMString& aAlign)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::align, aAlign);
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ NS_IMPL_STRING_ATTR(HTMLLinkElement, Target, target)
|
||||
NS_IMPL_STRING_ATTR(HTMLLinkElement, Type, type)
|
||||
|
||||
void
|
||||
HTMLLinkElement::GetItemValueText(nsAString& aValue)
|
||||
HTMLLinkElement::GetItemValueText(DOMString& aValue)
|
||||
{
|
||||
GetHref(aValue);
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ protected:
|
||||
virtual CORSMode GetCORSMode() const MOZ_OVERRIDE;
|
||||
protected:
|
||||
// nsGenericHTMLElement
|
||||
virtual void GetItemValueText(nsAString& text) MOZ_OVERRIDE;
|
||||
virtual void GetItemValueText(DOMString& text) MOZ_OVERRIDE;
|
||||
virtual void SetItemValueText(const nsAString& text) MOZ_OVERRIDE;
|
||||
nsRefPtr<nsDOMTokenList > mRelList;
|
||||
private:
|
||||
|
@ -85,6 +85,7 @@
|
||||
#include "mozilla/dom/VideoTrackList.h"
|
||||
#include "mozilla/dom/TextTrack.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
#include "ImageContainer.h"
|
||||
#include "nsRange.h"
|
||||
@ -2140,7 +2141,7 @@ HTMLMediaElement::~HTMLMediaElement()
|
||||
}
|
||||
|
||||
void
|
||||
HTMLMediaElement::GetItemValueText(nsAString& aValue)
|
||||
HTMLMediaElement::GetItemValueText(DOMString& aValue)
|
||||
{
|
||||
// Can't call GetSrc because we don't have a JSContext
|
||||
GetURIAttr(nsGkAtoms::src, nullptr, aValue);
|
||||
@ -2548,11 +2549,61 @@ nsresult HTMLMediaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParen
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLMediaElement::ReportMSETelemetry()
|
||||
{
|
||||
// Report telemetry for videos when a page is unloaded. We
|
||||
// want to know data on what state the video is at when
|
||||
// the user has exited.
|
||||
enum UnloadedState {
|
||||
ENDED = 0,
|
||||
PAUSED = 1,
|
||||
STALLED = 2,
|
||||
SEEKING = 3,
|
||||
OTHER = 4
|
||||
};
|
||||
|
||||
UnloadedState state = OTHER;
|
||||
if (Seeking()) {
|
||||
state = SEEKING;
|
||||
}
|
||||
else if (Ended()) {
|
||||
state = ENDED;
|
||||
}
|
||||
else if (Paused()) {
|
||||
state = PAUSED;
|
||||
}
|
||||
else {
|
||||
// For buffering we check if the current playback position is at the end
|
||||
// of a buffered range, within a margin of error. We also consider to be
|
||||
// buffering if the last frame status was buffering and the ready state is
|
||||
// HAVE_CURRENT_DATA to account for times where we are in a buffering state
|
||||
// regardless of what actual data we have buffered.
|
||||
bool stalled = false;
|
||||
nsRefPtr<TimeRanges> ranges = Buffered();
|
||||
const double errorMargin = 0.05;
|
||||
double t = CurrentTime();
|
||||
TimeRanges::index_type index = ranges->Find(t, errorMargin);
|
||||
ErrorResult ignore;
|
||||
stalled = index != TimeRanges::NoIndex &&
|
||||
(ranges->End(index, ignore) - t) < errorMargin;
|
||||
stalled |= mLastNextFrameStatus == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_BUFFERING &&
|
||||
mReadyState == HTMLMediaElement::HAVE_CURRENT_DATA;
|
||||
if (stalled) {
|
||||
state = STALLED;
|
||||
}
|
||||
}
|
||||
|
||||
Telemetry::Accumulate(Telemetry::VIDEO_MSE_UNLOAD_STATE, state);
|
||||
LOG(PR_LOG_DEBUG, ("%p VIDEO_MSE_UNLOAD_STATE = %d", this, state));
|
||||
}
|
||||
|
||||
void HTMLMediaElement::UnbindFromTree(bool aDeep,
|
||||
bool aNullParent)
|
||||
{
|
||||
if (!mPaused && mNetworkState != nsIDOMHTMLMediaElement::NETWORK_EMPTY)
|
||||
if (!mPaused && mNetworkState != nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
|
||||
Pause();
|
||||
}
|
||||
|
||||
mElementInTreeState = ELEMENT_NOT_INTREE_HAD_INTREE;
|
||||
|
||||
@ -3701,6 +3752,10 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE
|
||||
if (aPauseElement != mPausedForInactiveDocumentOrChannel) {
|
||||
mPausedForInactiveDocumentOrChannel = aPauseElement;
|
||||
if (aPauseElement) {
|
||||
if (mMediaSource) {
|
||||
ReportMSETelemetry();
|
||||
}
|
||||
|
||||
#ifdef MOZ_EME
|
||||
// For EME content, force destruction of the CDM client (and CDM
|
||||
// instance if this is the last client for that CDM instance) and
|
||||
@ -3742,11 +3797,21 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE
|
||||
}
|
||||
}
|
||||
|
||||
bool HTMLMediaElement::IsBeingDestroyed()
|
||||
{
|
||||
nsIDocument* ownerDoc = OwnerDoc();
|
||||
nsIDocShell* docShell = ownerDoc ? ownerDoc->GetDocShell() : nullptr;
|
||||
bool isBeingDestroyed = false;
|
||||
if (docShell) {
|
||||
docShell->IsBeingDestroyed(&isBeingDestroyed);
|
||||
}
|
||||
return isBeingDestroyed;
|
||||
}
|
||||
|
||||
void HTMLMediaElement::NotifyOwnerDocumentActivityChanged()
|
||||
{
|
||||
nsIDocument* ownerDoc = OwnerDoc();
|
||||
|
||||
if (mDecoder) {
|
||||
if (mDecoder && !IsBeingDestroyed()) {
|
||||
mDecoder->SetElementVisibility(!ownerDoc->Hidden());
|
||||
mDecoder->NotifyOwnerActivityChanged();
|
||||
}
|
||||
|
@ -620,6 +620,11 @@ public:
|
||||
return FinishDecoderSetup(aDecoder, aStream, nullptr, nullptr);
|
||||
}
|
||||
|
||||
// Returns true if the media element is being destroyed. Used in
|
||||
// dormancy checks to prevent dormant processing for an element
|
||||
// that will soon be gone.
|
||||
bool IsBeingDestroyed();
|
||||
|
||||
protected:
|
||||
virtual ~HTMLMediaElement();
|
||||
|
||||
@ -627,7 +632,7 @@ protected:
|
||||
class MediaStreamTracksAvailableCallback;
|
||||
class StreamListener;
|
||||
|
||||
virtual void GetItemValueText(nsAString& text) MOZ_OVERRIDE;
|
||||
virtual void GetItemValueText(DOMString& text) MOZ_OVERRIDE;
|
||||
virtual void SetItemValueText(const nsAString& text) MOZ_OVERRIDE;
|
||||
|
||||
class WakeLockBoolWrapper {
|
||||
@ -963,6 +968,8 @@ protected:
|
||||
return isPaused;
|
||||
}
|
||||
|
||||
void ReportMSETelemetry();
|
||||
|
||||
// Check the permissions for audiochannel.
|
||||
bool CheckAudioChannelPermissions(const nsAString& aType);
|
||||
|
||||
|
@ -36,7 +36,7 @@ NS_IMPL_STRING_ATTR(HTMLMetaElement, Name, name)
|
||||
NS_IMPL_STRING_ATTR(HTMLMetaElement, Scheme, scheme)
|
||||
|
||||
void
|
||||
HTMLMetaElement::GetItemValueText(nsAString& aValue)
|
||||
HTMLMetaElement::GetItemValueText(DOMString& aValue)
|
||||
{
|
||||
GetContent(aValue);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
protected:
|
||||
virtual ~HTMLMetaElement();
|
||||
|
||||
virtual void GetItemValueText(nsAString& text) MOZ_OVERRIDE;
|
||||
virtual void GetItemValueText(DOMString& text) MOZ_OVERRIDE;
|
||||
virtual void SetItemValueText(const nsAString& text) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::cite, aCite, aRv);
|
||||
}
|
||||
void GetDateTime(nsAString& aDateTime)
|
||||
void GetDateTime(DOMString& aDateTime)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::datetime, aDateTime);
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ HTMLObjectElement::GetForm(nsIDOMHTMLFormElement **aForm)
|
||||
}
|
||||
|
||||
void
|
||||
HTMLObjectElement::GetItemValueText(nsAString& aValue)
|
||||
HTMLObjectElement::GetItemValueText(DOMString& aValue)
|
||||
{
|
||||
GetData(aValue);
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ private:
|
||||
*/
|
||||
bool IsFocusableForTabIndex();
|
||||
|
||||
virtual void GetItemValueText(nsAString& text) MOZ_OVERRIDE;
|
||||
virtual void GetItemValueText(DOMString& text) MOZ_OVERRIDE;
|
||||
virtual void SetItemValueText(const nsAString& text) MOZ_OVERRIDE;
|
||||
|
||||
virtual ~HTMLObjectElement();
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
{
|
||||
SetHTMLIntAttr(nsGkAtoms::start, aStart, rv);
|
||||
}
|
||||
void GetType(nsString& aType)
|
||||
void GetType(DOMString& aType)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::type, aType);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ HTMLSharedObjectElement::HTMLSharedObjectElement(already_AddRefed<mozilla::dom::
|
||||
}
|
||||
|
||||
void
|
||||
HTMLSharedObjectElement::GetItemValueText(nsAString& aValue)
|
||||
HTMLSharedObjectElement::GetItemValueText(DOMString& aValue)
|
||||
{
|
||||
if (mNodeInfo->Equals(nsGkAtoms::applet)) {
|
||||
nsGenericHTMLElement::GetItemValueText(aValue);
|
||||
|
@ -206,7 +206,7 @@ private:
|
||||
// always true for <embed>, per the documentation in nsIContent.h.
|
||||
bool mIsDoneAddingChildren;
|
||||
|
||||
virtual void GetItemValueText(nsAString& text) MOZ_OVERRIDE;
|
||||
virtual void GetItemValueText(DOMString& text) MOZ_OVERRIDE;
|
||||
virtual void SetItemValueText(const nsAString& text) MOZ_OVERRIDE;
|
||||
|
||||
virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
|
||||
|
@ -121,7 +121,7 @@ HTMLSourceElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
}
|
||||
|
||||
void
|
||||
HTMLSourceElement::GetItemValueText(nsAString& aValue)
|
||||
HTMLSourceElement::GetItemValueText(DOMString& aValue)
|
||||
{
|
||||
GetSrc(aValue);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
SetHTMLAttr(nsGkAtoms::src, aSrc, rv);
|
||||
}
|
||||
|
||||
void GetType(nsString& aType)
|
||||
void GetType(DOMString& aType)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::type, aType);
|
||||
}
|
||||
@ -69,7 +69,7 @@ public:
|
||||
SetHTMLAttr(nsGkAtoms::type, aType, rv);
|
||||
}
|
||||
|
||||
void GetSrcset(nsString& aSrcset)
|
||||
void GetSrcset(DOMString& aSrcset)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::srcset, aSrcset);
|
||||
}
|
||||
@ -78,7 +78,7 @@ public:
|
||||
SetHTMLAttr(nsGkAtoms::srcset, aSrcset, rv);
|
||||
}
|
||||
|
||||
void GetSizes(nsString& aSizes)
|
||||
void GetSizes(DOMString& aSizes)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::sizes, aSizes);
|
||||
}
|
||||
@ -87,7 +87,7 @@ public:
|
||||
SetHTMLAttr(nsGkAtoms::sizes, aSizes, rv);
|
||||
}
|
||||
|
||||
void GetMedia(nsString& aMedia)
|
||||
void GetMedia(DOMString& aMedia)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::media, aMedia);
|
||||
}
|
||||
@ -102,7 +102,7 @@ protected:
|
||||
virtual JSObject* WrapNode(JSContext* aCx) MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual void GetItemValueText(nsAString& text) MOZ_OVERRIDE;
|
||||
virtual void GetItemValueText(DOMString& text) MOZ_OVERRIDE;
|
||||
virtual void SetItemValueText(const nsAString& text) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
// nsIDOMHTMLTableCaptionElement
|
||||
NS_DECL_NSIDOMHTMLTABLECAPTIONELEMENT
|
||||
|
||||
void GetAlign(nsString& aAlign)
|
||||
void GetAlign(DOMString& aAlign)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::align, aAlign);
|
||||
}
|
||||
|
@ -127,9 +127,9 @@ HTMLTableCellElement::SetAbbr(const nsAString& aAbbr)
|
||||
NS_IMETHODIMP
|
||||
HTMLTableCellElement::GetAbbr(nsAString& aAbbr)
|
||||
{
|
||||
nsString abbr;
|
||||
DOMString abbr;
|
||||
GetAbbr(abbr);
|
||||
aAbbr = abbr;
|
||||
abbr.ToString(aAbbr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -144,9 +144,9 @@ HTMLTableCellElement::SetAxis(const nsAString& aAxis)
|
||||
NS_IMETHODIMP
|
||||
HTMLTableCellElement::GetAxis(nsAString& aAxis)
|
||||
{
|
||||
nsString axis;
|
||||
DOMString axis;
|
||||
GetAxis(axis);
|
||||
aAxis = axis;
|
||||
axis.ToString(aAxis);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -161,9 +161,9 @@ HTMLTableCellElement::SetAlign(const nsAString& aAlign)
|
||||
NS_IMETHODIMP
|
||||
HTMLTableCellElement::GetAlign(nsAString& aAlign)
|
||||
{
|
||||
nsString align;
|
||||
DOMString align;
|
||||
GetAlign(align);
|
||||
aAlign = align;
|
||||
align.ToString(aAlign);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -178,9 +178,9 @@ HTMLTableCellElement::SetVAlign(const nsAString& aVAlign)
|
||||
NS_IMETHODIMP
|
||||
HTMLTableCellElement::GetVAlign(nsAString& aVAlign)
|
||||
{
|
||||
nsString vAlign;
|
||||
DOMString vAlign;
|
||||
GetVAlign(vAlign);
|
||||
aVAlign = vAlign;
|
||||
vAlign.ToString(aVAlign);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -195,9 +195,9 @@ HTMLTableCellElement::SetCh(const nsAString& aCh)
|
||||
NS_IMETHODIMP
|
||||
HTMLTableCellElement::GetCh(nsAString& aCh)
|
||||
{
|
||||
nsString ch;
|
||||
DOMString ch;
|
||||
GetCh(ch);
|
||||
aCh = ch;
|
||||
ch.ToString(aCh);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -212,9 +212,9 @@ HTMLTableCellElement::SetChOff(const nsAString& aChOff)
|
||||
NS_IMETHODIMP
|
||||
HTMLTableCellElement::GetChOff(nsAString& aChOff)
|
||||
{
|
||||
nsString chOff;
|
||||
DOMString chOff;
|
||||
GetChOff(chOff);
|
||||
aChOff = chOff;
|
||||
chOff.ToString(aChOff);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -229,9 +229,9 @@ HTMLTableCellElement::SetBgColor(const nsAString& aBgColor)
|
||||
NS_IMETHODIMP
|
||||
HTMLTableCellElement::GetBgColor(nsAString& aBgColor)
|
||||
{
|
||||
nsString bgColor;
|
||||
DOMString bgColor;
|
||||
GetBgColor(bgColor);
|
||||
aBgColor = bgColor;
|
||||
bgColor.ToString(aBgColor);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -246,9 +246,9 @@ HTMLTableCellElement::SetHeight(const nsAString& aHeight)
|
||||
NS_IMETHODIMP
|
||||
HTMLTableCellElement::GetHeight(nsAString& aHeight)
|
||||
{
|
||||
nsString height;
|
||||
DOMString height;
|
||||
GetHeight(height);
|
||||
aHeight = height;
|
||||
height.ToString(aHeight);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -263,9 +263,9 @@ HTMLTableCellElement::SetWidth(const nsAString& aWidth)
|
||||
NS_IMETHODIMP
|
||||
HTMLTableCellElement::GetWidth(nsAString& aWidth)
|
||||
{
|
||||
nsString width;
|
||||
DOMString width;
|
||||
GetWidth(width);
|
||||
aWidth = width;
|
||||
width.ToString(aWidth);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -295,9 +295,9 @@ HTMLTableCellElement::SetScope(const nsAString& aScope)
|
||||
NS_IMETHODIMP
|
||||
HTMLTableCellElement::GetScope(nsAString& aScope)
|
||||
{
|
||||
nsString scope;
|
||||
DOMString scope;
|
||||
GetScope(scope);
|
||||
aScope = scope;
|
||||
scope.ToString(aScope);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -312,9 +312,9 @@ HTMLTableCellElement::SetHeaders(const nsAString& aHeaders)
|
||||
NS_IMETHODIMP
|
||||
HTMLTableCellElement::GetHeaders(nsAString& aHeaders)
|
||||
{
|
||||
nsString headers;
|
||||
DOMString headers;
|
||||
GetHeaders(headers);
|
||||
aHeaders = headers;
|
||||
headers.ToString(aHeaders);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -349,7 +349,7 @@ HTMLTableCellElement::GetRowSpan(int32_t* aRowSpan)
|
||||
}
|
||||
|
||||
void
|
||||
HTMLTableCellElement::GetAlign(nsString& aValue)
|
||||
HTMLTableCellElement::GetAlign(DOMString& aValue)
|
||||
{
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::align, aValue)) {
|
||||
// There's no align attribute, ask the row for the alignment.
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
SetHTMLIntAttr(nsGkAtoms::rowspan, aRowSpan, aError);
|
||||
}
|
||||
//already_AddRefed<nsDOMSettableTokenList> Headers() const;
|
||||
void GetHeaders(nsString& aHeaders)
|
||||
void GetHeaders(DOMString& aHeaders)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::headers, aHeaders);
|
||||
}
|
||||
@ -59,7 +59,7 @@ public:
|
||||
}
|
||||
int32_t CellIndex() const;
|
||||
|
||||
void GetAbbr(nsString& aAbbr)
|
||||
void GetAbbr(DOMString& aAbbr)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::abbr, aAbbr);
|
||||
}
|
||||
@ -67,7 +67,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::abbr, aAbbr, aError);
|
||||
}
|
||||
void GetScope(nsString& aScope)
|
||||
void GetScope(DOMString& aScope)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::scope, aScope);
|
||||
}
|
||||
@ -75,12 +75,12 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::scope, aScope, aError);
|
||||
}
|
||||
void GetAlign(nsString& aAlign);
|
||||
void GetAlign(DOMString& aAlign);
|
||||
void SetAlign(const nsAString& aAlign, ErrorResult& aError)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
|
||||
}
|
||||
void GetAxis(nsString& aAxis)
|
||||
void GetAxis(DOMString& aAxis)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::axis, aAxis);
|
||||
}
|
||||
@ -88,7 +88,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::axis, aAxis, aError);
|
||||
}
|
||||
void GetHeight(nsString& aHeight)
|
||||
void GetHeight(DOMString& aHeight)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::height, aHeight);
|
||||
}
|
||||
@ -96,7 +96,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::height, aHeight, aError);
|
||||
}
|
||||
void GetWidth(nsString& aWidth)
|
||||
void GetWidth(DOMString& aWidth)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::width, aWidth);
|
||||
}
|
||||
@ -104,7 +104,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::width, aWidth, aError);
|
||||
}
|
||||
void GetCh(nsString& aCh)
|
||||
void GetCh(DOMString& aCh)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::_char, aCh);
|
||||
}
|
||||
@ -112,7 +112,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::_char, aCh, aError);
|
||||
}
|
||||
void GetChOff(nsString& aChOff)
|
||||
void GetChOff(DOMString& aChOff)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::charoff, aChOff);
|
||||
}
|
||||
@ -128,7 +128,7 @@ public:
|
||||
{
|
||||
SetHTMLBoolAttr(nsGkAtoms::nowrap, aNoWrap, aError);
|
||||
}
|
||||
void GetVAlign(nsString& aVAlign)
|
||||
void GetVAlign(DOMString& aVAlign)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::valign, aVAlign);
|
||||
}
|
||||
@ -136,7 +136,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::valign, aVAlign, aError);
|
||||
}
|
||||
void GetBgColor(nsString& aBgColor)
|
||||
void GetBgColor(DOMString& aBgColor)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::bgcolor, aBgColor);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
SetHTMLIntAttr(nsGkAtoms::span, aSpan, aError);
|
||||
}
|
||||
|
||||
void GetAlign(nsString& aAlign)
|
||||
void GetAlign(DOMString& aAlign)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::align, aAlign);
|
||||
}
|
||||
@ -37,7 +37,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
|
||||
}
|
||||
void GetCh(nsString& aCh)
|
||||
void GetCh(DOMString& aCh)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::_char, aCh);
|
||||
}
|
||||
@ -45,7 +45,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::_char, aCh, aError);
|
||||
}
|
||||
void GetChOff(nsString& aChOff)
|
||||
void GetChOff(DOMString& aChOff)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::charoff, aChOff);
|
||||
}
|
||||
@ -53,7 +53,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::charoff, aChOff, aError);
|
||||
}
|
||||
void GetVAlign(nsString& aVAlign)
|
||||
void GetVAlign(DOMString& aVAlign)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::valign, aVAlign);
|
||||
}
|
||||
@ -61,7 +61,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::valign, aVAlign, aError);
|
||||
}
|
||||
void GetWidth(nsString& aWidth)
|
||||
void GetWidth(DOMString& aWidth)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::width, aWidth);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
ErrorResult& aError);
|
||||
void DeleteRow(int32_t aIndex, ErrorResult& aError);
|
||||
|
||||
void GetAlign(nsString& aAlign)
|
||||
void GetAlign(DOMString& aAlign)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::align, aAlign);
|
||||
}
|
||||
@ -104,7 +104,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
|
||||
}
|
||||
void GetBorder(nsString& aBorder)
|
||||
void GetBorder(DOMString& aBorder)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::border, aBorder);
|
||||
}
|
||||
@ -112,7 +112,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::border, aBorder, aError);
|
||||
}
|
||||
void GetFrame(nsString& aFrame)
|
||||
void GetFrame(DOMString& aFrame)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::frame, aFrame);
|
||||
}
|
||||
@ -120,7 +120,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::frame, aFrame, aError);
|
||||
}
|
||||
void GetRules(nsString& aRules)
|
||||
void GetRules(DOMString& aRules)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::rules, aRules);
|
||||
}
|
||||
@ -132,11 +132,15 @@ public:
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::summary, aSummary);
|
||||
}
|
||||
void GetSummary(DOMString& aSummary)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::summary, aSummary);
|
||||
}
|
||||
void SetSummary(const nsAString& aSummary, ErrorResult& aError)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::summary, aSummary, aError);
|
||||
}
|
||||
void GetWidth(nsString& aWidth)
|
||||
void GetWidth(DOMString& aWidth)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::width, aWidth);
|
||||
}
|
||||
@ -144,7 +148,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::width, aWidth, aError);
|
||||
}
|
||||
void GetBgColor(nsString& aBgColor)
|
||||
void GetBgColor(DOMString& aBgColor)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::bgcolor, aBgColor);
|
||||
}
|
||||
@ -152,7 +156,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::bgcolor, aBgColor, aError);
|
||||
}
|
||||
void GetCellPadding(nsString& aCellPadding)
|
||||
void GetCellPadding(DOMString& aCellPadding)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::cellpadding, aCellPadding);
|
||||
}
|
||||
@ -160,7 +164,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::cellpadding, aCellPadding, aError);
|
||||
}
|
||||
void GetCellSpacing(nsString& aCellSpacing)
|
||||
void GetCellSpacing(DOMString& aCellSpacing)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::cellspacing, aCellSpacing);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
InsertCell(int32_t aIndex, ErrorResult& aError);
|
||||
void DeleteCell(int32_t aValue, ErrorResult& aError);
|
||||
|
||||
void GetAlign(nsString& aAlign)
|
||||
void GetAlign(DOMString& aAlign)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::align, aAlign);
|
||||
}
|
||||
@ -45,7 +45,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
|
||||
}
|
||||
void GetCh(nsString& aCh)
|
||||
void GetCh(DOMString& aCh)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::_char, aCh);
|
||||
}
|
||||
@ -53,7 +53,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::_char, aCh, aError);
|
||||
}
|
||||
void GetChOff(nsString& aChOff)
|
||||
void GetChOff(DOMString& aChOff)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::charoff, aChOff);
|
||||
}
|
||||
@ -61,7 +61,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::charoff, aChOff, aError);
|
||||
}
|
||||
void GetVAlign(nsString& aVAlign)
|
||||
void GetVAlign(DOMString& aVAlign)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::valign, aVAlign);
|
||||
}
|
||||
@ -69,7 +69,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::valign, aVAlign, aError);
|
||||
}
|
||||
void GetBgColor(nsString& aBgColor)
|
||||
void GetBgColor(DOMString& aBgColor)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::bgcolor, aBgColor);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
InsertRow(int32_t aIndex, ErrorResult& aError);
|
||||
void DeleteRow(int32_t aValue, ErrorResult& aError);
|
||||
|
||||
void GetAlign(nsString& aAlign)
|
||||
void GetAlign(DOMString& aAlign)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::align, aAlign);
|
||||
}
|
||||
@ -37,7 +37,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
|
||||
}
|
||||
void GetCh(nsString& aCh)
|
||||
void GetCh(DOMString& aCh)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::_char, aCh);
|
||||
}
|
||||
@ -45,7 +45,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::_char, aCh, aError);
|
||||
}
|
||||
void GetChOff(nsString& aChOff)
|
||||
void GetChOff(DOMString& aChOff)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::charoff, aChOff);
|
||||
}
|
||||
@ -53,7 +53,7 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::charoff, aChOff, aError);
|
||||
}
|
||||
void GetVAlign(nsString& aVAlign)
|
||||
void GetVAlign(DOMString& aVAlign)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::valign, aVAlign);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ HTMLTimeElement::WrapNode(JSContext* cx)
|
||||
}
|
||||
|
||||
void
|
||||
HTMLTimeElement::GetItemValueText(nsAString& text)
|
||||
HTMLTimeElement::GetItemValueText(DOMString& text)
|
||||
{
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::datetime)) {
|
||||
GetDateTime(text);
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
virtual ~HTMLTimeElement();
|
||||
|
||||
// HTMLTimeElement WebIDL
|
||||
void GetDateTime(nsAString& aDateTime)
|
||||
void GetDateTime(DOMString& aDateTime)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::datetime, aDateTime);
|
||||
}
|
||||
@ -31,7 +31,7 @@ public:
|
||||
SetHTMLAttr(nsGkAtoms::datetime, aDateTime, aError);
|
||||
}
|
||||
|
||||
virtual void GetItemValueText(nsAString& text) MOZ_OVERRIDE;
|
||||
virtual void GetItemValueText(DOMString& text) MOZ_OVERRIDE;
|
||||
virtual void SetItemValueText(const nsAString& text) MOZ_OVERRIDE;
|
||||
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE;
|
||||
|
||||
|
@ -93,11 +93,9 @@ public:
|
||||
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE;
|
||||
|
||||
// For Track, ItemValue reflects the src attribute
|
||||
virtual void GetItemValueText(nsAString& aText) MOZ_OVERRIDE
|
||||
virtual void GetItemValueText(DOMString& aText) MOZ_OVERRIDE
|
||||
{
|
||||
DOMString value;
|
||||
GetSrc(value);
|
||||
value.ToString(aText);
|
||||
GetSrc(aText);
|
||||
}
|
||||
virtual void SetItemValueText(const nsAString& aText) MOZ_OVERRIDE
|
||||
{
|
||||
|
@ -3034,7 +3034,7 @@ nsGenericHTMLElement::GetItemValue(JSContext* aCx, JSObject* aScope,
|
||||
return;
|
||||
}
|
||||
|
||||
nsString string;
|
||||
DOMString string;
|
||||
GetItemValueText(string);
|
||||
if (!xpc::NonVoidStringToJsval(aCx, string, aRetval)) {
|
||||
aError.Throw(NS_ERROR_FAILURE);
|
||||
@ -3055,9 +3055,11 @@ nsGenericHTMLElement::GetItemValue(nsIVariant** aValue)
|
||||
if (ItemScope()) {
|
||||
out->SetAsISupports(static_cast<nsIContent*>(this));
|
||||
} else {
|
||||
nsAutoString string;
|
||||
DOMString string;
|
||||
GetItemValueText(string);
|
||||
out->SetAsAString(string);
|
||||
nsString xpcomString;
|
||||
string.ToString(xpcomString);
|
||||
out->SetAsAString(xpcomString);
|
||||
}
|
||||
|
||||
out.forget(aValue);
|
||||
@ -3098,7 +3100,7 @@ nsGenericHTMLElement::SetItemValue(nsIVariant* aValue)
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::GetItemValueText(nsAString& text)
|
||||
nsGenericHTMLElement::GetItemValueText(DOMString& text)
|
||||
{
|
||||
ErrorResult rv;
|
||||
GetTextContentInternal(text, rv);
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
// From Element
|
||||
nsresult CopyInnerTo(mozilla::dom::Element* aDest);
|
||||
|
||||
void GetTitle(nsString& aTitle)
|
||||
void GetTitle(mozilla::dom::DOMString& aTitle)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::title, aTitle);
|
||||
}
|
||||
@ -77,7 +77,7 @@ public:
|
||||
SetHTMLAttr(nsGkAtoms::title, aTitle);
|
||||
return NS_OK;
|
||||
}
|
||||
void GetLang(nsString& aLang)
|
||||
void GetLang(mozilla::dom::DOMString& aLang)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::lang, aLang);
|
||||
}
|
||||
@ -86,7 +86,7 @@ public:
|
||||
SetHTMLAttr(nsGkAtoms::lang, aLang);
|
||||
return NS_OK;
|
||||
}
|
||||
void GetDir(nsString& aDir)
|
||||
void GetDir(mozilla::dom::DOMString& aDir)
|
||||
{
|
||||
GetHTMLEnumAttr(nsGkAtoms::dir, aDir);
|
||||
}
|
||||
@ -296,7 +296,7 @@ protected:
|
||||
|
||||
// These methods are used to implement element-specific behavior of Get/SetItemValue
|
||||
// when an element has @itemprop but no @itemscope.
|
||||
virtual void GetItemValueText(nsAString& text);
|
||||
virtual void GetItemValueText(mozilla::dom::DOMString& text);
|
||||
virtual void SetItemValueText(const nsAString& text);
|
||||
public:
|
||||
virtual already_AddRefed<mozilla::dom::UndoManager> GetUndoManager() MOZ_OVERRIDE;
|
||||
@ -318,21 +318,21 @@ public:
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
NS_IMETHOD GetTitle(nsAString& aTitle) MOZ_FINAL MOZ_OVERRIDE {
|
||||
nsString title;
|
||||
mozilla::dom::DOMString title;
|
||||
GetTitle(title);
|
||||
aTitle.Assign(title);
|
||||
title.ToString(aTitle);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetLang(nsAString& aLang) MOZ_FINAL MOZ_OVERRIDE {
|
||||
nsString lang;
|
||||
mozilla::dom::DOMString lang;
|
||||
GetLang(lang);
|
||||
aLang.Assign(lang);
|
||||
lang.ToString(aLang);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetDir(nsAString& aDir) MOZ_FINAL MOZ_OVERRIDE {
|
||||
nsString dir;
|
||||
mozilla::dom::DOMString dir;
|
||||
GetDir(dir);
|
||||
aDir.Assign(dir);
|
||||
dir.ToString(aDir);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD SetDir(const nsAString& aDir) MOZ_FINAL MOZ_OVERRIDE {
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "mozilla/dom/DOMStorageIPC.h"
|
||||
#include "mozilla/dom/ExternalHelperAppChild.h"
|
||||
#include "mozilla/dom/PCrashReporterChild.h"
|
||||
#include "mozilla/dom/ProcessGlobal.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/asmjscache/AsmJSCache.h"
|
||||
#include "mozilla/dom/asmjscache/PAsmJSCacheEntryChild.h"
|
||||
@ -1913,13 +1914,21 @@ ContentChild::RecvNotifyVisited(const URIParams& aURI)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvLoadProcessScript(const nsString& aURL)
|
||||
{
|
||||
ProcessGlobal* global = ProcessGlobal::Get();
|
||||
global->LoadScript(aURL);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvAsyncMessage(const nsString& aMsg,
|
||||
const ClonedMessageData& aData,
|
||||
InfallibleTArray<CpowEntry>&& aCpows,
|
||||
const IPC::Principal& aPrincipal)
|
||||
{
|
||||
nsRefPtr<nsFrameMessageManager> cpm = nsFrameMessageManager::sChildProcessManager;
|
||||
nsRefPtr<nsFrameMessageManager> cpm = nsFrameMessageManager::GetChildProcessManager();
|
||||
if (cpm) {
|
||||
StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForChild(aData);
|
||||
CrossProcessCpowHolder cpows(this, aCpows);
|
||||
|
@ -304,6 +304,8 @@ public:
|
||||
virtual bool RecvNotifyAlertsObserver(const nsCString& aType,
|
||||
const nsString& aData) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvLoadProcessScript(const nsString& aURL) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvAsyncMessage(const nsString& aMsg,
|
||||
const ClonedMessageData& aData,
|
||||
InfallibleTArray<CpowEntry>&& aCpows,
|
||||
|
@ -4179,6 +4179,14 @@ ContentParent::RecvPrivateDocShellsExist(const bool& aExist)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::DoLoadMessageManagerScript(const nsAString& aURL,
|
||||
bool aRunInGlobalScope)
|
||||
{
|
||||
MOZ_ASSERT(!aRunInGlobalScope);
|
||||
return SendLoadProcessScript(nsString(aURL));
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::DoSendAsyncMessage(JSContext* aCx,
|
||||
const nsAString& aMessage,
|
||||
|
@ -169,6 +169,8 @@ public:
|
||||
/**
|
||||
* MessageManagerCallback methods that we override.
|
||||
*/
|
||||
virtual bool DoLoadMessageManagerScript(const nsAString& aURL,
|
||||
bool aRunInGlobalScope) MOZ_OVERRIDE;
|
||||
virtual bool DoSendAsyncMessage(JSContext* aCx,
|
||||
const nsAString& aMessage,
|
||||
const mozilla::dom::StructuredCloneData& aData,
|
||||
|
@ -553,6 +553,8 @@ child:
|
||||
*/
|
||||
async Shutdown();
|
||||
|
||||
async LoadProcessScript(nsString url);
|
||||
|
||||
parent:
|
||||
/**
|
||||
* Tell the parent process a new accessible document has been created.
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/IntentionalCrash.h"
|
||||
#include "mozilla/dom/workers/ServiceWorkerManager.h"
|
||||
#include "mozilla/dom/indexedDB/PIndexedDBPermissionRequestChild.h"
|
||||
#include "mozilla/plugins/PluginWidgetChild.h"
|
||||
@ -2618,7 +2617,7 @@ TabChild::RecvLoadRemoteScript(const nsString& aURL, const bool& aRunInGlobalSco
|
||||
// error.
|
||||
return true;
|
||||
|
||||
LoadFrameScriptInternal(aURL, aRunInGlobalScope);
|
||||
LoadScriptInternal(aURL, aRunInGlobalScope);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2769,7 +2768,7 @@ TabChild::InitTabChildGlobal(FrameScriptLoading aScriptLoading)
|
||||
nsISupports* scopeSupports = NS_ISUPPORTS_CAST(EventTarget*, scope);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(globalId, "outOfProcessTabChildGlobal");
|
||||
NS_ENSURE_TRUE(InitTabChildGlobalInternal(scopeSupports, globalId), false);
|
||||
NS_ENSURE_TRUE(InitChildGlobalInternal(scopeSupports, globalId), false);
|
||||
|
||||
scope->Init();
|
||||
|
||||
@ -3217,13 +3216,6 @@ TabChildGlobal::GetContent(nsIDOMWindow** aContent)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChildGlobal::PrivateNoteIntentionalCrash()
|
||||
{
|
||||
mozilla::NoteIntentionalCrash("tab");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChildGlobal::GetDocShell(nsIDocShell** aDocShell)
|
||||
{
|
||||
@ -3235,20 +3227,6 @@ TabChildGlobal::GetDocShell(nsIDocShell** aDocShell)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChildGlobal::Btoa(const nsAString& aBinaryData,
|
||||
nsAString& aAsciiBase64String)
|
||||
{
|
||||
return nsContentUtils::Btoa(aBinaryData, aAsciiBase64String);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChildGlobal::Atob(const nsAString& aAsciiString,
|
||||
nsAString& aBinaryData)
|
||||
{
|
||||
return nsContentUtils::Atob(aAsciiString, aBinaryData);
|
||||
}
|
||||
|
||||
JSContext*
|
||||
TabChildGlobal::GetJSContextForEventHandlers()
|
||||
{
|
||||
|
@ -76,6 +76,7 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, DOMEventTargetHelper)
|
||||
NS_FORWARD_SAFE_NSIMESSAGELISTENERMANAGER(mMessageManager)
|
||||
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
|
||||
NS_FORWARD_SAFE_NSIMESSAGEMANAGERGLOBAL(mMessageManager)
|
||||
NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
|
||||
JS::Handle<JS::Value> aObject,
|
||||
JS::Handle<JS::Value> aRemote,
|
||||
@ -104,15 +105,6 @@ public:
|
||||
}
|
||||
NS_IMETHOD GetContent(nsIDOMWindow** aContent) MOZ_OVERRIDE;
|
||||
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell) MOZ_OVERRIDE;
|
||||
NS_IMETHOD Dump(const nsAString& aStr) MOZ_OVERRIDE
|
||||
{
|
||||
return mMessageManager ? mMessageManager->Dump(aStr) : NS_OK;
|
||||
}
|
||||
NS_IMETHOD PrivateNoteIntentionalCrash() MOZ_OVERRIDE;
|
||||
NS_IMETHOD Btoa(const nsAString& aBinaryData,
|
||||
nsAString& aAsciiBase64String) MOZ_OVERRIDE;
|
||||
NS_IMETHOD Atob(const nsAString& aAsciiString,
|
||||
nsAString& aBinaryData) MOZ_OVERRIDE;
|
||||
|
||||
nsresult AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
@ -173,7 +165,7 @@ protected:
|
||||
// It make sense to place in this class all helper functions, and functionality which could be shared between
|
||||
// Cross-process/Cross-thread implmentations.
|
||||
class TabChildBase : public nsISupports,
|
||||
public nsFrameScriptExecutor,
|
||||
public nsMessageManagerScriptExecutor,
|
||||
public ipc::MessageManagerCallback
|
||||
{
|
||||
public:
|
||||
|
@ -113,7 +113,7 @@ nsIContentChild::RecvAsyncMessage(const nsString& aMsg,
|
||||
InfallibleTArray<CpowEntry>&& aCpows,
|
||||
const IPC::Principal& aPrincipal)
|
||||
{
|
||||
nsRefPtr<nsFrameMessageManager> cpm = nsFrameMessageManager::sChildProcessManager;
|
||||
nsRefPtr<nsFrameMessageManager> cpm = nsFrameMessageManager::GetChildProcessManager();
|
||||
if (cpm) {
|
||||
StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForChild(aData);
|
||||
CrossProcessCpowHolder cpows(this, aCpows);
|
||||
|
@ -144,6 +144,7 @@ void MediaDecoder::UpdateDormantState(bool aDormantTimeout, bool aActivity)
|
||||
if (!mDecoderStateMachine ||
|
||||
mPlayState == PLAY_STATE_SHUTDOWN ||
|
||||
!mOwner->GetVideoFrameContainer() ||
|
||||
(mOwner->GetMediaElement() && mOwner->GetMediaElement()->IsBeingDestroyed()) ||
|
||||
!mDecoderStateMachine->IsDormantNeeded())
|
||||
{
|
||||
return;
|
||||
@ -984,8 +985,8 @@ bool MediaDecoder::IsSameOriginMedia()
|
||||
bool MediaDecoder::IsSeeking() const
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return mPlayState == PLAY_STATE_SEEKING ||
|
||||
(mPlayState == PLAY_STATE_LOADING && mRequestedSeekTarget.IsValid());
|
||||
return !mIsDormant && (mPlayState == PLAY_STATE_SEEKING ||
|
||||
(mPlayState == PLAY_STATE_LOADING && mRequestedSeekTarget.IsValid()));
|
||||
}
|
||||
|
||||
bool MediaDecoder::IsEnded() const
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "nsContentCID.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "MainThreadUtils.h"
|
||||
#include "EMELog.h"
|
||||
#include "mozilla/EMEUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "CDMCaps.h"
|
||||
#include "EMELog.h"
|
||||
#include "mozilla/CDMCaps.h"
|
||||
#include "mozilla/EMEUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "SamplesWaitingForKey.h"
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "nsContentCID.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "MainThreadUtils.h"
|
||||
#include "mozilla/EMELog.h"
|
||||
#include "mozilla/EMEUtils.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "prenv.h"
|
||||
#include "mozilla/PodOperations.h"
|
||||
|
@ -1,31 +0,0 @@
|
||||
/* -*- 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/. */
|
||||
|
||||
#include "EMELog.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
|
||||
PRLogModuleInfo* GetEMELog() {
|
||||
static PRLogModuleInfo* log = nullptr;
|
||||
if (!log) {
|
||||
log = PR_NewLogModule("EME");
|
||||
}
|
||||
return log;
|
||||
}
|
||||
|
||||
PRLogModuleInfo* GetEMEVerboseLog() {
|
||||
static PRLogModuleInfo* log = nullptr;
|
||||
if (!log) {
|
||||
log = PR_NewLogModule("EMEV");
|
||||
}
|
||||
return log;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace mozilla
|
116
dom/media/eme/EMEUtils.cpp
Normal file
116
dom/media/eme/EMEUtils.cpp
Normal file
@ -0,0 +1,116 @@
|
||||
/* -*- 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/. */
|
||||
|
||||
#include "mozilla/EMEUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
|
||||
PRLogModuleInfo* GetEMELog() {
|
||||
static PRLogModuleInfo* log = nullptr;
|
||||
if (!log) {
|
||||
log = PR_NewLogModule("EME");
|
||||
}
|
||||
return log;
|
||||
}
|
||||
|
||||
PRLogModuleInfo* GetEMEVerboseLog() {
|
||||
static PRLogModuleInfo* log = nullptr;
|
||||
if (!log) {
|
||||
log = PR_NewLogModule("EMEV");
|
||||
}
|
||||
return log;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static bool
|
||||
ContainsOnlyDigits(const nsAString& aString)
|
||||
{
|
||||
nsAString::const_iterator iter, end;
|
||||
aString.BeginReading(iter);
|
||||
aString.EndReading(end);
|
||||
while (iter != end) {
|
||||
char16_t ch = *iter;
|
||||
if (ch < '0' || ch > '9') {
|
||||
return false;
|
||||
}
|
||||
iter++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
ParseKeySystem(const nsAString& aExpectedKeySystem,
|
||||
const nsAString& aInputKeySystem,
|
||||
int32_t& aOutCDMVersion)
|
||||
{
|
||||
if (!StringBeginsWith(aInputKeySystem, aExpectedKeySystem)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aInputKeySystem.Length() > aExpectedKeySystem.Length() + 8) {
|
||||
// Allow up to 8 bytes for the ".version" field. 8 bytes should
|
||||
// be enough for any versioning scheme...
|
||||
NS_WARNING("Input KeySystem including was suspiciously long");
|
||||
return false;
|
||||
}
|
||||
|
||||
const char16_t* versionStart = aInputKeySystem.BeginReading() + aExpectedKeySystem.Length();
|
||||
const char16_t* end = aInputKeySystem.EndReading();
|
||||
if (versionStart == end) {
|
||||
// No version supplied with keysystem.
|
||||
aOutCDMVersion = NO_CDM_VERSION;
|
||||
return true;
|
||||
}
|
||||
if (*versionStart != '.') {
|
||||
// version not in correct format.
|
||||
NS_WARNING("EME keySystem version string not prefixed by '.'");
|
||||
return false;
|
||||
}
|
||||
versionStart++;
|
||||
const nsAutoString versionStr(Substring(versionStart, end));
|
||||
if (!ContainsOnlyDigits(versionStr)) {
|
||||
NS_WARNING("Non-digit character in EME keySystem string's version suffix");
|
||||
return false;
|
||||
}
|
||||
nsresult rv;
|
||||
int32_t version = versionStr.ToInteger(&rv);
|
||||
if (NS_FAILED(rv) || version < 0) {
|
||||
NS_WARNING("Invalid version in EME keySystem string");
|
||||
return false;
|
||||
}
|
||||
aOutCDMVersion = version;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static const char16_t* sKeySystems[] = {
|
||||
MOZ_UTF16("org.w3.clearkey"),
|
||||
MOZ_UTF16("com.adobe.access"),
|
||||
MOZ_UTF16("com.adobe.primetime"),
|
||||
};
|
||||
|
||||
bool
|
||||
ParseKeySystem(const nsAString& aInputKeySystem,
|
||||
nsAString& aOutKeySystem,
|
||||
int32_t& aOutCDMVersion)
|
||||
{
|
||||
for (const char16_t* keySystem : sKeySystems) {
|
||||
int32_t minCDMVersion = NO_CDM_VERSION;
|
||||
if (ParseKeySystem(nsDependentString(keySystem),
|
||||
aInputKeySystem,
|
||||
minCDMVersion)) {
|
||||
aOutKeySystem = keySystem;
|
||||
aOutCDMVersion = minCDMVersion;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user