Skip to content

Commit

Permalink
chore: bootstrap build #1051
Browse files Browse the repository at this point in the history
  • Loading branch information
playwright-devops authored and aslushnikov committed Mar 23, 2020
1 parent 45e34fd commit fbd1717
Show file tree
Hide file tree
Showing 58 changed files with 6,167 additions and 34 deletions.
2 changes: 2 additions & 0 deletions accessible/base/NotificationController.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ class NotificationController final : public EventQueue,
}
#endif

bool IsUpdatePendingForJugglerAccessibility() { return IsUpdatePending(); }

protected:
virtual ~NotificationController();

Expand Down
5 changes: 5 additions & 0 deletions accessible/interfaces/nsIAccessibleDocument.idl
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,9 @@ interface nsIAccessibleDocument : nsISupports
* Return the child document accessible at the given index.
*/
nsIAccessibleDocument getChildDocumentAt(in unsigned long index);

/**
* Return whether it is updating.
*/
readonly attribute boolean isUpdatePendingForJugglerAccessibility;
};
9 changes: 9 additions & 0 deletions accessible/xpcom/xpcAccessibleDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ xpcAccessibleDocument::GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor) {
return NS_OK;
}


NS_IMETHODIMP
xpcAccessibleDocument::GetIsUpdatePendingForJugglerAccessibility(bool* updating) {
NS_ENSURE_ARG_POINTER(updating);
*updating = Intl()->Controller()->IsUpdatePendingForJugglerAccessibility();
return NS_OK;
}


////////////////////////////////////////////////////////////////////////////////
// xpcAccessibleDocument

Expand Down
2 changes: 2 additions & 0 deletions accessible/xpcom/xpcAccessibleDocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class xpcAccessibleDocument : public xpcAccessibleHyperText,
nsIAccessibleDocument** aDocument) final;
NS_IMETHOD GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor) final;

NS_IMETHOD GetIsUpdatePendingForJugglerAccessibility(bool* aUpdating) final;

/**
* Return XPCOM wrapper for the internal accessible.
*/
Expand Down
5 changes: 5 additions & 0 deletions browser/installer/allowed-dupes.mn
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ browser/chrome/browser/res/payments/formautofill/autofillEditForms.js
# Bug 1451050 - Remote settings empty dumps (will be populated with data eventually)
browser/defaults/settings/pinning/pins.json
browser/defaults/settings/main/example.json
# Juggler/marionette files
chrome/juggler/content/content/floating-scrollbars.css
browser/chrome/devtools/skin/floating-scrollbars-responsive-design.css
chrome/juggler/content/server/stream-utils.js
chrome/marionette/content/stream-utils.js
#ifdef MOZ_EME_WIN32_ARTIFACT
gmp-clearkey/0.1/manifest.json
i686/gmp-clearkey/0.1/manifest.json
Expand Down
5 changes: 5 additions & 0 deletions browser/installer/package-manifest.in
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@
@RESPATH@/components/marionette.js
#endif

@RESPATH@/chrome/juggler@JAREXT@
@RESPATH@/chrome/juggler.manifest
@RESPATH@/components/juggler.manifest
@RESPATH@/components/juggler.js

