Backed out 4 changesets (bug 1155493) for Android test_browserElement_inproc_CopyPaste.html timeouts/crashes.

Backed out changeset 3bd7adb9f591 (bug 1155493)
Backed out changeset 0380b1684e6b (bug 1155493)
Backed out changeset 58b7c1eaf3c8 (bug 1155493)
Backed out changeset 896beb5088a7 (bug 1155493)
This commit is contained in:
Ryan VanderMeulen 2015-05-25 13:15:06 -04:00
Родитель 11a7323cc9
Коммит cf9976434d
12 изменённых файлов: 17 добавлений и 319 удалений

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

@ -350,7 +350,6 @@ var shell = {
this.contentBrowser.addEventListener('mozbrowserloadstart', this, true);
this.contentBrowser.addEventListener('mozbrowserselectionstatechanged', this, true);
this.contentBrowser.addEventListener('mozbrowserscrollviewchange', this, true);
this.contentBrowser.addEventListener('mozbrowsercaretstatechanged', this);
CustomEventManager.init();
WebappsHelper.init();
@ -381,7 +380,6 @@ var shell = {
this.contentBrowser.removeEventListener('mozbrowserloadstart', this, true);
this.contentBrowser.removeEventListener('mozbrowserselectionstatechanged', this, true);
this.contentBrowser.removeEventListener('mozbrowserscrollviewchange', this, true);
this.contentBrowser.removeEventListener('mozbrowsercaretstatechanged', this);
ppmm.removeMessageListener("content-handler", this);
UserAgentOverrides.uninit();
@ -492,28 +490,6 @@ var shell = {
detail: data,
});
break;
case 'mozbrowsercaretstatechanged':
{
let elt = evt.target;
let win = elt.ownerDocument.defaultView;
let offsetX = win.mozInnerScreenX - window.mozInnerScreenX;
let offsetY = win.mozInnerScreenY - window.mozInnerScreenY;
let rect = elt.getBoundingClientRect();
offsetX += rect.left;
offsetY += rect.top;
let data = evt.detail;
data.offsetX = offsetX;
data.offsetY = offsetY;
data.sendDoCommandMsg = null;
shell.sendChromeEvent({
type: 'caretstatechanged',
detail: data,
});
}
break;
case 'MozApplicationManifest':
try {
@ -742,10 +718,6 @@ var CustomEventManager = {
case 'do-command':
DoCommandHelper.handleEvent(detail.cmd);
break;
case 'copypaste-do-command':
Services.obs.notifyObservers({ wrappedJSObject: shell.contentBrowser },
'ask-children-to-execute-copypaste-command', detail.cmd);
break;
}
}
}

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

