This commit is contained in:
Ryan VanderMeulen 2014-06-09 16:46:33 -04:00
Родитель dc6b9d18e5 160716596e
Коммит 2c4e67a9ed
12 изменённых файлов: 135 добавлений и 32 удалений

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

@ -3067,7 +3067,10 @@
this.mCurrentBrowser = document.getAnonymousElementByAttribute(this, "anonid", "initialBrowser");
this.mCurrentTab = this.tabContainer.firstChild;
let els = Cc["@mozilla.org/eventlistenerservice;1"].getService(Ci.nsIEventListenerService);
const nsIEventListenerService =
Components.interfaces.nsIEventListenerService;
let els = Components.classes["@mozilla.org/eventlistenerservice;1"]
.getService(nsIEventListenerService);
els.addSystemEventListener(document, "keydown", this, false);
els.addSystemEventListener(document, "keypress", this, false);
window.addEventListener("sizemodechange", this, false);
@ -3147,7 +3150,10 @@
this.mTabListeners[i].destroy();
this.mTabListeners[i] = null;
}
let els = Cc["@mozilla.org/eventlistenerservice;1"].getService(Ci.nsIEventListenerService);
const nsIEventListenerService =
Components.interfaces.nsIEventListenerService;
let els = Components.classes["@mozilla.org/eventlistenerservice;1"]
.getService(nsIEventListenerService);
els.removeSystemEventListener(document, "keydown", this, false);
els.removeSystemEventListener(document, "keypress", this, false);
window.removeEventListener("sizemodechange", this, false);

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

@ -36,9 +36,6 @@ if test "$compiler" != "$cxxcompiler"; then
fi
CC_VERSION=`echo "$CC_VERSION" | sed 's/ //g'`
CXX_VERSION=`echo "$CXX_VERSION" | sed 's/ //g'`
echo "$CC_VERSION"
echo "$CXX_VERSION"
ecit 1
if test "$compiler" = "gcc"; then
GNU_CC=1
GNU_CXX=1

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

@ -546,6 +546,9 @@ Link::SetHrefAttribute(nsIURI *aURI)
{
NS_ASSERTION(aURI, "Null URI is illegal!");
// if we change this code to not reserialize we need to do something smarter
// in SetProtocol because changing the protocol of an URI can change the
// "nature" of the nsIURL/nsIURI implementation.
nsAutoCString href;
(void)aURI->GetSpec(href);
(void)mElement->SetAttr(kNameSpaceID_None, nsGkAtoms::href,

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

@ -15,6 +15,7 @@
#include "nsIIOService.h"
#include "nsEscape.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsIURL.h"
namespace mozilla {
@ -262,7 +263,34 @@ URL::SetProtocol(const nsAString& aProtocol)
nsAString::const_iterator iter(start);
FindCharInReadable(':', iter, end);
mURI->SetScheme(NS_ConvertUTF16toUTF8(Substring(start, iter)));
// Changing the protocol of a URL, changes the "nature" of the URI
// implementation. In order to do this properly, we have to serialize the
// existing URL and reparse it in a new object.
nsCOMPtr<nsIURI> clone;
nsresult rv = mURI->Clone(getter_AddRefs(clone));
if (NS_WARN_IF(NS_FAILED(rv)) || !clone) {
return;
}
rv = clone->SetScheme(NS_ConvertUTF16toUTF8(Substring(start, iter)));
if (NS_WARN_IF(NS_FAILED(rv))) {
return;
}
nsAutoCString href;
rv = clone->GetSpec(href);
if (NS_WARN_IF(NS_FAILED(rv))) {
return;
}
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), href);
if (NS_WARN_IF(NS_FAILED(rv))) {
return;
}
mURI = uri;
}
#define URL_GETTER( value, func ) \

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

@ -60,6 +60,7 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Fails on b2g-desktop, track
[test_setting_opener.html]
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
[test_url.html]
[test_url_data.html]
[test_url_empty_port.html]
[test_urlExceptions.html]
[test_urlSearchParams.html]

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