#if defined(ENABLE_TESTS) && defined(MOZ_DEBUG)
@RESPATH@/components/TestInterfaceJS.js
@RESPATH@/components/TestInterfaceJS.manifest
Expand Down
13 changes: 6 additions & 7 deletions devtools/server/socket/websocket-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,12 @@ function writeHttpResponse(output, response) {
* Process the WebSocket handshake headers and return the key to be sent in
* Sec-WebSocket-Accept response header.
*/
function processRequest({ requestLine, headers }) {
function processRequest({ requestLine, headers }, expectedPath) {
const [method, path] = requestLine.split(" ");
if (method !== "GET") {
throw new Error("The handshake request must use GET method");
}

if (path !== "/") {
if (path !== expectedPath) {
throw new Error("The handshake request has unknown path");
}

Expand Down Expand Up @@ -189,13 +188,13 @@ function computeKey(key) {
/**
* Perform the server part of a WebSocket opening handshake on an incoming connection.
*/
const serverHandshake = async function(input, output) {
const serverHandshake = async function(input, output, expectedPath) {
// Read the request
const request = await readHttpRequest(input);

try {
// Check and extract info from the request
const { acceptKey } = processRequest(request);
const { acceptKey } = processRequest(request, expectedPath);

// Send response headers
await writeHttpResponse(output, [
Expand All @@ -217,8 +216,8 @@ const serverHandshake = async function(input, output) {
* Performs the WebSocket handshake and waits for the WebSocket to open.
* Returns Promise with a WebSocket ready to send and receive messages.
*/
const accept = async function(transport, input, output) {
await serverHandshake(input, output);
const accept = async function(transport, input, output, expectedPath) {
await serverHandshake(input, output, expectedPath || "/");

const transportProvider = {
setListener(upgradeListener) {
Expand Down
115 changes: 115 additions & 0 deletions docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include "mozilla/dom/ContentFrameMessageManager.h"
#include "mozilla/dom/DocGroup.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Geolocation.h"
#include "mozilla/dom/HTMLAnchorElement.h"
#include "mozilla/dom/PerformanceNavigation.h"
#include "mozilla/dom/PermissionMessageUtils.h"
Expand Down Expand Up @@ -96,6 +97,7 @@
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeOwner.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/Element.h"
#include "nsIDocumentLoaderFactory.h"
#include "nsIDOMWindow.h"
#include "nsIEditingSession.h"
Expand Down Expand Up @@ -351,6 +353,9 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext,
mUseStrictSecurityChecks(false),
mObserveErrorPages(true),
mCSSErrorReportingEnabled(false),
mFileInputInterceptionEnabled(false),
mBypassCSPEnabled(false),
mOnlineOverride(nsIDocShell::ONLINE_OVERRIDE_NONE),
mAllowAuth(mItemType == typeContent),
mAllowKeywordFixup(false),
mIsOffScreenBrowser(false),
Expand Down Expand Up @@ -1223,6 +1228,7 @@ bool nsDocShell::SetCurrentURI(nsIURI* aURI, nsIRequest* aRequest,
isSubFrame = mLSHE->GetIsSubFrame();
}

FireOnFrameLocationChange(this, aRequest, aURI, aLocationFlags);
if (!isSubFrame && !isRoot) {
/*
* We don't want to send OnLocationChange notifications when
Expand Down Expand Up @@ -3363,6 +3369,109 @@ nsDocShell::GetMessageManager(ContentFrameMessageManager** aMessageManager) {
return NS_OK;
}

// =============== Juggler Begin =======================

nsDocShell* nsDocShell::GetRootDocShell() {
nsCOMPtr<nsIDocShellTreeItem> rootAsItem;
GetInProcessSameTypeRootTreeItem(getter_AddRefs(rootAsItem));
nsCOMPtr<nsIDocShell> rootShell = do_QueryInterface(rootAsItem);
return nsDocShell::Cast(rootShell);
}

NS_IMETHODIMP
nsDocShell::GetBypassCSPEnabled(bool* aEnabled) {
MOZ_ASSERT(aEnabled);
*aEnabled = mBypassCSPEnabled;
return NS_OK;
}

NS_IMETHODIMP
nsDocShell::SetBypassCSPEnabled(bool aEnabled) {
mBypassCSPEnabled = aEnabled;
return NS_OK;
}

bool nsDocShell::IsBypassCSPEnabled() {
return GetRootDocShell()->mBypassCSPEnabled;
}

NS_IMETHODIMP
nsDocShell::GetLanguageOverride(nsAString& aLanguageOverride) {
MOZ_ASSERT(aEnabled);
aLanguageOverride = GetRootDocShell()->mLanguageOverride;
return NS_OK;
}

NS_IMETHODIMP
nsDocShell::SetLanguageOverride(const nsAString& aLanguageOverride) {
mLanguageOverride = aLanguageOverride;
return NS_OK;
}

NS_IMETHODIMP
nsDocShell::GetFileInputInterceptionEnabled(bool* aEnabled) {
MOZ_ASSERT(aEnabled);
*aEnabled = GetRootDocShell()->mFileInputInterceptionEnabled;
return NS_OK;
}

NS_IMETHODIMP
nsDocShell::SetFileInputInterceptionEnabled(bool aEnabled) {
mFileInputInterceptionEnabled = aEnabled;
return NS_OK;
}

bool nsDocShell::IsFileInputInterceptionEnabled() {
return GetRootDocShell()->mFileInputInterceptionEnabled;
}

void nsDocShell::FilePickerShown(mozilla::dom::Element* element) {
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
observerService->NotifyObservers(
ToSupports(element), "juggler-file-picker-shown", nullptr);
}

RefPtr<nsGeolocationService> nsDocShell::GetGeolocationServiceOverride() {
return GetRootDocShell()->mGeolocationServiceOverride;
}

NS_IMETHODIMP
nsDocShell::SetGeolocationOverride(nsIDOMGeoPosition* aGeolocationOverride) {
if (aGeolocationOverride) {
if (!mGeolocationServiceOverride) {
mGeolocationServiceOverride = new nsGeolocationService();
mGeolocationServiceOverride->Init();
}
mGeolocationServiceOverride->Update(aGeolocationOverride);
} else {
mGeolocationServiceOverride = nullptr;
}
return NS_OK;
}

NS_IMETHODIMP
nsDocShell::GetOnlineOverride(OnlineOverride* aOnlineOverride) {
*aOnlineOverride = GetRootDocShell()->mOnlineOverride;
return NS_OK;
}

NS_IMETHODIMP
nsDocShell::SetOnlineOverride(OnlineOverride aOnlineOverride) {
// We don't have a way to verify this coming from Javascript, so this check is
// still needed.
if (!(aOnlineOverride == ONLINE_OVERRIDE_NONE ||
aOnlineOverride == ONLINE_OVERRIDE_ONLINE ||
aOnlineOverride == ONLINE_OVERRIDE_OFFLINE)) {
return NS_ERROR_INVALID_ARG;
}

mOnlineOverride = aOnlineOverride;
return NS_OK;
}

// =============== Juggler End =======================

NS_IMETHODIMP
nsDocShell::GetIsNavigating(bool* aOut) {
*aOut = mIsNavigating;
Expand Down Expand Up @@ -12138,6 +12247,9 @@ class OnLinkClickEvent : public Runnable {
mNoOpenerImplied, nullptr, nullptr,
mIsUserTriggered, mTriggeringPrincipal, mCsp);
}
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
observerService->NotifyObservers(ToSupports(mContent), "juggler-link-click-sync", nullptr);

return NS_OK;
}

Expand Down Expand Up @@ -12227,6 +12339,9 @@ nsresult nsDocShell::OnLinkClick(
this, aContent, aURI, target, aFileName, aPostDataStream,
aHeadersDataStream, noOpenerImplied, aIsUserTriggered, aIsTrusted,
aTriggeringPrincipal, aCsp);

nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
observerService->NotifyObservers(ToSupports(aContent), "juggler-link-click", nullptr);
return DispatchToTabGroup(TaskCategory::UI, ev.forget());
}

Expand Down
17 changes: 17 additions & 0 deletions docshell/base/nsDocShell.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "Units.h"
#include "jsapi.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/dom/Geolocation.h"
#include "mozilla/HalScreenConfiguration.h"
#include "mozilla/LinkedList.h"
#include "mozilla/Maybe.h"
Expand All @@ -25,6 +26,7 @@
#include "mozilla/UniquePtr.h"
#include "mozilla/WeakPtr.h"
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ChildSHistory.h"
#include "mozilla/dom/ProfileTimelineMarkerBinding.h"
#include "mozilla/dom/WindowProxyHolder.h"
Expand Down Expand Up @@ -481,6 +483,13 @@ class nsDocShell final : public nsDocLoader,
mSkipBrowsingContextDetachOnDestroy = true;
}

bool IsFileInputInterceptionEnabled();
void FilePickerShown(mozilla::dom::Element* element);

bool IsBypassCSPEnabled();

RefPtr<nsGeolocationService> GetGeolocationServiceOverride();

// Create a content viewer within this nsDocShell for the given
// `WindowGlobalChild` actor.
nsresult CreateContentViewerForActor(
Expand Down Expand Up @@ -1040,6 +1049,8 @@ class nsDocShell final : public nsDocLoader,

bool CSSErrorReportingEnabled() const { return mCSSErrorReportingEnabled; }

nsDocShell* GetRootDocShell();

// Handles retrieval of subframe session history for nsDocShell::LoadURI. If a
// load is requested in a subframe of the current DocShell, the subframe
// loadType may need to reflect the loadType of the parent document, or in
Expand Down Expand Up @@ -1296,6 +1307,12 @@ class nsDocShell final : public nsDocLoader,
bool mUseStrictSecurityChecks : 1;
bool mObserveErrorPages : 1;
bool mCSSErrorReportingEnabled : 1;
bool mFileInputInterceptionEnabled: 1;
bool mBypassCSPEnabled : 1;
nsString mLanguageOverride;
RefPtr<nsGeolocationService> mGeolocationServiceOverride;
OnlineOverride mOnlineOverride;

bool mAllowAuth : 1;
bool mAllowKeywordFixup : 1;
bool mIsOffScreenBrowser : 1;
Expand Down
16 changes: 16 additions & 0 deletions docshell/base/nsIDocShell.idl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ interface nsIURI;
interface nsIChannel;
interface nsIContentViewer;
interface nsIContentSecurityPolicy;
interface nsIDOMGeoPosition;
interface nsIDocShellLoadInfo;
interface nsIEditor;
interface nsIEditingSession;
Expand Down Expand Up @@ -1132,4 +1133,19 @@ interface nsIDocShell : nsIDocShellTreeItem
* @see nsISHEntry synchronizeLayoutHistoryState().
*/
void synchronizeLayoutHistoryState();

attribute boolean fileInputInterceptionEnabled;

attribute boolean bypassCSPEnabled;

attribute AString languageOverride;

cenum OnlineOverride: 8 {
ONLINE_OVERRIDE_NONE = 0,
ONLINE_OVERRIDE_ONLINE = 1,
ONLINE_OVERRIDE_OFFLINE = 2,
};
[infallible] attribute nsIDocShell_OnlineOverride onlineOverride;

void setGeolocationOverride(in nsIDOMGeoPosition position);
};
8 changes: 8 additions & 0 deletions dom/base/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3278,6 +3278,9 @@ void Document::SendToConsole(nsCOMArray<nsISecurityConsoleMessage>& aMessages) {
}

void Document::ApplySettingsFromCSP(bool aSpeculative) {
if (mDocumentContainer && mDocumentContainer->IsBypassCSPEnabled())
return;

nsresult rv = NS_OK;
if (!aSpeculative) {
// 1) apply settings from regular CSP
Expand Down Expand Up @@ -3327,6 +3330,11 @@ nsresult Document::InitCSP(nsIChannel* aChannel) {
return NS_OK;
}

nsCOMPtr<nsIDocShell> shell(mDocumentContainer);
if (shell && nsDocShell::Cast(shell)->IsBypassCSPEnabled()) {
return NS_OK;
}

// If this is a data document - no need to set CSP.
if (mLoadedAsData) {
return NS_OK;
Expand Down
Loading

0 comments on commit fbd1717

Please sign in to comment.