Merge mozilla-central into build-system

The 3 merged files had no conflicts and were manually verified to ensure
no incompatible changes crept in.
This commit is contained in:
Gregory Szorc 2013-02-27 21:02:02 -08:00
Родитель 0c8ee65118 dd3dacfa62
Коммит e1b210ddf6
231 изменённых файлов: 5160 добавлений и 2867 удалений

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

@ -18,7 +18,7 @@
<script type="application/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(13);
SimpleTest.expectAssertions(13, 14);
} else if (navigator.platform.startsWith("Linux")) {
SimpleTest.expectAssertions(18);
} else if (navigator.platform.startsWith("Mac")) {

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

@ -92,8 +92,12 @@
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
if (!MAC) {
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
} else {
todo(false, "Re-enable on Mac after fixing bug 845095 - intermittent orange");
}
]]>
</script>

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

@ -111,6 +111,7 @@ _BROWSER_FILES = \
browser_bug555767.js \
browser_bug556061.js \
browser_bug559991.js \
browser_bug561636.js \
browser_bug561623.js \
browser_bug562649.js \
browser_bug563588.js \
@ -327,13 +328,6 @@ _BROWSER_FILES += \
# browser_maconly_carbon_mismatch_plugin.js
endif
# bug 766546, disable browser_bug561636.js on Windows
ifneq ($(OS_ARCH),WINNT)
_BROWSER_FILES += \
browser_bug561636.js \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk
libs:: $(_BROWSER_FILES)

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

@ -5,20 +5,20 @@ ok(gInvalidFormPopup,
function checkPopupShow()
{
ok(gInvalidFormPopup.state == 'showing' || gInvalidFormPopup.state == 'open',
"The invalid form popup should be shown");
"[Test " + testId + "] The invalid form popup should be shown");
}
function checkPopupHide()
{
ok(gInvalidFormPopup.state != 'showing' && gInvalidFormPopup.state != 'open',
"The invalid form popup should not be shown");
"[Test " + testId + "] The invalid form popup should not be shown");
}
function checkPopupMessage(doc)
{
is(gInvalidFormPopup.firstChild.textContent,
doc.getElementById('i').validationMessage,
"The panel should show the message from validationMessage");
"[Test " + testId + "] The panel should show the message from validationMessage");
}
let gObserver = {
@ -29,17 +29,31 @@ let gObserver = {
}
};
var testId = -1;
function nextTest()
{
testId++;
if (testId >= tests.length) {
finish();
return;
}
executeSoon(tests[testId]);
}
function test()
{
waitForExplicitFinish();
test1();
waitForFocus(nextTest);
}
var tests = [
/**
* In this test, we check that no popup appears if the form is valid.
*/
function test1() {
function()
{
let uri = "data:text/html,<html><body><iframe name='t'></iframe><form target='t' action='data:text/html,'><input><input id='s' type='submit'></form></body></html>";
let tab = gBrowser.addTab();
@ -54,21 +68,19 @@ function test1() {
// Clean-up
gBrowser.removeTab(gBrowser.selectedTab);
// Next test
executeSoon(test2);
nextTest();
});
}, true);
gBrowser.selectedTab = tab;
gBrowser.selectedTab.linkedBrowser.loadURI(uri);
}
},
/**
* In this test, we check that, when an invalid form is submitted,
* the invalid element is focused and a popup appears.
*/
function test2()
function()
{
let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input required id='i'><input id='s' type='submit'></form>";
let tab = gBrowser.addTab();
@ -85,7 +97,7 @@ function test2()
// Clean-up and next test.
gBrowser.removeTab(gBrowser.selectedTab);
executeSoon(test3);
nextTest();
}, false);
tab.linkedBrowser.addEventListener("load", function(aEvent) {
@ -96,13 +108,13 @@ function test2()
gBrowser.selectedTab = tab;
gBrowser.selectedTab.linkedBrowser.loadURI(uri);
}
},
/**
* In this test, we check that, when an invalid form is submitted,
* the first invalid element is focused and a popup appears.
*/
function test3()
function()
{
let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input><input id='i' required><input required><input id='s' type='submit'></form>";
let tab = gBrowser.addTab();
@ -119,7 +131,7 @@ function test3()
// Clean-up and next test.
gBrowser.removeTab(gBrowser.selectedTab);
executeSoon(test4a);
nextTest();
}, false);
tab.linkedBrowser.addEventListener("load", function(aEvent) {
@ -130,13 +142,13 @@ function test3()
gBrowser.selectedTab = tab;
gBrowser.selectedTab.linkedBrowser.loadURI(uri);
}
},
/**
* In this test, we check that, we hide the popup by interacting with the
* invalid element if the element becomes valid.
*/
function test4a()
function()
{
let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input id='i' required><input id='s' type='submit'></form>";
let tab = gBrowser.addTab();
@ -158,7 +170,7 @@ function test4a()
// Clean-up and next test.
gBrowser.removeTab(gBrowser.selectedTab);
executeSoon(test4b);
nextTest();
});
}, false);
@ -170,13 +182,13 @@ function test4a()
gBrowser.selectedTab = tab;
gBrowser.selectedTab.linkedBrowser.loadURI(uri);
}
},
/**
* In this test, we check that, we don't hide the popup by interacting with the
* invalid element if the element is still invalid.
*/
function test4b()
function()
{
let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input type='email' id='i' required><input id='s' type='submit'></form>";
let tab = gBrowser.addTab();
@ -198,7 +210,7 @@ function test4b()
// Clean-up and next test.
gBrowser.removeTab(gBrowser.selectedTab);
executeSoon(test5);
nextTest();
});
}, false);
@ -210,13 +222,13 @@ function test4b()
gBrowser.selectedTab = tab;
gBrowser.selectedTab.linkedBrowser.loadURI(uri);
}
},
/**
* In this test, we check that we can hide the popup by blurring the invalid
* element.
*/
function test5()
function()
{
let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input id='i' required><input id='s' type='submit'></form>";
let tab = gBrowser.addTab();
@ -238,7 +250,7 @@ function test5()
// Clean-up and next test.
gBrowser.removeTab(gBrowser.selectedTab);
executeSoon(test6);
nextTest();
});
}, false);
@ -250,12 +262,12 @@ function test5()
gBrowser.selectedTab = tab;
gBrowser.selectedTab.linkedBrowser.loadURI(uri);
}
},
/**
* In this test, we check that we can hide the popup by pressing TAB.
*/
function test6()
function()
{
let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input id='i' required><input id='s' type='submit'></form>";
let tab = gBrowser.addTab();
@ -277,7 +289,7 @@ function test6()
// Clean-up and next test.
gBrowser.removeTab(gBrowser.selectedTab);
executeSoon(test7);
nextTest();
});
}, false);
@ -289,12 +301,12 @@ function test6()
gBrowser.selectedTab = tab;
gBrowser.selectedTab.linkedBrowser.loadURI(uri);
}
},
/**
* In this test, we check that the popup will hide if we move to another tab.
*/
function test7()
function()
{
let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input id='i' required><input id='s' type='submit'></form>";
let tab = gBrowser.addTab();
@ -318,7 +330,7 @@ function test7()
// Clean-up and next test.
gBrowser.removeTab(gBrowser.selectedTab);
gBrowser.removeTab(gBrowser.selectedTab);
executeSoon(test8);
nextTest();
});
}, false);
@ -330,17 +342,17 @@ function test7()
gBrowser.selectedTab = tab;
gBrowser.selectedTab.linkedBrowser.loadURI(uri);
}
},
/**
* In this test, we check that nothing happen (no focus nor popup) if the
* invalid form is submitted in another tab than the current focused one
* (submitted in background).
*/
function test8()
function()
{
let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input id='i' required><input id='s' type='submit'></form>";
let tab = gBrowser.addTab();
let tab = gBrowser.addTab(uri);
gObserver.notifyInvalidSubmit = function() {
executeSoon(function() {
@ -355,29 +367,34 @@ function test8()
gObserver.notifyInvalidSubmit = function () {};
gBrowser.removeTab(tab);
// Next test
executeSoon(test9);
nextTest();
});
};
Services.obs.addObserver(gObserver, "invalidformsubmit", false);
tab.linkedBrowser.addEventListener("load", function(aEvent) {
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
function doClick() {
isnot(gBrowser.selectedTab, tab,
"This tab should have been loaded in background");
tab.linkedBrowser.contentDocument.getElementById('s').click();
}, true);
}
tab.linkedBrowser.loadURI(uri);
}
if (tab.linkedBrowser.contentDocument.readyState == 'complete') {
doClick();
} else {
tab.linkedBrowser.addEventListener("load", function(aEvent) {
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
doClick();
}, true);
}
},
/**
* In this test, we check that the author defined error message is shown.
*/
function test9()
function()
{
let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input x-moz-errormessage='foo' required id='i'><input id='s' type='submit'></form>";
let tab = gBrowser.addTab();
@ -396,7 +413,7 @@ function test9()
// Clean-up and next test.
gBrowser.removeTab(gBrowser.selectedTab);
executeSoon(test10);
nextTest();
}, false);
tab.linkedBrowser.addEventListener("load", function(aEvent) {
@ -407,12 +424,12 @@ function test9()
gBrowser.selectedTab = tab;
gBrowser.selectedTab.linkedBrowser.loadURI(uri);
}
},
/**
* In this test, we check that the message is correctly updated when it changes.
*/
function test10()
function()
{
let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input type='email' required id='i'><input id='s' type='submit'></form>";
let tab = gBrowser.addTab();
@ -434,13 +451,13 @@ function test10()
executeSoon(function() {
// Now, the element suffers from another error, the message should have
// been updated.
// been updated.
is(gInvalidFormPopup.firstChild.textContent, input.validationMessage,
"The panel should show the current validation message");
// Clean-up and next test.
gBrowser.removeTab(gBrowser.selectedTab);
executeSoon(finish);
nextTest();
});
}, false);
@ -455,4 +472,6 @@ function test10()
gBrowser.selectedTab = tab;
gBrowser.selectedTab.linkedBrowser.loadURI(uri);
}
},
];

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

