mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-08 07:53:54 +00:00
Bug 1510569 - Reimplement RemoteWebProgressRequest as an XPCOM component in C++ r=Ehsan
Differential Revision: https://phabricator.services.mozilla.com/D24940 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
0196dec3ba
commit
2217e5192a
207
dom/ipc/RemoteWebProgressRequest.cpp
Normal file
207
dom/ipc/RemoteWebProgressRequest.cpp
Normal file
@ -0,0 +1,207 @@
|
||||
/* 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 "RemoteWebProgressRequest.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_ISUPPORTS(RemoteWebProgressRequest, nsIRequest, nsIChannel,
|
||||
nsIClassifiedChannel, nsIRemoteWebProgressRequest)
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::Init(nsIURI *aURI, nsIURI *aOriginalURI,
|
||||
const nsACString &aMatchedList) {
|
||||
mURI = aURI;
|
||||
mOriginalURI = aOriginalURI;
|
||||
mMatchedList = aMatchedList;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIChannel methods
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetOriginalURI(nsIURI **aOriginalURI) {
|
||||
NS_ENSURE_ARG_POINTER(aOriginalURI);
|
||||
NS_ADDREF(*aOriginalURI = mOriginalURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::SetOriginalURI(nsIURI *aOriginalURI) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetURI(nsIURI **aURI) {
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
NS_ADDREF(*aURI = mURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetOwner(nsISupports **aOwner) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::SetOwner(nsISupports *aOwner) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetNotificationCallbacks(
|
||||
nsIInterfaceRequestor **aNotificationCallbacks) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::SetNotificationCallbacks(
|
||||
nsIInterfaceRequestor *aNotificationCallbacks) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetSecurityInfo(
|
||||
nsISupports **aSecurityInfo) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetContentType(
|
||||
nsACString &aContentType) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::SetContentType(
|
||||
const nsACString &aContentType) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetContentCharset(
|
||||
nsACString &aContentCharset) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::SetContentCharset(
|
||||
const nsACString &aContentCharset) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetContentLength(
|
||||
int64_t *aContentLength) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::SetContentLength(
|
||||
int64_t aContentLength) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::Open(nsIInputStream **_retval) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::AsyncOpen(
|
||||
nsIStreamListener *aListener) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetContentDisposition(
|
||||
uint32_t *aContentDisposition) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::SetContentDisposition(
|
||||
uint32_t aContentDisposition) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetContentDispositionFilename(
|
||||
nsAString &aContentDispositionFilename) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::SetContentDispositionFilename(
|
||||
const nsAString &aContentDispositionFilename) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetContentDispositionHeader(
|
||||
nsACString &aContentDispositionHeader) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetLoadInfo(nsILoadInfo **aLoadInfo) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::SetLoadInfo(nsILoadInfo *aLoadInfo) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetIsDocument(bool *aIsDocument) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// nsIClassifiedChannel methods
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::SetMatchedInfo(
|
||||
const nsACString &aList, const nsACString &aProvider,
|
||||
const nsACString &aFullHash) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetMatchedList(
|
||||
nsACString &aMatchedList) {
|
||||
aMatchedList = mMatchedList;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetMatchedProvider(
|
||||
nsACString &aMatchedProvider) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetMatchedFullHash(
|
||||
nsACString &aMatchedFullHash) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// nsIRequest methods
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetName(nsACString &aName) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::IsPending(bool *_retval) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetStatus(nsresult *aStatus) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::Cancel(nsresult aStatus) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::Suspend(void) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::Resume(void) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetLoadGroup(
|
||||
nsILoadGroup **aLoadGroup) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::SetLoadGroup(nsILoadGroup *aLoadGroup) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::GetLoadFlags(nsLoadFlags *aLoadFlags) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteWebProgressRequest::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
44
dom/ipc/RemoteWebProgressRequest.h
Normal file
44
dom/ipc/RemoteWebProgressRequest.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* 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_RemoteWebProgressRequest_h
|
||||
#define mozilla_dom_RemoteWebProgressRequest_h
|
||||
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIClassifiedChannel.h"
|
||||
#include "nsIRemoteWebProgressRequest.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class RemoteWebProgressRequest final : public nsIRemoteWebProgressRequest,
|
||||
public nsIChannel,
|
||||
public nsIClassifiedChannel {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIREMOTEWEBPROGRESSREQUEST
|
||||
NS_DECL_NSICHANNEL
|
||||
NS_DECL_NSICLASSIFIEDCHANNEL
|
||||
NS_DECL_NSIREQUEST
|
||||
|
||||
RemoteWebProgressRequest()
|
||||
: mURI(nullptr), mOriginalURI(nullptr), mMatchedList(VoidCString()) {}
|
||||
|
||||
RemoteWebProgressRequest(nsIURI* aURI, nsIURI* aOriginalURI,
|
||||
const nsACString& aMatchedList)
|
||||
: mURI(aURI), mOriginalURI(aOriginalURI), mMatchedList(aMatchedList) {}
|
||||
|
||||
protected:
|
||||
~RemoteWebProgressRequest() = default;
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
nsCString mMatchedList;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_RemoteWebProgressRequest_h
|
@ -10,4 +10,11 @@ Classes = [
|
||||
'type': 'mozilla::dom::RemoteWebProgress',
|
||||
'headers': ['mozilla/dom/RemoteWebProgress.h'],
|
||||
},
|
||||
{
|
||||
'name': 'RemoteWebProgressRequest',
|
||||
'cid': 'eec2e27d-dc1d-4ab3-bed4-63536bd2a21e',
|
||||
'contract_ids': ['@mozilla.org/dom/remote-web-progress-request;1'],
|
||||
'type': 'mozilla::dom::RemoteWebProgressRequest',
|
||||
'headers': ['mozilla/dom/RemoteWebProgressRequest.h'],
|
||||
},
|
||||
]
|
||||
|
@ -10,6 +10,7 @@ with Files("**"):
|
||||
XPIDL_SOURCES += [
|
||||
'nsIHangReport.idl',
|
||||
'nsIRemoteWebProgress.idl',
|
||||
'nsIRemoteWebProgressRequest.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'dom'
|
||||
@ -53,6 +54,7 @@ EXPORTS.mozilla.dom += [
|
||||
'PermissionMessageUtils.h',
|
||||
'ReferrerInfoUtils.h',
|
||||
'RemoteWebProgress.h',
|
||||
'RemoteWebProgressRequest.h',
|
||||
'TabChild.h',
|
||||
'TabContext.h',
|
||||
'TabMessageUtils.h',
|
||||
@ -93,6 +95,7 @@ UNIFIED_SOURCES += [
|
||||
'ProcessPriorityManager.cpp',
|
||||
'ReferrerInfoUtils.cpp',
|
||||
'RemoteWebProgress.cpp',
|
||||
'RemoteWebProgressRequest.cpp',
|
||||
'SharedMap.cpp',
|
||||
'SharedStringMap.cpp',
|
||||
'StructuredCloneData.cpp',
|
||||
|
15
dom/ipc/nsIRemoteWebProgressRequest.idl
Normal file
15
dom/ipc/nsIRemoteWebProgressRequest.idl
Normal file
@ -0,0 +1,15 @@
|
||||
/* 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 "nsISupports.idl"
|
||||
|
||||
interface nsIURI;
|
||||
|
||||
[scriptable, uuid(e14ff4c2-7e26-4748-8755-dfd074b9c746)]
|
||||
interface nsIRemoteWebProgressRequest : nsISupports
|
||||
{
|
||||
void init(in nsIURI aURI,
|
||||
in nsIURI aOriginalURI,
|
||||
in ACString aMatchedList);
|
||||
};
|
@ -8,27 +8,13 @@ var EXPORTED_SYMBOLS = ["RemoteWebProgressManager"];
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const RemoteWebProgress = Components.Constructor(
|
||||
"@mozilla.org/dom/remote-web-progress;1", "nsIRemoteWebProgress", "init");
|
||||
const RemoteWebProgressRequest = Components.Constructor(
|
||||
"@mozilla.org/dom/remote-web-progress-request;1",
|
||||
"nsIRemoteWebProgressRequest", "init");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "E10SUtils",
|
||||
"resource://gre/modules/E10SUtils.jsm");
|
||||
|
||||
function RemoteWebProgressRequest(uriOrSpec, originalURIOrSpec, matchedList) {
|
||||
this.wrappedJSObject = this;
|
||||
|
||||
this._uri = uriOrSpec instanceof Ci.nsIURI ? uriOrSpec
|
||||
: Services.io.newURI(uriOrSpec);
|
||||
this._originalURI = originalURIOrSpec instanceof Ci.nsIURI ?
|
||||
originalURIOrSpec : Services.io.newURI(originalURIOrSpec);
|
||||
this._matchedList = matchedList;
|
||||
}
|
||||
|
||||
RemoteWebProgressRequest.prototype = {
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIChannel, Ci.nsIClassifiedChannel]),
|
||||
|
||||
get URI() { return this._uri; },
|
||||
get originalURI() { return this._originalURI; },
|
||||
get matchedList() { return this._matchedList; },
|
||||
};
|
||||
|
||||
function RemoteWebProgressManager(aBrowser) {
|
||||
this._topLevelWebProgress = new RemoteWebProgress(
|
||||
@ -170,12 +156,13 @@ RemoteWebProgressManager.prototype = {
|
||||
webProgress.QueryInterface(Ci.nsIWebProgress);
|
||||
}
|
||||
|
||||
let request =
|
||||
aRequestURI ?
|
||||
new RemoteWebProgressRequest(aRequestURI,
|
||||
aOriginalRequestURI,
|
||||
aMatchedList) :
|
||||
null;
|
||||
let request = null;
|
||||
if (aRequestURI) {
|
||||
request = new RemoteWebProgressRequest(aRequestURI,
|
||||
aOriginalRequestURI,
|
||||
aMatchedList);
|
||||
request = request.QueryInterface(Ci.nsIRequest);
|
||||
}
|
||||
|
||||
return [webProgress, request];
|
||||
},
|
||||
@ -208,9 +195,11 @@ RemoteWebProgressManager.prototype = {
|
||||
// The WebProgressRequest object however is always dynamic.
|
||||
let request = null;
|
||||
if (json.requestURI) {
|
||||
request = new RemoteWebProgressRequest(json.requestURI,
|
||||
json.originalRequestURI,
|
||||
json.matchedList);
|
||||
request = new RemoteWebProgressRequest(
|
||||
Services.io.newURI(json.requestURI),
|
||||
Services.io.newURI(json.originalRequestURI),
|
||||
json.matchedList);
|
||||
request = request.QueryInterface(Ci.nsIRequest);
|
||||
}
|
||||
|
||||
if (isTopLevel) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user