@ -0,0 +1,37 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test URL API - data:plain</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1018682">Mozilla Bug 1018682</a>
<script type="application/javascript">
var base = new URL("data:text/plain,");
base.protocol = "chrome:";
is(base.protocol, 'data:', "The protocol should not change from data to chrome.");
try {
var relative = new URL("a", base);
ok(false, "Relative URL from a data:text/plain should not work.");
} catch(e) {
ok(true, "Relative URL from a data:text/plain should not work.");
}
base.protocol = "http:";
ok(true, "Protocol: http changed");
is(base.href, "http://text/plain,", "Base URL is correct");
var relative = new URL("a", base);
ok(relative, "This works.");
is(relative.href, "http://text/a", "Relative URL is correct");
</script>
</body>
</html>

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

@ -1 +1 @@
load 408431-1.html
skip load 408431-1.html # bug 1022509 - renable when the cause of that is backed out

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

@ -1008,6 +1008,9 @@ CompositorOGL::DrawQuad(const Rect& aRect,
IntRect intClipRect;
aClipRect.ToIntRect(&intClipRect);
if (!mTarget) {
intClipRect.MoveBy(mRenderOffset.x, mRenderOffset.y);
}
gl()->fScissor(intClipRect.x, FlipY(intClipRect.y + intClipRect.height),
intClipRect.width, intClipRect.height);

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

@ -166,6 +166,8 @@ FrameManager.prototype = {
messageManager.addWeakMessageListener("Marionette:emitTouchEvent", this.server);
messageManager.addWeakMessageListener("Marionette:log", this.server);
messageManager.addWeakMessageListener("Marionette:register", this.server);
messageManager.addWeakMessageListener("Marionette:setStatusbarHeight", this.server);
messageManager.addWeakMessageListener("Marionette:getStatusbarHeight", this.server);
messageManager.addWeakMessageListener("Marionette:runEmulatorCmd", this.server);
messageManager.addWeakMessageListener("Marionette:runEmulatorShell", this.server);
messageManager.addWeakMessageListener("Marionette:shareData", this.server);
@ -196,6 +198,8 @@ FrameManager.prototype = {
messageManager.removeWeakMessageListener("Marionette:log", this.server);
messageManager.removeWeakMessageListener("Marionette:shareData", this.server);
messageManager.removeWeakMessageListener("Marionette:register", this.server);
messageManager.removeWeakMessageListener("Marionette:setStatusbarHeight", this.server);
messageManager.removeWeakMessageListener("Marionette:getStatusbarHeight", this.server);
messageManager.removeWeakMessageListener("Marionette:runEmulatorCmd", this.server);
messageManager.removeWeakMessageListener("Marionette:runEmulatorShell", this.server);
messageManager.removeWeakMessageListener("Marionette:switchToFrame", this.server);

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

@ -72,7 +72,6 @@ let touchIds = {};
let multiLast = {};
let lastCoordinates = null;
let isTap = false;
let scrolling = false;
// whether to send mouse event
let mouseEventsOnly = false;
@ -105,6 +104,10 @@ function registerSelf() {
// check if we're the main process
if (register[0][1] == true) {
addMessageListener("MarionetteMainListener:emitTouchEvent", emitTouchEventForIFrame);
let height = getStatusbarHeight();
if (height) {
sendSyncMessage("Marionette:setStatusbarHeight", { height: height });
}
}
importedScripts = FileUtils.getDir('TmpD', [], false);
importedScripts.append('marionetteContentScripts');
@ -125,6 +128,14 @@ function emitTouchEventForIFrame(message) {
1, 0);
}
function getStatusbarHeight(message) {
let statusbar = curFrame.document.getElementById("statusbar");
if (statusbar) {
//Yes, clientHeight. This statusbar affects screens where it isn't even visible, like FTU
return statusbar.clientHeight;
}
}
/**
* Add a message listener that's tied to our listenerId.
*/
@ -679,24 +690,31 @@ function executeWithCallback(msg, useFinish) {
/**
* This function creates a touch event given a touch type and a touch
*/
function emitTouchEvent(type, touch) {
function emitTouchEvent(type, target, x, y, touchId) {
if (!wasInterrupted()) {
let loggingInfo = "emitting Touch event of type " + type + " to element with id: " + touch.target.id + " and tag name: " + touch.target.tagName + " at coordinates (" + touch.clientX + ", " + touch.clientY + ") relative to the viewport";
dumpLog(loggingInfo);
var docShell = curFrame.document.defaultView.
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIWebNavigation).
QueryInterface(Components.interfaces.nsIDocShell);
if (docShell.asyncPanZoomEnabled && scrolling) {
if (docShell.asyncPanZoomEnabled) {
// if we're in APZ and we're scrolling, we must use injectTouchEvent to dispatch our touchmove events
// NOTE: This is an internal frame, below the statusbar. The coordinates we get here must be offset by
// the coordinates of the statusbar
let statusbarHeight = sendSyncMessage("Marionette:getStatusbarHeight");
if (statusbarHeight) {
y += parseInt(statusbarHeight, 10);
}
let touch = createATouch(target, x, y, touchId);
let index = sendSyncMessage("MarionetteFrame:getCurrentFrameId");
// only call emitTouchEventForIFrame if we're inside an iframe.
if (index != null) {
let loggingInfo = "emitting Touch event of type " + type + " to element with id: " + touch.target.id + " and tag name: " + touch.target.tagName + " at coordinates (" + touch.clientX + ", " + touch.clientY + ") relative to the viewport";
dumpLog(loggingInfo);
sendSyncMessage("Marionette:emitTouchEvent", {index: index, type: type, id: touch.identifier,
clientX: touch.clientX, clientY: touch.clientY,
radiusX: touch.radiusX, radiusY: touch.radiusY,
rotation: touch.rotationAngle, force: touch.force});
return;
return touch;
}
}
// we get here if we're not in asyncPacZoomEnabled land, or if we're the main process
@ -707,8 +725,12 @@ function emitTouchEvent(type, touch) {
{log: elementManager.wrapValue(marionetteLogObj.getLogs())});
marionetteLogObj.clearLogs();
*/
let touch = createATouch(target, x, y, touchId);
let loggingInfo = "emitting Touch event of type " + type + " to element with id: " + touch.target.id + " and tag name: " + touch.target.tagName + " at coordinates (" + touch.clientX + ", " + touch.clientY + ") relative to the viewport";
dumpLog(loggingInfo);
let domWindowUtils = curFrame.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
domWindowUtils.sendTouchEvent(type, [touch.identifier], [touch.clientX], [touch.clientY], [touch.radiusX], [touch.radiusY], [touch.rotationAngle], [touch.force], 1, 0);
return touch;
}
}
@ -819,9 +841,8 @@ function generateEvents(type, x, y, touchId, target) {
}
else {
let touchId = nextTouchId++;
let touch = createATouch(target, x, y, touchId);
emitTouchEvent('touchstart', touch);
emitTouchEvent('touchend', touch);
emitTouchEvent('touchstart', target, x, y, touchId);
emitTouchEvent('touchend', target, x, y, touchId);
mousetap(target.ownerDocument, x, y);
}
lastCoordinates = null;
@ -834,9 +855,7 @@ function generateEvents(type, x, y, touchId, target) {
}
else {
let touchId = nextTouchId++;
let touch = createATouch(target, x, y, touchId);
emitTouchEvent('touchstart', touch);
touchIds[touchId] = touch;
touchIds[touchId] = emitTouchEvent('touchstart', target, x, y, touchId);
return touchId;
}
break;
@ -846,8 +865,7 @@ function generateEvents(type, x, y, touchId, target) {
}
else {
let touch = touchIds[touchId];
touch = createATouch(touch.target, lastCoordinates[0], lastCoordinates[1], touchId);
emitTouchEvent('touchend', touch);
emitTouchEvent('touchend', touch.target, lastCoordinates[0], lastCoordinates[1], touchId);
if (isTap) {
mousetap(touch.target.ownerDocument, touch.clientX, touch.clientY);
}
@ -862,7 +880,8 @@ function generateEvents(type, x, y, touchId, target) {
emitMouseEvent(doc, 'mouseup', lastCoordinates[0], lastCoordinates[1]);
}
else {
emitTouchEvent('touchcancel', touchIds[touchId]);
let touch = touchIds[touchId];
emitTouchEvent('touchcancel', touch.target, x, y, touchId);
delete touchIds[touchId];
}
lastCoordinates = null;
@ -873,9 +892,7 @@ function generateEvents(type, x, y, touchId, target) {
emitMouseEvent(doc, 'mousemove', x, y);
}
else {
touch = createATouch(touchIds[touchId].target, x, y, touchId);
touchIds[touchId] = touch;
emitTouchEvent('touchmove', touch);
touchIds[touchId] = emitTouchEvent('touchmove', touchIds[touchId].target, x, y, touchId);
}
break;
case 'contextmenu':
@ -981,9 +998,6 @@ function actions(chain, touchId, command_id, i) {
return;
}
// look ahead to check if we're scrolling. Needed for APZ touch dispatching.
if ((i != chain.length) && (chain[i][0].indexOf('move') !== -1)) {
scrolling = true;
}
el = elementManager.getKnownElement(pack[1], curFrame);
c = coordinates(el, pack[2], pack[3]);
touchId = generateEvents('press', c.x, c.y, null, el);
@ -992,7 +1006,6 @@ function actions(chain, touchId, command_id, i) {
case 'release':
generateEvents('release', lastCoordinates[0], lastCoordinates[1], touchId);
actions(chain, null, command_id, i);
scrolling = false;
break;
case 'move':
el = elementManager.getKnownElement(pack[1], curFrame);
@ -1026,7 +1039,6 @@ function actions(chain, touchId, command_id, i) {
case 'cancel':
generateEvents('cancel', lastCoordinates[0], lastCoordinates[1], touchId);
actions(chain, touchId, command_id, i);
scrolling = false;
break;
case 'longPress':
generateEvents('contextmenu', lastCoordinates[0], lastCoordinates[1], touchId);

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

@ -138,6 +138,7 @@ function MarionetteServerConnection(aPrefix, aTransport, aServer)
this.currentFrameElement = null;
this.testName = null;
this.mozBrowserClose = null;
this.statusbarHeight = null;
}
MarionetteServerConnection.prototype = {
@ -424,7 +425,12 @@ MarionetteServerConnection.prototype = {
whenBrowserStarted: function MDA_whenBrowserStarted(win, newSession) {
try {
if (!Services.prefs.getBoolPref("marionette.contentListener") || !newSession) {
this.curBrowser.loadFrameScript(FRAME_SCRIPT, win);
try {
this.curBrowser.loadFrameScript(FRAME_SCRIPT, win);
} catch (e) {
logger.info("failed loading frame script due to" + e.toString());
throw e;
}
}
}
catch (e) {
@ -2436,6 +2442,12 @@ MarionetteServerConnection.prototype = {
globalMessageManager.broadcastAsyncMessage(
"MarionetteMainListener:emitTouchEvent", message.json);
return;
case "Marionette:setStatusbarHeight":
//NOTE: If we had content<->content communication, this wouldn't be needed
this.statusbarHeight = message.json.height;
return;
case "Marionette:getStatusbarHeight":
return [this.statusbarHeight];
}
}
};

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

@ -256,7 +256,7 @@
#ifdef NS_NO_VTABLE
#undef NS_NO_VTABLE
#endif
#if defined(_MSC_VER)
#if defined(_MSC_VER) && !defined(__clang__)
#define NS_NO_VTABLE __declspec(novtable)
#else
#define NS_NO_VTABLE