Backed out 4 changesets (bug 1595800) for devtools failures at browser_contextual_identity.js. CLOSED TREE

Backed out changeset 7d6f51331aed (bug 1595800)
Backed out changeset d44c8dde04be (bug 1595800)
Backed out changeset 2f607bbc19b9 (bug 1595800)
Backed out changeset 196ca9fefb06 (bug 1595800)
This commit is contained in:
Brindusan Cristian 2019-12-03 19:44:37 +02:00
Родитель c502777f53
Коммит 4709de082d
12 изменённых файлов: 82 добавлений и 57 удалений

Просмотреть файл

@ -154,6 +154,11 @@ var global = this;
.getInterface(Ci.nsIWebProgress);
webProgress.removeProgressListener(WebProgressListener);
docShell.deviceSizeIsPageSize = gDeviceSizeWasPageSize;
// Restore the original physical screen orientation values before RDM is stopped.
// This is necessary since the window document's `setCurrentRDMPaneOrientation`
// WebIDL operation can only modify the window's screen orientation values while the
// window content is in RDM.
restoreScreenOrientation();
restoreScrollbars();
setDocumentInRDMPane(false);
stopOnResize();
@ -203,6 +208,13 @@ var global = this;
flushStyle();
}
function restoreScreenOrientation() {
docShell.contentViewer.DOMDocument.setRDMPaneOrientation(
"landscape-primary",
0
);
}
function setDocumentInRDMPane(inRDMPane) {
// We don't propegate this property to descendent documents.
docShell.browsingContext.inRDMPane = inRDMPane;

Просмотреть файл

@ -12,6 +12,7 @@ const { PureComponent } = require("devtools/client/shared/vendor/react");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const { PORTRAIT_PRIMARY, LANDSCAPE_PRIMARY } = require("../constants");
const Types = require("../types");
const e10s = require("../utils/e10s");
const message = require("../utils/message");
@ -41,6 +42,7 @@ class Browser extends PureComponent {
super(props);
this.onContentResize = this.onContentResize.bind(this);
this.onResizeViewport = this.onResizeViewport.bind(this);
this.onSetScreenOrientation = this.onSetScreenOrientation.bind(this);
}
/**
@ -111,8 +113,21 @@ class Browser extends PureComponent {
});
}
onSetScreenOrientation(msg) {
const { width, height } = msg.data;
const { angle, id } = this.props.viewport;
const type = height >= width ? PORTRAIT_PRIMARY : LANDSCAPE_PRIMARY;
this.props.onChangeViewportOrientation(id, type, angle);
}
async startFrameScript() {
const { browser, onContentResize, onResizeViewport } = this;
const {
browser,
onContentResize,
onResizeViewport,
onSetScreenOrientation,
} = this;
const mm = browser.frameLoader.messageManager;
// Notify tests when the content has received a resize event. This is not
@ -121,6 +136,7 @@ class Browser extends PureComponent {
// resized to match.
e10s.on(mm, "OnContentResize", onContentResize);
e10s.on(mm, "OnResizeViewport", onResizeViewport);
e10s.on(mm, "OnLocationChange", onSetScreenOrientation);
const ready = e10s.once(mm, "ChildScriptReady");
mm.loadFrameScript(FRAME_SCRIPT, true);
@ -139,11 +155,17 @@ class Browser extends PureComponent {
}
async stopFrameScript() {
const { browser, onContentResize, onResizeViewport } = this;
const {
browser,
onContentResize,
onResizeViewport,
onSetScreenOrientation,
} = this;
const mm = browser.frameLoader.messageManager;
e10s.off(mm, "OnContentResize", onContentResize);
e10s.off(mm, "OnResizeViewport", onResizeViewport);
e10s.off(mm, "OnLocationChange", onSetScreenOrientation);
await e10s.request(mm, "Stop");
message.post(window, "stop-frame-script:done");
}

Просмотреть файл

@ -306,9 +306,6 @@ class ResponsiveUI {
await this.inited;
}
// Restore screen orientation of physical device.
await this.updateScreenOrientation("landscape-primary", 0);
if (this.isBrowserUIEnabled) {
await this.emulationFront.setDocumentInRDMPane(false);
}

Просмотреть файл

@ -423,7 +423,7 @@ const EmulationActor = protocol.ActorClassWithSpec(emulationSpec, {
this.win.screen.orientation.angle !== angle ||
this.win.screen.orientation.type !== type
) {
this.docShell.browsingContext.setRDMPaneOrientation(type, angle);
this.win.document.setRDMPaneOrientation(type, angle);
}
},

Просмотреть файл

@ -52,17 +52,6 @@ extern mozilla::LazyLogModule gAutoplayPermissionLog;
#define AUTOPLAY_LOG(msg, ...) \
MOZ_LOG(gAutoplayPermissionLog, LogLevel::Debug, (msg, ##__VA_ARGS__))
namespace IPC {
// Allow serialization and deserialization of OrientationType over IPC
template <>
struct ParamTraits<mozilla::dom::OrientationType>
: public ContiguousEnumSerializerInclusive<
mozilla::dom::OrientationType,
mozilla::dom::OrientationType::Portrait_primary,
mozilla::dom::OrientationType::Landscape_secondary> {};
} // namespace IPC
namespace mozilla {
namespace dom {

Просмотреть файл

@ -274,18 +274,6 @@ class BrowsingContext : public nsISupports,
bool IsLoading();
// ScreenOrientation related APIs
void SetCurrentOrientation(OrientationType aType, float aAngle) {
SetCurrentOrientationType(aType);
SetCurrentOrientationAngle(aAngle);
}
void SetRDMPaneOrientation(OrientationType aType, float aAngle) {
if (mInRDMPane) {
SetCurrentOrientation(aType, aAngle);
}
}
// Using the rules for choosing a browsing context we try to find
// the browsing context with the given name in the set of
// transitively reachable browsing contexts. Performs access control

Просмотреть файл

@ -42,11 +42,6 @@ MOZ_BC_FIELD(FeaturePolicy, RefPtr<mozilla::dom::FeaturePolicy>)
// See nsSandboxFlags.h for the possible flags.
MOZ_BC_FIELD(SandboxFlags, uint32_t)
// ScreenOrientation-related APIs
MOZ_BC_FIELD(CurrentOrientationAngle, float)
MOZ_BC_FIELD(CurrentOrientationType, mozilla::dom::OrientationType)
MOZ_BC_FIELD(HistoryID, nsID)
MOZ_BC_FIELD(InRDMPane, bool)

Просмотреть файл

@ -1346,6 +1346,8 @@ Document::Document(const char* aContentType)
mFlashClassification(FlashClassification::Unknown),
mScrollAnchorAdjustmentLength(0),
mScrollAnchorAdjustmentCount(0),
mCurrentOrientationAngle(0),
mCurrentOrientationType(OrientationType::Portrait_primary),
mServoRestyleRootDirtyBits(0),
mThrowOnDynamicMarkupInsertionCounter(0),
mIgnoreOpensDuringUnloadCounter(0),
@ -13572,6 +13574,12 @@ bool Document::SetOrientationPendingPromise(Promise* aPromise) {
return true;
}
void Document::SetRDMPaneOrientation(OrientationType aType, uint16_t aAngle) {
if (GetBrowsingContext()->InRDMPane()) {
SetCurrentOrientation(aType, aAngle);
}
}
static void DispatchPointerLockChange(Document* aTarget) {
if (!aTarget) {
return;

Просмотреть файл

@ -2290,12 +2290,23 @@ class Document : public nsINode,
// ScreenOrientation related APIs
void SetCurrentOrientation(OrientationType aType, uint16_t aAngle) {
mCurrentOrientationType = aType;
mCurrentOrientationAngle = aAngle;
}
uint16_t CurrentOrientationAngle() const { return mCurrentOrientationAngle; }
OrientationType CurrentOrientationType() const {
return mCurrentOrientationType;
}
void ClearOrientationPendingPromise();
bool SetOrientationPendingPromise(Promise* aPromise);
Promise* GetOrientationPendingPromise() const {
return mOrientationPendingPromise;
}
void SetRDMPaneOrientation(OrientationType aType, uint16_t aAngle);
//----------------------------------------------------------------------
// Document notification API's
@ -5240,6 +5251,9 @@ class Document : public nsINode,
// http://www.w3.org/TR/screen-orientation/
RefPtr<Promise> mOrientationPendingPromise;
uint16_t mCurrentOrientationAngle;
OrientationType mCurrentOrientationType;
nsTArray<RefPtr<nsFrameLoader>> mInitializableFrameLoaders;
nsTArray<nsCOMPtr<nsIRunnable>> mFrameLoaderFinalizers;
RefPtr<nsRunnableMethod<Document>> mFrameLoaderRunner;

Просмотреть файл

@ -78,9 +78,8 @@ ScreenOrientation::ScreenOrientation(nsPIDOMWindowInner* aWindow,
mAngle = config.angle();
Document* doc = GetResponsibleDocument();
BrowsingContext* bc = doc ? doc->GetBrowsingContext() : nullptr;
if (bc && !bc->InRDMPane()) {
bc->SetCurrentOrientation(mType, mAngle);
if (doc) {
doc->SetCurrentOrientation(mType, mAngle);
}
}
@ -195,10 +194,9 @@ ScreenOrientation::LockOrientationTask::Run() {
return NS_OK;
}
BrowsingContext* bc = mDocument->GetBrowsingContext();
if (OrientationLockContains(bc->GetCurrentOrientationType()) ||
if (OrientationLockContains(mDocument->CurrentOrientationType()) ||
(mOrientationLock == hal::eScreenOrientation_Default &&
bc->GetCurrentOrientationAngle() == 0)) {
mDocument->CurrentOrientationAngle() == 0)) {
// Orientation lock will not cause an orientation change.
mPromise->MaybeResolveWithUndefined();
mDocument->ClearOrientationPendingPromise();
@ -422,13 +420,12 @@ OrientationType ScreenOrientation::GetType(CallerType aCallerType,
}
Document* doc = GetResponsibleDocument();
BrowsingContext* bc = doc ? doc->GetBrowsingContext() : nullptr;
if (!bc) {
if (!doc) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return OrientationType::Portrait_primary;
}
return bc->GetCurrentOrientationType();
return doc->CurrentOrientationType();
}
uint16_t ScreenOrientation::GetAngle(CallerType aCallerType,
@ -438,13 +435,12 @@ uint16_t ScreenOrientation::GetAngle(CallerType aCallerType,
}
Document* doc = GetResponsibleDocument();
BrowsingContext* bc = doc ? doc->GetBrowsingContext() : nullptr;
if (!bc) {
if (!doc) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return 0;
}
return bc->GetCurrentOrientationAngle();
return doc->CurrentOrientationAngle();
}
ScreenOrientation::LockPermission
@ -494,8 +490,7 @@ void ScreenOrientation::Notify(const hal::ScreenConfiguration& aConfiguration) {
}
Document* doc = GetResponsibleDocument();
BrowsingContext* bc = doc ? doc->GetBrowsingContext() : nullptr;
if (!bc) {
if (!doc) {
return;
}
@ -531,8 +526,8 @@ void ScreenOrientation::Notify(const hal::ScreenConfiguration& aConfiguration) {
return;
}
if (mType != bc->GetCurrentOrientationType()) {
bc->SetCurrentOrientation(mType, mAngle);
if (mType != doc->CurrentOrientationType()) {
doc->SetCurrentOrientation(mType, mAngle);
nsCOMPtr<nsIRunnable> runnable = DispatchChangeEventAndResolvePromise();
rv = NS_DispatchToMainThread(runnable);
@ -614,10 +609,9 @@ ScreenOrientation::VisibleEventListener::HandleEvent(Event* aEvent) {
target->RemoveSystemEventListener(NS_LITERAL_STRING("visibilitychange"), this,
true);
BrowsingContext* bc = doc->GetBrowsingContext();
if (bc && bc->GetCurrentOrientationType() !=
if (doc->CurrentOrientationType() !=
orientation->DeviceType(CallerType::System)) {
bc->SetCurrentOrientation(orientation->DeviceType(CallerType::System),
doc->SetCurrentOrientation(orientation->DeviceType(CallerType::System),
orientation->DeviceAngle(CallerType::System));
nsCOMPtr<nsIRunnable> runnable =

Просмотреть файл

@ -51,10 +51,6 @@ interface BrowsingContext {
// The inRDMPane flag indicates whether or not Responsive Design Mode is
// active for the browsing context.
attribute boolean inRDMPane;
// Extension to give chrome JS the ability to set the window screen
// orientation while in RDM.
void setRDMPaneOrientation(OrientationType type, float rotationAngle);
};
[Exposed=Window, ChromeOnly]

Просмотреть файл

@ -623,6 +623,16 @@ partial interface Document {
readonly attribute FeaturePolicy featurePolicy;
};
/**
* Document extensions to support devtools.
*/
partial interface Document {
// Extension to give chrome JS the ability to set the window screen
// orientation while in RDM.
[ChromeOnly]
void setRDMPaneOrientation(OrientationType type, float rotationAngle);
};
// Extension to give chrome JS the ability to specify a non-default keypress
// event model.
partial interface Document {