Bug 1299390 - part 3: Remove BrowserElement methods required by BrowserElementAudioChannel only. r=baku, r=alwu
MozReview-Commit-ID: LAyGMvmmZpz
--- a/dom/browser-element/BrowserElementChildPreload.js
+++ b/dom/browser-element/BrowserElementChildPreload.js
@@ -287,21 +287,16 @@ BrowserElementChild.prototype = {
"get-screenshot": this._recvGetScreenshot,
"get-contentdimensions": this._recvGetContentDimensions,
"set-visible": this._recvSetVisible,
"get-visible": this._recvVisible,
"send-mouse-event": this._recvSendMouseEvent,
"send-touch-event": this._recvSendTouchEvent,
"get-can-go-back": this._recvCanGoBack,
"get-can-go-forward": this._recvCanGoForward,
- "mute": this._recvMute,
- "unmute": this._recvUnmute,
- "get-muted": this._recvGetMuted,
- "set-volume": this._recvSetVolume,
- "get-volume": this._recvGetVolume,
"go-back": this._recvGoBack,
"go-forward": this._recvGoForward,
"reload": this._recvReload,
"stop": this._recvStop,
"zoom": this._recvZoom,
"unblock-modal-prompt": this._recvStopWaiting,
"fire-ctx-callback": this._recvFireCtxCallback,
"owner-visibility-change": this._recvOwnerVisibilityChange,
@@ -1305,42 +1300,16 @@ BrowserElementChild.prototype = {
_recvCanGoForward: function(data) {
var webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
sendAsyncMsg('got-can-go-forward', {
id: data.json.id,
successRv: webNav.canGoForward
});
},
- _recvMute: function(data) {
- this._windowUtils.audioMuted = true;
- },
-
- _recvUnmute: function(data) {
- this._windowUtils.audioMuted = false;
- },
-
- _recvGetMuted: function(data) {
- sendAsyncMsg('got-muted', {
- id: data.json.id,
- successRv: this._windowUtils.audioMuted
- });
- },
-
- _recvSetVolume: function(data) {
- this._windowUtils.audioVolume = data.json.volume;
- },
-
- _recvGetVolume: function(data) {
- sendAsyncMsg('got-volume', {
- id: data.json.id,
- successRv: this._windowUtils.audioVolume
- });
- },
-
_recvGoBack: function(data) {
try {
docShell.QueryInterface(Ci.nsIWebNavigation).goBack();
} catch(e) {
// Silently swallow errors; these happen when we can't go back.
}
},
--- a/dom/browser-element/BrowserElementParent.js
+++ b/dom/browser-element/BrowserElementParent.js
@@ -163,18 +163,16 @@ BrowserElementParent.prototype = {
"firstpaint": this._fireProfiledEventFromMsg,
"documentfirstpaint": this._fireProfiledEventFromMsg,
"nextpaint": this._recvNextPaint,
"got-purge-history": this._gotDOMRequestResult,
"got-screenshot": this._gotDOMRequestResult,
"got-contentdimensions": this._gotDOMRequestResult,
"got-can-go-back": this._gotDOMRequestResult,
"got-can-go-forward": this._gotDOMRequestResult,
- "got-muted": this._gotDOMRequestResult,
- "got-volume": this._gotDOMRequestResult,
"requested-dom-fullscreen": this._requestedDOMFullscreen,
"fullscreen-origin-change": this._fullscreenOriginChange,
"exit-dom-fullscreen": this._exitDomFullscreen,
"got-visible": this._gotDOMRequestResult,
"visibilitychange": this._childVisibilityChange,
"got-set-input-method-active": this._gotDOMRequestResult,
"scrollviewchange": this._handleScrollViewChange,
"caretstatechanged": this._handleCaretStateChanged,
@@ -619,32 +617,16 @@ BrowserElementParent.prototype = {
backward: direction == Ci.nsIBrowserElementAPI.FIND_BACKWARD
});
}),
clearMatch: defineNoReturnMethod(function() {
return this._sendAsyncMsg('clear-match');
}),
- mute: defineNoReturnMethod(function() {
- this._sendAsyncMsg('mute');
- }),
-
- unmute: defineNoReturnMethod(function() {
- this._sendAsyncMsg('unmute');
- }),
-
- getMuted: defineDOMRequestMethod('get-muted'),
-
- getVolume: defineDOMRequestMethod('get-volume'),
-
- setVolume: defineNoReturnMethod(function(volume) {
- this._sendAsyncMsg('set-volume', {volume});
- }),
-
goBack: defineNoReturnMethod(function() {
this._sendAsyncMsg('go-back');
}),
goForward: defineNoReturnMethod(function() {
this._sendAsyncMsg('go-forward');
}),
--- a/dom/browser-element/nsIBrowserElementAPI.idl
+++ b/dom/browser-element/nsIBrowserElementAPI.idl
@@ -77,23 +77,16 @@ interface nsIBrowserElementAPI : nsISupp
nsIDOMDOMRequest getCanGoBack();
nsIDOMDOMRequest getCanGoForward();
nsIDOMDOMRequest getContentDimensions();
void findAll(in DOMString searchString, in long caseSensitivity);
void findNext(in long direction);
void clearMatch();
- void mute();
- void unmute();
- nsIDOMDOMRequest getMuted();
-
- void setVolume(in float volume);
- nsIDOMDOMRequest getVolume();
-
void addNextPaintListener(in nsIBrowserElementNextPaintListener listener);
void removeNextPaintListener(in nsIBrowserElementNextPaintListener listener);
nsIDOMDOMRequest executeScript(in DOMString script, in jsval options);
/**
* Returns an object that represents a Web Manifest:
* http://w3c.github.io/manifest/
--- a/dom/html/nsBrowserElement.cpp
+++ b/dom/html/nsBrowserElement.cpp
@@ -450,84 +450,16 @@ nsBrowserElement::RemoveNextPaintListene
nsresult rv = mBrowserElementAPI->RemoveNextPaintListener(listener);
if (NS_WARN_IF(NS_FAILED(rv))) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
}
}
already_AddRefed<DOMRequest>
-nsBrowserElement::GetMuted(ErrorResult& aRv)
-{
- NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
-
- nsCOMPtr<nsIDOMDOMRequest> req;
- nsresult rv = mBrowserElementAPI->GetMuted(getter_AddRefs(req));
-
- if (NS_WARN_IF(NS_FAILED(rv))) {
- aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
- return nullptr;
- }
-
- return req.forget().downcast<DOMRequest>();
-}
-
-void
-nsBrowserElement::Mute(ErrorResult& aRv)
-{
- NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
-
- nsresult rv = mBrowserElementAPI->Mute();
-
- if (NS_WARN_IF(NS_FAILED(rv))) {
- aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
- }
-}
-
-void
-nsBrowserElement::Unmute(ErrorResult& aRv)
-{
- NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
-
- nsresult rv = mBrowserElementAPI->Unmute();
-
- if (NS_WARN_IF(NS_FAILED(rv))) {
- aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
- }
-}
-
-already_AddRefed<DOMRequest>
-nsBrowserElement::GetVolume(ErrorResult& aRv)
-{
- NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
-
- nsCOMPtr<nsIDOMDOMRequest> req;
- nsresult rv = mBrowserElementAPI->GetVolume(getter_AddRefs(req));
-
- if (NS_WARN_IF(NS_FAILED(rv))) {
- aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
- return nullptr;
- }
-
- return req.forget().downcast<DOMRequest>();
-}
-
-void
-nsBrowserElement::SetVolume(float aVolume, ErrorResult& aRv)
-{
- NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
-
- nsresult rv = mBrowserElementAPI->SetVolume(aVolume);
-
- if (NS_WARN_IF(NS_FAILED(rv))) {
- aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
- }
-}
-
-already_AddRefed<DOMRequest>
nsBrowserElement::ExecuteScript(const nsAString& aScript,
const BrowserElementExecuteScriptOptions& aOptions,
ErrorResult& aRv)
{
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
nsCOMPtr<nsIDOMDOMRequest> req;
nsCOMPtr<nsIXPConnectWrappedJS> wrappedObj = do_QueryInterface(mBrowserElementAPI);
--- a/dom/html/nsBrowserElement.h
+++ b/dom/html/nsBrowserElement.h
@@ -66,23 +66,16 @@ public:
already_AddRefed<dom::DOMRequest>
Download(const nsAString& aUrl,
const dom::BrowserElementDownloadOptions& options,
ErrorResult& aRv);
already_AddRefed<dom::DOMRequest> PurgeHistory(ErrorResult& aRv);
- void Mute(ErrorResult& aRv);
- void Unmute(ErrorResult& aRv);
- already_AddRefed<dom::DOMRequest> GetMuted(ErrorResult& aRv);
-
- void SetVolume(float aVolume , ErrorResult& aRv);
- already_AddRefed<dom::DOMRequest> GetVolume(ErrorResult& aRv);
-
already_AddRefed<dom::DOMRequest>
GetScreenshot(uint32_t aWidth,
uint32_t aHeight,
const nsAString& aMimeType,
ErrorResult& aRv);
void Zoom(float aZoom, ErrorResult& aRv);
--- a/dom/webidl/BrowserElement.webidl
+++ b/dom/webidl/BrowserElement.webidl
@@ -166,51 +166,8 @@ interface BrowserElementPrivileged {
optional BrowserElementExecuteScriptOptions options);
[Throws,
Pref="dom.mozBrowserFramesEnabled",
ChromeOnly]
DOMRequest getWebManifest();
};
-
-// Bits needed for BrowserElementAudioChannel.
-partial interface BrowserElementPrivileged {
- /**
- * Mutes all audio in this browser.
- */
- [Throws,
- Pref="dom.mozBrowserFramesEnabled",
- ChromeOnly]
- void mute();
-
- /**
- * Unmutes all audio in this browser.
- */
- [Throws,
- Pref="dom.mozBrowserFramesEnabled",
- ChromeOnly]
- void unmute();
-
- /**
- * Obtains whether or not the browser is muted.
- */
- [Throws,
- Pref="dom.mozBrowserFramesEnabled",
- ChromeOnly]
- DOMRequest getMuted();
-
- /**
- * Sets the volume for the browser.
- */
- [Throws,
- Pref="dom.mozBrowserFramesEnabled",
- ChromeOnly]
- void setVolume(float volume);
-
- /**
- * Gets the volume for the browser.
- */
- [Throws,
- Pref="dom.mozBrowserFramesEnabled",
- ChromeOnly]
- DOMRequest getVolume();
-};