Skip to content

Commit

Permalink
merge mozilla-inbound to mozilla-central. r=merge a=merge
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: IRW0W7LuIM7
  • Loading branch information
Archaeopteryx committed Oct 3, 2017
2 parents b8b1e75 + 5b0447d commit 47a3410
Show file tree
Hide file tree
Showing 57 changed files with 555 additions and 1,628 deletions.
48 changes: 48 additions & 0 deletions accessible/ipc/win/COMPtrTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#define mozilla_a11y_COMPtrTypes_h

#include "mozilla/a11y/AccessibleHandler.h"
#include "mozilla/a11y/Compatibility.h"
#include "mozilla/Attributes.h"
#include "mozilla/mscom/ActivationContext.h"
#include "mozilla/mscom/COMPtrHolder.h"
#include "mozilla/NotNull.h"

Expand All @@ -16,6 +19,51 @@
namespace mozilla {
namespace a11y {

class MOZ_RAII IAccessibleEnvironment : public mscom::ProxyStream::Environment
{
public:
IAccessibleEnvironment() = default;

bool Push() override
{
mActCtxRgn = GetActCtx();
return !!mActCtxRgn;
}

bool Pop() override
{
return mActCtxRgn.Deactivate();
}

private:
static const mscom::ActivationContext& GetActCtx()
{
static const mscom::ActivationContext
sActCtx(Compatibility::GetActCtxResourceId());
MOZ_DIAGNOSTIC_ASSERT(sActCtx);
return sActCtx;
}

private:
mscom::ActivationContextRegion mActCtxRgn;
};

} // namespace a11y

namespace mscom {
namespace detail {

template<>
struct EnvironmentSelector<IAccessible>
{
typedef a11y::IAccessibleEnvironment Type;
};

} // namespace detail
} // namespace mscom

namespace a11y {

typedef mozilla::mscom::COMPtrHolder<IAccessible, IID_IAccessible> IAccessibleHolder;
typedef mozilla::mscom::COMPtrHolder<IDispatch, IID_IDispatch> IDispatchHolder;

Expand Down
1 change: 1 addition & 0 deletions browser/base/content/test/newtab/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ subsuite = clipboard
[browser_newtab_drop_preview.js]
[browser_newtab_focus.js]
[browser_newtab_fullscreen_focus.js]
skip-if = os == "mac" && debug # bug 1394963
[browser_newtab_perwindow_private_browsing.js]
[browser_newtab_reflow_load.js]
support-files =
Expand Down
2 changes: 1 addition & 1 deletion browser/components/migration/tests/unit/xpcshell.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ skip-if = os != "win"
skip-if = os != "win"
[test_fx_telemetry.js]
[test_IE_bookmarks.js]
skip-if = os != "win"
skip-if = true # bug 1392396
[test_IE_cookies.js]
skip-if = os != "win"
[test_IE7_passwords.js]
Expand Down
1 change: 1 addition & 0 deletions browser/components/newtab/tests/browser/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ support-files =

[browser_remotenewtab_pageloads.js]
[browser_newtab_overrides.js]
skip-if = true # bug 1399854
41 changes: 1 addition & 40 deletions dom/plugins/base/nsNPAPIPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1727,46 +1727,7 @@ _setvalue(NPP npp, NPPVariable variable, void *result)
NPError
_requestread(NPStream *pstream, NPByteRange *rangeList)
{
if (!NS_IsMainThread()) {
NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_requestread called from the wrong thread\n"));
return NPERR_INVALID_PARAM;
}
NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_RequestRead: stream=%p\n",
(void*)pstream));

#ifdef PLUGIN_LOGGING
for(NPByteRange * range = rangeList; range != nullptr; range = range->next)
MOZ_LOG(nsPluginLogging::gNPNLog,PLUGIN_LOG_NOISY,
("%i-%i", range->offset, range->offset + range->length - 1));

MOZ_LOG(nsPluginLogging::gNPNLog,PLUGIN_LOG_NOISY, ("\n\n"));
PR_LogFlush();
#endif

if (!pstream || !rangeList || !pstream->ndata)
return NPERR_INVALID_PARAM;

nsNPAPIStreamWrapper* streamWrapper = static_cast<nsNPAPIStreamWrapper*>(pstream->ndata);
nsNPAPIPluginStreamListener* streamlistener = streamWrapper->GetStreamListener();
if (!streamlistener) {
return NPERR_GENERIC_ERROR;
}

int32_t streamtype = NP_NORMAL;

streamlistener->GetStreamType(&streamtype);

if (streamtype != NP_SEEK)
return NPERR_STREAM_NOT_SEEKABLE;

if (!streamlistener->mStreamListenerPeer)
return NPERR_GENERIC_ERROR;

nsresult rv = streamlistener->mStreamListenerPeer->RequestRead((NPByteRange *)rangeList);
if (NS_FAILED(rv))
return NPERR_GENERIC_ERROR;

return NPERR_NO_ERROR;
return NPERR_STREAM_NOT_SEEKABLE;
}

// Deprecated, only stubbed out
Expand Down
77 changes: 4 additions & 73 deletions dom/plugins/base/nsNPAPIPluginStreamListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ nsNPAPIPluginStreamListener::nsNPAPIPluginStreamListener(nsNPAPIPluginInstance*
, mInst(inst)
, mStreamBufferSize(0)
, mStreamBufferByteCount(0)
, mStreamType(NP_NORMAL)
, mStreamState(eStreamStopped)
, mStreamCleanedUp(false)
, mCallNotify(notifyData ? true : false)
Expand Down Expand Up @@ -115,11 +114,6 @@ nsNPAPIPluginStreamListener::CleanUpStream(NPReason reason)
mHTTPRedirectCallback = nullptr;
}