@ -34,15 +34,12 @@ function isTopBrowserElement(docShell) {
}
if (!('BrowserElementIsPreloaded' in this)) {
if (isTopBrowserElement(docShell)) {
if (Services.prefs.getBoolPref("dom.mozInputMethod.enabled")) {
try {
Services.scriptloader.loadSubScript("chrome://global/content/forms.js");
} catch (e) {
}
if (isTopBrowserElement(docShell) &&
Services.prefs.getBoolPref("dom.mozInputMethod.enabled")) {
try {
Services.scriptloader.loadSubScript("chrome://global/content/forms.js");
} catch (e) {
}
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementCopyPaste.js");
}
if (Services.prefs.getIntPref("dom.w3c_touch_events.enabled") == 1) {

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

@ -1,90 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
dump("###################################### BrowserElementCopyPaste.js loaded\n");
let CopyPasteAssistent = {
COMMAND_MAP: {
'cut': 'cmd_cut',
'copy': 'cmd_copyAndCollapseToEnd',
'paste': 'cmd_paste',
'selectall': 'cmd_selectAll'
},
init: function() {
addEventListener('mozcaretstatechanged',
this._caretStateChangedHandler.bind(this),
/* useCapture = */ true,
/* wantsUntrusted = */ false);
addMessageListener('browser-element-api:call', this._browserAPIHandler.bind(this));
},
_browserAPIHandler: function(e) {
switch (e.data.msg_name) {
case 'copypaste-do-command':
if (this._isCommandEnabled(e.data.command)) {
docShell.doCommand(COMMAND_MAP[e.data.command]);
}
break;
}
},
_isCommandEnabled: function(cmd) {
let command = this.COMMAND_MAP[cmd];
if (!command) {
return false;
}
return docShell.isCommandEnabled(command);
},
_caretStateChangedHandler: function(e) {
e.stopPropagation();
let boundingClientRect = e.boundingClientRect;
let canPaste = this._isCommandEnabled("paste");
let zoomFactor = content.innerWidth == 0 ? 1 : content.screen.width / content.innerWidth;
let detail = {
rect: {
width: boundingClientRect ? boundingClientRect.width : 0,
height: boundingClientRect ? boundingClientRect.height : 0,
top: boundingClientRect ? boundingClientRect.top : 0,
bottom: boundingClientRect ? boundingClientRect.bottom : 0,
left: boundingClientRect ? boundingClientRect.left : 0,
right: boundingClientRect ? boundingClientRect.right : 0,
},
commands: {
canSelectAll: this._isCommandEnabled("selectall"),
canCut: this._isCommandEnabled("cut"),
canCopy: this._isCommandEnabled("copy"),
canPaste: this._isCommandEnabled("paste"),
},
zoomFactor: zoomFactor,
reason: e.reason,
collapsed: e.collapsed,
caretVisible: e.caretVisible,
selectionVisible: e.selectionVisible
};
// Get correct geometry information if we have nested iframe.
let currentWindow = e.target.defaultView;
while (currentWindow.realFrameElement) {
let currentRect = currentWindow.realFrameElement.getBoundingClientRect();
detail.rect.top += currentRect.top;
detail.rect.bottom += currentRect.top;
detail.rect.left += currentRect.left;
detail.rect.right += currentRect.left;
currentWindow = currentWindow.realFrameElement.ownerDocument.defaultView;
}
sendAsyncMsg('caretstatechanged', detail);
},
};
CopyPasteAssistent.init();

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

@ -87,7 +87,6 @@ function BrowserElementParent() {
Services.obs.addObserver(this, 'oop-frameloader-crashed', /* ownsWeak = */ true);
Services.obs.addObserver(this, 'copypaste-docommand', /* ownsWeak = */ true);
Services.obs.addObserver(this, 'ask-children-to-execute-copypaste-command', /* ownsWeak = */ true);
}
BrowserElementParent.prototype = {
@ -204,7 +203,6 @@ BrowserElementParent.prototype = {
"got-set-input-method-active": this._gotDOMRequestResult,
"selectionstatechanged": this._handleSelectionStateChanged,
"scrollviewchange": this._handleScrollViewChange,
"caretstatechanged": this._handleCaretStateChanged,
};
let mmSecuritySensitiveCalls = {
@ -440,34 +438,6 @@ BrowserElementParent.prototype = {
this._frameElement.dispatchEvent(evt);
},
// Called when state of accessible caret in child has changed.
// The fields of data is as following:
// - rect: Contains bounding rectangle of selection, Include width, height,
// top, bottom, left and right.
// - commands: Describe what commands can be executed in child. Include canSelectAll,
// canCut, canCopy and canPaste. For example: if we want to check if cut
// command is available, using following code, if (data.commands.canCut) {}.
// - zoomFactor: Current zoom factor in child frame.
// - reason: The reason causes the state changed. Include "visibilitychange",
// "updateposition", "longpressonemptycontent", "taponcaret", "presscaret",
// "releasecaret".
// - collapsed: Indicate current selection is collapsed or not.
// - caretVisible: Indicate the caret visiibility.
// - selectionVisible: Indicate current selection is visible or not.
_handleCaretStateChanged: function(data) {
let evt = this._createEvent('caretstatechanged', data.json,
/* cancelable = */ false);
let self = this;
function sendDoCommandMsg(cmd) {
let data = { command: cmd };
self._sendAsyncMsg('copypaste-do-command', data);
}
Cu.exportFunction(sendDoCommandMsg, evt.detail, { defineAs: 'sendDoCommandMsg' });
this._frameElement.dispatchEvent(evt);
},
_handleScrollViewChange: function(data) {
let evt = this._createEvent("scrollviewchange", data.json,
/* cancelable = */ false);
@ -1009,11 +979,6 @@ BrowserElementParent.prototype = {
this._sendAsyncMsg('do-command', { command: data });
}
break;
case 'ask-children-to-execute-copypaste-command':
if (this._isAlive() && this._frameElement == subject.wrappedJSObject) {
this._sendAsyncMsg('copypaste-do-command', { command: data });
}
break;
default:
debug('Unknown topic: ' + topic);
break;

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

@ -65,10 +65,6 @@ const browserElementTestHelpers = {
this._setPref('selectioncaret.enabled', value);
},
setAccessibleCaretEnabledPref: function(value) {
this._setPref('layout.accessiblecaret.enabled', value);
},
getOOPByDefaultPref: function() {
return this._getBoolPref("dom.ipc.browser_frames.oop_by_default");
},

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

@ -21,7 +21,6 @@ var defaultData;
var pasteData;
var focusScript;
var createEmbededFrame = false;
var testAccessibleCaret = false;
function copyToClipboard(str) {
gTextarea.value = str;
@ -161,24 +160,16 @@ function dispatchTest(e) {
break;
default:
if (createEmbededFrame || browserElementTestHelpers.getOOPByDefaultPref()) {
if (testAccessibleCaret) {
SimpleTest.finish();
return;
} else {
testAccessibleCaret = true;
createEmbededFrame = false;
browserElementTestHelpers.setSelectionChangeEnabledPref(false);
browserElementTestHelpers.setAccessibleCaretEnabledPref(true);
}
SimpleTest.finish();
} else {
createEmbededFrame = true;
}
// clean up and run test again.
document.body.removeChild(iframeOuter);
document.body.removeChild(gTextarea);
state = 0;
runTest();
// clean up and run test again.
document.body.removeChild(iframeOuter);
document.body.removeChild(gTextarea);
state = 0;
runTest();
}
break;
}
}
@ -192,17 +183,14 @@ function isChildProcess() {
function testSelectAll(e) {
// Skip mozbrowser test if we're at child process.
if (!isChildProcess()) {
let eventName = testAccessibleCaret ? "mozbrowsercaretstatechanged" : "mozbrowserselectionstatechanged";
iframeOuter.addEventListener(eventName, function selectchangeforselectall(e) {
if (!e.detail.states || e.detail.states.indexOf('selectall') == 0) {
iframeOuter.removeEventListener(eventName, selectchangeforselectall, true);
iframeOuter.addEventListener("mozbrowserselectionstatechanged", function selectchangeforselectall(e) {
if (e.detail.states.indexOf('selectall') == 0) {
iframeOuter.removeEventListener("mozbrowserselectionstatechanged", selectchangeforselectall, true);
ok(true, "got mozbrowserselectionstatechanged event." + stateMeaning);
ok(e.detail, "event.detail is not null." + stateMeaning);
ok(e.detail.width != 0, "event.detail.width is not zero" + stateMeaning);
ok(e.detail.height != 0, "event.detail.height is not zero" + stateMeaning);
if (!testAccessibleCaret) {
ok(e.detail.states, "event.detail.state " + e.detail.states);
}
ok(e.detail.states, "event.detail.state " + e.detail.states);
SimpleTest.executeSoon(function() { testCopy1(e); });
}
}, true);

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

@ -7,7 +7,6 @@ toolkit.jar:
content/global/remote-test-ipc.js (remote-test.js)
content/global/BrowserElementChild.js (../browser-element/BrowserElementChild.js)
content/global/BrowserElementChildPreload.js (../browser-element/BrowserElementChildPreload.js)
content/global/BrowserElementCopyPaste.js (../browser-element/BrowserElementCopyPaste.js)
content/global/BrowserElementPanning.js (../browser-element/BrowserElementPanning.js)
* content/global/BrowserElementPanningAPZDisabled.js (../browser-element/BrowserElementPanningAPZDisabled.js)
content/global/manifestMessages.js (manifestMessages.js)

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

@ -103,7 +103,6 @@ const BrowserElementIsPreloaded = true;
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementPanning.js", global);
}
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementCopyPaste.js", global);
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementChildPreload.js", global);
Services.io.getProtocolHandler("app");

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

@ -1,32 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
enum CaretChangedReason {
"visibilitychange",
"updateposition",
"longpressonemptycontent",
"taponcaret",
"presscaret",
"releasecaret"
};
dictionary CaretStateChangedEventInit : EventInit {
boolean collapsed = true;
DOMRectReadOnly? boundingClientRect = null;
CaretChangedReason reason = "visibilitychange";
boolean caretVisible = false;
boolean selectionVisible = false;
};
[Constructor(DOMString type, optional CaretStateChangedEventInit eventInit),
ChromeOnly]
interface CaretStateChangedEvent : Event {
readonly attribute boolean collapsed;
readonly attribute DOMRectReadOnly? boundingClientRect;
readonly attribute CaretChangedReason reason;
readonly attribute boolean caretVisible;
readonly attribute boolean selectionVisible;
};

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

@ -725,7 +725,6 @@ GENERATED_EVENTS_WEBIDL_FILES = [
'CameraConfigurationEvent.webidl',
'CameraFacesDetectedEvent.webidl',
'CameraStateChangeEvent.webidl',
'CaretStateChangedEvent.webidl',
'CFStateChangeEvent.webidl',
'CloseEvent.webidl',
'CSSFontFaceLoadEvent.webidl',

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

@ -90,7 +90,6 @@ AccessibleCaretManager::HideCarets()
AC_LOG("%s", __FUNCTION__);
mFirstCaret->SetAppearance(Appearance::None);
mSecondCaret->SetAppearance(Appearance::None);
DispatchCaretStateChangedEvent(CaretChangedReason::Visibilitychange);
CancelCaretTimeoutTimer();
}
}
@ -155,8 +154,7 @@ AccessibleCaretManager::UpdateCaretsForCursorMode()
// No need to consider whether the caret's position is out of scrollport.
// According to the spec, we need to explicitly hide it after the scrolling is
// ended.
bool oldSecondCaretVisible = mSecondCaret->IsLogicallyVisible();
PositionChangedResult caretResult = mFirstCaret->SetPosition(frame, offset);
mFirstCaret->SetPosition(frame, offset);
mFirstCaret->SetSelectionBarEnabled(false);
if (nsContentUtils::HasNonEmptyTextContent(
editingHost, nsContentUtils::eRecurseIntoChildren)) {
@ -166,11 +164,6 @@ AccessibleCaretManager::UpdateCaretsForCursorMode()
mFirstCaret->SetAppearance(Appearance::NormalNotShown);
}
mSecondCaret->SetAppearance(Appearance::None);
if ((caretResult == PositionChangedResult::Changed ||
oldSecondCaretVisible) && !mActiveCaret) {
DispatchCaretStateChangedEvent(CaretChangedReason::Updateposition);
}
}
void
@ -221,14 +214,6 @@ AccessibleCaretManager::UpdateCaretsForSelectionMode()
}
UpdateCaretsForTilt();
if ((firstCaretResult == PositionChangedResult::Changed ||
secondCaretResult == PositionChangedResult::Changed ||
firstCaretResult == PositionChangedResult::Invisible ||
secondCaretResult == PositionChangedResult::Invisible) &&
!mActiveCaret) {
DispatchCaretStateChangedEvent(CaretChangedReason::Updateposition);
}
}
void
@ -268,7 +253,6 @@ AccessibleCaretManager::PressCaret(const nsPoint& aPoint)
mOffsetYToCaretLogicalPosition =
mActiveCaret->LogicalPosition().y - aPoint.y;
SetSelectionDragState(true);
DispatchCaretStateChangedEvent(CaretChangedReason::Presscaret);
CancelCaretTimeoutTimer();
rv = NS_OK;
}
@ -295,7 +279,6 @@ AccessibleCaretManager::ReleaseCaret()
mActiveCaret = nullptr;
SetSelectionDragState(false);
DispatchCaretStateChangedEvent(CaretChangedReason::Releasecaret);
LaunchCaretTimeoutTimer();
return NS_OK;
}
@ -308,7 +291,6 @@ AccessibleCaretManager::TapCaret(const nsPoint& aPoint)
nsresult rv = NS_ERROR_FAILURE;
if (GetCaretMode() == CaretMode::Cursor) {
DispatchCaretStateChangedEvent(CaretChangedReason::Taponcaret);
rv = NS_OK;
}
@ -349,7 +331,6 @@ AccessibleCaretManager::SelectWordOrShortcut(const nsPoint& aPoint)
editingHost, nsContentUtils::eRecurseIntoChildren))) {
// Content is empty. No need to select word.
AC_LOG("%s, Cannot select word bacause content is empty", __FUNCTION__);
DispatchCaretStateChangedEvent(CaretChangedReason::Longpressonemptycontent);
return NS_OK;
}
@ -885,75 +866,4 @@ AccessibleCaretManager::CancelCaretTimeoutTimer()
}
}
void
AccessibleCaretManager::DispatchCaretStateChangedEvent(CaretChangedReason aReason) const
{
MOZ_ASSERT(nsContentUtils::IsSafeToRunScript());
// Holding PresShell to prevent AccessibleCaretManager to be destroyed.
nsCOMPtr<nsIPresShell> presShell = mPresShell;
// XXX: Do we need to flush layout?
presShell->FlushPendingNotifications(Flush_Layout);
if (presShell->IsDestroying()) {
return;
}
Selection* sel = GetSelection();
if (!sel) {
return;
}
nsIDocument* doc = mPresShell->GetDocument();
MOZ_ASSERT(doc);
CaretStateChangedEventInit init;
init.mBubbles = true;
const nsRange* range = sel->GetAnchorFocusRange();
nsINode* commonAncestorNode = nullptr;
if (range) {
commonAncestorNode = range->GetCommonAncestor();
}
if (!commonAncestorNode) {
commonAncestorNode = sel->GetFrameSelection()->GetAncestorLimiter();
}
nsRefPtr<DOMRect> domRect = new DOMRect(ToSupports(doc));
nsRect rect = nsContentUtils::GetSelectionBoundingRect(sel);
nsIFrame* commonAncestorFrame = nullptr;
nsIFrame* rootFrame = mPresShell->GetRootFrame();
if (commonAncestorNode && commonAncestorNode->IsContent()) {
commonAncestorFrame = commonAncestorNode->AsContent()->GetPrimaryFrame();
}
if (commonAncestorFrame && rootFrame) {
nsLayoutUtils::TransformRect(rootFrame, commonAncestorFrame, rect);
nsRect clampedRect = nsLayoutUtils::ClampRectToScrollFrames(commonAncestorFrame,
rect);
nsLayoutUtils::TransformRect(commonAncestorFrame, rootFrame, clampedRect);
domRect->SetLayoutRect(clampedRect);
init.mSelectionVisible = !clampedRect.IsEmpty();
init.mBoundingClientRect = domRect;
} else {
domRect->SetLayoutRect(rect);
init.mSelectionVisible = true;
}
init.mBoundingClientRect = domRect;
init.mReason = aReason;
init.mCollapsed = sel->IsCollapsed();
init.mCaretVisible = mFirstCaret->IsLogicallyVisible() ||
mSecondCaret->IsLogicallyVisible();
nsRefPtr<CaretStateChangedEvent> event =
CaretStateChangedEvent::Constructor(doc, NS_LITERAL_STRING("mozcaretstatechanged"), init);
event->SetTrusted(true);
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
bool ret;
doc->DispatchEvent(event, &ret);
}
} // namespace mozilla

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

@ -13,7 +13,6 @@
#include "nsISelectionListener.h"
#include "nsRefPtr.h"
#include "nsWeakReference.h"
#include "mozilla/dom/CaretStateChangedEvent.h"
#include "mozilla/EventForwards.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/WeakPtr.h"
@ -133,10 +132,6 @@ protected:
already_AddRefed<nsFrameSelection> GetFrameSelection() const;
nsIContent* GetFocusedContent() const;
// This function will call FlushPendingNotifications. So caller must ensure
// everything exists after calling this method.
void DispatchCaretStateChangedEvent(dom::CaretChangedReason aReason) const;
// If we're dragging the first caret, we do not want to drag it over the
// previous character of the second caret. Same as the second caret. So we
// check if content offset exceeds the previous/next character of second/first