@ -399,8 +399,7 @@ this.PlacesUIUtils = {
* TRANSITION_LINK.
*/
markPageAsTyped: function PUIU_markPageAsTyped(aURL) {
PlacesUtils.history.QueryInterface(Ci.nsIBrowserHistory)
.markPageAsTyped(this.createFixedURI(aURL));
PlacesUtils.history.markPageAsTyped(this.createFixedURI(aURL));
},
/**
@ -421,8 +420,7 @@ this.PlacesUIUtils = {
* so automatic visits can be correctly ignored.
*/
markPageAsFollowedLink: function PUIU_markPageAsFollowedLink(aURL) {
PlacesUtils.history.QueryInterface(Ci.nsIBrowserHistory)
.markPageAsFollowedLink(this.createFixedURI(aURL));
PlacesUtils.history.markPageAsFollowedLink(this.createFixedURI(aURL));
},
/**

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

@ -27,7 +27,7 @@ const BrowserTouchHandler = {
target: aMessage.target };
// Touch input selection handling
if (!InputSourceHelper.isPrecise) {
if (SelectionHelperUI.isActive()) {
if (SelectionHelperUI.isActive) {
// Selection handler is active.
if (aMessage.json.types.indexOf("selected-text") != -1) {
// long tap on existing selection. The incoming message has the

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

@ -33,11 +33,6 @@ var ContextCommands = {
this.clipboard.copyString(ContextMenuUI.popupState.string,
this.docRef);
this.showToast(Strings.browser.GetStringFromName("selectionHelper.textCopied"));
} else {
let x = ContextMenuUI.popupState.x;
let y = ContextMenuUI.popupState.y;
let json = {x: x, y: y, command: "copy" };
target.messageManager.sendAsyncMessage("Browser:ContextCommand", json);
}
} else {
// chrome

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

@ -497,6 +497,7 @@
</field>
<!-- Change client coordinates in device pixels to page-relative ones in CSS px. -->
<!-- (Does not take into account sub frame scroll) -->
<method name="transformClientToBrowser">
<parameter name="clientX"/>
<parameter name="clientY"/>

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

@ -19,11 +19,13 @@
<implementation implements="nsIDOMEventListener">
<constructor>
<![CDATA[
this._selectionOverlay.addEventListener('contextmenu', this);
]]>
</constructor>
<destructor>
<![CDATA[
this._selectionOverlay.removeEventListener('contextmenu', this);
]]>
</destructor>
@ -87,6 +89,31 @@
</body>
</method>
<method name="_onContextMenu">
<parameter name="aEvent"/>
<body>
<![CDATA[
// forward this over. frame script will treat this like
// a bubbling contextmenu event.
Browser.selectedTab.browser.messageManager.sendAsyncMessage("Browser:InvokeContextAtPoint", {
xPos: aEvent.clientX, yPos: aEvent.clientY });
]]>
</body>
</method>
<method name="handleEvent">
<parameter name="aEvent"/>
<body>
<![CDATA[
switch (aEvent.type) {
case 'contextmenu':
this._onContextMenu(aEvent);
break;
}
]]>
</body>
</method>
<method name="addDebugRect">
<parameter name="aLeft"/>
<parameter name="aTop"/>

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

@ -46,7 +46,8 @@ let Elements = {};
["progress", "progress-control"],
["contentNavigator", "content-navigator"],
["aboutFlyout", "about-flyoutpanel"],
["prefsFlyout", "prefs-flyoutpanel"]
["prefsFlyout", "prefs-flyoutpanel"],
["syncFlyout", "sync-flyoutpanel"]
].forEach(function (aElementGlobal) {
let [name, id] = aElementGlobal;
XPCOMUtils.defineLazyGetter(Elements, name, function() {
@ -1306,6 +1307,18 @@ var StartUI = {
}
};
var SyncPanelUI = {
init: function() {
// Run some setup code the first time the panel is shown.
Elements.syncFlyout.addEventListener("PopupChanged", function onShow(aEvent) {
if (aEvent.detail && aEvent.popup === Elements.syncFlyout) {
Elements.syncFlyout.removeEventListener("PopupChanged", onShow, false);
WeaveGlue.init();
}
}, false);
}
};
var FlyoutPanelsUI = {
get _aboutVersionLabel() {
return document.getElementById('about-version-label');
@ -1325,11 +1338,13 @@ var FlyoutPanelsUI = {
init: function() {
this._initAboutPanel();
PreferencesPanelView.init();
SyncPanelUI.init();
},
hide: function() {
Elements.aboutFlyout.hide();
Elements.prefsFlyout.hide();
Elements.syncFlyout.hide();
}
};
@ -1609,6 +1624,11 @@ var SettingsCharm = {
label: Strings.browser.GetStringFromName("optionsCharm"),
onselected: function() Elements.prefsFlyout.show()
});
// Sync
this.addEntry({
label: Strings.browser.GetStringFromName("syncCharm"),
onselected: function() Elements.syncFlyout.show()
});
// About
this.addEntry({
label: Strings.browser.GetStringFromName("aboutCharm1"),

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

@ -967,7 +967,7 @@ var Browser = {
case "Browser:TapOnSelection":
if (!InputSourceHelper.isPrecise) {
if (SelectionHelperUI.isActive()) {
if (SelectionHelperUI.isActive) {
SelectionHelperUI.shutdown();
}
if (SelectionHelperUI.canHandle(aMessage)) {

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

@ -428,6 +428,22 @@
class="text-link" value="&aboutHeader.policy.label;"/>
</flyoutpanel>
<flyoutpanel id="sync-flyoutpanel" headertext="&syncHeader.title;">
<setting id="sync-connect" title="&sync.notconnected;" type="control">
<button label="&sync.connect;" oncommand="WeaveGlue.tryConnect();" />
</setting>
<setting id="sync-connected" class="setting-group" title="&sync.connected;" type="control" collapsed="true">
<button id="sync-pairdevice" label="&sync.pair.title;" oncommand="SyncPairDevice.open();" />
</setting>
<setting id="sync-sync" class="setting-subgroup" type="control" collapsed="true">
<button id="sync-syncButton" label="&sync.syncNow;" oncommand="WeaveGlue.sync();"/>
</setting>
<setting id="sync-device" class="setting-subgroup" type="string" title="&sync.deviceName;" onchange="WeaveGlue.changeName(this);" collapsed="true"/>
<setting id="sync-disconnect" class="setting-subgroup" type="control" collapsed="true">
<button label="&sync.disconnect;" oncommand="WeaveGlue.disconnect();" />
</setting>
</flyoutpanel>
<flyoutpanel id="prefs-flyoutpanel" headertext="&optionsHeader.title;">
<settings id="prefs-startup" label="&optionsHeader.startup.title;"> <!-- note, this element has a custom margin-top -->
<setting id="prefs-homepage" title="&optionsHeader.homepage.title;" type="menulist" pref="browser.startup.sessionRestore" class="setting-expanded">
@ -454,23 +470,6 @@
</settings>
<setting id="prefs-master-password" title="&optionsHeader.privacy.masterPassword.label;" type="bool" oncommand="MasterPasswordUI.show(this.value);"/>
<settings id="prefs-sync" label="&sync.title;">
<setting id="sync-connect" title="&sync.notconnected;" type="control">
<button label="&sync.connect;" oncommand="WeaveGlue.tryConnect();" />
</setting>
<setting id="sync-connected" class="setting-group" title="&sync.connected;" type="control" collapsed="true">
<button id="sync-pairdevice" label="&sync.pair.title;" oncommand="SyncPairDevice.open();" />
<button id="sync-details" label="&sync.details;" type="checkbox" autocheck="false" checked="false" oncommand="WeaveGlue.showDetails();" />
</setting>
<setting id="sync-sync" class="setting-subgroup" type="control" collapsed="true">
<button id="sync-syncButton" label="&sync.syncNow;" oncommand="WeaveGlue.sync();"/>
</setting>
<setting id="sync-device" class="setting-subgroup" type="string" title="&sync.deviceName;" onchange="WeaveGlue.changeName(this);" collapsed="true"/>
<setting id="sync-disconnect" class="setting-subgroup" type="control" collapsed="true">
<button label="&sync.disconnect;" oncommand="WeaveGlue.disconnect();" />
</setting>
</settings>
</flyoutpanel>
<!-- Form Helper form validation helper popup -->
@ -682,7 +681,8 @@
</hbox>
<!-- Selection overlay - this should be below any content that can have selectable text -->
<box class="selection-overlay-hidden" id="selection-overlay"/>
<!-- onclick addresses dom bug 835175, str in bug 832957 -->
<box onclick="false" class="selection-overlay-hidden" id="selection-overlay"/>
</stack>
<svg:svg height="0">

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

@ -167,32 +167,38 @@ const ElementTouchHelper = {
*/
/*
* elementFromPoint
* elementFromPoint - find the closes element at a point. searches
* sub-frames.
*
* @param x,y Browser coordinates
* @return Element at position, null if no active browser or no element found
* @param aX, aY browser coordinates
* @return
* element - element at the position, or null if no active browser or
* element was found.
* frameX - x position within the subframe element was found. aX if no
* sub-frame was found.
* frameY - y position within the subframe element was found. aY if no
* sub-frame was found.
*/
function elementFromPoint(x, y) {
function elementFromPoint(aX, aY) {
// browser's elementFromPoint expect browser-relative client coordinates.
// subtract browser's scroll values to adjust
let cwu = Util.getWindowUtils(content);
let elem = ElementTouchHelper.getClosest(cwu, x, y);
let elem = ElementTouchHelper.getClosest(cwu, aX, aY);
// step through layers of IFRAMEs and FRAMES to find innermost element
while (elem && (elem instanceof HTMLIFrameElement ||
elem instanceof HTMLFrameElement)) {
// adjust client coordinates' origin to be top left of iframe viewport
let rect = elem.getBoundingClientRect();
x -= rect.left;
y -= rect.top;
aX -= rect.left;
aY -= rect.top;
let windowUtils = elem.contentDocument
.defaultView
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
elem = ElementTouchHelper.getClosest(windowUtils, x, y);
elem = ElementTouchHelper.getClosest(windowUtils, aX, aY);
}
return elem;
return { element: elem, frameX: aX, frameY: aY };
}
/*
@ -400,7 +406,7 @@ let Content = {
*/
_genericMouseDown: function _genericMouseDown(x, y) {
let element = elementFromPoint(x, y);
let { element } = elementFromPoint(x, y);
if (!element)
return;
@ -417,7 +423,7 @@ let Content = {
_genericMouseClick: function _genericMouseClick(aEvent) {
ContextMenuHandler.reset();
let element = elementFromPoint(aEvent.clientX, aEvent.clientY);
let { element: element } = elementFromPoint(aEvent.clientX, aEvent.clientY);
if (!element)
return;

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

@ -91,8 +91,9 @@ var ContextMenuHandler = {
_onContextAtPoint: function _onContextCommand(aMessage) {
// we need to find popupNode as if the context menu were
// invoked on underlying content.
let elem = elementFromPoint(aMessage.json.xPos, aMessage.json.yPos);
this._processPopupNode(elem, aMessage.json.xPos, aMessage.json.yPos,
let { element, frameX, frameY } =
elementFromPoint(aMessage.json.xPos, aMessage.json.yPos);
this._processPopupNode(element, frameX, frameY,
Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH);
},
@ -171,7 +172,12 @@ var ContextMenuHandler = {
offsetX += rect.left;
offsetY += rect.top;
}
return { offsetX: offsetX, offsetY: offsetY };
let win = null;
if (element == aPopupNode)
win = content;
else
win = element.contentDocument.defaultView;
return { targetWindow: win, offsetX: offsetX, offsetY: offsetY };
},
/*
@ -183,8 +189,12 @@ var ContextMenuHandler = {
_processPopupNode: function _processPopupNode(aPopupNode, aX, aY, aInputSrc) {
if (!aPopupNode)
return;
let { offsetX: offsetX, offsetY: offsetY } =
let { targetWindow: targetWindow,
offsetX: offsetX,
offsetY: offsetY } =
this._translateToTopLevelWindow(aPopupNode);
let popupNode = this.popupNode = aPopupNode;
let imageUrl = "";
@ -298,9 +308,9 @@ var ContextMenuHandler = {
if (isText) {
// If this is text and has a selection, we want to bring
// up the copy option on the context menu.
if (content && content.getSelection() &&
content.getSelection().toString().length > 0) {
state.string = content.getSelection().toString();
let selection = targetWindow.getSelection();
if (selection && selection.toString().length > 0) {
state.string = targetWindow.getSelection().toString();
state.types.push("copy");
state.types.push("selected-text");
} else {

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

@ -47,11 +47,11 @@ var SelectionHandler = {
_targetIsEditable: false,
_contentWindow: null,
_contentOffset: { x:0, y:0 },
_frameOffset: { x:0, y:0 },
_domWinUtils: null,
_selectionMoveActive: false,
_lastMarker: "",
_debugOptions: { dumpRanges: false, displayRanges: false },
_snap: true,
init: function init() {
addMessageListener("Browser:SelectionStart", this);
@ -85,6 +85,16 @@ var SelectionHandler = {
return (this._contentWindow != null);
},
/*
* snap - enable or disable word snap for the active marker when a
* SelectionMoveEnd event is received. Typically you would disable
* snap when zoom is < 1.0 for precision selection.
*/
get snap() {
return this._snap;
},
/*************************************************
* Browser event handlers
*/
@ -103,11 +113,10 @@ var SelectionHandler = {
let selection = this._contentWindow.getSelection();
selection.removeAllRanges();
Util.dumpLn(this._targetElement);
// Set our initial selection, aX and aY should be in client coordinates.
if (!this._domWinUtils.selectAtPoint(aX, aY, Ci.nsIDOMWindowUtils
.SELECT_WORDNOSPACE)) {
let framePoint = this._clientPointToFramePoint({ xPos: aX, yPos: aY });
if (!this._domWinUtils.selectAtPoint(framePoint.xPos, framePoint.yPos,
Ci.nsIDOMWindowUtils.SELECT_WORDNOSPACE)) {
this._onFail("failed to set selection at point");
return;
}
@ -169,8 +178,7 @@ var SelectionHandler = {
} else {
pos = aMsg.end;
}
this._handleSelectionPoint(aMsg.change, pos);
this._handleSelectionPoint(aMsg.change, pos, false);
},
/*
@ -195,7 +203,7 @@ var SelectionHandler = {
pos = aMsg.end;
}
this._handleSelectionPoint(aMsg.change, pos);
this._handleSelectionPoint(aMsg.change, pos, true);
this._selectionMoveActive = false;
// _handleSelectionPoint may set a scroll timer, so this must
@ -215,15 +223,16 @@ var SelectionHandler = {
*/
_onSelectionCopy: function _onSelectionCopy(aMsg) {
let tap = {
xPos: aMsg.xPos, // + this._contentOffset.x,
yPos: aMsg.yPos, // + this._contentOffset.y,
xPos: aMsg.xPos,
yPos: aMsg.yPos,
};
let tapInSelection = (tap.xPos > this._cache.rect.left &&
tap.xPos < this._cache.rect.right) &&
(tap.yPos > this._cache.rect.top &&
tap.yPos < this._cache.rect.bottom);
// Util.dumpLn(tap.xPos, tap.yPos, "|", this._cache.rect.left,
// Util.dumpLn(tapInSelection,
// tap.xPos, tap.yPos, "|", this._cache.rect.left,
// this._cache.rect.right, this._cache.rect.top,
// this._cache.rect.bottom);
let success = false;
@ -329,7 +338,7 @@ var SelectionHandler = {
let selection = this._getSelection();
// If the range didn't have any text, let's bail
if (!selection.toString().trim().length) {
if (!selection || !selection.toString().trim().length) {
this._onFail("no text was present in the current selection");
return;
}
@ -354,7 +363,6 @@ var SelectionHandler = {
let { element: element,
contentWindow: contentWindow,
offset: offset,
frameOffset: frameOffset,
utils: utils } =
this.getCurrentWindowAndOffset(aX, aY);
if (!contentWindow) {
@ -363,7 +371,6 @@ var SelectionHandler = {
this._targetElement = element;
this._contentWindow = contentWindow;
this._contentOffset = offset;
this._frameOffset = frameOffset;
this._domWinUtils = utils;
this._targetIsEditable = false;
if (this._isTextInput(this._targetElement)) {
@ -387,12 +394,7 @@ var SelectionHandler = {
* SelectionHelperUI.
*/
_updateUIMarkerRects: function _updateUIMarkerRects(aSelection) {
// Extract the information we'll send over to the ui - cache holds content
// coordinate oriented start and end position data. Note the coordinates
// of the range passed in are relative the sub frame the range sits in.
// SelectionHelperUI calls transformBrowserToClient to get client coords.
this._cache = this._extractContentRectFromRange(aSelection.getRangeAt(0),
this._contentOffset);
this._cache = this._extractClientRectFromRange(aSelection.getRangeAt(0));
if (this. _debugOptions.dumpRanges) {
Util.dumpLn("start:", "(" + this._cache.start.xPos + "," +
this._cache.start.yPos + ")");
@ -410,7 +412,7 @@ var SelectionHandler = {
_restrictSelectionRectToEditBounds: function _restrictSelectionRectToEditBounds() {
if (!this._targetIsEditable)
return;
let bounds = this._getTargetContentRect();
let bounds = this._getTargetClientRect();
if (this._cache.start.xPos < bounds.left)
this._cache.start.xPos = bounds.left;
if (this._cache.end.xPos < bounds.left)
@ -431,9 +433,9 @@ var SelectionHandler = {
},
/*
* _handleSelectionPoint(aMarker, aPoint)
* _handleSelectionPoint(aMarker, aPoint, aEndOfSelection)
*
* After a monocle moves to a new point in the document, determintes
* After a monocle moves to a new point in the document, determines
* what the target is and acts on its selection accordingly. If the
* monocle is within the bounds of the target, adds or subtracts selection
* at the monocle coordinates appropriately and then merges selection ranges
@ -441,17 +443,22 @@ var SelectionHandler = {
* of the target and the underlying target is editable, uses the selection
* controller to advance selection and visibility within the control.
*/
_handleSelectionPoint: function _handleSelectionPoint(aMarker, aClientPoint) {
_handleSelectionPoint: function _handleSelectionPoint(aMarker, aClientPoint,
aEndOfSelection) {
let selection = this._getSelection();
let clientPoint = { xPos: aClientPoint.xPos, yPos: aClientPoint.yPos };
if (selection.rangeCount == 0 || selection.rangeCount > 1) {
Util.dumpLn("warning, unexpected selection state.");
this._setContinuousSelection();
if (selection.rangeCount == 0) {
this._onFail("selection.rangeCount == 0");
return;
}
// We expect continuous selection ranges.
if (selection.rangeCount > 1) {
this._setContinuousSelection();
}
// Adjust our y position up such that we are sending coordinates on
// the text line vs. below it where the monocle is positioned. This
// applies to free floating text areas. For text inputs we'll constrain
@ -489,10 +496,7 @@ var SelectionHandler = {
this._setContinuousSelection();
// Update the other monocle's position if we've dragged off to one side
if (result.start)
this._updateSelectionUI(true, false);
if (result.end)
this._updateSelectionUI(false, true);
this._updateSelectionUI(result.start, result.end);
return;
}
@ -504,7 +508,7 @@ var SelectionHandler = {
this.clearTimers();
// Adjusts the selection based on monocle movement
this._adjustSelection(aMarker, clientPoint);
this._adjustSelection(aMarker, clientPoint, aEndOfSelection);
// Update the other monocle's position. We do this because the dragging
// monocle may reset the static monocle to a new position if the dragging
@ -527,8 +531,12 @@ var SelectionHandler = {
* @param the marker currently being manipulated
* @param aClientPoint the point designating the new start or end
* position for the selection.
* @param aEndOfSelection indicates if this is the end of a selection
* move, in which case we may want to snap to the end of a word or
* sentence.
*/
_adjustSelection: function _adjustSelection(aMarker, aClientPoint) {
_adjustSelection: function _adjustSelection(aMarker, aClientPoint,
aEndOfSelection) {
// Make a copy of the existing range, we may need to reset it.
this._backupRangeList();
@ -538,15 +546,20 @@ var SelectionHandler = {
// Tests to see if the user is trying to shrink the selection, and if so
// collapses it down to the appropriate side such that our calls below
// will reset the selection to the proper range.
this._shrinkSelectionFromPoint(aMarker, framePoint);
let shrunk = this._shrinkSelectionFromPoint(aMarker, framePoint);
let selectResult = false;
try {
// If we're at the end of a selection (touchend) snap to the word.
let type = ((aEndOfSelection && this._snap) ?
Ci.nsIDOMWindowUtils.SELECT_WORD :
Ci.nsIDOMWindowUtils.SELECT_CHARACTER);
// Select a character at the point.
selectResult =
this._domWinUtils.selectAtPoint(aClientPoint.xPos,
aClientPoint.yPos,
Ci.nsIDOMWindowUtils.SELECT_CHARACTER);
this._domWinUtils.selectAtPoint(framePoint.xPos,
framePoint.yPos,
type);
} catch (ex) {
}
@ -760,7 +773,7 @@ var SelectionHandler = {
/*
* _setContinuousSelection()
*
* Smoothes a selection with multiple ranges into a single
* Smooths a selection with multiple ranges into a single
* continuous range.
*/
_setContinuousSelection: function _setContinuousSelection() {
@ -798,8 +811,8 @@ var SelectionHandler = {
newEndOffset = range.endOffset;
break;
case 0: // startRange is equal
newEndNode = startNode.endContainer;
newEndOffset = startNode.endOffset;
newEndNode = range.endContainer;
newEndOffset = range.endOffset;
break;
case 1: // startRange is after
newEndNode = startRange.endContainer;
@ -832,44 +845,51 @@ var SelectionHandler = {
* character of selection at the collapse point.
*
* @param aMarker the marker that is being relocated. ("start" or "end")
* @param aFramePoint position of the marker. Should be relative to the
* inner frame so that it matches selection range coordinates.
* @param aFramePoint position of the marker.
*/
_shrinkSelectionFromPoint: function _shrinkSelectionFromPoint(aMarker, aFramePoint) {
let result = false;
try {
let selection = this._getSelection();
let rects = selection.getRangeAt(0).getClientRects();
for (let idx = 0; idx < rects.length; idx++) {
if (Util.pointWithinDOMRect(aFramePoint.xPos, aFramePoint.yPos, rects[idx])) {
if (aMarker == "start") {
selection.collapseToEnd();
} else {
selection.collapseToStart();
for (let range = 0; range < selection.rangeCount; range++) {
// relative to frame
let rects = selection.getRangeAt(range).getClientRects();
for (let idx = 0; idx < rects.length; idx++) {
// Util.dumpLn("[" + idx + "]", aFramePoint.xPos, aFramePoint.yPos, rects[idx].left,
// rects[idx].top, rects[idx].right, rects[idx].bottom);
if (Util.pointWithinDOMRect(aFramePoint.xPos, aFramePoint.yPos, rects[idx])) {
result = true;
if (aMarker == "start") {
selection.collapseToEnd();
} else {
selection.collapseToStart();
}
// collapseToStart and collapseToEnd leave an empty range in the
// selection at the collapse point. Therefore we need to add some
// selection such that the selection added by selectAtPoint and
// the current empty range will get merged properly when we smooth
// the selection ranges out.
let selCtrl = this._getSelectController();
// Expand the collapsed range such that it occupies a little space.
if (aMarker == "start") {
// State: focus = anchor (collapseToEnd does this)
selCtrl.characterMove(false, true);
// State: focus = (anchor - 1)
selection.collapseToStart();
// State: focus = anchor and both are -1 from the original offset
selCtrl.characterMove(true, true);
// State: focus = anchor + 1, both have been moved back one char
} else {
selCtrl.characterMove(true, true);
}
break;
}
// collapseToStart and collapseToEnd leave an empty range in the
// selection at the collapse point. Therefore we need to add some
// selection such that the selection added by selectAtPoint and
// the current empty range will get merged properly when we smooth
// the selection rnages out.
let selCtrl = this._getSelectController();
// Expand the collapsed range such that it occupies a little space.
if (aMarker == "start") {
// State: focus = anchor (collapseToEnd does this)
selCtrl.characterMove(false, true);
// State: focus = (anchor - 1)
selection.collapseToStart();
// State: focus = anchor and both are -1 from the original offset
selCtrl.characterMove(true, true);
// State: focus = anchor + 1, both have been moved back one char
} else {
selCtrl.characterMove(true, true);
}
break;
}
}
} catch (ex) {
Util.dumpLn("error shrinking selection:", ex.message);
}
return result;
},
/*
@ -954,7 +974,7 @@ var SelectionHandler = {
* coordinates in a range extracted from any sub frames. If aRange
* is in the root frame offset should be zero.
*/
_extractContentRectFromRange: function _extractContentRectFromRange(aRange, aOffset) {
_extractClientRectFromRange: function _extractClientRectFromRange(aRange) {
let cache = {
start: {}, end: {},
rect: { left: 0, top: 0, right: 0, bottom: 0 }
@ -967,23 +987,23 @@ var SelectionHandler = {
for (let idx = 0; idx < rects.length; idx++) {
if (this. _debugOptions.dumpRanges) Util.dumpDOMRect(idx, rects[idx]);
if (!startSet && !Util.isEmptyDOMRect(rects[idx])) {
cache.start.xPos = rects[idx].left + aOffset.x;
cache.start.yPos = rects[idx].bottom + aOffset.y;
cache.start.xPos = rects[idx].left + this._contentOffset.x;
cache.start.yPos = rects[idx].bottom + this._contentOffset.y;
startSet = true;
if (this. _debugOptions.dumpRanges) Util.dumpLn("start set");
}
if (!Util.isEmptyDOMRect(rects[idx])) {
cache.end.xPos = rects[idx].right + aOffset.x;
cache.end.yPos = rects[idx].bottom + aOffset.y;
cache.end.xPos = rects[idx].right + this._contentOffset.x;
cache.end.yPos = rects[idx].bottom + this._contentOffset.y;
if (this. _debugOptions.dumpRanges) Util.dumpLn("end set");
}
}
let r = aRange.getBoundingClientRect();
cache.rect.left = r.left + aOffset.x;
cache.rect.top = r.top + aOffset.y;
cache.rect.right = r.right + aOffset.x;
cache.rect.bottom = r.bottom + aOffset.y;
cache.rect.left = r.left + this._contentOffset.x;
cache.rect.top = r.top + this._contentOffset.y;
cache.rect.right = r.right + this._contentOffset.x;
cache.rect.bottom = r.bottom + this._contentOffset.y;
if (!rects.length) {
Util.dumpLn("no rects in selection range. unexpected.");
@ -992,17 +1012,6 @@ var SelectionHandler = {
return cache;
},
_getTargetContentRect: function _getTargetContentRect() {
let client = this._targetElement.getBoundingClientRect();
let rect = {};
rect.left = client.left + this._contentOffset.x;
rect.top = client.top + this._contentOffset.y;
rect.right = client.right + this._contentOffset.x;
rect.bottom = client.bottom + this._contentOffset.y;
return rect;
},
_getTargetClientRect: function _getTargetClientRect() {
return this._targetElement.getBoundingClientRect();
},
@ -1012,8 +1021,8 @@ var SelectionHandler = {
*/
_clientPointToFramePoint: function _clientPointToFramePoint(aClientPoint) {
let point = {
xPos: aClientPoint.xPos - this._frameOffset.x,
yPos: aClientPoint.yPos - this._frameOffset.y
xPos: aClientPoint.xPos - this._contentOffset.x,
yPos: aClientPoint.yPos - this._contentOffset.y
};
return point;
},
@ -1025,40 +1034,32 @@ var SelectionHandler = {
* sub frame coords + offset = root frame position
*/
getCurrentWindowAndOffset: function(x, y) {
// elementFromPoint: If the element at the given point belongs to another
// document (such as an iframe's subdocument), the element in the calling
// document's DOM (e.g. the iframe) is returned.
// If the element at the given point belongs to another document (such
// as an iframe's subdocument), the element in the calling document's
// DOM (e.g. the iframe) is returned.
let utils = Util.getWindowUtils(content);
let element = utils.elementFromPoint(x, y, true, false);
let offset = { x:0, y:0 };
let frameOffset = { x:0, y:0 };
let scrollOffset = ContentScroll.getScrollOffset(content);
offset.x += scrollOffset.x;
offset.y += scrollOffset.y;
while (element && (element instanceof HTMLIFrameElement ||
element instanceof HTMLFrameElement)) {
//Util.dumpLn("found child frame:", element.contentDocument.location);
// Get the content scroll offset in the child frame
scrollOffset = ContentScroll.getScrollOffset(element.contentDocument.defaultView);
// get the child frame position in client coordinates
let rect = element.getBoundingClientRect();
// subtract frame offset from our elementFromPoint coordinates
x -= rect.left;
// subtract frame and scroll offset and from elementFromPoint coordinates
// calculate offsets for digging down into sub frames
// using elementFromPoint:
// Get the content scroll offset in the child frame
scrollOffset = ContentScroll.getScrollOffset(element.contentDocument.defaultView);
// subtract frame and scroll offset from our elementFromPoint coordinates
x -= rect.left + scrollOffset.x;
y -= rect.top + scrollOffset.y;
// calculate offsets we'll use to translate to client coords:
// add frame client offset to our total offset result
offset.x += rect.left;
// add the frame's y offset + scroll offset to our total offset result
offset.y += rect.top + scrollOffset.y;
// Track the offset to the origin of the sub-frame as well
frameOffset.x += rect.left;
frameOffset.y += rect.top
offset.y += rect.top;
// get the frame's nsIDOMWindowUtils
utils = element.contentDocument
@ -1077,7 +1078,6 @@ var SelectionHandler = {
element: element,
contentWindow: element.ownerDocument.defaultView,
offset: offset,
frameOffset: frameOffset,
utils: utils
};
},
@ -1098,7 +1098,9 @@ var SelectionHandler = {
_getSelectedText: function _getSelectedText() {
let selection = this._getSelection();
return selection.toString();
if (selection)
return selection.toString();
return "";
},
_getSelection: function _getSelection() {
@ -1106,8 +1108,9 @@ var SelectionHandler = {
return this._targetElement
.QueryInterface(Ci.nsIDOMNSEditableElement)
.editor.selection;
else
else if (this._contentWindow)
return this._contentWindow.getSelection();
return null;
},
_getSelectController: function _getSelectController() {

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

@ -71,7 +71,15 @@ MarkerDragger.prototype = {
}
}
function Marker() {}
function Marker(aParent, aTag, aElementId, xPos, yPos) {
this._xPos = xPos;
this._yPos = yPos;
this._selectionHelperUI = aParent;
this._element = document.getElementById(aElementId);
// These get picked in input.js and receives drag input
this._element.customDragger = new MarkerDragger(this);
this.tag = aTag;
}
Marker.prototype = {
_element: null,
@ -107,13 +115,6 @@ Marker.prototype = {
return this._element.customDragger.dragging;
},
init: function init(aParent, aElementId, xPos, yPos) {
this._selectionHelperUI = aParent;
this._element = document.getElementById(aElementId);
// These get picked in input.js and receives drag input
this._element.customDragger = new MarkerDragger(this);
},
shutdown: function shutdown() {
this._element.hidden = true;
this._element.customDragger.shutdown = true;
@ -196,21 +197,18 @@ var SelectionHelperUI = {
_target: null,
_movement: { active: false, x:0, y: 0 },
_activeSelectionRect: null,
_selectionHandlerActive: false,
get startMark() {
if (this._startMark == null) {
this._startMark = new Marker();
this._startMark.tag = "start";
this._startMark.init(this, "selectionhandle-start");
this._startMark = new Marker(this, "start", "selectionhandle-start", 0, 0);
}
return this._startMark;
},
get endMark() {
if (this._endMark == null) {
this._endMark = new Marker();
this._endMark.tag = "end";
this._endMark.init(this, "selectionhandle-end");
this._endMark = new Marker(this, "end", "selectionhandle-end", 0, 0);
}
return this._endMark;
},
@ -246,18 +244,18 @@ var SelectionHelperUI = {
this._init();
Util.dumpLn("enableSelection target:", this._popupState._target);
// Set the track bounds for each marker NIY
this.startMark.setTrackBounds(this._popupState.xPos, this._popupState.yPos);
this.endMark.setTrackBounds(this._popupState.xPos, this._popupState.yPos);
// Send this over to SelectionHandler in content, they'll message us
// back with information on the current selection.
this._popupState._target.messageManager.sendAsyncMessage(
"Browser:SelectionStart",
{ xPos: this._popupState.xPos,
yPos: this._popupState.yPos });
// back with information on the current selection. SelectionStart
// takes client coordinates.
this._selectionHandlerActive = false;
this._sendAsyncMessage("Browser:SelectionStart", {
xPos: this._popupState.xPos,
yPos: this._popupState.yPos
});
this._setupDebugOptions();
},
@ -268,19 +266,21 @@ var SelectionHelperUI = {
* Attaches to existing selection and begins editing.
*/
attachEditSession: function attachEditSession(aMessage) {
if (aMessage.target == undefined)
return;
this._popupState = aMessage.json;
this._popupState._target = aMessage.target;
this._init();
Util.dumpLn("enableSelection target:", this._popupState._target);
// Set the track bounds for each marker NIY
this.startMark.setTrackBounds(this._popupState.xPos, this._popupState.yPos);
this.endMark.setTrackBounds(this._popupState.xPos, this._popupState.yPos);
// Send this over to SelectionHandler in content, they'll message us
// back with information on the current selection.
// back with information on the current selection. SelectionAttach
// takes client coordinates.
this._selectionHandlerActive = false;
this._popupState._target.messageManager.sendAsyncMessage(
"Browser:SelectionAttach",
{ xPos: this._popupState.xPos,
@ -301,12 +301,14 @@ var SelectionHelperUI = {
},
/*
* isActive
* isActive (prop)
*
* Determines if an edit session is currently active.
*/
isActive: function isActive() {
return (this._popupState && this._popupState._target);
get isActive() {
return (this._popupState != null &&
this._popupState._target != null &&
this._selectionHandlerActive);
},
/*
@ -316,8 +318,7 @@ var SelectionHelperUI = {
* selection regions if they exist.
*/
closeEditSession: function closeEditSession() {
if (this._popupState._target)
this._popupState._target.messageManager.sendAsyncMessage("Browser:SelectionClose");
this._sendAsyncMessage("Browser:SelectionClose");
this._shutdown();
},
@ -328,8 +329,7 @@ var SelectionHelperUI = {
* associated with the edit session.
*/
closeEditSessionAndClear: function closeEditSessionAndClear() {
if (this._popupState._target)
this._popupState._target.messageManager.sendAsyncMessage("Browser:SelectionClear");
this._sendAsyncMessage("Browser:SelectionClear");
this.closeEditSession();
},
@ -347,13 +347,16 @@ var SelectionHelperUI = {
// selection related events
window.addEventListener("click", this, true);
window.addEventListener("dblclick", this, true);
window.addEventListener("MozPressTapGesture", this, true);
// Picking up scroll attempts
window.addEventListener("touchstart", this, true);
window.addEventListener("touchend", this, true);
window.addEventListener("touchmove", this, true);
// context ui display events
window.addEventListener("MozContextUIShow", this, true);
window.addEventListener("MozContextUIDismiss", this, true);
// cancellation related events
window.addEventListener("keypress", this, true);
Elements.browsers.addEventListener("URLChanged", this, true);
@ -373,12 +376,14 @@ var SelectionHelperUI = {
window.removeEventListener("click", this, true);
window.removeEventListener("dblclick", this, true);
window.removeEventListener("MozPressTapGesture", this, true);
window.removeEventListener("touchstart", this, true);
window.removeEventListener("touchend", this, true);
window.removeEventListener("touchmove", this, true);
window.removeEventListener("MozContextUIShow", this, true);
window.removeEventListener("MozContextUIDismiss", this, true);
window.removeEventListener("keypress", this, true);
Elements.browsers.removeEventListener("URLChanged", this, true);
Elements.browsers.removeEventListener("SizeChanged", this, true);
@ -396,6 +401,7 @@ var SelectionHelperUI = {
this._popupState = null;
this._activeSelectionRect = null;
this._selectionHandlerActive = false;
this.overlay.displayDebugLayer = false;
this.overlay.enabled = false;
@ -429,53 +435,48 @@ var SelectionHelperUI = {
// Turn on the debug layer
this.overlay.displayDebugLayer = true;
// Tell SelectionHandler what to do
this._popupState
._target
.messageManager
.sendAsyncMessage("Browser:SelectionDebug", debugOpts);
this._sendAsyncMessage("Browser:SelectionDebug", debugOpts);
}
},
/*
* Event handlers for document events
* _sendAsyncMessage - helper for sending a message to
* SelectionHandler.
*/
_sendAsyncMessage: function _sendAsyncMessage(aMsg, aJson) {
if (!this._popupState || !this._popupState._target) {
if (this._debugEvents)
Util.dumpLn("SelectionHelperUI sendAsyncMessage could not send", aMsg);
return;
}
this._popupState._target.messageManager.sendAsyncMessage(aMsg, aJson);
},
_checkForActiveDrag: function _checkForActiveDrag() {
return (this.startMark.dragging || this.endMark.dragging);
},
_hitTestSelection: function _hitTestSelection(aEvent) {
let clickPos =
this._popupState._target.transformClientToBrowser(aEvent.clientX,
aEvent.clientY);
// Ignore if the double tap isn't on our active selection rect.
if (this._activeSelectionRect &&
Util.pointWithinRect(clickPos.x, clickPos.y, this._activeSelectionRect)) {
Util.pointWithinRect(aEvent.clientX, aEvent.clientY, this._activeSelectionRect)) {
return true;
}
return false;
},
/*
* Event handlers for document events
*/
_onTap: function _onTap(aEvent) {
// Trap single clicks which if forwarded to content will clear selection.
aEvent.stopPropagation();
aEvent.preventDefault();
if (this.startMark.hitTest(aEvent.clientX, aEvent.clientY) ||
this.endMark.hitTest(aEvent.clientX, aEvent.clientY)) {
// NIY
this._popupState._target.messageManager.sendAsyncMessage("Browser:ChangeMode", {});
}
},
_onLongTap: function _onLongTap(aEvent) {
// Check to see if this tap is on one of our monocles. Tap is
// easy to trigger when dragging them around.
if (this.startMark.hitTest(aEvent.clientX, aEvent.clientY) ||
this.endMark.hitTest(aEvent.clientX, aEvent.clientY)) {
aEvent.stopPropagation();
aEvent.preventDefault();
return;
// this._sendAsyncMessage("Browser:ChangeMode", {});
}
},
@ -491,15 +492,10 @@ var SelectionHelperUI = {
}
// Select and close
let clickPos =
this._popupState._target.transformClientToBrowser(aEvent.clientX,
aEvent.clientY);
let json = {
xPos: clickPos.x,
yPos: clickPos.y,
};
this._popupState._target.messageManager.sendAsyncMessage("Browser:SelectionCopy", json);
this._sendAsyncMessage("Browser:SelectionCopy", {
xPos: aEvent.clientX,
yPos: aEvent.clientY,
});
aEvent.stopPropagation();
aEvent.preventDefault();
@ -513,16 +509,13 @@ var SelectionHelperUI = {
},
_onSelectionRangeChange: function _onSelectionRangeChange(json) {
// start and end contain client coordinates.
if (json.updateStart) {
let pos =
this._popupState._target.transformBrowserToClient(json.start.xPos, json.start.yPos);
this.startMark.position(pos.x, pos.y);
this.startMark.position(json.start.xPos, json.start.yPos);
this.startMark.show();
}
if (json.updateEnd) {
let pos =
this._popupState._target.transformBrowserToClient(json.end.xPos, json.end.yPos);
this.endMark.position(pos.x, pos.y);
this.endMark.position(json.end.xPos, json.end.yPos);
this.endMark.show();
}
this._activeSelectionRect = json.rect;
@ -538,9 +531,14 @@ var SelectionHelperUI = {
},
_onResize: function _onResize() {
this._popupState._target
.messageManager
.sendAsyncMessage("Browser:SelectionUpdate", {});
this._sendAsyncMessage("Browser:SelectionUpdate", {});
},
_onContextUIVisibilityEvent: function _onContextUIVisibilityEvent(aType) {
// Manage display of monocles when the context ui is displayed.
if (!this.isActive)
return;
this.overlay.hidden = (aType == "MozContextUIShow");
},
_onDebugRectRequest: function _onDebugRectRequest(aMsg) {
@ -561,7 +559,7 @@ var SelectionHelperUI = {
},
handleEvent: function handleEvent(aEvent) {
if (this._debugEvents && aEvent.type != "touchmove") {
if (this._debugEvents) {
Util.dumpLn("SelectionHelperUI:", aEvent.type);
}
switch (aEvent.type) {
@ -573,10 +571,6 @@ var SelectionHelperUI = {
this._onDblTap(aEvent);
break;
case "MozPressTapGesture":
this._onLongTap(aEvent);
break;
case "touchstart": {
if (aEvent.touches.length != 1)
break;
@ -619,7 +613,12 @@ var SelectionHelperUI = {
case "URLChanged":
case "MozPrecisePointer":
this.closeEditSessionAndClear();
break;
break;
case "MozContextUIShow":
case "MozContextUIDismiss":
this._onContextUIVisibilityEvent(aEvent.type);
break;
}
},
@ -628,12 +627,15 @@ var SelectionHelperUI = {
let json = aMessage.json;
switch (aMessage.name) {
case "Content:SelectionFail":
this._selectionHandlerActive = false;
this._onSelectionFail();
break;
case "Content:SelectionRange":
this._selectionHandlerActive = true;
this._onSelectionRangeChange(json);
break;
case "Content:SelectionCopied":
this._selectionHandlerActive = true;
this._onSelectionCopied(json);
break;
case "Content:SelectionDebugRect":
@ -670,20 +672,20 @@ var SelectionHelperUI = {
markerDragStart: function markerDragStart(aMarker) {
let json = this._getMarkerBaseMessage();
json.change = aMarker.tag;
this._popupState._target.messageManager.sendAsyncMessage("Browser:SelectionMoveStart", json);
this._sendAsyncMessage("Browser:SelectionMoveStart", json);
},
markerDragStop: function markerDragStop(aMarker) {
//aMarker.show();
let json = this._getMarkerBaseMessage();
json.change = aMarker.tag;
this._popupState._target.messageManager.sendAsyncMessage("Browser:SelectionMoveEnd", json);
this._sendAsyncMessage("Browser:SelectionMoveEnd", json);
},
markerDragMove: function markerDragMove(aMarker) {
let json = this._getMarkerBaseMessage();
json.change = aMarker.tag;
this._popupState._target.messageManager.sendAsyncMessage("Browser:SelectionMove", json);
this._sendAsyncMessage("Browser:SelectionMove", json);
},
showToast: function showToast(aString) {

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

@ -34,8 +34,6 @@ const kMaxVelocity = 6;
// in metro. Fixing something in this mode does not insure the bug is
// in metro.
const kDebugMouseInputPref = "metro.debug.treatmouseastouch";
// Colorizes the touch input overlay so you know when it is active.
const kDebugMouseLayerPref = "metro.debug.colorizeInputOverlay";
// Display rects around selection ranges. Useful in debugging
// selection problems.
const kDebugSelectionDisplayPref = "metro.debug.selection.displayRanges";
@ -94,6 +92,7 @@ var TouchModule = {
// capture phase events
window.addEventListener("CancelTouchSequence", this, true);
window.addEventListener("dblclick", this, true);
// bubble phase
window.addEventListener("contextmenu", this, false);
@ -142,6 +141,18 @@ var TouchModule = {
case "touchend":
this._onTouchEnd(aEvent);
break;
case "dblclick":
// XXX This will get picked up somewhere below us for "double tap to zoom"
// once we get omtc and the apzc. Currently though dblclick is delivered to
// content and triggers selection of text, so fire up the SelectionHelperUI
// once selection is present.
setTimeout(function () {
let contextInfo = { name: "",
json: { xPos: aEvent.clientX, yPos: aEvent.clientY },
target: Browser.selectedTab.browser };
SelectionHelperUI.attachEditSession(contextInfo);
}, 50);
break;
}
}
}

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

@ -10,7 +10,6 @@ var PreferencesPanelView = {
if (aEvent.detail && aEvent.popup === Elements.prefsFlyout) {
Elements.prefsFlyout.removeEventListener("PopupChanged", onShow, false);
MasterPasswordUI.updatePreference();
WeaveGlue.init();
}
}, false);
}

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

@ -285,15 +285,6 @@ let WeaveGlue = {
document.getElementById("syncsetup-button-connect").disabled = disabled;
},
showDetails: function showDetails() {
// Show the connect UI detail settings
let show = this._elements.sync.collapsed;
this._elements.details.checked = show;
this._elements.sync.collapsed = !show;
this._elements.device.collapsed = !show;
this._elements.disconnect.collapsed = !show;
},
tryConnect: function login() {
// If Sync is not configured, simply show the setup dialog
if (this._loginError || Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED) {
@ -409,7 +400,7 @@ let WeaveGlue = {
elements[id] = document.getElementById("syncsetup-" + id);
});
let settingids = ["device", "connect", "connected", "disconnect", "sync", "details", "pairdevice"];
let settingids = ["device", "connect", "connected", "disconnect", "sync", "pairdevice"];
settingids.forEach(function(id) {
elements[id] = document.getElementById("sync-" + id);
});
@ -436,7 +427,6 @@ let WeaveGlue = {
// Make some aliases
let connect = this._elements.connect;
let connected = this._elements.connected;
let details = this._elements.details;
let device = this._elements.device;
let disconnect = this._elements.disconnect;
let sync = this._elements.sync;
@ -465,12 +455,12 @@ let WeaveGlue = {
if (!isConfigured) {
connect.setAttribute("title", this._bundle.GetStringFromName("notconnected.label"));
connect.firstChild.disabled = false;
details.checked = false;
sync.collapsed = true;
device.collapsed = true;
disconnect.collapsed = true;
}
sync.collapsed = !isConfigured;
device.collapsed = !isConfigured;
disconnect.collapsed = !isConfigured;
// Check the lock on a timeout because it's set just after notifying
setTimeout(function(self) {
// Prevent certain actions when the service is locked

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

@ -16,6 +16,7 @@ browser.search.contextTextSearchLabel=Search %S for ".."
# Settings Charms
aboutCharm1=About
optionsCharm=Options
syncCharm=Sync
helpOnlineCharm=Help (online)
# General

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

@ -25,5 +25,6 @@
<!ENTITY optionsHeader.privacy.doNotTrack.title "Tracking">
<!ENTITY optionsHeader.privacy.doNotTrack.label "Tell websites not to track me">
<!ENTITY optionsHeader.privacy.masterPassword.label "Use Master Password">
<!-- see sync.dtd -->
<!-- ## Sync Flyout Panel ## -->
<!-- see sync.dtd -->

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

@ -2,11 +2,11 @@
- 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/. -->
<!ENTITY sync.title "Sync">
<!ENTITY syncHeader.title "Sync">
<!ENTITY sync.notconnected "Not connected">
<!ENTITY sync.connect "Connect">
<!ENTITY sync.connected "Connected">
<!ENTITY sync.details "Details">
<!ENTITY sync.deviceName "This device">
<!ENTITY sync.disconnect "Disconnect">
<!ENTITY sync.syncNow "Sync Now">

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

@ -628,6 +628,12 @@ flyoutpanel > settings:first-child {
margin-top: 0px;
}
/* Sync flyout pane */
#sync-flyoutpanel {
width: 400px;
}
/* About flyout pane */
#about-flyoutpanel {
@ -687,10 +693,12 @@ settings {
}
/* <setting> elements that are not in a <settings> group get special treatment */
#prefs-flyoutpanel > setting {
#prefs-flyoutpanel > setting,
#sync-flyoutpanel > setting {
margin-top: 16px;
}
#prefs-flyoutpanel > setting .preferences-title {
#prefs-flyoutpanel > setting .preferences-title,
font-weight: bold
}

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

@ -9023,9 +9023,9 @@ if test "${OS_TARGET}" = "WINNT"; then
elif test "${OS_TARGET}" = "Android"; then
EXTRA_GYP_DEFINES="-D gtest_target_type=executable -D android_toolchain=${android_toolchain} -G os=android "
if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
EXTRA_GYP_DEFINES+=" -D armv7=0 "
EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
else
EXTRA_GYP_DEFINES+=" -D armv7=1 "
EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=1 "
fi
fi

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

@ -34,7 +34,7 @@ function loadBrowser(isApp, callback) {
if (isApp) {
iframe.setAttribute("mozapp", APP_MANIFEST);
}
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.src = APP_URL;
document.getElementById("content").appendChild(iframe);

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

@ -43,7 +43,7 @@
ok("Browser prefs set.");
let iframe = document.createElement("iframe");
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.id = "iframe";
iframe.src = childFrameURL;

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

@ -45,7 +45,7 @@ function setUp() {
function loadApp(callback) {
let iframe = document.createElement("iframe");
iframe.setAttribute("mozapp", APP_MANIFEST);
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.src = APP_URL;
document.getElementById("content").appendChild(iframe);

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

@ -14,6 +14,6 @@ load 746813-1.html
load 743499-negative-size.html
skip-if(Android) load 767337-1.html
skip-if(Android||B2G) load 780392-1.html # bug 833371 for B2G
skip-if(B2G) load 789933-1.html # bug 833371
skip-if(Android||B2G) load 789933-1.html # bug 833371
load 794463-1.html
load 802926-1.html

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

@ -1899,19 +1899,6 @@ nsTextEditorState::SetValue(const nsAString& aValue, bool aUserInput,
selPriv->EndBatchChanges();
}
}
// This second check _shouldn't_ be necessary, but let's be safe.
if (!weakFrame.IsAlive()) {
return;
}
nsIScrollableFrame* scrollableFrame = do_QueryFrame(mBoundFrame->GetFirstPrincipalChild());
if (scrollableFrame)
{
// Scroll the upper left corner of the text control's
// content area back into view.
scrollableFrame->ScrollTo(nsPoint(0, 0), nsIScrollableFrame::INSTANT);
}
} else {
if (!mValue) {
mValue = new nsCString;

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

@ -52,6 +52,7 @@ MOCHITEST_FILES = \
test_input_sanitization.html \
test_valueasdate_attribute.html \
test_input_file_b2g_disabled.html \
test_input_textarea_set_value_no_scroll.html \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -0,0 +1,122 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=829606
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 829606</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript;version=1.7">
/** Test for Bug 829606 **/
/*
* This test checks that setting .value on an text field (input or textarea)
* doesn't scroll the field to its beginning.
*/
SimpleTest.waitForExplicitFinish();
var gTestRunner = null;
function test(aElementName)
{
var element = document.getElementsByTagName(aElementName)[0];
element.focus();
var baseSnapshot = snapshotWindow(window);
// This is a sanity check.
var s2 = snapshotWindow(window);
var results = compareSnapshots(baseSnapshot, snapshotWindow(window), true);
ok(results[0], "sanity check: screenshots should be the same");
element.selectionStart = element.selectionEnd = element.value.length;
setTimeout(function() {
synthesizeKey('f', {});
var selectionAtTheEndSnapshot = snapshotWindow(window);
results = compareSnapshots(baseSnapshot, selectionAtTheEndSnapshot, false);
ok(results[0], "after appending a character, string should have changed");
element.value = element.value;
var tmpSnapshot = snapshotWindow(window);
results = compareSnapshots(baseSnapshot, tmpSnapshot, false);
ok(results[0], "re-settig the value should change nothing");
results = compareSnapshots(selectionAtTheEndSnapshot, tmpSnapshot, true);
ok(results[0], "re-settig the value should change nothing");
element.selectionStart = element.selectionEnd = 0;
element.blur();
gTestRunner.next();
}, 0);
}
// This test checks that when a textarea has a long list of values and the
// textarea's value is then changed, the values are shown correctly.
function testCorrectUpdateOnScroll()
{
var textarea = document.createElement('textarea');
textarea.rows = 5;
textarea.cols = 10;
textarea.value = 'a\nb\nc\nd';
document.getElementById('content').appendChild(textarea);
var baseSnapshot = snapshotWindow(window);
textarea.value = '1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n';
textarea.selectionStart = textarea.selectionEnd = textarea.value.length;
var fullSnapshot = snapshotWindow(window);
var results = compareSnapshots(baseSnapshot, fullSnapshot, false);
ok(results[0], "sanity check: screenshots should not be the same");
textarea.value = 'a\nb\nc\nd';
var tmpSnapshot = snapshotWindow(window);
results = compareSnapshots(baseSnapshot, tmpSnapshot, true);
ok(results[0], "textarea view should look like the beginning");
setTimeout(function() {
gTestRunner.next();
}, 0);
}
function runTest()
{
test('input');
yield;
test('textarea');
yield;
testCorrectUpdateOnScroll();
yield;
SimpleTest.finish();
yield;
}
gTestRunner = runTest();
SimpleTest.waitForFocus(function() {
gTestRunner.next();
});;
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=829606">Mozilla Bug 829606</a>
<p id="display"></p>
<div id="content">
<textarea rows='1' cols='5'>this is a \n long text</textarea>
<input size='5' value="this is a very long text">
</div>
<pre id="test">
</pre>
</body>
</html>

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

@ -21,7 +21,11 @@
<pre id="test">
<script type="application/javascript">
SimpleTest.expectAssertions(1); // bug 845552
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 1); // bug 845552
} else {
SimpleTest.expectAssertions(1); // bug 845552
}
/** Tests for Bug 545812 **/

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

@ -100,6 +100,10 @@ public:
* Insert aDuration of null data at the end of the segment.
*/
virtual void AppendNullData(TrackTicks aDuration) = 0;
/**
* Remove all contents, setting duration to 0.
*/
virtual void Clear() = 0;
protected:
MediaSegment(Type aType) : mDuration(0), mType(aType)
@ -186,6 +190,11 @@ public:
}
mDuration += aDuration;
}
virtual void Clear()
{
mDuration = 0;
mChunks.Clear();
}
class ChunkIterator {
public:

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

@ -118,6 +118,9 @@ MediaStreamGraphImpl::ExtractPendingInput(SourceMediaStream* aStream,
StreamTime t =
GraphTimeToStreamTime(aStream, mStateComputedTime) +
(aDesiredUpToTime - mStateComputedTime);
LOG(PR_LOG_DEBUG, ("Calling NotifyPull aStream=%p t=%f current end=%f", aStream,
MediaTimeToSeconds(t),
MediaTimeToSeconds(aStream->mBuffer.GetEnd())));
if (t > aStream->mBuffer.GetEnd()) {
*aEnsureNextIteration = true;
for (uint32_t j = 0; j < aStream->mListeners.Length(); ++j) {
@ -1637,22 +1640,25 @@ SourceMediaStream::AddTrack(TrackID aID, TrackRate aRate, TrackTicks aStart,
}
}
void
bool
SourceMediaStream::AppendToTrack(TrackID aID, MediaSegment* aSegment)
{
MutexAutoLock lock(mMutex);
// ::EndAllTrackAndFinished() can end these before the sources notice
bool appended = false;
if (!mFinished) {
TrackData *track = FindDataForTrack(aID);
if (track) {
track->mData->AppendFrom(aSegment);
appended = true;
} else {
NS_ERROR("Append to non-existent track!");
aSegment->Clear();
}
}
if (!mDestroyed) {
GraphImpl()->EnsureNextIteration();
}
return appended;
}
bool
@ -1663,8 +1669,7 @@ SourceMediaStream::HaveEnoughBuffered(TrackID aID)
if (track) {
return track->mHaveEnough;
}
NS_ERROR("No track in HaveEnoughBuffered!");
return true;
return false;
}
void
@ -1674,7 +1679,7 @@ SourceMediaStream::DispatchWhenNotEnoughBuffered(TrackID aID,
MutexAutoLock lock(mMutex);
TrackData* data = FindDataForTrack(aID);
if (!data) {
NS_ERROR("No track in DispatchWhenNotEnoughBuffered");
aSignalThread->Dispatch(aSignalRunnable, 0);
return;
}
@ -1694,8 +1699,6 @@ SourceMediaStream::EndTrack(TrackID aID)
TrackData *track = FindDataForTrack(aID);
if (track) {
track->mCommands |= TRACK_END;
} else {
NS_ERROR("End of non-existant track");
}
}
if (!mDestroyed) {

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

@ -567,22 +567,27 @@ public:
/**
* Append media data to a track. Ownership of aSegment remains with the caller,
* but aSegment is emptied.
* Returns false if the data was not appended because no such track exists
* or the stream was already finished.
*/
void AppendToTrack(TrackID aID, MediaSegment* aSegment);
bool AppendToTrack(TrackID aID, MediaSegment* aSegment);
/**
* Returns true if the buffer currently has enough data.
* Returns false if there isn't enough data or if no such track exists.
*/
bool HaveEnoughBuffered(TrackID aID);
/**
* Ensures that aSignalRunnable will be dispatched to aSignalThread
* when we don't have enough buffered data in the track (which could be
* immediately).
* immediately). Will dispatch the runnable immediately if the track
* does not exist.
*/
void DispatchWhenNotEnoughBuffered(TrackID aID,
nsIThread* aSignalThread, nsIRunnable* aSignalRunnable);
/**
* Indicate that a track has ended. Do not do any more API calls
* affecting this track.
* Ignored if the track does not exist.
*/
void EndTrack(TrackID aID);
/**
@ -653,7 +658,6 @@ protected:
return &mUpdateTracks[i];
}
}
NS_ERROR("Bad track ID!");
return nullptr;
}

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

@ -21,6 +21,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=490705
<pre id="test">
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 2); // bug 845676
}
/**
* FFT is a class for calculating the Discrete Fourier Transform of a signal
* with the Fast Fourier Transform algorithm.

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

@ -16,6 +16,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=493187
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.expectAssertions(0, 1);
var manager = new MediaTestManager;
function start(e) {

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

@ -17,6 +17,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=490705
<pre id="test">
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 2); // bug 845676
}
var testFile = "bug495794.ogg";
var testFileDuration = 0.30;
var testFileChannelCount = 6;

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

@ -11,6 +11,10 @@
<pre id="test">
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 20); // bug 845676
}
var manager = new MediaTestManager;
function startTest(test, token) {

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

@ -9,6 +9,11 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 16); // bug 845676
}
var manager = new MediaTestManager;
function startTest(test, token) {

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

@ -10,6 +10,10 @@
<pre id="test">
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 20); // bug 845676
}
var manager = new MediaTestManager;
function ended(evt) {

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

@ -11,6 +11,10 @@
<script>
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 16); // bug 845676
}
var manager = new MediaTestManager;
var tokens = {

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

@ -10,6 +10,11 @@
<pre id="test">
<script>
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 16); // bug 845676
}
var manager = new MediaTestManager;
var tokens = {

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

@ -10,6 +10,10 @@
<pre id="test">
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 18); // bug 845676
}
var manager = new MediaTestManager;
function startTest(test, token) {

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

@ -10,6 +10,10 @@
<pre id="test">
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 84); // bug 845676
}
var manager = new MediaTestManager;
function startTest(test, token) {

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

@ -10,6 +10,10 @@
<pre id="test">
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 16); // bug 845676
}
var manager = new MediaTestManager;
function startTest(test, token) {

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

@ -12,6 +12,8 @@
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 1);
} else if (navigator.platform.startsWith("Mac")) {
SimpleTest.expectAssertions(0, 2);
}
let manager = new MediaTestManager;

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

@ -21,6 +21,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=548523
<pre id="test">
<script type="application/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 8); // bug 845676
}
/** Test for Bug 548523 **/
var manager = new MediaTestManager;

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

@ -23,7 +23,7 @@
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.expectAssertions(120, 400);
SimpleTest.expectAssertions(80, 400);
var manager = new MediaTestManager;

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

@ -20,6 +20,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=713381
<pre id="test">
<script type="application/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 2); // bug 845676
}
/** Test for Bug 713381 **/
const num = 500;

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

@ -124,8 +124,11 @@ MediaEngineWebRTCVideoSource::NotifyPull(MediaStreamGraph* aGraph,
if (delta > 0) {
// NULL images are allowed
segment.AppendFrame(image ? image.forget() : nullptr, delta, gfxIntSize(mWidth, mHeight));
aSource->AppendToTrack(aID, &(segment));
aLastEndTime = target;
// This can fail if either a) we haven't added the track yet, or b)
// we've removed or finished the track.
if (aSource->AppendToTrack(aID, &(segment))) {
aLastEndTime = target;
}
}
}

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

@ -872,9 +872,9 @@ void
nsDocShell::DestroyChildren()
{
nsCOMPtr<nsIDocShellTreeItem> shell;
uint32_t n = mChildList.Length();
for (uint32_t i = 0; i < n; i++) {
shell = do_QueryInterface(ChildAt(i));
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
shell = do_QueryObject(iter.GetNext());
NS_ASSERTION(shell, "docshell has null child");
if (shell) {
@ -2080,9 +2080,9 @@ nsDocShell::SetPrivateBrowsing(bool aUsePrivateBrowsing)
}
}
uint32_t count = mChildList.Length();
for (uint32_t i = 0; i < count; ++i) {
nsCOMPtr<nsILoadContext> shell = do_QueryInterface(ChildAt(i));
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
nsCOMPtr<nsILoadContext> shell = do_QueryObject(iter.GetNext());
if (shell) {
shell->SetPrivateBrowsing(aUsePrivateBrowsing);
}
@ -2116,9 +2116,9 @@ nsDocShell::SetAffectPrivateSessionLifetime(bool aAffectLifetime)
}
mAffectPrivateSessionLifetime = aAffectLifetime;
uint32_t count = mChildList.Length();
for (uint32_t i = 0; i < count; ++i) {
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(ChildAt(i));
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
nsCOMPtr<nsIDocShell> shell = do_QueryObject(iter.GetNext());
if (shell) {
shell->SetAffectPrivateSessionLifetime(aAffectLifetime);
}
@ -2488,9 +2488,9 @@ nsDocShell::HistoryPurged(int32_t aNumEntries)
mPreviousTransIndex = std::max(-1, mPreviousTransIndex - aNumEntries);
mLoadedTransIndex = std::max(0, mLoadedTransIndex - aNumEntries);
uint32_t count = mChildList.Length();
for (uint32_t i = 0; i < count; ++i) {
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(ChildAt(i));
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
nsCOMPtr<nsIDocShell> shell = do_QueryObject(iter.GetNext());
if (shell) {
shell->HistoryPurged(aNumEntries);
}
@ -2518,9 +2518,9 @@ nsDocShell::HistoryTransactionRemoved(int32_t aIndex)
--mLoadedTransIndex;
}
uint32_t count = mChildList.Length();
for (uint32_t i = 0; i < count; ++i) {
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(ChildAt(i));
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
nsCOMPtr<nsIDocShell> shell = do_QueryObject(iter.GetNext());
if (shell) {
static_cast<nsDocShell*>(shell.get())->
HistoryTransactionRemoved(aIndex);
@ -3403,9 +3403,9 @@ nsDocShell::SetTreeOwner(nsIDocShellTreeOwner * aTreeOwner)
mTreeOwner = aTreeOwner; // Weak reference per API
uint32_t n = mChildList.Length();
for (uint32_t i = 0; i < n; i++) {
nsCOMPtr<nsIDocShellTreeItem> child = do_QueryInterface(ChildAt(i));
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
nsCOMPtr<nsIDocShellTreeItem> child = do_QueryObject(iter.GetNext());
NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
int32_t childType = ~mItemType; // Set it to not us in case the get fails
child->GetItemType(&childType); // We don't care if this fails, if it does we won't set the owner
@ -3602,7 +3602,7 @@ nsDocShell::GetChildAt(int32_t aIndex, nsIDocShellTreeItem ** aChild)
}
#endif
nsIDocumentLoader* child = SafeChildAt(aIndex);
nsIDocumentLoader* child = ChildAt(aIndex);
NS_ENSURE_TRUE(child, NS_ERROR_UNEXPECTED);
return CallQueryInterface(child, aChild);
@ -3624,9 +3624,9 @@ nsDocShell::FindChildWithName(const PRUnichar * aName,
return NS_OK;
nsXPIDLString childName;
uint32_t n = mChildList.Length();
for (uint32_t i = 0; i < n; i++) {
nsCOMPtr<nsIDocShellTreeItem> child = do_QueryInterface(ChildAt(i));
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
nsCOMPtr<nsIDocShellTreeItem> child = do_QueryObject(iter.GetNext());
NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
int32_t childType;
child->GetItemType(&childType);
@ -4676,9 +4676,9 @@ nsDocShell::Stop(uint32_t aStopFlags)
Stop();
}
uint32_t count = mChildList.Length();
for (uint32_t n = 0; n < count; n++) {
nsCOMPtr<nsIWebNavigation> shellAsNav(do_QueryInterface(ChildAt(n)));
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
nsCOMPtr<nsIWebNavigation> shellAsNav(do_QueryObject(iter.GetNext()));
if (shellAsNav)
shellAsNav->Stop(aStopFlags);
}
@ -5290,9 +5290,9 @@ nsDocShell::SetIsActive(bool aIsActive)
// Recursively tell all of our children, but don't tell <iframe mozbrowser>
// children; they handle their state separately.
uint32_t n = mChildList.Length();
for (uint32_t i = 0; i < n; ++i) {
nsCOMPtr<nsIDocShell> docshell = do_QueryInterface(ChildAt(i));
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
nsCOMPtr<nsIDocShell> docshell = do_QueryObject(iter.GetNext());
if (!docshell) {
continue;
}
@ -6213,9 +6213,9 @@ nsDocShell::SuspendRefreshURIs()
}
// Suspend refresh URIs for our child shells as well.
uint32_t n = mChildList.Length();
for (uint32_t i = 0; i < n; ++i) {
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(ChildAt(i));
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
nsCOMPtr<nsIDocShell> shell = do_QueryObject(iter.GetNext());
if (shell)
shell->SuspendRefreshURIs();
}
@ -6229,9 +6229,9 @@ nsDocShell::ResumeRefreshURIs()
RefreshURIFromQueue();
// Resume refresh URIs for our child shells as well.
uint32_t n = mChildList.Length();
for (uint32_t i = 0; i < n; ++i) {
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(ChildAt(i));
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
nsCOMPtr<nsIDocShell> shell = do_QueryObject(iter.GetNext());
if (shell)
shell->ResumeRefreshURIs();
}
@ -7276,9 +7276,9 @@ nsDocShell::BeginRestore(nsIContentViewer *aContentViewer, bool aTop)
nsresult
nsDocShell::BeginRestoreChildren()
{
uint32_t n = mChildList.Length();
for (uint32_t i = 0; i < n; ++i) {
nsCOMPtr<nsIDocShell> child = do_QueryInterface(ChildAt(i));
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
nsCOMPtr<nsIDocShell> child = do_QueryObject(iter.GetNext());
if (child) {
nsresult rv = child->BeginRestore(nullptr, false);
NS_ENSURE_SUCCESS(rv, rv);
@ -7293,9 +7293,9 @@ nsDocShell::FinishRestore()
// First we call finishRestore() on our children. In the simulated load,
// all of the child frames finish loading before the main document.
uint32_t n = mChildList.Length();
for (uint32_t i = 0; i < n; ++i) {
nsCOMPtr<nsIDocShell> child = do_QueryInterface(ChildAt(i));
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
nsCOMPtr<nsIDocShell> child = do_QueryObject(iter.GetNext());
if (child) {
child->FinishRestore();
}
@ -7798,9 +7798,9 @@ nsDocShell::RestoreFromHistory()
// Meta-refresh timers have been restarted for this shell, but not
// for our children. Walk the child shells and restart their timers.
uint32_t n = mChildList.Length();
for (uint32_t i = 0; i < n; ++i) {
nsCOMPtr<nsIDocShell> child = do_QueryInterface(ChildAt(i));
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
nsCOMPtr<nsIDocShell> child = do_QueryObject(iter.GetNext());
if (child)
child->ResumeRefreshURIs();
}
@ -10811,10 +10811,9 @@ nsDocShell::WalkHistoryEntries(nsISHEntry *aRootEntry,
// Walk the children of aRootShell and see if one of them
// has srcChild as a SHEntry.
uint32_t childCount = aRootShell->mChildList.Length();
for (uint32_t j = 0; j < childCount; ++j) {
nsDocShell *child =
static_cast<nsDocShell*>(aRootShell->ChildAt(j));
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(aRootShell->mChildList);
while (iter.HasMore()) {
nsDocShell *child = static_cast<nsDocShell*>(iter.GetNext());
if (child->HasHistoryEntry(childEntry)) {
childShell = child;

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

@ -9,7 +9,7 @@
iframe { width: 90%; height: 50px; }
</style>
<script>
if (navigator.platform.startsWith("Mac")) {
if (!navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 1);
}

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

@ -9,7 +9,7 @@
iframe { width: 90%; height: 200px; }
</style>
<script>
if (navigator.platform.startsWith("Mac")) {
if (!navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 1);
}

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

@ -9,6 +9,10 @@
iframe { width: 90%; height: 50px; }
</style>
<script>
if (navigator.platform.startsWith("Linux")) {
SimpleTest.expectAssertions(0, 1);
}
window.onload = function () {
//navigateByLocation(window0); // Don't have a handle to the window.
navigateByOpen("window1");

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

@ -9,6 +9,10 @@
iframe { width: 90%; height: 50px; }
</style>
<script>
if (navigator.platform.startsWith("Linux")) {
SimpleTest.expectAssertions(0, 1);
}
window.onload = function () {
navigateByLocation(window0);
navigateByOpen("window1");

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

@ -5,9 +5,15 @@
#include "nsIDOMClassInfo.h"
#include "DOMError.h"
#include "nsString.h"
#include "nsIRandomGenerator.h"
#include "jsapi.h"
#include "jsfriendapi.h"
#include "nsIServiceManager.h"
#include "nsCOMPtr.h"
#include "nsIRandomGenerator.h"
#include "mozilla/dom/ContentChild.h"
using mozilla::dom::ContentChild;
using namespace js::ArrayBufferView;
@ -36,6 +42,8 @@ Crypto::~Crypto()
NS_IMETHODIMP
Crypto::GetRandomValues(const jsval& aData, JSContext *cx, jsval* _retval)
{
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Called on the wrong thread");
// Make sure this is a JavaScript object
if (!aData.isObject()) {
return NS_ERROR_DOM_NOT_OBJECT_ERR;
@ -72,27 +80,31 @@ Crypto::GetRandomValues(const jsval& aData, JSContext *cx, jsval* _retval)
return NS_ERROR_DOM_QUOTA_EXCEEDED_ERR;
}
nsCOMPtr<nsIRandomGenerator> randomGenerator;
nsresult rv;
randomGenerator =
do_GetService("@mozilla.org/security/random-generator;1", &rv);
if (NS_FAILED(rv)) {
NS_WARNING("unable to continue without random number generator");
return rv;
}
void *dataptr = JS_GetArrayBufferViewData(view);
NS_ENSURE_TRUE(dataptr, NS_ERROR_FAILURE);
unsigned char* data =
static_cast<unsigned char*>(dataptr);
uint8_t *buf;
rv = randomGenerator->GenerateRandomBytes(dataLen, &buf);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
if (XRE_GetProcessType() != GeckoProcessType_Default) {
InfallibleTArray<uint8_t> randomValues;
// Tell the parent process to generate random values via PContent
ContentChild* cc = ContentChild::GetSingleton();
if (!cc->SendGetRandomValues(dataLen, &randomValues)) {
return NS_ERROR_FAILURE;
}
NS_ASSERTION(dataLen == randomValues.Length(),
"Invalid length returned from parent process!");
memcpy(data, randomValues.Elements(), dataLen);
} else {
uint8_t *buf = GetRandomValues(dataLen);
memcpy(data, buf, dataLen);
NS_Free(buf);
if (!buf) {
return NS_ERROR_FAILURE;
}
memcpy(data, buf, dataLen);
NS_Free(buf);
}
*_retval = OBJECT_TO_JSVAL(view);
@ -168,5 +180,22 @@ Crypto::DisableRightClick()
}
#endif
uint8_t*
Crypto::GetRandomValues(uint32_t aLength)
{
nsCOMPtr<nsIRandomGenerator> randomGenerator;
nsresult rv;
randomGenerator =
do_GetService("@mozilla.org/security/random-generator;1");
NS_ENSURE_TRUE(randomGenerator, nullptr);
uint8_t* buf;
rv = randomGenerator->GenerateRandomBytes(aLength, &buf);
NS_ENSURE_SUCCESS(rv, nullptr);
return buf;
}
} // namespace dom
} // namespace mozilla

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

@ -25,6 +25,9 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMCRYPTO
static uint8_t*
GetRandomValues(uint32_t aLength);
};
} // namespace dom

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

@ -3011,8 +3011,9 @@ nsDOMWindowUtils::SelectAtPoint(float aX, float aY, uint32_t aSelectBehavior,
}
// Get the target frame at the client coordinates passed to us
nsCOMPtr<nsIWidget> widget = GetWidget();
nsIntPoint pt(aX, aY);
nsPoint offset;
nsCOMPtr<nsIWidget> widget = GetWidget(&offset);
nsIntPoint pt = ToWidgetPoint(aX, aY, offset, GetPresContext());
nsPoint ptInRoot =
nsLayoutUtils::GetEventCoordinatesRelativeTo(widget, pt, rootFrame);
nsIFrame* targetFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, ptInRoot);

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

@ -1023,7 +1023,65 @@ class IDLDictionary(IDLObjectWithScope):
[member.location, inheritedMember.location])
def validate(self):
pass
def typeContainsDictionary(memberType, dictionary):
"""
Returns a tuple whose:
- First element is a Boolean value indicating whether
memberType contains dictionary.
- Second element is:
A list of locations that leads from the type that was passed in
the memberType argument, to the dictionary being validated,
if the boolean value in the first element is True.
None, if the boolean value in the first element is False.
"""
if memberType.nullable() or \
memberType.isArray() or \
memberType.isSequence():
return typeContainsDictionary(memberType.inner, dictionary)
if memberType.isDictionary():
if memberType.inner == dictionary:
return (True, [memberType.location])
(contains, locations) = dictionaryContainsDictionary(memberType.inner, \
dictionary)
if contains:
return (True, [memberType.location] + locations)
if memberType.isUnion():
for member in memberType.flatMemberTypes:
(contains, locations) = typeContainsDictionary(member, dictionary)
if contains:
return (True, locations)
return (False, None)
def dictionaryContainsDictionary(dictMember, dictionary):
for member in dictMember.members:
(contains, locations) = typeContainsDictionary(member.type, dictionary)
if contains:
return (True, [member.location] + locations)
if dictMember.parent:
if dictMember.parent == dictionary:
return (True, [dictMember.location])
else:
(contains, locations) = dictionaryContainsDictionary(dictMember.parent, dictionary)
if contains:
return (True, [dictMember.location] + locations)
return (False, None)
for member in self.members:
(contains, locations) = typeContainsDictionary(member.type, self)
if contains:
raise WebIDLError("Dictionary %s has member with itself as type." %
self.identifier.name,
[member.location] + locations)
def addExtendedAttributes(self, attrs):
assert len(attrs) == 0

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

@ -296,3 +296,132 @@ def WebIDLTest(parser, harness):
""")
results = parser.finish()
harness.ok(True, "Union arg containing a dictionary should actually parse")
parser = parser.reset()
threw = False
try:
parser.parse("""
dictionary Foo {
Foo foo;
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Member type must not be its Dictionary.")
parser = parser.reset()
threw = False
try:
parser.parse("""
dictionary Foo3 : Foo {
short d;
};
dictionary Foo2 : Foo3 {
boolean c;
};
dictionary Foo1 : Foo2 {
long a;
};
dictionary Foo {
Foo1 b;
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Member type must not be a Dictionary that "
"inherits from its Dictionary.")
parser = parser.reset()
threw = False
try:
parser.parse("""
dictionary Foo {
(Foo or DOMString)[]? b;
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Member type must not be a Nullable type "
"whose inner type includes its Dictionary.")
parser = parser.reset()
threw = False
try:
parser.parse("""
dictionary Foo {
(DOMString or Foo) b;
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Member type must not be a Union type, one of "
"whose member types includes its Dictionary.")
parser = parser.reset()
threw = False
try:
parser.parse("""
dictionary Foo {
sequence<sequence<sequence<Foo>>> c;
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Member type must not be a Sequence type "
"whose element type includes its Dictionary.")
parser = parser.reset()
threw = False
try:
parser.parse("""
dictionary Foo {
(DOMString or Foo)[] d;
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Member type must not be an Array type "
"whose element type includes its Dictionary.")
parser = parser.reset()
threw = False
try:
parser.parse("""
dictionary Foo {
Foo1 b;
};
dictionary Foo3 {
Foo d;
};
dictionary Foo2 : Foo3 {
short c;
};
dictionary Foo1 : Foo2 {
long a;
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Member type must not be a Dictionary, one of whose "
"members or inherited members has a type that includes "
"its Dictionary.")

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

@ -15,7 +15,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
document.body.appendChild(iframe);
mm = SpecialPowers.getBrowserFrameMessageManager(iframe);

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

@ -11,7 +11,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
is(e.detail.message, 'Hello');

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

@ -26,7 +26,7 @@ makeAllAppsLaunchable();
function testAppElement(expectAnApp, callback) {
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp');
iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
is(e.detail.message == 'app', expectAnApp, e.detail.message);

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

@ -13,7 +13,7 @@ function runTest() {
SpecialPowers.addPermission("embed-apps", true, document);
var iframe1 = document.createElement('iframe');
iframe1.mozbrowser = true;
SpecialPowers.wrap(iframe1).mozbrowser = true;
iframe1.setAttribute('mozapp', 'http://example.org/manifest.webapp');
// Two mozapp frames for different apps with the same code both do the same
@ -26,7 +26,7 @@ function runTest() {
SimpleTest.executeSoon(function() {
var iframe2 = document.createElement('iframe');
iframe2.mozbrowser = true;
SpecialPowers.wrap(iframe2).mozbrowser = true;
iframe2.setAttribute('mozapp', 'http://example.com/manifest.webapp');
iframe2.addEventListener('mozbrowseropenwindow', function(e) {

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

@ -17,7 +17,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
document.body.appendChild(iframe);
// Wait for the initial load to finish, then navigate the page, then start test

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

@ -22,7 +22,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
addOneShotIframeEventListener('mozbrowserloadend', function() {
SimpleTest.executeSoon(test2);

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

@ -47,7 +47,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
document.body.appendChild(iframe);
iframe.src = 'data:text/html,<html>' +
'<body style="background:green">hello</body></html>';

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

@ -14,7 +14,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe1 = document.createElement('iframe');
iframe1.mozbrowser = true;
SpecialPowers.wrap(iframe1).mozbrowser = true;
// Two mozbrowser frames with the same code both do the same
// window.open("foo", "bar") call. We should only get one
@ -36,7 +36,7 @@ function runTest() {
SimpleTest.executeSoon(function() {
var iframe2 = document.createElement('iframe');
iframe2.mozbrowser = true;
SpecialPowers.wrap(iframe2).mozbrowser = true;
iframe2.addEventListener('mozbrowseropenwindow', function(e) {
ok(false, "Got second mozbrowseropenwindow event.");

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

@ -11,7 +11,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
document.body.appendChild(iframe);
iframe.addEventListener("mozbrowserclose", function(e) {

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

@ -22,11 +22,11 @@ function runTest() {
// frame.
var appFrame = document.createElement('iframe');
appFrame.mozbrowser = true;
SpecialPowers.wrap(appFrame).mozbrowser = true;
appFrame.setAttribute('mozapp', 'http://example.org/manifest.webapp');
var browserFrame = document.createElement('iframe');
browserFrame.mozbrowser = true;
SpecialPowers.wrap(browserFrame).mozbrowser = true;
var gotAppFrameClose = false;
appFrame.addEventListener('mozbrowserclose', function() {

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

@ -11,7 +11,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.addEventListener('mozbrowseropenwindow', function(e) {
ok(true, "got openwindow event.");

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

@ -34,7 +34,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe1 = document.createElement('iframe');
iframe1.mozbrowser = true;
SpecialPowers.wrap(iframe1).mozbrowser = true;
document.body.appendChild(iframe1);
iframe1.src = 'data:text/html,<html>' +
'<body>' +

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

@ -14,7 +14,7 @@ function runTest() {
const innerPage = 'http://example.com/tests/dom/browser-element/mochitest/file_browserElement_CookiesNotThirdParty.html';
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
if (e.detail.message == 'next') {

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

@ -12,7 +12,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe1 = document.createElement('iframe');
iframe1.mozbrowser = true;
SpecialPowers.wrap(iframe1).mozbrowser = true;
iframe1.src = 'data:text/html,<html>' +
'<body style="background:green">hello</body></html>';
document.body.appendChild(iframe1);

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

@ -11,7 +11,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe1 = document.createElement('iframe');
iframe1.mozbrowser = true;
SpecialPowers.wrap(iframe1).mozbrowser = true;
iframe1.id = 'iframe1';
iframe1.addEventListener('mozbrowserloadend', function if1_loadend() {
iframe1.removeEventListener('mozbrowserloadend', if1_loadend);

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

@ -62,7 +62,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
runTestQueue([testFirstLoad, testReload, testChangeLocation]);
}

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

@ -12,7 +12,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.addEventListener("mozbrowsererror", function(e) {
ok(true, "Got mozbrowsererror event.");

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

@ -49,7 +49,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
document.body.appendChild(iframe);
testWyciwyg();
}

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

@ -11,7 +11,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
var gotFirstPaint = false;
var gotFirstLocationChange = false;

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

@ -13,7 +13,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.setAttribute('name', 'foo');
iframe.addEventListener("mozbrowseropenwindow", function(e) {

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

@ -11,7 +11,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframeJS = document.createElement('iframe');
iframeJS.mozbrowser = true;
SpecialPowers.wrap(iframeJS).mozbrowser = true;
iframeJS.addEventListener('mozbrowserloadstart', function(e) {
ok(false, "This should not happen!");
@ -25,7 +25,7 @@ function runTest() {
document.body.appendChild(iframeJS);
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
var gotPopup = false;
iframe.addEventListener('mozbrowseropenwindow', function(e) {

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

@ -12,7 +12,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe1 = document.createElement('iframe');
iframe1.mozbrowser = true;
SpecialPowers.wrap(iframe1).mozbrowser = true;
document.body.appendChild(iframe1);
iframe1.src = 'data:text/html,<html>' +
'<body style="background:green">hello</body></html>';

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

@ -19,14 +19,14 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe1 = document.createElement('iframe');
iframe1.mozbrowser = true;
SpecialPowers.wrap(iframe1).mozbrowser = true;
document.body.appendChild(iframe1);
// iframe2 is a red herring; we modify its favicon but don't listen for
// iconchanges; we want to make sure that its iconchange events aren't
// picked up by the listener on iframe1.
var iframe2 = document.createElement('iframe');
iframe2.mozbrowser = true;
SpecialPowers.wrap(iframe2).mozbrowser = true;
document.body.appendChild(iframe2);
// iframe3 is another red herring. It's not a mozbrowser, so we shouldn't

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

@ -23,7 +23,7 @@ browserElementTestHelpers.addPermission();
browserElementTestHelpers.setOOPDisabledPref(true); // this is breaking the autofocus.
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.src = browserElementTestHelpers.focusPage;
document.body.appendChild(iframe);

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

@ -21,7 +21,7 @@ function runTest() {
var seenLocationChange = false;
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.id = 'iframe';
iframe.src = browserElementTestHelpers.emptyPage1;

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

@ -11,7 +11,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
document.body.appendChild(iframe);
// Add a first listener that we'll remove shortly after.

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

@ -29,7 +29,7 @@ function runTest() {
var remote = !browserElementTestHelpers.getOOPByDefaultPref();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.setAttribute('remote', remote);
// The page we load does window.open, then checks some things and reports

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

@ -14,7 +14,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
var gotPopup = false;
iframe.addEventListener('mozbrowseropenwindow', function(e) {

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

@ -11,7 +11,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
var gotPopup = false;
iframe.addEventListener('mozbrowseropenwindow', function(e) {

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

@ -11,7 +11,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.addEventListener('mozbrowseropenwindow', function(e) {
ok(true, 'Got first window.open call');

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

@ -17,7 +17,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
var gotPopup = false;
iframe.addEventListener('mozbrowseropenwindow', function(e) {

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

@ -12,7 +12,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.addEventListener('mozbrowseropenwindow', function(e) {
ok(e.detail.url.indexOf('does_not_exist.html') != -1,

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

@ -16,7 +16,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.addEventListener('mozbrowseropenwindow', function(e) {
ok(e.detail.url.indexOf('does_not_exist.html') != -1,

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

@ -26,7 +26,7 @@ catch(e) {}
SpecialPowers.setIntPref(dialogTimeLimitPrefName, 10);
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
document.body.appendChild(iframe);
var numPrompts = 0;

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

@ -15,7 +15,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
document.body.appendChild(iframe);
var prompts = [

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

@ -22,7 +22,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
addOneShotIframeEventListener('mozbrowserloadend', function() {
SimpleTest.executeSoon(test2);

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

@ -22,7 +22,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.addEventListener('mozbrowserloadend', mozbrowserLoaded);

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

@ -76,7 +76,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
isPostRequestSubmitted = false;
iframe.src = 'file_post_request.html';

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

@ -13,7 +13,7 @@ function runTest() {
browserElementTestHelpers.addPermission();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
SpecialPowers.wrap(iframe).mozbrowser = true;
document.body.appendChild(iframe);
iframe.addEventListener("mozbrowsershowmodalprompt", function(e) {

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше