Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[embedlite] Do not leak internal strings out from embedding API. Fixe…
…s JB#44123
  • Loading branch information
rainemak committed Dec 11, 2018
1 parent eae05f4 commit 9f175ec
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 50 deletions.
25 changes: 2 additions & 23 deletions embedding/embedlite/EmbedLiteContentController.h
Expand Up @@ -7,7 +7,6 @@
#ifndef mozilla_embedlite_EmbedLiteContentController_h
#define mozilla_embedlite_EmbedLiteContentController_h

#include "FrameMetrics.h" // for FrameMetrics, etc
#include "Units.h" // for CSSPoint, CSSRect, etc
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
#include "nsISupportsImpl.h"
Expand All @@ -20,47 +19,27 @@ class EmbedLiteContentController
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(EmbedLiteContentController)

/**
* Requests a paint of the given FrameMetrics |aFrameMetrics| from Gecko.
* Implementations per-platform are responsible for actually handling this.
* This method will always be called on the Gecko main thread.
*/
virtual void RequestContentRepaint(const mozilla::layers::FrameMetrics& aFrameMetrics) = 0;

/**
* Acknowledges the recipt of a scroll offset update for the scrollable
* frame with the given scroll id. This is used to maintain consistency
* between APZ and other sources of scroll changes.
*/
virtual void AcknowledgeScrollUpdate(const mozilla::layers::FrameMetrics::ViewID& aScrollId,
const uint32_t& aScrollGeneration) = 0;

/**
* Requests handling of a double tap. |aPoint| is in CSS pixels, relative to
* the current scroll offset. This should eventually round-trip back to
* AsyncPanZoomController::ZoomToRect with the dimensions that we want to zoom
* to.
*/
virtual void HandleDoubleTap(const CSSPoint& aPoint,
Modifiers aModifiers,
const mozilla::layers::ScrollableLayerGuid& aGuid) = 0;
virtual void HandleDoubleTap(const CSSPoint& aPoint, Modifiers aModifiers) = 0;

/**
* Requests handling a single tap. |aPoint| is in CSS pixels, relative to the
* current scroll offset. This should simulate and send to content a mouse
* button down, then mouse button up at |aPoint|.
*/
virtual void HandleSingleTap(const CSSPoint& aPoint,
Modifiers aModifiers,
const mozilla::layers::ScrollableLayerGuid& aGuid) = 0;
virtual void HandleSingleTap(const CSSPoint& aPoint, Modifiers aModifiers) = 0;

/**
* Requests handling a long tap. |aPoint| is in CSS pixels, relative to the
* current scroll offset.
*/
virtual void HandleLongTap(const CSSPoint& aPoint,
Modifiers aModifiers,
const mozilla::layers::ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId) = 0;

/**
Expand Down
9 changes: 3 additions & 6 deletions embedding/embedlite/embedshared/EmbedLiteViewBaseChild.cpp
Expand Up @@ -388,9 +388,6 @@ void
EmbedLiteViewBaseChild::RelayFrameMetrics(const FrameMetrics& aFrameMetrics)
{
LOGT();
for (unsigned int i = 0; i < mControllerListeners.Length(); i++) {
mControllerListeners[i]->RequestContentRepaint(aFrameMetrics);
}
}

bool
Expand Down Expand Up @@ -815,7 +812,7 @@ EmbedLiteViewBaseChild::RecvHandleDoubleTap(const CSSPoint& aPoint,
CSSPoint cssPoint = APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid);

for (unsigned int i = 0; i < mControllerListeners.Length(); i++) {
mControllerListeners[i]->HandleDoubleTap(cssPoint, aModifiers, aGuid);
mControllerListeners[i]->HandleDoubleTap(cssPoint, aModifiers);
}

if (sPostAZPCAsJson.doubleTap) {
Expand Down Expand Up @@ -846,7 +843,7 @@ EmbedLiteViewBaseChild::RecvHandleSingleTap(const CSSPoint& aPoint,
CSSPoint cssPoint = APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid);

for (unsigned int i = 0; i < mControllerListeners.Length(); i++) {
mControllerListeners[i]->HandleSingleTap(cssPoint, aModifiers, aGuid);
mControllerListeners[i]->HandleSingleTap(cssPoint, aModifiers);
}

if (sPostAZPCAsJson.singleTap) {
Expand All @@ -873,7 +870,7 @@ EmbedLiteViewBaseChild::RecvHandleLongTap(const CSSPoint& aPoint,
CSSPoint cssPoint = APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid);

for (unsigned int i = 0; i < mControllerListeners.Length(); i++) {
mControllerListeners[i]->HandleLongTap(cssPoint, 0, aGuid, aInputBlockId);
mControllerListeners[i]->HandleLongTap(cssPoint, 0, aInputBlockId);
}

if (sPostAZPCAsJson.longTap) {
Expand Down
13 changes: 0 additions & 13 deletions embedding/embedlite/modules/EmbedLiteAppService.cpp
Expand Up @@ -324,19 +324,6 @@ EmbedLiteAppService::GetContentWindowByID(uint32_t aId, nsIDOMWindow * *outWindo
return rv;
}

NS_IMETHODIMP
EmbedLiteAppService::GetCompositedRectInCSS(const mozilla::layers::FrameMetrics& aFrameMetrics,
float* aX, float* aY, float* aWidth, float* aHeight)
{
mozilla::CSSRect cssCompositedRect(aFrameMetrics.CalculateCompositedRectInCssPixels());
*aX = cssCompositedRect.x;
*aY = cssCompositedRect.y;
*aWidth = cssCompositedRect.width;
*aHeight = cssCompositedRect.height;

return NS_OK;
}

NS_IMETHODIMP
EmbedLiteAppService::SendAsyncMessageLocal(uint32_t aId, const char16_t* messageName, const char16_t* message)
{
Expand Down
4 changes: 0 additions & 4 deletions embedding/embedlite/modules/nsIEmbedAppService.idl
Expand Up @@ -20,12 +20,9 @@
*/

%{C++
#include "nsStringGlue.h" // needed for AString -> nsAString, unfortunately
#include "mozilla/embedlite/EmbedLiteContentController.h"
#include "FrameMetrics.h"
%}

[ref] native nsConstFrameMetrics(const mozilla::layers::FrameMetrics);
[ptr] native EmbedLiteContentController(mozilla::embedlite::EmbedLiteContentController);

[scriptable, uuid(99d60536-e1a7-11e2-b76e-ff454ce9029f)]
Expand Down Expand Up @@ -62,7 +59,6 @@ interface nsIEmbedAppService : nsISupports
void sendAsyncMessageLocal(in uint32_t aId, in wstring messageName, in wstring message);

// AZPC Interface
void getCompositedRectInCSS(in nsConstFrameMetrics aMetrics, out float aX, out float aY, out float aWidth, out float aHeight);
void zoomToRect(in uint32_t aId, in float aX, in float aY, in float aWidth, in float aHeight);
void contentReceivedInputBlock(in uint32_t aId, in boolean aPreventDefault);
// Not sure how else to add event listener from js component without browser
Expand Down
4 changes: 0 additions & 4 deletions embedding/embedlite/modules/nsIEmbedLiteJSON.idl
Expand Up @@ -7,10 +7,6 @@
#include "nsIPropertyBag2.idl"
#include "nsIWritablePropertyBag2.idl"

%{ C++
#include "nsStringGlue.h" // needed for AString -> nsAString, unfortunately
%}

/**
* An optional interface for embedding clients wishing to receive
* notifications for when a tooltip should be displayed or removed.
Expand Down

0 comments on commit 9f175ec

Please sign in to comment.