Skip to content

Commit

Permalink
chore: bootstrap build #1068
Browse files Browse the repository at this point in the history
  • Loading branch information
playwright-devops authored and yury-s committed Apr 1, 2020
1 parent d140f8c commit 25a65e1
Show file tree
Hide file tree
Showing 67 changed files with 6,345 additions and 41 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 @@ -209,6 +209,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
178 changes: 178 additions & 0 deletions docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
# include <unistd.h> // for getpid()
#endif

#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU
# include "unicode/locid.h"
# include "unicode/timezone.h"
# include "unicode/unistr.h"
#endif /* JS_HAS_INTL_API && !MOZ_SYSTEM_ICU */

#include "js/LocaleSensitive.h"

#include "mozilla/ArrayUtils.h"
#include "mozilla/Attributes.h"
#include "mozilla/AutoRestore.h"
Expand Down Expand Up @@ -53,6 +61,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 All @@ -71,6 +80,7 @@
#include "mozilla/dom/nsCSPContext.h"
#include "mozilla/dom/LoadURIOptionsBinding.h"
#include "mozilla/dom/JSWindowActorChild.h"
#include "mozilla/dom/WorkerCommon.h"

#include "mozilla/net/DocumentChannel.h"
#include "mozilla/net/DocumentChannelChild.h"
Expand All @@ -96,6 +106,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 @@ -183,6 +194,7 @@
#include "nsGlobalWindow.h"
#include "nsISearchService.h"
#include "nsJSEnvironment.h"
#include "nsJSUtils.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsObjectLoadingContent.h"
Expand Down Expand Up @@ -350,6 +362,9 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext,
mUseErrorPages(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 @@ -1219,6 +1234,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 @@ -3340,6 +3356,162 @@ 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;
}


static void SetIcuLocale(const nsAString& aLanguageOverride) {
icu::Locale locale(NS_LossyConvertUTF16toASCII(aLanguageOverride).get());
if (icu::Locale::getDefault() == locale)
return;
UErrorCode error_code = U_ZERO_ERROR;
const char* lang = locale.getLanguage();
if (lang != nullptr && *lang != '\0') {
icu::Locale::setDefault(locale, error_code);
} else {
fprintf(stderr, "SetIcuLocale Failed to set the ICU default locale to %s\n", NS_LossyConvertUTF16toASCII(aLanguageOverride).get());
}

AutoJSAPI jsapi;
jsapi.Init();
JSContext* cx = jsapi.cx();
JS_ResetDefaultLocale(JS_GetRuntime(cx));

ResetDefaultLocaleInAllWorkers();
}

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

NS_IMETHODIMP
nsDocShell::OverrideTimezone(const nsAString& aTimezoneOverride, bool* aSuccess) {
NS_ENSURE_ARG(aSuccess);

// Validate timezone id.
UniquePtr<icu::TimeZone> timezone(icu::TimeZone::createTimeZone(
icu::UnicodeString(NS_LossyConvertUTF16toASCII(aTimezoneOverride).get(), -1, US_INV)));
if (!timezone || *timezone == icu::TimeZone::getUnknown()) {
fprintf(stderr, "Invalid timezone id: %s\n", NS_LossyConvertUTF16toASCII(aTimezoneOverride).get());
*aSuccess = false;
return NS_OK;
}

// The env variable is read by js::DateTimeInfo::internalResyncICUDefaultTimeZone()
auto setTimeZoneEnv = [](const char* value) {
#if defined(_WIN32)
return _putenv_s("TZ", value) == 0;
#else
return setenv("TZ", value, true) == 0;
#endif /* _WIN32 */
};

*aSuccess = setTimeZoneEnv(NS_LossyConvertUTF16toASCII(aTimezoneOverride).get());
if (*aSuccess) {
nsJSUtils::ResetTimeZone();
} else {
fprintf(stderr, "Failed to change timezone to '%s'\n", NS_LossyConvertUTF16toASCII(aTimezoneOverride).get());
}
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 @@ -12137,6 +12309,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 @@ -12226,6 +12401,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
Loading

0 comments on commit 25a65e1

Please sign in to comment.