// Seekable streams have an extra addref when they are created which must
// be matched here.
if (NP_SEEK == mStreamType && mStreamState == eStreamTypeSet)
NS_RELEASE_THIS();

if (mStreamListenerPeer) {
mStreamListenerPeer->CancelRequests(NS_BINDING_ABORTED);
mStreamListenerPeer = nullptr;
Expand Down Expand Up @@ -212,15 +206,13 @@ nsNPAPIPluginStreamListener::OnStartBinding(nsPluginStreamListenerPeer* streamPe
NPP npp;
mInst->GetNPP(&npp);

bool seekable;
char* contentType;
uint16_t streamType = NP_NORMAL;
NPError error;

streamPeer->GetURL(&mNPStreamWrapper->mNPStream.url);
streamPeer->GetLength((uint32_t*)&(mNPStreamWrapper->mNPStream.end));
streamPeer->GetLastModified((uint32_t*)&(mNPStreamWrapper->mNPStream.lastmodified));
streamPeer->IsSeekable(&seekable);
streamPeer->GetContentType(&contentType);

if (!mResponseHeaders.IsEmpty()) {
Expand All @@ -232,68 +224,25 @@ nsNPAPIPluginStreamListener::OnStartBinding(nsPluginStreamListenerPeer* streamPe

NPPAutoPusher nppPusher(npp);

NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->newstream)(npp, (char*)contentType, &mNPStreamWrapper->mNPStream, seekable, &streamType), mInst,
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->newstream)(npp, (char*)contentType, &mNPStreamWrapper->mNPStream, false, &streamType), mInst,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);

NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("NPP NewStream called: this=%p, npp=%p, mime=%s, seek=%d, type=%d, return=%d, url=%s\n",
this, npp, (char *)contentType, seekable, streamType, error, mNPStreamWrapper->mNPStream.url));
this, npp, (char *)contentType, false, streamType, error, mNPStreamWrapper->mNPStream.url));

if (error != NPERR_NO_ERROR)
return NS_ERROR_FAILURE;

mStreamState = eNewStreamCalled;

if (!SetStreamType(streamType, false)) {
if (streamType != NP_NORMAL) {
return NS_ERROR_FAILURE;
}

return NS_OK;
}

bool
nsNPAPIPluginStreamListener::SetStreamType(uint16_t aType, bool aNeedsResume)
{
switch(aType)
{
case NP_NORMAL:
mStreamType = NP_NORMAL;
break;
case NP_ASFILEONLY:
mStreamType = NP_ASFILEONLY;
break;
case NP_ASFILE:
mStreamType = NP_ASFILE;
break;
case NP_SEEK:
mStreamType = NP_SEEK;
// Seekable streams should continue to exist even after OnStopRequest
// is fired, so we AddRef ourself an extra time and Release when the
// plugin calls NPN_DestroyStream (CleanUpStream). If the plugin never
// calls NPN_DestroyStream the stream will be destroyed before the plugin
// instance is destroyed.
NS_ADDREF_THIS();
break;
case nsPluginStreamListenerPeer::STREAM_TYPE_UNKNOWN:
MOZ_ASSERT(!aNeedsResume);
mStreamType = nsPluginStreamListenerPeer::STREAM_TYPE_UNKNOWN;
SuspendRequest();
mStreamStopMode = eDoDeferredStop;
// In this case we do not want to execute anything else in this function.
return true;
default:
return false;
}
mStreamState = eStreamTypeSet;
if (aNeedsResume) {
if (mStreamListenerPeer) {
mStreamListenerPeer->OnStreamTypeSet(mStreamType);
}
ResumeRequest();
}
return true;
}

void
nsNPAPIPluginStreamListener::SuspendRequest()
{
Expand Down Expand Up @@ -709,25 +658,7 @@ nsNPAPIPluginStreamListener::OnStopBinding(nsPluginStreamListenerPeer* streamPee

// The following code can result in the deletion of 'this'. Don't
// assume we are alive after this!
//
// Delay cleanup if the stream is of type NP_SEEK and status isn't
// NS_BINDING_ABORTED (meaning the plugin hasn't called NPN_DestroyStream).
// This is because even though we're done delivering data the plugin may
// want to seek. Eventually either the plugin will call NPN_DestroyStream
// or we'll perform cleanup when the instance goes away. See bug 91140.
if (mStreamType != NP_SEEK ||
(NP_SEEK == mStreamType && NS_BINDING_ABORTED == status)) {
return CleanUpStream(reason);
}

return NS_OK;
}

nsresult
nsNPAPIPluginStreamListener::GetStreamType(int32_t *result)
{
*result = mStreamType;
return NS_OK;
return CleanUpStream(reason);
}

bool
Expand Down
3 changes: 0 additions & 3 deletions dom/plugins/base/nsNPAPIPluginStreamListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ class nsNPAPIPluginStreamListener : public nsITimerCallback,
const char* fileName);
nsresult OnStopBinding(nsPluginStreamListenerPeer* streamPeer,
nsresult status);
nsresult GetStreamType(int32_t *result);
bool SetStreamType(uint16_t aType, bool aNeedsResume = true);

bool IsStarted();
nsresult CleanUpStream(NPReason reason);
Expand Down Expand Up @@ -112,7 +110,6 @@ class nsNPAPIPluginStreamListener : public nsITimerCallback,
nsNPAPIStreamWrapper *mNPStreamWrapper;
uint32_t mStreamBufferSize;
int32_t mStreamBufferByteCount;
int32_t mStreamType;
StreamState mStreamState;
bool mStreamCleanedUp;
bool mCallNotify;
Expand Down
Loading

0 comments on commit 47a3410

Please sign in to comment.