Merge m-c to inbound.
@ -539,7 +539,7 @@ static nsRoleMapEntry sWAIRoleMaps[] =
|
||||
kUseMapRole,
|
||||
eNoValue,
|
||||
eNoAction,
|
||||
ePoliteLiveAttr,
|
||||
eNoLiveAttr,
|
||||
eSelect,
|
||||
kNoReqStates
|
||||
},
|
||||
|
@ -60,8 +60,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
|
||||
testAttrs("logAssertive", {"live" : "assertive"}, true);
|
||||
testAttrs("marquee", {"live" : "off"}, true);
|
||||
testAttrs("status", {"live" : "polite"}, true);
|
||||
testAttrs("tablist", {"live" : "polite"}, true);
|
||||
testAttrs("timer", {"live" : "off"}, true);
|
||||
testAbsentAttrs("tablist", {"live" : "polite"});
|
||||
|
||||
// container-live object attribute
|
||||
testAttrs("liveChild", {"container-live" : "polite"}, true);
|
||||
@ -70,8 +70,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
|
||||
testAttrs("logAssertiveChild", {"container-live" : "assertive"}, true);
|
||||
testAttrs("marqueeChild", {"container-live" : "off"}, true);
|
||||
testAttrs("statusChild", {"container-live" : "polite"}, true);
|
||||
testAttrs("tablistChild", {"container-live" : "polite"}, true);
|
||||
testAttrs("timerChild", {"container-live" : "off"}, true);
|
||||
testAbsentAttrs("tablistChild", {"container-live" : "polite"});
|
||||
|
||||
// container-live-role object attribute
|
||||
testAttrs("log", {"container-live-role" : "log"}, true);
|
||||
@ -84,8 +84,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
|
||||
testAttrs("logAssertiveChild", {"container-live-role" : "log"}, true);
|
||||
testAttrs("marqueeChild", {"container-live-role" : "marquee"}, true);
|
||||
testAttrs("statusChild", {"container-live-role" : "status"}, true);
|
||||
testAttrs("tablistChild", {"container-live-role" : "tablist"}, true);
|
||||
testAttrs("timerChild", {"container-live-role" : "timer"}, true);
|
||||
testAbsentAttrs("tablistChild", {"container-live-role" : "tablist"});
|
||||
|
||||
// absent aria-label and aria-labelledby object attribute
|
||||
testAbsentAttrs("label", {"label" : "foo"});
|
||||
@ -153,9 +153,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
|
||||
Mozilla Bug 558036
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=663136"
|
||||
title="Add test coverage for tablist as implicit live region">
|
||||
Mozilla Bug 663136
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=896400"
|
||||
title="Tablist should no longer be an implicit live region">
|
||||
Mozilla Bug 896400
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=563862"
|
||||
|
@ -107,7 +107,6 @@ MOCHITEST_BROWSER_TESTS = \
|
||||
browser_dbg_source_maps-02.js \
|
||||
browser_dbg_step-out.js \
|
||||
browser_dbg_event-listeners.js \
|
||||
browser_dbg_break-on-dom-event.js \
|
||||
head.js \
|
||||
$(NULL)
|
||||
|
||||
@ -161,6 +160,14 @@ else
|
||||
$(browser_dbg_createChrome.js disabled to fix for ubuntu hangs, bug 847558)
|
||||
endif
|
||||
|
||||
# Bug 895426:
|
||||
# Disable browser_dbg_break-on-dom-event.js due to frequent failures
|
||||
ifneq (Darwin,$(OS_ARCH))
|
||||
MOCHITEST_BROWSER_TESTS += \
|
||||
browser_dbg_break-on-dom-event.js \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
MOCHITEST_BROWSER_FILES_PARTS = MOCHITEST_BROWSER_TESTS MOCHITEST_BROWSER_PAGES
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -122,25 +122,3 @@ let RemoteTabsStartView = {
|
||||
this._grid.arrangeItems();
|
||||
}
|
||||
};
|
||||
|
||||
let RemoteTabsPanelView = {
|
||||
_view: null,
|
||||
|
||||
get _grid() { return document.getElementById("remotetabs-list"); },
|
||||
get visible() { return PanelUI.isPaneVisible("remotetabs-container"); },
|
||||
|
||||
init: function init() {
|
||||
//decks are fragile, don't hide the tab panel(bad things happen), hide link in menu.
|
||||
let snappedEntry = document.getElementById("snappedRemoteTabsLabel");
|
||||
let uiList = [snappedEntry];
|
||||
this._view = new RemoteTabsView(this._grid, uiList);
|
||||
},
|
||||
|
||||
show: function show() {
|
||||
this._grid.arrangeItems();
|
||||
},
|
||||
|
||||
uninit: function uninit() {
|
||||
this._view.destruct();
|
||||
}
|
||||
};
|
||||
|
@ -9,17 +9,20 @@ const kProgressMarginStart = 30;
|
||||
const kProgressMarginEnd = 70;
|
||||
|
||||
const WebProgress = {
|
||||
get _identityBox() { return document.getElementById("identity-box"); },
|
||||
|
||||
_progressActive: false,
|
||||
|
||||
init: function init() {
|
||||
messageManager.addMessageListener("Content:StateChange", this);
|
||||
messageManager.addMessageListener("Content:LocationChange", this);
|
||||
messageManager.addMessageListener("Content:SecurityChange", this);
|
||||
Elements.progress.addEventListener("transitionend", this._progressTransEnd, true);
|
||||
Elements.tabList.addEventListener("TabSelect", this._onTabSelect, true);
|
||||
|
||||
Elements.progress.addEventListener("transitionend", this, true);
|
||||
Elements.tabList.addEventListener("TabSelect", this, true);
|
||||
|
||||
let urlBar = document.getElementById("urlbar-edit");
|
||||
urlBar.addEventListener("input", this._onUrlBarInput, false);
|
||||
urlBar.addEventListener("input", this, false);
|
||||
|
||||
return this;
|
||||
},
|
||||
@ -62,6 +65,20 @@ const WebProgress = {
|
||||
}
|
||||
},
|
||||
|
||||
handleEvent: function handleEvent(aEvent) {
|
||||
switch (aEvent.type) {
|
||||
case "transitionend":
|
||||
this._progressTransEnd(aEvent);
|
||||
break;
|
||||
case "TabSelect":
|
||||
this._onTabSelect(aEvent);
|
||||
break;
|
||||
case "input":
|
||||
this._onUrlBarInput(aEvent);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
_securityChange: function _securityChange(aJson, aTab) {
|
||||
let state = aJson.state;
|
||||
let nsIWebProgressListener = Ci.nsIWebProgressListener;
|
||||
@ -75,8 +92,7 @@ const WebProgress = {
|
||||
}
|
||||
|
||||
if (aTab == Browser.selectedTab) {
|
||||
let identityBox = document.getElementById("identity-box-inner");
|
||||
identityBox.className = aTab._identityState;
|
||||
this._identityBox.className = aTab._identityState;
|
||||
}
|
||||
},
|
||||
|
||||
@ -203,24 +219,22 @@ const WebProgress = {
|
||||
Elements.progress.setAttribute("fade", true);
|
||||
},
|
||||
|
||||
_progressTransEnd: function _progressTransEnd(data) {
|
||||
_progressTransEnd: function _progressTransEnd(aEvent) {
|
||||
if (!Elements.progress.hasAttribute("fade"))
|
||||
return;
|
||||
// Close out fade finished, reset
|
||||
if (data.propertyName == "opacity") {
|
||||
if (aEvent.propertyName == "opacity") {
|
||||
Elements.progress.style.width = "0px";
|
||||
Elements.progressContainer.setAttribute("collapsed", true);
|
||||
}
|
||||
},
|
||||
|
||||
_onTabSelect: function(aEvent) {
|
||||
let identityBox = document.getElementById("identity-box-inner");
|
||||
let tab = Browser.getTabFromChrome(aEvent.originalTarget);
|
||||
identityBox.className = tab._identityState || "";
|
||||
this._identityBox.className = tab._identityState || "";
|
||||
},
|
||||
|
||||
_onUrlBarInput: function(aEvent) {
|
||||
let identityBox = document.getElementById("identity-box-inner");
|
||||
Browser.selectedTab._identityState = identityBox.className = "";
|
||||
Browser.selectedTab._identityState = this._identityBox.className = "";
|
||||
},
|
||||
};
|
||||
|
@ -370,26 +370,6 @@ var BookmarksStartView = {
|
||||
}
|
||||
};
|
||||
|
||||
var BookmarksPanelView = {
|
||||
_view: null,
|
||||
|
||||
get _grid() { return document.getElementById("bookmarks-list"); },
|
||||
get visible() { return PanelUI.isPaneVisible("bookmarks-container"); },
|
||||
|
||||
init: function init() {
|
||||
this._view = new BookmarksView(this._grid, null, Bookmarks.metroRoot);
|
||||
},
|
||||
|
||||
show: function show() {
|
||||
this._view.getBookmarks(true);
|
||||
this._grid.arrangeItems();
|
||||
},
|
||||
|
||||
uninit: function uninit() {
|
||||
this._view.destruct();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Observes bookmark changes and keeps a linked BookmarksView updated.
|
||||
*
|
||||
|
@ -123,12 +123,10 @@ let ScriptContexts = {};
|
||||
["ContextCommands", "chrome://browser/content/ContextCommands.js"],
|
||||
["Bookmarks", "chrome://browser/content/bookmarks.js"],
|
||||
["Downloads", "chrome://browser/content/downloads.js"],
|
||||
["BookmarksPanelView", "chrome://browser/content/bookmarks.js"],
|
||||
["ConsolePanelView", "chrome://browser/content/console.js"],
|
||||
["BookmarksStartView", "chrome://browser/content/bookmarks.js"],
|
||||
["HistoryView", "chrome://browser/content/history.js"],
|
||||
["HistoryStartView", "chrome://browser/content/history.js"],
|
||||
["HistoryPanelView", "chrome://browser/content/history.js"],
|
||||
["Site", "chrome://browser/content/Site.js"],
|
||||
["TopSites", "chrome://browser/content/TopSites.js"],
|
||||
["TopSitesView", "chrome://browser/content/TopSites.js"],
|
||||
@ -142,7 +140,6 @@ let ScriptContexts = {};
|
||||
["FlyoutPanelsUI", "chrome://browser/content/flyouts/flyoutUI.js"],
|
||||
#ifdef MOZ_SERVICES_SYNC
|
||||
["RemoteTabsView", "chrome://browser/content/RemoteTabs.js"],
|
||||
["RemoteTabsPanelView", "chrome://browser/content/RemoteTabs.js"],
|
||||
["RemoteTabsStartView", "chrome://browser/content/RemoteTabs.js"],
|
||||
#endif
|
||||
].forEach(function (aScript) {
|
||||
|
@ -1230,10 +1230,7 @@ var PanelUI = {
|
||||
},
|
||||
|
||||
views: {
|
||||
"bookmarks-container": "BookmarksPanelView",
|
||||
"console-container": "ConsolePanelView",
|
||||
"remotetabs-container": "RemoteTabsPanelView",
|
||||
"history-container" : "HistoryPanelView"
|
||||
},
|
||||
|
||||
init: function() {
|
||||
|
@ -247,7 +247,7 @@
|
||||
<html:div id="overlay-plus" class="overlay-button"
|
||||
observes="cmd_back"></html:div>
|
||||
|
||||
<!-- Navbar -->
|
||||
<!-- Navigation bar -->
|
||||
<appbar id="navbar" mousethrough="never" observes="bcast_windowState">
|
||||
<hbox id="progress-container" layer="true">
|
||||
<hbox id="progress-control" />
|
||||
@ -259,90 +259,116 @@
|
||||
<hbox id="urlbar-autocomplete" observes="bcast_windowState"/>
|
||||
</scrollbox>
|
||||
|
||||
<!-- Main Toolbar -->
|
||||
<toolbar id="toolbar" observes="bcast_windowState" flex="1">
|
||||
<!-- Main toolbar -->
|
||||
<toolbar id="toolbar" flex="1">
|
||||
<observes element="bcast_windowState" attribute="*"/>
|
||||
<observes element="bcast_urlbarState" attribute="*"/>
|
||||
|
||||
<toolbarbutton id="back-button" class="appbar-primary" command="cmd_back"/>
|
||||
<toolbarbutton id="forward-button" class="appbar-primary" command="cmd_forward"/>
|
||||
<toolbarbutton id="back-button" class="appbar-primary"
|
||||
command="cmd_back"/>
|
||||
<toolbarbutton id="forward-button" class="appbar-primary"
|
||||
command="cmd_forward"/>
|
||||
|
||||
<hbox id="urlbar-container" flex="1" observes="bcast_urlbarState">
|
||||
<hbox id="urlbar" flex="1">
|
||||
<box id="identity-box" role="button">
|
||||
<hbox id="identity-box-inner" align="center" mousethrough="always">
|
||||
<image id="identity-icon"/>
|
||||
</hbox>
|
||||
</box>
|
||||
<hbox id="urlbar" flex="1" observes="bcast_urlbarState">
|
||||
<box id="identity-box" align="center" role="button">
|
||||
<image id="identity-icon"/>
|
||||
</box>
|
||||
|
||||
<textbox id="urlbar-edit"
|
||||
type="url"
|
||||
class="uri-element"
|
||||
autocompletesearch="history"
|
||||
autocompletepopup="urlbar-autocomplete"
|
||||
completeselectedindex="true"
|
||||
placeholder="&urlbar.emptytext;"
|
||||
flex="1"/>
|
||||
</hbox>
|
||||
<textbox id="urlbar-edit" type="url" flex="1"
|
||||
autocompletesearch="history"
|
||||
autocompletepopup="urlbar-autocomplete"
|
||||
completeselectedindex="true"
|
||||
placeholder="&urlbar.emptytext;"/>
|
||||
|
||||
<toolbarbutton id="reload-button" oncommand="CommandUpdater.doCommand(event.shiftKey ? 'cmd_forceReload' : 'cmd_reload');"/>
|
||||
<toolbarbutton id="stop-button" command="cmd_stop"/>
|
||||
<toolbarbutton id="go-button" class="urlbar-button"
|
||||
command="cmd_go"/>
|
||||
<toolbarbutton id="reload-button" class="urlbar-button"
|
||||
oncommand="CommandUpdater.doCommand(
|
||||
event.shiftKey ? 'cmd_forceReload'
|
||||
: 'cmd_reload');"/>
|
||||
<toolbarbutton id="stop-button" class="urlbar-button"
|
||||
command="cmd_stop"/>
|
||||
</hbox>
|
||||
|
||||
<toolbarbutton id="download-button" class="appbar-secondary" oncommand="Appbar.onDownloadButton()"/>
|
||||
<toolbarbutton id="star-button" class="appbar-primary" type="checkbox" oncommand="Appbar.onStarButton()"/>
|
||||
<toolbarbutton id="pin-button" class="appbar-primary" type="checkbox" oncommand="Appbar.onPinButton()"/>
|
||||
<toolbarbutton id="menu-button" class="appbar-primary" oncommand="Appbar.onMenuButton(event)"/>
|
||||
<toolbarbutton id="download-button" class="appbar-secondary"
|
||||
oncommand="Appbar.onDownloadButton()"/>
|
||||
<toolbarbutton id="star-button" class="appbar-primary" type="checkbox"
|
||||
oncommand="Appbar.onStarButton()"/>
|
||||
<toolbarbutton id="pin-button" class="appbar-primary" type="checkbox"
|
||||
oncommand="Appbar.onPinButton()"/>
|
||||
<toolbarbutton id="menu-button" class="appbar-primary"
|
||||
oncommand="Appbar.onMenuButton(event)"/>
|
||||
</toolbar>
|
||||
</vbox>
|
||||
</appbar>
|
||||
|
||||
<vbox id="panel-container" hidden="true" class="window-width window-height meta" observes="bcast_windowState">
|
||||
<vbox id="panel-container" class="window-width window-height meta"
|
||||
hidden="true" observes="bcast_windowState">
|
||||
<hbox id="panel-header">
|
||||
<toolbarbutton id="panel-close-button" command="cmd_panel"/>
|
||||
<toolbarbutton id="panel-close-button" class="appbar-primary"
|
||||
command="cmd_panel"/>
|
||||
</hbox>
|
||||
|
||||
<deck id="panel-items" selectedIndex="0" flex="1" >
|
||||
<scrollbox id="bookmarks-container" flex="1">
|
||||
<richgrid id="bookmarks-list" noun="bookmark" class="canSnapTiles" seltype="multiple" flex="1"/>
|
||||
<richgrid id="bookmarks-list" noun="bookmark" class="canSnapTiles"
|
||||
seltype="multiple" flex="1"/>
|
||||
</scrollbox>
|
||||
<scrollbox id="history-container" flex="1">
|
||||
<richgrid id="history-list" noun="history" class="canSnapTiles" seltype="multiple" flex="1"/>
|
||||
<richgrid id="history-list" noun="history" class="canSnapTiles"
|
||||
seltype="multiple" flex="1"/>
|
||||
</scrollbox>
|
||||
<scrollbox id="remotetabs-container" flex="1">
|
||||
<richgrid id="remotetabs-list" noun="tab" class="canSnapTiles" seltype="single" flex="1"/>
|
||||
<richgrid id="remotetabs-list" noun="tab" class="canSnapTiles"
|
||||
seltype="single" flex="1"/>
|
||||
</scrollbox>
|
||||
<vbox id="console-container" flex="1">
|
||||
<vbox id="console-header" class="panel-list">
|
||||
<label class="panel-header" value="&consoleHeader.label;"/>
|
||||
<hbox align="center">
|
||||
<label value="&consoleCodeEval.label;" control="console-eval-textbox"/>
|
||||
<textbox id="console-eval-textbox" class="toolbar search-bar" value="" onkeypress="ConsolePanelView.onEvalKeyPress(event)" flex="1"/>
|
||||
<button id="console-button-eval" class="show-text" label="&consoleEvaluate.label;" oncommand="ConsolePanelView.evaluateTypein()"/>
|
||||
<label value="&consoleCodeEval.label;"
|
||||
control="console-eval-textbox"/>
|
||||
<textbox id="console-eval-textbox" class="toolbar search-bar"
|
||||
value="" flex="1"
|
||||
onkeypress="ConsolePanelView.onEvalKeyPress(event)"/>
|
||||
<button id="console-button-eval" class="show-text"
|
||||
label="&consoleEvaluate.label;"
|
||||
oncommand="ConsolePanelView.evaluateTypein()"/>
|
||||
</hbox>
|
||||
<hbox align="center" pack="end">
|
||||
<radiogroup id="console-filter" oncommand="ConsolePanelView.changeMode();">
|
||||
<radio id="console-filter-all" label="&consoleAll.label;" value="all" selected="true"/>
|
||||
<radio id="console-filter-messages" label="&consoleMessages.label;" value="message"/>
|
||||
<radio id="console-filter-warnings" label="&consoleWarnings.label;" value="warning"/>
|
||||
<radio id="console-filter-errors" label="&consoleErrors.label;" value="error"/>
|
||||
<radiogroup id="console-filter"
|
||||
oncommand="ConsolePanelView.changeMode();">
|
||||
<radio id="console-filter-all" value="all" selected="true"
|
||||
label="&consoleAll.label;"/>
|
||||
<radio id="console-filter-messages" value="message"
|
||||
label="&consoleMessages.label;" />
|
||||
<radio id="console-filter-warnings" value="warning"
|
||||
label="&consoleWarnings.label;"/>
|
||||
<radio id="console-filter-errors" value="error"
|
||||
label="&consoleErrors.label;"/>
|
||||
</radiogroup>
|
||||
<button id="console-clear" class="show-text" oncommand="ConsolePanelView.clearConsole();" label="&consoleClear.label;"/>
|
||||
<button id="console-clear" class="show-text"
|
||||
label="&consoleClear.label;"
|
||||
oncommand="ConsolePanelView.clearConsole();"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
||||
<richlistbox id="console-box" class="panel-list console-box" flex="1" onkeypress="ConsolePanelView.onConsoleBoxKeyPress(event)" oncontextmenu="ConsolePanelView.onContextMenu(event);"/>
|
||||
<richlistbox id="console-box" class="panel-list console-box" flex="1"
|
||||
onkeypress="ConsolePanelView.onConsoleBoxKeyPress(event)"
|
||||
oncontextmenu="ConsolePanelView.onContextMenu(event);"/>
|
||||
</vbox>
|
||||
</deck>
|
||||
</vbox>
|
||||
|
||||
<!-- Find bar -->
|
||||
<appbar id="findbar" class="window-width findbar-box" orient="horizontal" pack="start">
|
||||
<textbox id="findbar-textbox" class="search-bar findbar-item" oncommand="FindHelperUI.search(this.value)" oninput="FindHelperUI.updateCommands(this.value);" type="search"/>
|
||||
<button class="findbar-item previous-button" command="cmd_findPrevious"/>
|
||||
<button class="findbar-item next-button" command="cmd_findNext"/>
|
||||
<appbar id="findbar" class="window-width" pack="start">
|
||||
<textbox id="findbar-textbox" type="search"
|
||||
oncommand="FindHelperUI.search(this.value)"
|
||||
oninput="FindHelperUI.updateCommands(this.value); "/>
|
||||
<button class="previous-button" command="cmd_findPrevious"/>
|
||||
<button class="next-button" command="cmd_findNext"/>
|
||||
<spacer flex="1"/>
|
||||
<button id="findbar-close" class="findbar-item close-button" command="cmd_findClose"/>
|
||||
<button id="findbar-close" class="close-button" command="cmd_findClose"/>
|
||||
</appbar>
|
||||
|
||||
<!-- Context button bar -->
|
||||
|
@ -292,22 +292,3 @@ let HistoryStartView = {
|
||||
this._view.destruct();
|
||||
}
|
||||
};
|
||||
|
||||
let HistoryPanelView = {
|
||||
_view: null,
|
||||
get _grid() { return document.getElementById("history-list"); },
|
||||
get visible() { return PanelUI.isPaneVisible("history-container"); },
|
||||
|
||||
show: function show() {
|
||||
this._view.populateGrid(true);
|
||||
this._grid.arrangeItems();
|
||||
},
|
||||
|
||||
init: function init() {
|
||||
this._view = new HistoryView(this._grid, StartUI.maxResultsPerSection, false);
|
||||
},
|
||||
|
||||
uninit: function uninit() {
|
||||
this._view.destruct();
|
||||
}
|
||||
};
|
||||
|
@ -1157,12 +1157,13 @@ var GestureModule = {
|
||||
*/
|
||||
var InputSourceHelper = {
|
||||
isPrecise: false,
|
||||
touchIsActive: false,
|
||||
|
||||
init: function ish_init() {
|
||||
// debug feature, make all input imprecise
|
||||
window.addEventListener("mousemove", this, true);
|
||||
window.addEventListener("mousedown", this, true);
|
||||
window.addEventListener("touchstart", this, true);
|
||||
window.addEventListener("touchend", this, true);
|
||||
},
|
||||
|
||||
_precise: function () {
|
||||
@ -1180,20 +1181,31 @@ var InputSourceHelper = {
|
||||
},
|
||||
|
||||
handleEvent: function ish_handleEvent(aEvent) {
|
||||
if (aEvent.type == "touchstart") {
|
||||
this._imprecise();
|
||||
return;
|
||||
}
|
||||
switch (aEvent.mozInputSource) {
|
||||
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE:
|
||||
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_PEN:
|
||||
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_ERASER:
|
||||
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_CURSOR:
|
||||
this._precise();
|
||||
break;
|
||||
|
||||
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH:
|
||||
switch(aEvent.type) {
|
||||
case "touchstart":
|
||||
this._imprecise();
|
||||
this.touchIsActive = true;
|
||||
break;
|
||||
case "touchend":
|
||||
this.touchIsActive = false;
|
||||
break;
|
||||
default:
|
||||
// Ignore mouse movement when touch is active. Prevents both mouse scrollbars
|
||||
// and touch scrollbars from displaying at the same time. Also works around
|
||||
// odd win8 bug involving an erant mousemove event after a touch sequence
|
||||
// starts (bug 896017).
|
||||
if (this.touchIsActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (aEvent.mozInputSource) {
|
||||
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE:
|
||||
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_PEN:
|
||||
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_ERASER:
|
||||
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_CURSOR:
|
||||
this._precise();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
@ -83,7 +83,7 @@ var CrashPrompt = {
|
||||
let vendorName = Services.strings.createBundle("chrome://branding/locale/brand.properties")
|
||||
.GetStringFromName("vendorShortName");
|
||||
let crashBundle = Services.strings.createBundle("chrome://browser/locale/crashprompt.properties");
|
||||
let message = crashBundle.formatStringFromName("crashprompt.messagebody", [brandName, vendorName, brandName], 3);
|
||||
let message = crashBundle.formatStringFromName("crashprompt.messagebody2", [brandName, vendorName], 2);
|
||||
let descElement = document.getElementById("privacy-crash-blurb");
|
||||
descElement.textContent = message;
|
||||
|
||||
|
@ -36,6 +36,7 @@ MOCHITEST_METRO_FILES = \
|
||||
browser_form_auto_complete.js \
|
||||
browser_form_auto_complete.html \
|
||||
browser_crashprompt.js \
|
||||
browser_inputsource.js \
|
||||
$(NULL)
|
||||
|
||||
ifndef MOZ_DEBUG
|
||||
|
@ -6,7 +6,6 @@
|
||||
"use strict";
|
||||
|
||||
let gStartView = BookmarksStartView._view;
|
||||
let gPanelView = BookmarksPanelView._view;
|
||||
|
||||
function test() {
|
||||
runTests();
|
||||
@ -65,7 +64,6 @@ var BookmarksTestHelper = {
|
||||
|
||||
// Simulate observer notification
|
||||
gStartView._changes.onItemRemoved(aId, gStartView._root);
|
||||
gPanelView._changes.onItemRemoved(aId, gPanelView._root);
|
||||
},
|
||||
},
|
||||
|
||||
@ -100,24 +98,18 @@ var BookmarksTestHelper = {
|
||||
|
||||
this._originalNavHistoryService = gStartView._navHistoryService;
|
||||
gStartView._navHistoryService = this.MockNavHistoryService;
|
||||
gPanelView._navHistoryService = this.MockNavHistoryService;
|
||||
|
||||
this._originalBookmarkService = gStartView._bookmarkService;
|
||||
gStartView._bookmarkService= this.MockBookmarkService;
|
||||
gPanelView._bookmarkService= this.MockBookmarkService;
|
||||
|
||||
this._originalPinHelper = gStartView._pinHelper;
|
||||
gStartView._pinHelper = this.MockPinHelper;
|
||||
gPanelView._pinHelper = this.MockPinHelper;
|
||||
|
||||
this._originalUpdateFavicon = gStartView._updateFavicon;
|
||||
gStartView._updateFavicon = function () {};
|
||||
gPanelView._updateFavicon = function () {};
|
||||
|
||||
gStartView.clearBookmarks();
|
||||
gStartView.getBookmarks();
|
||||
gPanelView.clearBookmarks();
|
||||
gPanelView.getBookmarks();
|
||||
},
|
||||
|
||||
restore: function () {
|
||||
@ -126,15 +118,8 @@ var BookmarksTestHelper = {
|
||||
gStartView._pinHelper = this._originalPinHelper;
|
||||
gStartView._updateFavicon = this._originalUpdateFavicon;
|
||||
|
||||
gPanelView._navHistoryService = this._originalNavHistoryService;
|
||||
gPanelView._bookmarkService= this._originalBookmarkService;
|
||||
gPanelView._pinHelper = this._originalPinHelper;
|
||||
gPanelView._updateFavicon = this._originalUpdateFavicon;
|
||||
|
||||
gStartView.clearBookmarks();
|
||||
gStartView.getBookmarks();
|
||||
gPanelView.clearBookmarks();
|
||||
gPanelView.getBookmarks();
|
||||
}
|
||||
};
|
||||
|
||||
@ -350,215 +335,3 @@ gTests.push({
|
||||
ok(gStartView._set.itemCount === gStartView._limit - 1, "Grid repopulated");
|
||||
}
|
||||
});
|
||||
|
||||
gTests.push({
|
||||
desc: "Test bookmarks PanelUI unpin",
|
||||
setUp: setup,
|
||||
tearDown: tearDown,
|
||||
run: function testBookmarksPanelUnpin() {
|
||||
PanelUI.show('bookmarks-container');
|
||||
|
||||
let pinButton = document.getElementById("pin-selected-button");
|
||||
let unpinButton = document.getElementById("unpin-selected-button");
|
||||
|
||||
// --------- unpin item 2
|
||||
|
||||
let item = gPanelView._getItemForBookmarkId(2);
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item, 10, 10);
|
||||
yield promise;
|
||||
|
||||
yield waitForCondition(() => !unpinButton.hidden);
|
||||
|
||||
ok(!unpinButton.hidden, "Unpin button is visible.");
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
EventUtils.synthesizeMouse(unpinButton, 10, 10, {}, window);
|
||||
yield promise;
|
||||
|
||||
item = gPanelView._getItemForBookmarkId(2);
|
||||
let startItem = gStartView._getItemForBookmarkId(2);
|
||||
|
||||
ok(item, "Item is in grid");
|
||||
ok(!startItem, "Item not in start grid");
|
||||
ok(!gPanelView._pinHelper.isPinned(2), "Item unpinned");
|
||||
|
||||
// --------- unpin multiple items
|
||||
|
||||
let item1 = gPanelView._getItemForBookmarkId(0);
|
||||
let item2 = gPanelView._getItemForBookmarkId(5);
|
||||
let item3 = gPanelView._getItemForBookmarkId(12);
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item1, 10, 10);
|
||||
sendContextMenuClickToElement(window, item2, 10, 10);
|
||||
sendContextMenuClickToElement(window, item3, 10, 10);
|
||||
yield promise;
|
||||
|
||||
ok(!unpinButton.hidden, "Unpin button is visible.");
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
EventUtils.synthesizeMouse(unpinButton, 10, 10, {}, window);
|
||||
yield promise;
|
||||
|
||||
item1 = gPanelView._getItemForBookmarkId(0);
|
||||
item2 = gPanelView._getItemForBookmarkId(5);
|
||||
item3 = gPanelView._getItemForBookmarkId(12);
|
||||
let startItem1 = gStartView._getItemForBookmarkId(0);
|
||||
let startItem2 = gStartView._getItemForBookmarkId(5);
|
||||
let startItem3 = gStartView._getItemForBookmarkId(12);
|
||||
|
||||
ok(item1 && item2 && item3, "Items are in grid");
|
||||
ok(!startItem1 && !startItem2 && !startItem3, "Items are not in start grid");
|
||||
ok(!gPanelView._pinHelper.isPinned(0) && !gPanelView._pinHelper.isPinned(5) && !gPanelView._pinHelper.isPinned(12) , "Items unpinned");
|
||||
|
||||
// --------- pin item 2
|
||||
|
||||
let item = gPanelView._getItemForBookmarkId(2);
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item, 10, 10);
|
||||
yield promise;
|
||||
|
||||
// Make sure app bar is updated
|
||||
yield waitForCondition(() => !pinButton.hidden);
|
||||
|
||||
ok(!pinButton.hidden, "Pin button is visible.");
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
EventUtils.synthesizeMouse(pinButton, 10, 10, {}, window);
|
||||
yield promise;
|
||||
|
||||
item = gPanelView._getItemForBookmarkId(2);
|
||||
let startItem = gStartView._getItemForBookmarkId(2);
|
||||
|
||||
ok(item, "Item is in grid");
|
||||
ok(startItem, "Item is back in start grid");
|
||||
ok(gPanelView._pinHelper.isPinned(2), "Item pinned");
|
||||
|
||||
// --------- pin multiple items
|
||||
|
||||
let item1 = gPanelView._getItemForBookmarkId(0);
|
||||
let item2 = gPanelView._getItemForBookmarkId(5);
|
||||
let item3 = gPanelView._getItemForBookmarkId(12);
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item1, 10, 10);
|
||||
sendContextMenuClickToElement(window, item2, 10, 10);
|
||||
sendContextMenuClickToElement(window, item3, 10, 10);
|
||||
yield promise;
|
||||
|
||||
// Make sure app bar is updated
|
||||
yield waitForCondition(() => !pinButton.hidden);
|
||||
|
||||
ok(!pinButton.hidden, "pin button is visible.");
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
EventUtils.synthesizeMouse(pinButton, 10, 10, {}, window);
|
||||
yield promise;
|
||||
|
||||
item1 = gPanelView._getItemForBookmarkId(0);
|
||||
item2 = gPanelView._getItemForBookmarkId(5);
|
||||
item3 = gPanelView._getItemForBookmarkId(12);
|
||||
let startItem1 = gStartView._getItemForBookmarkId(0);
|
||||
let startItem2 = gStartView._getItemForBookmarkId(5);
|
||||
let startItem3 = gStartView._getItemForBookmarkId(12);
|
||||
|
||||
ok(item1 && item2 && item3, "Items are in grid");
|
||||
ok(startItem1 && startItem2 && startItem3, "Items are back in start grid");
|
||||
ok(gPanelView._pinHelper.isPinned(0) && gPanelView._pinHelper.isPinned(5) && gPanelView._pinHelper.isPinned(12) , "Items pinned");
|
||||
}
|
||||
});
|
||||
|
||||
gTests.push({
|
||||
desc: "Test bookmarks PanelUI delete",
|
||||
setUp: setup,
|
||||
tearDown: tearDown,
|
||||
run: function testBookmarksPanelDelete() {
|
||||
PanelUI.show('bookmarks-container');
|
||||
|
||||
let restoreButton = document.getElementById("restore-selected-button");
|
||||
let deleteButton = document.getElementById("delete-selected-button");
|
||||
|
||||
// --------- delete item 2
|
||||
|
||||
let item = gPanelView._getItemForBookmarkId(2);
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item, 10, 10);
|
||||
yield promise;
|
||||
|
||||
ok(!deleteButton.hidden, "Delete button is visible.");
|
||||
|
||||
let promise = waitForCondition(() => !restoreButton.hidden);
|
||||
EventUtils.synthesizeMouse(deleteButton, 10, 10, {}, window);
|
||||
yield promise;
|
||||
|
||||
item = gPanelView._getItemForBookmarkId(2);
|
||||
let startItem = gStartView._getItemForBookmarkId(2);
|
||||
|
||||
ok(!item, "Item is not in grid");
|
||||
ok(startItem, "Item is not deleted from start grid yet");
|
||||
ok(BookmarksTestHelper._nodes[2], "Item exists");
|
||||
ok(!restoreButton.hidden, "Restore button is visible.");
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
Elements.contextappbar.dismiss();
|
||||
yield promise;
|
||||
|
||||
item = gPanelView._getItemForBookmarkId(2);
|
||||
startItem = gStartView._getItemForBookmarkId(2);
|
||||
|
||||
ok(!item, "Item gone from grid");
|
||||
ok(!startItem, "Item gone from start grid");
|
||||
ok(!BookmarksTestHelper._nodes[2], "Item RIP");
|
||||
|
||||
// --------- delete multiple items
|
||||
|
||||
let item1 = gPanelView._getItemForBookmarkId(0);
|
||||
let item2 = gPanelView._getItemForBookmarkId(5);
|
||||
let item3 = gPanelView._getItemForBookmarkId(12);
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item1, 10, 10);
|
||||
sendContextMenuClickToElement(window, item2, 10, 10);
|
||||
sendContextMenuClickToElement(window, item3, 10, 10);
|
||||
yield promise;
|
||||
|
||||
ok(!deleteButton.hidden, "Delete button is visible.");
|
||||
|
||||
let promise = waitForCondition(() => !restoreButton.hidden);
|
||||
EventUtils.synthesizeMouse(deleteButton, 10, 10, {}, window);
|
||||
yield promise;
|
||||
|
||||
item1 = gPanelView._getItemForBookmarkId(0);
|
||||
item2 = gPanelView._getItemForBookmarkId(5);
|
||||
item3 = gPanelView._getItemForBookmarkId(12);
|
||||
let startItem1 = gStartView._getItemForBookmarkId(0);
|
||||
let startItem2 = gStartView._getItemForBookmarkId(5);
|
||||
let startItem3 = gStartView._getItemForBookmarkId(12);
|
||||
|
||||
ok(!restoreButton.hidden, "Restore button is visible.");
|
||||
ok(!item1 && !item2 && !item3, "Items are not in grid");
|
||||
ok(startItem1 && startItem2 && startItem3, "Items are still in start grid");
|
||||
ok(BookmarksTestHelper._nodes[0] && BookmarksTestHelper._nodes[5] && BookmarksTestHelper._nodes[12],
|
||||
"Items not deleted yet");
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
Elements.contextappbar.dismiss();
|
||||
yield promise;
|
||||
|
||||
item1 = gPanelView._getItemForBookmarkId(0);
|
||||
item2 = gPanelView._getItemForBookmarkId(5);
|
||||
item3 = gPanelView._getItemForBookmarkId(12);
|
||||
let startItem1 = gStartView._getItemForBookmarkId(0);
|
||||
let startItem2 = gStartView._getItemForBookmarkId(5);
|
||||
let startItem3 = gStartView._getItemForBookmarkId(12);
|
||||
|
||||
ok(!item1 && !item2 && !item3, "Items are gone from grid");
|
||||
ok(!startItem1 && !startItem2 && !startItem3, "Items are gone from start grid");
|
||||
ok(!BookmarksTestHelper._nodes[0] && !BookmarksTestHelper._nodes[5] && !BookmarksTestHelper._nodes[12],
|
||||
"Items are gone for good");
|
||||
}
|
||||
});
|
||||
|
@ -6,7 +6,6 @@
|
||||
"use strict";
|
||||
|
||||
let gStartView = HistoryStartView._view;
|
||||
let gPanelView = HistoryPanelView._view;
|
||||
|
||||
function test() {
|
||||
runTests();
|
||||
@ -71,7 +70,6 @@ var HistoryTestHelper = {
|
||||
|
||||
// Simulate observer notification
|
||||
gStartView.onDeleteURI(aURI);
|
||||
gPanelView.onDeleteURI(aURI);
|
||||
},
|
||||
},
|
||||
|
||||
@ -106,20 +104,15 @@ var HistoryTestHelper = {
|
||||
|
||||
this._originalNavHistoryService = gStartView._navHistoryService;
|
||||
gStartView._navHistoryService = this.MockNavHistoryService;
|
||||
gPanelView._navHistoryService = this.MockNavHistoryService;
|
||||
|
||||
this._originalHistoryService = gStartView._historyService;
|
||||
gStartView._historyService= this.MockHistoryService;
|
||||
gPanelView._historyService= this.MockHistoryService;
|
||||
|
||||
this._originalPinHelper = gStartView._pinHelper;
|
||||
gStartView._pinHelper = this.MockPinHelper;
|
||||
gPanelView._pinHelper = this.MockPinHelper;
|
||||
|
||||
gStartView._set.clearAll();
|
||||
gStartView.populateGrid();
|
||||
gPanelView._set.clearAll();
|
||||
gPanelView.populateGrid();
|
||||
},
|
||||
|
||||
restore: function () {
|
||||
@ -127,14 +120,8 @@ var HistoryTestHelper = {
|
||||
gStartView._historyService= this._originalHistoryService;
|
||||
gStartView._pinHelper = this._originalPinHelper;
|
||||
|
||||
gPanelView._navHistoryService = this._originalNavHistoryService;
|
||||
gPanelView._historyService= this._originalHistoryService;
|
||||
gPanelView._pinHelper = this._originalPinHelper;
|
||||
|
||||
gStartView._set.clearAll();
|
||||
gStartView.populateGrid();
|
||||
gPanelView._set.clearAll();
|
||||
gPanelView.populateGrid();
|
||||
}
|
||||
};
|
||||
|
||||
@ -363,218 +350,3 @@ gTests.push({
|
||||
ok(gStartView._set.itemCount === gStartView._limit - 1, "Grid repopulated");
|
||||
}
|
||||
});
|
||||
|
||||
gTests.push({
|
||||
desc: "Test history PanelUI unpin",
|
||||
setUp: setup,
|
||||
tearDown: tearDown,
|
||||
run: function testHistoryPanelUnpin() {
|
||||
PanelUI.show('history-container');
|
||||
|
||||
let pinButton = document.getElementById("pin-selected-button");
|
||||
let unpinButton = document.getElementById("unpin-selected-button");
|
||||
|
||||
// --------- unpin item 2
|
||||
|
||||
let item = gPanelView._set.getItemsByUrl(uriFromIndex(2))[0];
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item, 10, 10);
|
||||
yield promise;
|
||||
|
||||
yield waitForCondition(() => !unpinButton.hidden);
|
||||
|
||||
ok(!unpinButton.hidden, "Unpin button is visible.");
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
EventUtils.synthesizeMouse(unpinButton, 10, 10, {}, window);
|
||||
yield promise;
|
||||
|
||||
item = gPanelView._set.getItemsByUrl(uriFromIndex(2))[0];
|
||||
let startItem = gStartView._set.getItemsByUrl(uriFromIndex(2))[0];
|
||||
|
||||
ok(item, "Item is in grid");
|
||||
ok(!startItem, "Item not in start grid");
|
||||
ok(!gPanelView._pinHelper.isPinned(uriFromIndex(2)), "Item unpinned");
|
||||
|
||||
// --------- unpin multiple items
|
||||
|
||||
let item1 = gPanelView._set.getItemsByUrl(uriFromIndex(0))[0];
|
||||
let item2 = gPanelView._set.getItemsByUrl(uriFromIndex(5))[0];
|
||||
let item3 = gPanelView._set.getItemsByUrl(uriFromIndex(12))[0];
|
||||
|
||||
scrollToEnd();
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item1, 10, 10);
|
||||
sendContextMenuClickToElement(window, item2, 10, 10);
|
||||
sendContextMenuClickToElement(window, item3, 10, 10);
|
||||
yield promise;
|
||||
|
||||
ok(!unpinButton.hidden, "Unpin button is visible.");
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
EventUtils.synthesizeMouse(unpinButton, 10, 10, {}, window);
|
||||
yield promise;
|
||||
|
||||
item1 = gPanelView._set.getItemsByUrl(uriFromIndex(0))[0];
|
||||
item2 = gPanelView._set.getItemsByUrl(uriFromIndex(5))[0];
|
||||
item3 = gPanelView._set.getItemsByUrl(uriFromIndex(12))[0];
|
||||
let startItem1 = gStartView._set.getItemsByUrl(uriFromIndex(0))[0];
|
||||
let startItem2 = gStartView._set.getItemsByUrl(uriFromIndex(5))[0];
|
||||
let startItem3 = gStartView._set.getItemsByUrl(uriFromIndex(12))[0];
|
||||
|
||||
ok(item1 && item2 && item3, "Items are in grid");
|
||||
ok(!startItem1 && !startItem2 && !startItem3, "Items are not in start grid");
|
||||
ok(!gPanelView._pinHelper.isPinned(uriFromIndex(0)) && !gPanelView._pinHelper.isPinned(uriFromIndex(5)) && !gPanelView._pinHelper.isPinned(uriFromIndex(12)) , "Items unpinned");
|
||||
|
||||
// --------- pin item 2
|
||||
|
||||
let item = gPanelView._set.getItemsByUrl(uriFromIndex(2))[0];
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item, 10, 10);
|
||||
yield promise;
|
||||
|
||||
// Make sure app bar is updated
|
||||
yield waitForCondition(() => !pinButton.hidden);
|
||||
|
||||
ok(!pinButton.hidden, "Pin button is visible.");
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
EventUtils.synthesizeMouse(pinButton, 10, 10, {}, window);
|
||||
yield promise;
|
||||
|
||||
item = gPanelView._set.getItemsByUrl(uriFromIndex(2))[0];
|
||||
let startItem = gStartView._set.getItemsByUrl(uriFromIndex(2))[0];
|
||||
|
||||
ok(item, "Item is in grid");
|
||||
ok(startItem, "Item is back in start grid");
|
||||
ok(gPanelView._pinHelper.isPinned(uriFromIndex(2)), "Item pinned");
|
||||
|
||||
// --------- pin multiple items
|
||||
|
||||
let item1 = gPanelView._set.getItemsByUrl(uriFromIndex(0))[0];
|
||||
let item2 = gPanelView._set.getItemsByUrl(uriFromIndex(5))[0];
|
||||
let item3 = gPanelView._set.getItemsByUrl(uriFromIndex(12))[0];
|
||||
|
||||
scrollToEnd();
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item1, 10, 10);
|
||||
sendContextMenuClickToElement(window, item2, 10, 10);
|
||||
sendContextMenuClickToElement(window, item3, 10, 10);
|
||||
yield promise;
|
||||
|
||||
// Make sure app bar is updated
|
||||
yield waitForCondition(() => !pinButton.hidden);
|
||||
|
||||
ok(!pinButton.hidden, "pin button is visible.");
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
EventUtils.synthesizeMouse(pinButton, 10, 10, {}, window);
|
||||
yield promise;
|
||||
|
||||
item1 = gPanelView._set.getItemsByUrl(uriFromIndex(0))[0];
|
||||
item2 = gPanelView._set.getItemsByUrl(uriFromIndex(5))[0];
|
||||
item3 = gPanelView._set.getItemsByUrl(uriFromIndex(12))[0];
|
||||
let startItem1 = gStartView._set.getItemsByUrl(uriFromIndex(0))[0];
|
||||
let startItem2 = gStartView._set.getItemsByUrl(uriFromIndex(5))[0];
|
||||
let startItem3 = gStartView._set.getItemsByUrl(uriFromIndex(12))[0];
|
||||
|
||||
ok(item1 && item2 && item3, "Items are in grid");
|
||||
ok(startItem1 && startItem2 && startItem3, "Items are back in start grid");
|
||||
ok(gPanelView._pinHelper.isPinned(uriFromIndex(0)) && gPanelView._pinHelper.isPinned(uriFromIndex(5)) && gPanelView._pinHelper.isPinned(uriFromIndex(12)) , "Items pinned");
|
||||
}
|
||||
});
|
||||
|
||||
gTests.push({
|
||||
desc: "Test history PanelUI delete",
|
||||
setUp: setup,
|
||||
tearDown: tearDown,
|
||||
run: function testHistoryPanelDelete() {
|
||||
PanelUI.show('history-container');
|
||||
|
||||
let restoreButton = document.getElementById("restore-selected-button");
|
||||
let deleteButton = document.getElementById("delete-selected-button");
|
||||
|
||||
// --------- delete item 2
|
||||
|
||||
let item = gPanelView._set.getItemsByUrl(uriFromIndex(2))[0];
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item, 10, 10);
|
||||
yield promise;
|
||||
|
||||
ok(!deleteButton.hidden, "Delete button is visible.");
|
||||
|
||||
let promise = waitForCondition(() => !restoreButton.hidden);
|
||||
EventUtils.synthesizeMouse(deleteButton, 10, 10, {}, window);
|
||||
yield promise;
|
||||
|
||||
item = gPanelView._set.getItemsByUrl(uriFromIndex(2))[0];
|
||||
let startItem = gStartView._set.getItemsByUrl(uriFromIndex(2))[0];
|
||||
|
||||
ok(!item, "Item is not in grid");
|
||||
ok(startItem, "Item is not deleted from start grid yet");
|
||||
ok(HistoryTestHelper._nodes[uriFromIndex(2)], "Item exists");
|
||||
ok(!restoreButton.hidden, "Restore button is visible.");
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
Elements.contextappbar.dismiss();
|
||||
yield promise;
|
||||
|
||||
item = gPanelView._set.getItemsByUrl(uriFromIndex(2))[0];
|
||||
startItem = gStartView._set.getItemsByUrl(uriFromIndex(2))[0];
|
||||
|
||||
ok(!item, "Item gone from grid");
|
||||
ok(!startItem, "Item gone from start grid");
|
||||
ok(!HistoryTestHelper._nodes[uriFromIndex(2)], "Item RIP");
|
||||
|
||||
// --------- delete multiple items
|
||||
|
||||
let item1 = gPanelView._set.getItemsByUrl(uriFromIndex(0))[0];
|
||||
let item2 = gPanelView._set.getItemsByUrl(uriFromIndex(5))[0];
|
||||
let item3 = gPanelView._set.getItemsByUrl(uriFromIndex(12))[0];
|
||||
|
||||
scrollToEnd();
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
sendContextMenuClickToElement(window, item1, 10, 10);
|
||||
sendContextMenuClickToElement(window, item2, 10, 10);
|
||||
sendContextMenuClickToElement(window, item3, 10, 10);
|
||||
yield promise;
|
||||
|
||||
ok(!deleteButton.hidden, "Delete button is visible.");
|
||||
|
||||
let promise = waitForCondition(() => !restoreButton.hidden);
|
||||
EventUtils.synthesizeMouse(deleteButton, 10, 10, {}, window);
|
||||
yield promise;
|
||||
|
||||
item1 = gPanelView._set.getItemsByUrl(uriFromIndex(0))[0];
|
||||
item2 = gPanelView._set.getItemsByUrl(uriFromIndex(5))[0];
|
||||
item3 = gPanelView._set.getItemsByUrl(uriFromIndex(12))[0];
|
||||
let startItem1 = gStartView._set.getItemsByUrl(uriFromIndex(0))[0];
|
||||
let startItem2 = gStartView._set.getItemsByUrl(uriFromIndex(5))[0];
|
||||
let startItem3 = gStartView._set.getItemsByUrl(uriFromIndex(12))[0];
|
||||
|
||||
ok(!restoreButton.hidden, "Restore button is visible.");
|
||||
ok(!item1 && !item2 && !item3, "Items are not in grid");
|
||||
ok(startItem1 && startItem2 && startItem3, "Items are still in start grid");
|
||||
ok(HistoryTestHelper._nodes[uriFromIndex(0)] && HistoryTestHelper._nodes[uriFromIndex(5)] && HistoryTestHelper._nodes[uriFromIndex(12)],
|
||||
"Items not deleted yet");
|
||||
|
||||
let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar);
|
||||
Elements.contextappbar.dismiss();
|
||||
yield promise;
|
||||
|
||||
item1 = gPanelView._set.getItemsByUrl(uriFromIndex(0))[0];
|
||||
item2 = gPanelView._set.getItemsByUrl(uriFromIndex(5))[0];
|
||||
item3 = gPanelView._set.getItemsByUrl(uriFromIndex(12))[0];
|
||||
let startItem1 = gStartView._set.getItemsByUrl(uriFromIndex(0))[0];
|
||||
let startItem2 = gStartView._set.getItemsByUrl(uriFromIndex(5))[0];
|
||||
let startItem3 = gStartView._set.getItemsByUrl(uriFromIndex(12))[0];
|
||||
|
||||
ok(!item1 && !item2 && !item3, "Items are gone from grid");
|
||||
ok(!startItem1 && !startItem2 && !startItem3, "Items are gone from start grid");
|
||||
ok(!HistoryTestHelper._nodes[uriFromIndex(0)] && !HistoryTestHelper._nodes[uriFromIndex(5)] && !HistoryTestHelper._nodes[uriFromIndex(12)],
|
||||
"Items are gone for good");
|
||||
}
|
||||
});
|
||||
|
75
browser/metro/base/tests/mochitest/browser_inputsource.js
Normal file
@ -0,0 +1,75 @@
|
||||
// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
/*=============================================================================
|
||||
Test cases
|
||||
=============================================================================*/
|
||||
|
||||
function test() {
|
||||
runTests();
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
yield addTab("about:blank");
|
||||
}
|
||||
|
||||
function testState(aState) {
|
||||
let bcastValue = document.getElementById("bcast_preciseInput").getAttribute("input");
|
||||
is(bcastValue, aState, "bcast attribute is " + aState);
|
||||
|
||||
if (aState == "precise") {
|
||||
ok(InputSourceHelper.isPrecise, "InputSourceHelper");
|
||||
let uri = Util.makeURI("chrome://browser/content/cursor.css");
|
||||
ok(!StyleSheetSvc.sheetRegistered(uri, Ci.nsIStyleSheetService.AGENT_SHEET), "cursor stylesheet registered");
|
||||
} else {
|
||||
ok(!InputSourceHelper.isPrecise, "InputSourceHelper");
|
||||
let uri = Util.makeURI("chrome://browser/content/cursor.css");
|
||||
ok(StyleSheetSvc.sheetRegistered(uri, Ci.nsIStyleSheetService.AGENT_SHEET), "cursor stylesheet registered");
|
||||
}
|
||||
}
|
||||
|
||||
function sendMouseMoves() {
|
||||
let utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
for (let deg = 0; deg < 180; deg++) {
|
||||
let coord = Math.sin((deg * Math.PI)/180) * 750;
|
||||
utils.sendMouseEventToWindow("mousemove", coord, coord, 2, 1, 0, true,
|
||||
1, Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE);
|
||||
}
|
||||
}
|
||||
|
||||
function sendTouchStart() {
|
||||
EventUtils.synthesizeTouchAtPoint(100, 100, { type: "touchstart" }, window);
|
||||
}
|
||||
|
||||
function sendTouchMove() {
|
||||
EventUtils.synthesizeTouchAtPoint(100, 100, { type: "touchmove" }, window);
|
||||
}
|
||||
|
||||
function sendTouchEnd() {
|
||||
EventUtils.synthesizeTouchAtPoint(100, 100, { type: "touchend" }, window);
|
||||
}
|
||||
|
||||
gTests.push({
|
||||
desc: "precise/imprecise input switcher",
|
||||
setUp: setUp,
|
||||
run: function () {
|
||||
sendMouseMoves();
|
||||
testState("precise");
|
||||
sendTouchStart();
|
||||
testState("imprecise");
|
||||
sendMouseMoves();
|
||||
testState("imprecise");
|
||||
sendTouchMove();
|
||||
testState("imprecise");
|
||||
sendTouchEnd();
|
||||
testState("imprecise");
|
||||
sendMouseMoves();
|
||||
testState("precise");
|
||||
}
|
||||
});
|
||||
|
@ -2,5 +2,5 @@
|
||||
# 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/.
|
||||
|
||||
# LOCALIZATION NOTE: '%S' is short brand name
|
||||
crashprompt.messagebody=We are sorry, %S just recovered from a crash. Sending crash reports will help %S make %S more stable and secure. You can always change your preference in Settings/Options.
|
||||
# LOCALIZATION NOTE (crashprompt.messagebody2): %1$S - short brand name, %2$S - vendor name
|
||||
crashprompt.messagebody2=We are sorry, %1$S just recovered from a crash. Sending crash reports will help %2$S make %1$S more stable and secure. You can always change your preference in Settings/Options.
|
||||
|
@ -96,3 +96,8 @@
|
||||
% that the bars slide up after the keyboard is in place.
|
||||
%define appbar_keyboard_slideup_duration 750ms
|
||||
|
||||
% minimum resolution cutoffs for displaying 1.4x and 1.8x versions of icons
|
||||
% XXX currently, there's some weirdness with the dppx unit, as documented in
|
||||
% bug 895277. Because of that, we have to use 1.39dppx instead of 1.4dppx.
|
||||
%define min_res_140pc 1.39dppx
|
||||
%define min_res_180pc 1.8dppx
|
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 1.4 KiB |
BIN
browser/metro/theme/images/navbar-back.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
browser/metro/theme/images/navbar-back@1.4x.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
browser/metro/theme/images/navbar-back@1.8x.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
browser/metro/theme/images/navbar-forward.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
browser/metro/theme/images/navbar-forward@1.4x.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
browser/metro/theme/images/navbar-forward@1.8x.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
browser/metro/theme/images/navbar-menu.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
browser/metro/theme/images/navbar-menu@1.4x.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
browser/metro/theme/images/navbar-menu@1.8x.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
browser/metro/theme/images/navbar-pin.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
browser/metro/theme/images/navbar-pin@1.4x.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
browser/metro/theme/images/navbar-pin@1.8x.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
browser/metro/theme/images/navbar-star.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
browser/metro/theme/images/navbar-star@1.4x.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
browser/metro/theme/images/navbar-star@1.8x.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
browser/metro/theme/images/urlbar-go.png
Normal file
After Width: | Height: | Size: 502 B |
BIN
browser/metro/theme/images/urlbar-go@1.4x.png
Normal file
After Width: | Height: | Size: 644 B |
BIN
browser/metro/theme/images/urlbar-go@1.8x.png
Normal file
After Width: | Height: | Size: 809 B |
BIN
browser/metro/theme/images/urlbar-reload.png
Normal file
After Width: | Height: | Size: 576 B |
BIN
browser/metro/theme/images/urlbar-reload@1.4x.png
Normal file
After Width: | Height: | Size: 761 B |
BIN
browser/metro/theme/images/urlbar-reload@1.8x.png
Normal file
After Width: | Height: | Size: 1023 B |
BIN
browser/metro/theme/images/urlbar-stop.png
Normal file
After Width: | Height: | Size: 362 B |
BIN
browser/metro/theme/images/urlbar-stop@1.4x.png
Normal file
After Width: | Height: | Size: 587 B |
BIN
browser/metro/theme/images/urlbar-stop@1.8x.png
Normal file
After Width: | Height: | Size: 687 B |
@ -22,18 +22,30 @@ chrome.jar:
|
||||
% override chrome://global/skin/netError.css chrome://browser/skin/netError.css
|
||||
|
||||
skin/images/panel-dark.png (images/panel-dark.png)
|
||||
skin/images/appbar-back.png (images/appbar-back.png)
|
||||
skin/images/appbar-back@1.4x.png (images/appbar-back@1.4x.png)
|
||||
skin/images/appbar-forward.png (images/appbar-forward.png)
|
||||
skin/images/appbar-forward@1.4x.png (images/appbar-forward@1.4x.png)
|
||||
skin/images/appbar-star.png (images/appbar-star.png)
|
||||
skin/images/appbar-star@1.4x.png (images/appbar-star@1.4x.png)
|
||||
skin/images/appbar-pin.png (images/appbar-pin.png)
|
||||
skin/images/appbar-pin@1.4x.png (images/appbar-pin@1.4x.png)
|
||||
skin/images/appbar-menu.png (images/appbar-menu.png)
|
||||
skin/images/appbar-menu@1.4x.png (images/appbar-menu@1.4x.png)
|
||||
skin/images/appbar-reload.png (images/appbar-reload.png)
|
||||
skin/images/appbar-stop.png (images/appbar-stop.png)
|
||||
skin/images/navbar-back.png (images/navbar-back.png)
|
||||
skin/images/navbar-back@1.4x.png (images/navbar-back@1.4x.png)
|
||||
skin/images/navbar-back@1.8x.png (images/navbar-back@1.8x.png)
|
||||
skin/images/navbar-forward.png (images/navbar-forward.png)
|
||||
skin/images/navbar-forward@1.4x.png (images/navbar-forward@1.4x.png)
|
||||
skin/images/navbar-forward@1.8x.png (images/navbar-forward@1.8x.png)
|
||||
skin/images/navbar-star.png (images/navbar-star.png)
|
||||
skin/images/navbar-star@1.4x.png (images/navbar-star@1.4x.png)
|
||||
skin/images/navbar-star@1.8x.png (images/navbar-star@1.8x.png)
|
||||
skin/images/navbar-pin.png (images/navbar-pin.png)
|
||||
skin/images/navbar-pin@1.4x.png (images/navbar-pin@1.4x.png)
|
||||
skin/images/navbar-pin@1.8x.png (images/navbar-pin@1.8x.png)
|
||||
skin/images/navbar-menu.png (images/navbar-menu.png)
|
||||
skin/images/navbar-menu@1.4x.png (images/navbar-menu@1.4x.png)
|
||||
skin/images/navbar-menu@1.8x.png (images/navbar-menu@1.8x.png)
|
||||
skin/images/urlbar-go.png (images/urlbar-go.png)
|
||||
skin/images/urlbar-go@1.4x.png (images/urlbar-go@1.4x.png)
|
||||
skin/images/urlbar-go@1.8x.png (images/urlbar-go@1.8x.png)
|
||||
skin/images/urlbar-reload.png (images/urlbar-reload.png)
|
||||
skin/images/urlbar-reload@1.4x.png (images/urlbar-reload@1.4x.png)
|
||||
skin/images/urlbar-reload@1.8x.png (images/urlbar-reload@1.8x.png)
|
||||
skin/images/urlbar-stop.png (images/urlbar-stop.png)
|
||||
skin/images/urlbar-stop@1.4x.png (images/urlbar-stop@1.4x.png)
|
||||
skin/images/urlbar-stop@1.8x.png (images/urlbar-stop@1.8x.png)
|
||||
skin/images/newtab-default.png (images/newtab-default.png)
|
||||
skin/images/closetab-default.png (images/closetab-default.png)
|
||||
skin/images/tab-arrows.png (images/tab-arrows.png)
|
||||
|
@ -744,42 +744,67 @@ appbar toolbar[labelled] > toolbarbutton > .toolbarbutton-text {
|
||||
-moz-image-region: rect(0 40px 40px 0);
|
||||
}
|
||||
|
||||
.appbar-primary:not([checked]):hover:not(:active) {
|
||||
.appbar-primary:not([checked]):hover:not(:active):not([disabled]) {
|
||||
-moz-image-region: rect(0 80px 40px 40px);
|
||||
}
|
||||
|
||||
.appbar-primary:not([checked]):active:not([disabled]),
|
||||
.appbar-primary[checked] {
|
||||
-moz-image-region: rect(0 120px 40px 80px);
|
||||
}
|
||||
|
||||
.appbar-primary[checked]:hover:not(:active) {
|
||||
.appbar-primary[checked]:hover:not(:active):not([disabled]) {
|
||||
-moz-image-region: rect(0 160px 40px 120px);
|
||||
}
|
||||
|
||||
.appbar-primary:active {
|
||||
-moz-image-region: rect(0 120px 40px 80px);
|
||||
.appbar-primary[checked]:active:not([disabled]) {
|
||||
-moz-image-region: rect(0 200px 40px 160px);
|
||||
}
|
||||
|
||||
@media (min-resolution: 130dpi) {
|
||||
@media (min-resolution: @min_res_140pc@) {
|
||||
.appbar-primary {
|
||||
-moz-image-region: rect(0 56px 56px 0);
|
||||
}
|
||||
|
||||
.appbar-primary:not([checked]):hover:not(:active) {
|
||||
.appbar-primary:not([checked]):hover:not(:active):not([disabled]) {
|
||||
-moz-image-region: rect(0 112px 56px 56px);
|
||||
}
|
||||
|
||||
.appbar-primary:not([checked]):active:not([disabled]),
|
||||
.appbar-primary[checked] {
|
||||
-moz-image-region: rect(0 224px 56px 168px);
|
||||
}
|
||||
|
||||
.appbar-primary[checked]:hover:not(:active) {
|
||||
-moz-image-region: rect(0 224px 56px 168px);
|
||||
}
|
||||
|
||||
.appbar-primary:active {
|
||||
-moz-image-region: rect(0 168px 56px 112px);
|
||||
}
|
||||
|
||||
.appbar-primary[checked]:hover:not(:active):not([disabled]) {
|
||||
-moz-image-region: rect(0 224px 56px 168px);
|
||||
}
|
||||
|
||||
.appbar-primary[checked]:active:not([disabled]) {
|
||||
-moz-image-region: rect(0 280px 56px 224px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-resolution: @min_res_180pc@) {
|
||||
.appbar-primary {
|
||||
-moz-image-region: rect(0 72px 72px 0);
|
||||
}
|
||||
|
||||
.appbar-primary:not([checked]):hover:not(:active):not([disabled]) {
|
||||
-moz-image-region: rect(0 144px 72px 72px);
|
||||
}
|
||||
|
||||
.appbar-primary:not([checked]):active:not([disabled]),
|
||||
.appbar-primary[checked] {
|
||||
-moz-image-region: rect(0 216px 72px 144px);
|
||||
}
|
||||
|
||||
.appbar-primary[checked]:hover:not(:active):not([disabled]) {
|
||||
-moz-image-region: rect(0 288px 72px 216px);
|
||||
}
|
||||
|
||||
.appbar-primary[checked]:active:not([disabled]) {
|
||||
-moz-image-region: rect(0 360px 72px 288px);
|
||||
}
|
||||
}
|
||||
|
||||
/* Secondary sprite format: one sprite for everything */
|
||||
@ -787,98 +812,3 @@ appbar toolbar[labelled] > toolbarbutton > .toolbarbutton-text {
|
||||
.appbar-secondary {
|
||||
list-style-image: url(chrome://browser/skin/images/appbar-icons.png);
|
||||
}
|
||||
|
||||
/* Find bar ------------------------------------------------------------- */
|
||||
|
||||
#findbar {
|
||||
background-color: @metro_orange@;
|
||||
padding: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
#findbar > toolbar {
|
||||
min-height: @findbar_height@ !important;
|
||||
}
|
||||
|
||||
#findbar > .previous-button,
|
||||
#findbar > .next-button,
|
||||
#findbar > .close-button {
|
||||
list-style-image: url(chrome://browser/skin/images/appbar-icons.png);
|
||||
min-width: @touch_button_small@ !important; /* button size */
|
||||
min-height: @touch_button_small@ !important; /* button size */
|
||||
border: none !important;
|
||||
background-image: none !important;
|
||||
background-color: inherit !important;
|
||||
pointer-events: auto;
|
||||
-moz-user-focus: ignore !important;
|
||||
margin: 0 @margin_normal@ !important;
|
||||
}
|
||||
|
||||
#findbar > .close-button {
|
||||
-moz-margin-start: 0;
|
||||
-moz-image-region: rect(0px, 480px, 40px, 440px);
|
||||
}
|
||||
|
||||
#findbar > .close-button:hover {
|
||||
-moz-image-region: rect(40px, 480px, 80px, 440px);
|
||||
}
|
||||
|
||||
#findbar > .close-button:active {
|
||||
-moz-image-region: rect(80px, 480px, 120px, 440px);
|
||||
}
|
||||
|
||||
#findbar > .previous-button {
|
||||
-moz-margin-end: 0;
|
||||
-moz-image-region: rect(0px, 400px, 40px, 360px);
|
||||
}
|
||||
|
||||
#findbar > .previous-button:hover {
|
||||
-moz-image-region: rect(40px, 400px, 80px, 360px);
|
||||
}
|
||||
|
||||
#findbar > .previous-button:active{
|
||||
-moz-image-region: rect(80px, 400px, 120px, 360px);
|
||||
}
|
||||
|
||||
#findbar > .next-button {
|
||||
-moz-margin-start: 0;
|
||||
-moz-image-region: rect(0px, 440px, 40px, 400px);
|
||||
}
|
||||
|
||||
#findbar > .next-button:hover {
|
||||
-moz-image-region: rect(40px, 440px, 80px, 400px);
|
||||
}
|
||||
|
||||
#findbar > .next-button:active {
|
||||
-moz-image-region: rect(80px, 440px, 120px, 400px);
|
||||
}
|
||||
|
||||
#findbar-textbox {
|
||||
pointer-events: auto;
|
||||
-moz-margin-end: 0;
|
||||
border: none !important;
|
||||
width: 20em;
|
||||
}
|
||||
|
||||
.textbox-search-icon {
|
||||
list-style-image: url("chrome://browser/skin/images/search-glass-30.png");
|
||||
-moz-image-region: auto;
|
||||
}
|
||||
|
||||
/* Override the default box ordering and make the find textbox appear to the
|
||||
right of the icon */
|
||||
#findbar-textbox input {
|
||||
-moz-box-ordinal-group: 2
|
||||
}
|
||||
|
||||
#findbar-textbox deck {
|
||||
margin-right: @margin_normal@;
|
||||
}
|
||||
|
||||
#findbar-textbox[status="1"] { /* Ci.nsITypeAheadFind.FIND_NOTFOUND */
|
||||
background: rgb(255,200,200);
|
||||
}
|
||||
|
||||
#findbar-textbox:hover:active {
|
||||
background: #8db8d8;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "nsAttrAndChildArray.h" // member
|
||||
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_*
|
||||
#include "nsIContent.h" // base class
|
||||
#include "nsIDOMTouchEvent.h" // base class (nsITouchEventReceiver)
|
||||
#include "nsIDOMXPathNSResolver.h" // base class
|
||||
#include "nsIInlineEventHandlers.h" // base class
|
||||
#include "nsINodeList.h" // base class
|
||||
@ -404,26 +403,6 @@ protected:
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
/**
|
||||
* Tearoff class to implement nsITouchEventReceiver
|
||||
*/
|
||||
class nsTouchEventReceiverTearoff MOZ_FINAL : public nsITouchEventReceiver
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
||||
NS_FORWARD_NSITOUCHEVENTRECEIVER(mElement->)
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsTouchEventReceiverTearoff)
|
||||
|
||||
nsTouchEventReceiverTearoff(mozilla::dom::FragmentOrElement *aElement) : mElement(aElement)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<mozilla::dom::FragmentOrElement> mElement;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tearoff class to implement nsIInlineEventHandlers
|
||||
*/
|
||||
|
@ -504,17 +504,6 @@ nsNodeSupportsWeakRefTearoff::GetWeakReference(nsIWeakReference** aInstancePtr)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_1(nsTouchEventReceiverTearoff, mElement)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsTouchEventReceiverTearoff)
|
||||
NS_INTERFACE_MAP_ENTRY(nsITouchEventReceiver)
|
||||
NS_INTERFACE_MAP_END_AGGREGATED(mElement)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsTouchEventReceiverTearoff)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsTouchEventReceiverTearoff)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_1(nsInlineEventHandlersTearoff, mElement)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsInlineEventHandlersTearoff)
|
||||
@ -1761,8 +1750,6 @@ NS_INTERFACE_MAP_BEGIN(FragmentOrElement)
|
||||
new nsNodeSupportsWeakRefTearoff(this))
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMXPathNSResolver,
|
||||
new nsNode3Tearoff(this))
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsITouchEventReceiver,
|
||||
new nsTouchEventReceiverTearoff(this))
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIInlineEventHandlers,
|
||||
new nsInlineEventHandlersTearoff(this))
|
||||
// DOM bindings depend on the identity pointer being the
|
||||
|
@ -1576,8 +1576,6 @@ NS_INTERFACE_TABLE_HEAD(nsDocument)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIRadioGroupContainer)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIMutationObserver)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIApplicationCacheContainer)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentTouch)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsITouchEventReceiver)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIInlineEventHandlers)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIObserver)
|
||||
NS_INTERFACE_TABLE_END
|
||||
@ -5254,7 +5252,7 @@ nsDocument::Register(JSContext* aCx, const nsAString& aName,
|
||||
|
||||
nsINode* parentNode = oldNode->GetParentNode();
|
||||
MOZ_ASSERT(parentNode, "Node obtained by GetElementsByTagName.");
|
||||
nsCOMPtr<nsIDOMElement> newElement = do_QueryInterface(newNode);
|
||||
nsCOMPtr<Element> newElement = do_QueryInterface(newNode);
|
||||
MOZ_ASSERT(newElement, "Cloned of node obtained by GetElementsByTagName.");
|
||||
|
||||
parentNode->ReplaceChild(*newNode, *oldNode, rv);
|
||||
@ -5279,8 +5277,9 @@ nsDocument::Register(JSContext* aCx, const nsAString& aName,
|
||||
nsCOMPtr<nsIDOMElementReplaceEvent> ptEvent = do_QueryInterface(event);
|
||||
MOZ_ASSERT(ptEvent);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(newElement);
|
||||
rv = ptEvent->InitElementReplaceEvent(NS_LITERAL_STRING("elementreplace"),
|
||||
false, false, newElement);
|
||||
false, false, element);
|
||||
if (rv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -6619,19 +6618,16 @@ nsIDocument::AdoptNode(nsINode& aAdoptedNode, ErrorResult& rv)
|
||||
case nsIDOMNode::ATTRIBUTE_NODE:
|
||||
{
|
||||
// Remove from ownerElement.
|
||||
nsCOMPtr<nsIDOMAttr> adoptedAttr = do_QueryInterface(adoptedNode);
|
||||
NS_ASSERTION(adoptedAttr, "Attribute not implementing nsIDOMAttr");
|
||||
nsRefPtr<Attr> adoptedAttr = static_cast<Attr*>(adoptedNode);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> ownerElement;
|
||||
rv = adoptedAttr->GetOwnerElement(getter_AddRefs(ownerElement));
|
||||
nsCOMPtr<Element> ownerElement = adoptedAttr->GetOwnerElement(rv);
|
||||
if (rv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (ownerElement) {
|
||||
nsCOMPtr<nsIDOMAttr> newAttr;
|
||||
rv = ownerElement->RemoveAttributeNode(adoptedAttr,
|
||||
getter_AddRefs(newAttr));
|
||||
nsRefPtr<Attr> newAttr =
|
||||
ownerElement->RemoveAttributeNode(*adoptedAttr, rv);
|
||||
if (rv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -9255,30 +9251,6 @@ nsDocument::SetImagesNeedAnimating(bool aAnimating)
|
||||
mAnimatingImages = aAnimating;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::CreateTouch(nsIDOMWindow* aView,
|
||||
nsIDOMEventTarget* aTarget,
|
||||
int32_t aIdentifier,
|
||||
int32_t aPageX,
|
||||
int32_t aPageY,
|
||||
int32_t aScreenX,
|
||||
int32_t aScreenY,
|
||||
int32_t aClientX,
|
||||
int32_t aClientY,
|
||||
int32_t aRadiusX,
|
||||
int32_t aRadiusY,
|
||||
float aRotationAngle,
|
||||
float aForce,
|
||||
nsIDOMTouch** aRetVal)
|
||||
{
|
||||
nsCOMPtr<EventTarget> target = do_QueryInterface(aTarget);
|
||||
*aRetVal = nsIDocument::CreateTouch(aView, target, aIdentifier, aPageX,
|
||||
aPageY, aScreenX, aScreenY, aClientX,
|
||||
aClientY, aRadiusX, aRadiusY,
|
||||
aRotationAngle, aForce).get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<Touch>
|
||||
nsIDocument::CreateTouch(nsIDOMWindow* aView,
|
||||
EventTarget* aTarget,
|
||||
@ -9301,47 +9273,6 @@ nsIDocument::CreateTouch(nsIDOMWindow* aView,
|
||||
return touch.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::CreateTouchList(nsIVariant* aPoints,
|
||||
nsIDOMTouchList** aRetVal)
|
||||
{
|
||||
nsRefPtr<nsDOMTouchList> retval = new nsDOMTouchList(ToSupports(this));
|
||||
if (aPoints) {
|
||||
uint16_t type;
|
||||
aPoints->GetDataType(&type);
|
||||
if (type == nsIDataType::VTYPE_INTERFACE ||
|
||||
type == nsIDataType::VTYPE_INTERFACE_IS) {
|
||||
nsCOMPtr<nsISupports> data;
|
||||
aPoints->GetAsISupports(getter_AddRefs(data));
|
||||
nsCOMPtr<nsIDOMTouch> point = do_QueryInterface(data);
|
||||
if (point) {
|
||||
retval->Append(static_cast<Touch*>(point.get()));
|
||||
}
|
||||
} else if (type == nsIDataType::VTYPE_ARRAY) {
|
||||
uint16_t valueType;
|
||||
nsIID iid;
|
||||
uint32_t valueCount;
|
||||
void* rawArray;
|
||||
aPoints->GetAsArray(&valueType, &iid, &valueCount, &rawArray);
|
||||
if (valueType == nsIDataType::VTYPE_INTERFACE ||
|
||||
valueType == nsIDataType::VTYPE_INTERFACE_IS) {
|
||||
nsISupports** values = static_cast<nsISupports**>(rawArray);
|
||||
for (uint32_t i = 0; i < valueCount; ++i) {
|
||||
nsCOMPtr<nsISupports> supports = dont_AddRef(values[i]);
|
||||
nsCOMPtr<nsIDOMTouch> point = do_QueryInterface(supports);
|
||||
if (point) {
|
||||
retval->Append(static_cast<Touch*>(point.get()));
|
||||
}
|
||||
}
|
||||
}
|
||||
nsMemory::Free(rawArray);
|
||||
}
|
||||
}
|
||||
|
||||
*aRetVal = retval.forget().get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsDOMTouchList>
|
||||
nsIDocument::CreateTouchList()
|
||||
{
|
||||
@ -11073,11 +11004,9 @@ nsDocument::XPCOMShutdown()
|
||||
NS_IMETHODIMP nsDocument::SetOn##name_(JSContext *cx, const JS::Value &v) { \
|
||||
return nsINode::SetOn##name_(cx, v); \
|
||||
}
|
||||
#define TOUCH_EVENT EVENT
|
||||
#define DOCUMENT_ONLY_EVENT EVENT
|
||||
#include "nsEventNameList.h"
|
||||
#undef DOCUMENT_ONLY_EVENT
|
||||
#undef TOUCH_EVENT
|
||||
#undef EVENT
|
||||
|
||||
void
|
||||
|
@ -503,7 +503,6 @@ class nsDocument : public nsIDocument,
|
||||
public nsIRadioGroupContainer,
|
||||
public nsIApplicationCacheContainer,
|
||||
public nsStubMutationObserver,
|
||||
public nsIDOMDocumentTouch,
|
||||
public nsIInlineEventHandlers,
|
||||
public nsIObserver
|
||||
{
|
||||
@ -780,12 +779,6 @@ public:
|
||||
// nsIApplicationCacheContainer
|
||||
NS_DECL_NSIAPPLICATIONCACHECONTAINER
|
||||
|
||||
// nsITouchEventReceiver
|
||||
NS_DECL_NSITOUCHEVENTRECEIVER
|
||||
|
||||
// nsIDOMDocumentTouch
|
||||
NS_DECL_NSIDOMDOCUMENTTOUCH
|
||||
|
||||
// nsIInlineEventHandlers
|
||||
NS_DECL_NSIINLINEEVENTHANDLERS
|
||||
|
||||
|
@ -1120,9 +1120,9 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow = do_GetInterface(ourDocshell);
|
||||
nsCOMPtr<nsPIDOMWindow> otherWindow = do_GetInterface(otherDocshell);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> ourFrameElement =
|
||||
nsCOMPtr<Element> ourFrameElement =
|
||||
ourWindow->GetFrameElementInternal();
|
||||
nsCOMPtr<nsIDOMElement> otherFrameElement =
|
||||
nsCOMPtr<Element> otherFrameElement =
|
||||
otherWindow->GetFrameElementInternal();
|
||||
|
||||
nsCOMPtr<EventTarget> ourChromeEventHandler =
|
||||
@ -1648,7 +1648,7 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||
// the right chrome event handler.
|
||||
|
||||
// Tell the window about the frame that hosts it.
|
||||
nsCOMPtr<nsIDOMElement> frame_element(do_QueryInterface(mOwnerContent));
|
||||
nsCOMPtr<Element> frame_element = mOwnerContent;
|
||||
NS_ASSERTION(frame_element, "frame loader owner element not a DOM element!");
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win_private(do_GetInterface(mDocShell));
|
||||
@ -2063,7 +2063,7 @@ nsFrameLoader::TryRemoteBrowser()
|
||||
context.SetTabContextForBrowserFrame(containingApp, scrollingBehavior);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> ownerElement = do_QueryInterface(mOwnerContent);
|
||||
nsCOMPtr<Element> ownerElement = mOwnerContent;
|
||||
mRemoteBrowser = ContentParent::CreateBrowserOrApp(context, ownerElement);
|
||||
if (mRemoteBrowser) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> rootItem;
|
||||
|
@ -264,7 +264,7 @@ HTMLVideoElement::GetVideoPlaybackQuality()
|
||||
uint64_t totalFrames = 0;
|
||||
uint64_t droppedFrames = 0;
|
||||
uint64_t corruptedFrames = 0;
|
||||
double playbackJitter = 0.0;
|
||||
double totalFrameDelay = 0.0;
|
||||
|
||||
if (sVideoStatsEnabled) {
|
||||
nsPIDOMWindow* window = OwnerDoc()->GetInnerWindow();
|
||||
@ -280,13 +280,13 @@ HTMLVideoElement::GetVideoPlaybackQuality()
|
||||
totalFrames = stats.GetParsedFrames();
|
||||
droppedFrames = totalFrames - stats.GetPresentedFrames();
|
||||
corruptedFrames = totalFrames - stats.GetDecodedFrames();
|
||||
playbackJitter = stats.GetPlaybackJitter();
|
||||
totalFrameDelay = stats.GetTotalFrameDelay();
|
||||
}
|
||||
}
|
||||
|
||||
nsRefPtr<VideoPlaybackQuality> playbackQuality =
|
||||
new VideoPlaybackQuality(this, creationTime, totalFrames, droppedFrames,
|
||||
corruptedFrames, playbackJitter);
|
||||
corruptedFrames, totalFrameDelay);
|
||||
return playbackQuality.forget();
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,6 @@ function HTML_TAG(aTagName, aImplClass) {
|
||||
interfaces[aTagName] =
|
||||
[ "nsIDOMEventTarget",
|
||||
"nsIDOMElementCSSInlineStyle",
|
||||
"nsITouchEventReceiver",
|
||||
"nsIInlineEventHandlers" ];
|
||||
|
||||
// Some interfaces don't appear in classinfo because other interfaces that
|
||||
|
@ -818,7 +818,7 @@ public:
|
||||
|
||||
FrameStatistics() :
|
||||
mReentrantMonitor("MediaDecoder::FrameStats"),
|
||||
mPlaybackJitter(0.0),
|
||||
mTotalFrameDelay(0.0),
|
||||
mParsedFrames(0),
|
||||
mDecodedFrames(0),
|
||||
mPresentedFrames(0) {}
|
||||
@ -845,9 +845,9 @@ public:
|
||||
return mPresentedFrames;
|
||||
}
|
||||
|
||||
double GetPlaybackJitter() {
|
||||
double GetTotalFrameDelay() {
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return mPlaybackJitter;
|
||||
return mTotalFrameDelay;
|
||||
}
|
||||
|
||||
// Increments the parsed and decoded frame counters by the passed in counts.
|
||||
@ -867,11 +867,11 @@ public:
|
||||
++mPresentedFrames;
|
||||
}
|
||||
|
||||
// Tracks the sum of display errors.
|
||||
// Tracks the sum of display delay.
|
||||
// Can be called on any thread.
|
||||
void NotifyPlaybackJitter(double aDisplayError) {
|
||||
void NotifyFrameDelay(double aFrameDelay) {
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
mPlaybackJitter += aDisplayError;
|
||||
mTotalFrameDelay += aFrameDelay;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -879,20 +879,20 @@ public:
|
||||
// ReentrantMonitor to protect access of playback statistics.
|
||||
ReentrantMonitor mReentrantMonitor;
|
||||
|
||||
// Sum of display duration error.
|
||||
// Access protected by mStatsReentrantMonitor.
|
||||
double mPlaybackJitter;
|
||||
// Sum of displayed frame delays.
|
||||
// Access protected by mReentrantMonitor.
|
||||
double mTotalFrameDelay;
|
||||
|
||||
// Number of frames parsed and demuxed from media.
|
||||
// Access protected by mStatsReentrantMonitor.
|
||||
// Access protected by mReentrantMonitor.
|
||||
uint32_t mParsedFrames;
|
||||
|
||||
// Number of parsed frames which were actually decoded.
|
||||
// Access protected by mStatsReentrantMonitor.
|
||||
// Access protected by mReentrantMonitor.
|
||||
uint32_t mDecodedFrames;
|
||||
|
||||
// Number of decoded frames which were actually sent down the rendering
|
||||
// pipeline to be painted ("presented"). Access protected by mStatsReentrantMonitor.
|
||||
// pipeline to be painted ("presented"). Access protected by mReentrantMonitor.
|
||||
uint32_t mPresentedFrames;
|
||||
};
|
||||
|
||||
|
@ -2540,10 +2540,10 @@ void MediaDecoderStateMachine::AdvanceFrame()
|
||||
}
|
||||
MediaDecoder::FrameStatistics& frameStats = mDecoder->GetFrameStatistics();
|
||||
frameStats.NotifyPresentedFrame();
|
||||
double frameDelay = double(clock_time - currentFrame->mTime) / USECS_PER_S;
|
||||
NS_ASSERTION(frameDelay >= 0.0, "Frame should never be displayed early.");
|
||||
frameStats.NotifyFrameDelay(frameDelay);
|
||||
remainingTime = currentFrame->mEndTime - clock_time;
|
||||
int64_t frameDuration = currentFrame->mEndTime - currentFrame->mTime;
|
||||
double displayError = fabs(double(frameDuration - remainingTime) / USECS_PER_S);
|
||||
frameStats.NotifyPlaybackJitter(displayError);
|
||||
currentFrame = nullptr;
|
||||
}
|
||||
|
||||
|
@ -21,13 +21,13 @@ VideoPlaybackQuality::VideoPlaybackQuality(HTMLMediaElement* aElement,
|
||||
uint64_t aTotalFrames,
|
||||
uint64_t aDroppedFrames,
|
||||
uint64_t aCorruptedFrames,
|
||||
double aPlaybackJitter)
|
||||
double aTotalFrameDelay)
|
||||
: mElement(aElement)
|
||||
, mCreationTime(aCreationTime)
|
||||
, mTotalFrames(aTotalFrames)
|
||||
, mDroppedFrames(aDroppedFrames)
|
||||
, mCorruptedFrames(aCorruptedFrames)
|
||||
, mPlaybackJitter(aPlaybackJitter)
|
||||
, mTotalFrameDelay(aTotalFrameDelay)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
|
||||
VideoPlaybackQuality(HTMLMediaElement* aElement, DOMHighResTimeStamp aCreationTime,
|
||||
uint64_t aTotalFrames, uint64_t aDroppedFrames,
|
||||
uint64_t aCorruptedFrames, double aPlaybackJitter);
|
||||
uint64_t aCorruptedFrames, double aTotalFrameDelay);
|
||||
|
||||
HTMLMediaElement* GetParentObject() const;
|
||||
|
||||
@ -49,9 +49,9 @@ public:
|
||||
return mCorruptedFrames;
|
||||
}
|
||||
|
||||
double PlaybackJitter()
|
||||
double TotalFrameDelay()
|
||||
{
|
||||
return mPlaybackJitter;
|
||||
return mTotalFrameDelay;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -60,7 +60,7 @@ private:
|
||||
uint64_t mTotalFrames;
|
||||
uint64_t mDroppedFrames;
|
||||
uint64_t mCorruptedFrames;
|
||||
double mPlaybackJitter;
|
||||
double mTotalFrameDelay;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -21,7 +21,7 @@ function test() {
|
||||
is(vpq.totalVideoFrames, 0, "totalVideoFrames should be 0");
|
||||
is(vpq.droppedVideoFrames, 0, "droppedVideoFrames should be 0");
|
||||
is(vpq.corruptedVideoFrames, 0, "corruptedVideoFrames should be 0");
|
||||
is(vpq.playbackJitter, 0, "playbackJitter should be 0");
|
||||
is(vpq.totalFrameDelay, 0, "totalFrameDelay should be 0");
|
||||
|
||||
var vpq2 = video.getVideoPlaybackQuality();
|
||||
ok(vpq !== vpq2, "getVideoPlaybackQuality should return a new object");
|
||||
@ -38,7 +38,7 @@ function test() {
|
||||
ok(vpq.totalVideoFrames > 0, "totalVideoFrames should be > 0");
|
||||
ok(vpq.droppedVideoFrames >= 0, "droppedVideoFrames should be >= 0");
|
||||
ok(vpq.corruptedVideoFrames >= 0, "corruptedVideoFrames should be >= 0");
|
||||
ok(vpq.playbackJitter >= 0, "playbackJitter should be >= 0");
|
||||
ok(vpq.totalFrameDelay >= 0, "totalFrameDelay should be >= 0");
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.video_stats.enabled", false]]}, function () {
|
||||
vpq = video.getVideoPlaybackQuality();
|
||||
@ -46,7 +46,7 @@ function test() {
|
||||
is(vpq.totalVideoFrames, 0, "totalVideoFrames should be 0");
|
||||
is(vpq.droppedVideoFrames, 0, "droppedVideoFrames should be 0");
|
||||
is(vpq.corruptedVideoFrames, 0, "corruptedVideoFrames should be 0");
|
||||
is(vpq.playbackJitter, 0, "playbackJitter should be 0");
|
||||
is(vpq.totalFrameDelay, 0, "totalFrameDelay should be 0");
|
||||
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
@ -31,6 +31,20 @@ SVGAltGlyphElement::SVGAltGlyphElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
nsSVGElement::EnumAttributesInfo
|
||||
SVGAltGlyphElement::GetEnumInfo()
|
||||
{
|
||||
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
|
||||
ArrayLength(sEnumInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::LengthAttributesInfo
|
||||
SVGAltGlyphElement::GetLengthInfo()
|
||||
{
|
||||
return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
|
||||
ArrayLength(sLengthInfo));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
|
@ -42,12 +42,21 @@ public:
|
||||
protected:
|
||||
|
||||
// nsSVGElement overrides
|
||||
virtual EnumAttributesInfo GetEnumInfo() MOZ_OVERRIDE;
|
||||
virtual LengthAttributesInfo GetLengthInfo() MOZ_OVERRIDE;
|
||||
virtual StringAttributesInfo GetStringInfo() MOZ_OVERRIDE;
|
||||
|
||||
enum { HREF };
|
||||
nsSVGString mStringAttributes[1];
|
||||
static StringInfo sStringInfo[1];
|
||||
|
||||
nsSVGEnum mEnumAttributes[1];
|
||||
virtual nsSVGEnum* EnumAttributes() MOZ_OVERRIDE
|
||||
{ return mEnumAttributes; }
|
||||
|
||||
nsSVGLength2 mLengthAttributes[1];
|
||||
virtual nsSVGLength2* LengthAttributes() MOZ_OVERRIDE
|
||||
{ return mLengthAttributes; }
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -26,6 +26,19 @@ SVGTSpanElement::SVGTSpanElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
nsSVGElement::EnumAttributesInfo
|
||||
SVGTSpanElement::GetEnumInfo()
|
||||
{
|
||||
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
|
||||
ArrayLength(sEnumInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::LengthAttributesInfo
|
||||
SVGTSpanElement::GetLengthInfo()
|
||||
{
|
||||
return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
|
||||
ArrayLength(sLengthInfo));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
@ -30,6 +30,18 @@ public:
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual EnumAttributesInfo GetEnumInfo() MOZ_OVERRIDE;
|
||||
virtual LengthAttributesInfo GetLengthInfo() MOZ_OVERRIDE;
|
||||
|
||||
nsSVGEnum mEnumAttributes[1];
|
||||
virtual nsSVGEnum* EnumAttributes() MOZ_OVERRIDE
|
||||
{ return mEnumAttributes; }
|
||||
|
||||
nsSVGLength2 mLengthAttributes[1];
|
||||
virtual nsSVGLength2* LengthAttributes() MOZ_OVERRIDE
|
||||
{ return mLengthAttributes; }
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -55,38 +55,16 @@ SVGTextContentElement::FrameIsSVGText()
|
||||
return frame && frame->IsSVGText();
|
||||
}
|
||||
|
||||
nsSVGElement::EnumAttributesInfo
|
||||
SVGTextContentElement::GetEnumInfo()
|
||||
{
|
||||
// If we want to start supporting lengthAdjust="" on <textPath> we'll
|
||||
// need to modify SVGTextPathElement::GetEnumInfo to return an
|
||||
// EnumAttributesInfo for it, since GetEnumInfo isn't currently
|
||||
// designed to include attribute information from superclasses.
|
||||
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
|
||||
ArrayLength(sEnumInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::LengthAttributesInfo
|
||||
SVGTextContentElement::GetLengthInfo()
|
||||
{
|
||||
// If we want to start supporting textLength="" on <textPath> we'll
|
||||
// need to modify SVGTextPathElement::GetEnumInfo to return an
|
||||
// EnumAttributesInfo for it, since GetEnumInfo isn't currently
|
||||
// designed to include attribute information from superclasses.
|
||||
return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
|
||||
ArrayLength(sLengthInfo));
|
||||
}
|
||||
|
||||
already_AddRefed<SVGAnimatedLength>
|
||||
SVGTextContentElement::TextLength()
|
||||
{
|
||||
return mLengthAttributes[TEXTLENGTH].ToDOMAnimatedLength(this);
|
||||
return LengthAttributes()[TEXTLENGTH].ToDOMAnimatedLength(this);
|
||||
}
|
||||
|
||||
already_AddRefed<SVGAnimatedEnumeration>
|
||||
SVGTextContentElement::LengthAdjust()
|
||||
{
|
||||
return mEnumAttributes[LENGTHADJUST].ToDOMAnimatedEnum(this);
|
||||
return EnumAttributes()[LENGTHADJUST].ToDOMAnimatedEnum(this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -55,17 +55,13 @@ protected:
|
||||
nsSVGTextFrame2* GetSVGTextFrame();
|
||||
bool FrameIsSVGText();
|
||||
|
||||
virtual EnumAttributesInfo GetEnumInfo() MOZ_OVERRIDE;
|
||||
virtual LengthAttributesInfo GetLengthInfo() MOZ_OVERRIDE;
|
||||
|
||||
enum { LENGTHADJUST };
|
||||
nsSVGEnum mEnumAttributes[1];
|
||||
virtual nsSVGEnum* EnumAttributes() = 0;
|
||||
static nsSVGEnumMapping sLengthAdjustMap[];
|
||||
static EnumInfo sEnumInfo[1];
|
||||
|
||||
enum { TEXTLENGTH };
|
||||
nsSVGLength2 mLengthAttributes[1];
|
||||
|
||||
virtual nsSVGLength2* LengthAttributes() = 0;
|
||||
static LengthInfo sLengthInfo[1];
|
||||
};
|
||||
|
||||
|
@ -25,6 +25,20 @@ SVGTextElement::SVGTextElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
nsSVGElement::EnumAttributesInfo
|
||||
SVGTextElement::GetEnumInfo()
|
||||
{
|
||||
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
|
||||
ArrayLength(sEnumInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::LengthAttributesInfo
|
||||
SVGTextElement::GetLengthInfo()
|
||||
{
|
||||
return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
|
||||
ArrayLength(sLengthInfo));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
|
@ -31,6 +31,18 @@ public:
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
protected:
|
||||
virtual EnumAttributesInfo GetEnumInfo() MOZ_OVERRIDE;
|
||||
virtual LengthAttributesInfo GetLengthInfo() MOZ_OVERRIDE;
|
||||
|
||||
nsSVGEnum mEnumAttributes[1];
|
||||
virtual nsSVGEnum* EnumAttributes() MOZ_OVERRIDE
|
||||
{ return mEnumAttributes; }
|
||||
|
||||
nsSVGLength2 mLengthAttributes[1];
|
||||
virtual nsSVGLength2* LengthAttributes() MOZ_OVERRIDE
|
||||
{ return mLengthAttributes; }
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -23,9 +23,12 @@ SVGTextPathElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aScope)
|
||||
return SVGTextPathElementBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
nsSVGElement::LengthInfo SVGTextPathElement::sLengthInfo[1] =
|
||||
nsSVGElement::LengthInfo SVGTextPathElement::sLengthInfo[2] =
|
||||
{
|
||||
{ &nsGkAtoms::startOffset, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
// from SVGTextContentElement:
|
||||
{ &nsGkAtoms::textLength, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::XY },
|
||||
// from SVGTextPathElement:
|
||||
{ &nsGkAtoms::startOffset, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X }
|
||||
};
|
||||
|
||||
nsSVGEnumMapping SVGTextPathElement::sMethodMap[] = {
|
||||
@ -40,8 +43,14 @@ nsSVGEnumMapping SVGTextPathElement::sSpacingMap[] = {
|
||||
{nullptr, 0}
|
||||
};
|
||||
|
||||
nsSVGElement::EnumInfo SVGTextPathElement::sEnumInfo[2] =
|
||||
nsSVGElement::EnumInfo SVGTextPathElement::sEnumInfo[3] =
|
||||
{
|
||||
// from SVGTextContentElement:
|
||||
{ &nsGkAtoms::lengthAdjust,
|
||||
sLengthAdjustMap,
|
||||
SVG_LENGTHADJUST_SPACING
|
||||
},
|
||||
// from SVGTextPathElement:
|
||||
{ &nsGkAtoms::method,
|
||||
sMethodMap,
|
||||
TEXTPATH_METHODTYPE_ALIGN
|
||||
|
@ -63,15 +63,19 @@ public:
|
||||
virtual EnumAttributesInfo GetEnumInfo() MOZ_OVERRIDE;
|
||||
virtual StringAttributesInfo GetStringInfo() MOZ_OVERRIDE;
|
||||
|
||||
enum { STARTOFFSET };
|
||||
nsSVGLength2 mLengthAttributes[1];
|
||||
static LengthInfo sLengthInfo[1];
|
||||
enum { /* TEXTLENGTH, */ STARTOFFSET = 1 };
|
||||
nsSVGLength2 mLengthAttributes[2];
|
||||
virtual nsSVGLength2* LengthAttributes() MOZ_OVERRIDE
|
||||
{ return mLengthAttributes; }
|
||||
static LengthInfo sLengthInfo[2];
|
||||
|
||||
enum { METHOD, SPACING };
|
||||
nsSVGEnum mEnumAttributes[2];
|
||||
enum { /* LENGTHADJUST, */ METHOD = 1, SPACING };
|
||||
nsSVGEnum mEnumAttributes[3];
|
||||
virtual nsSVGEnum* EnumAttributes() MOZ_OVERRIDE
|
||||
{ return mEnumAttributes; }
|
||||
static nsSVGEnumMapping sMethodMap[];
|
||||
static nsSVGEnumMapping sSpacingMap[];
|
||||
static EnumInfo sEnumInfo[2];
|
||||
static EnumInfo sEnumInfo[3];
|
||||
|
||||
enum { HREF };
|
||||
nsSVGString mStringAttributes[1];
|
||||
|
@ -163,7 +163,8 @@ nsSVGViewBox::SetBaseValueString(const nsAString& aValue,
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
if (viewBox == mBaseVal) {
|
||||
// Comparison against mBaseVal is only valid if we currently have a base val.
|
||||
if (mHasBaseVal && viewBox == mBaseVal) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -300,6 +300,18 @@ function runTests()
|
||||
is(marker.hasAttribute("viewBox"), true, "viewBox hasAttribute");
|
||||
ok(marker.getAttribute("viewBox") === "", "empty viewBox attribute");
|
||||
|
||||
marker.setAttribute("viewBox", "9 10 11 12");
|
||||
marker.removeAttribute("viewBox");
|
||||
marker.setAttribute("viewBox", "9 10 11 12");
|
||||
is(marker.viewBox.baseVal.x, 9, "viewBox.x baseVal after re-setting attribute to same rect value");
|
||||
is(marker.viewBox.baseVal.y, 10, "viewBox.y baseVal after re-setting attribute to same rect value");
|
||||
is(marker.viewBox.baseVal.width, 11, "viewBox.width baseVal after re-setting attribute to same rect value");
|
||||
is(marker.viewBox.baseVal.height, 12, "viewBox.height baseVal after re-setting attribute to same rect value");
|
||||
is(marker.viewBox.animVal.x, 9, "viewBox.x animVal after re-setting attribute to same rect value");
|
||||
is(marker.viewBox.animVal.y, 10, "viewBox.y animVal after re-setting attribute to same rect value");
|
||||
is(marker.viewBox.animVal.width, 11, "viewBox.width animVal after re-setting attribute to same rect value");
|
||||
is(marker.viewBox.animVal.height, 12, "viewBox.height animVal after re-setting attribute to same rect value");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "nsError.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
static PRLogModuleInfo* gLog;
|
||||
@ -203,7 +204,8 @@ nsXULCommandDispatcher::SetFocusedWindow(nsIDOMWindow* aWindow)
|
||||
// end up focusing whatever is currently focused inside the frame. Since
|
||||
// setting the command dispatcher's focused window doesn't raise the window,
|
||||
// setting it to a top-level window doesn't need to do anything.
|
||||
nsCOMPtr<nsIDOMElement> frameElement = window->GetFrameElementInternal();
|
||||
nsCOMPtr<nsIDOMElement> frameElement =
|
||||
do_QueryInterface(window->GetFrameElementInternal());
|
||||
if (frameElement)
|
||||
return fm->SetFocus(frameElement, 0);
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "SerializedLoadContext.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
class mozIApplication;
|
||||
|
||||
@ -35,7 +35,7 @@ public:
|
||||
// AppId/inBrowser arguments override those in SerializedLoadContext provided
|
||||
// by child process.
|
||||
LoadContext(const IPC::SerializedLoadContext& aToCopy,
|
||||
nsIDOMElement* aTopFrameElement,
|
||||
dom::Element* aTopFrameElement,
|
||||
uint32_t aAppId, bool aInBrowser)
|
||||
: mTopFrameElement(do_GetWeakReference(aTopFrameElement))
|
||||
, mAppId(aAppId)
|
||||
|
@ -8624,7 +8624,7 @@ nsDocShell::InternalLoad(nsIURI * aURI,
|
||||
// First, notify any nsIContentPolicy listeners about the document load.
|
||||
// Only abort the load if a content policy listener explicitly vetos it!
|
||||
//
|
||||
nsCOMPtr<nsIDOMElement> requestingElement;
|
||||
nsCOMPtr<Element> requestingElement;
|
||||
// Use nsPIDOMWindow since we _want_ to cross the chrome boundary if needed
|
||||
if (mScriptGlobal)
|
||||
requestingElement = mScriptGlobal->GetFrameElementInternal();
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/unused.h"
|
||||
|
||||
using mozilla::unused; // <snicker>
|
||||
@ -92,7 +93,8 @@ nsContentPermissionRequestProxy::GetElement(nsIDOMElement * *aRequestingElement)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aRequestingElement = mParent->mElement);
|
||||
nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(mParent->mElement);
|
||||
elem.forget(aRequestingElement);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -124,7 +126,7 @@ namespace dom {
|
||||
|
||||
ContentPermissionRequestParent::ContentPermissionRequestParent(const nsACString& aType,
|
||||
const nsACString& aAccess,
|
||||
nsIDOMElement *aElement,
|
||||
Element* aElement,
|
||||
const IPC::Principal& aPrincipal)
|
||||
{
|
||||
MOZ_COUNT_CTOR(ContentPermissionRequestParent);
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "nsIContentPermissionPrompt.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/PContentPermissionRequestParent.h"
|
||||
@ -19,14 +18,19 @@ class nsContentPermissionRequestProxy;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class Element;
|
||||
|
||||
class ContentPermissionRequestParent : public PContentPermissionRequestParent
|
||||
{
|
||||
public:
|
||||
ContentPermissionRequestParent(const nsACString& type, const nsACString& access, nsIDOMElement *element, const IPC::Principal& principal);
|
||||
ContentPermissionRequestParent(const nsACString& type,
|
||||
const nsACString& access,
|
||||
Element* element,
|
||||
const IPC::Principal& principal);
|
||||
virtual ~ContentPermissionRequestParent();
|
||||
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
nsCOMPtr<nsIDOMElement> mElement;
|
||||
nsCOMPtr<Element> mElement;
|
||||
nsCOMPtr<nsContentPermissionRequestProxy> mProxy;
|
||||
nsCString mType;
|
||||
nsCString mAccess;
|
||||
|
@ -2505,15 +2505,9 @@ nsDOMWindowUtils::RenderDocument(const nsRect& aRect,
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
||||
|
||||
// Get DOM Document
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMDocument> ddoc;
|
||||
rv = window->GetDocument(getter_AddRefs(ddoc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Get Document
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(ddoc, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDocument> doc = window->GetDoc();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
|
||||
// Get Primary Shell
|
||||
nsCOMPtr<nsIPresShell> presShell = doc->GetShell();
|
||||
@ -3217,23 +3211,15 @@ nsDOMWindowUtils::LoadSheet(nsIURI *aSheetURI, uint32_t aSheetType)
|
||||
aSheetType == USER_SHEET ||
|
||||
aSheetType == AUTHOR_SHEET);
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_INVALID_ARG);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> ddoc;
|
||||
nsresult rv = window->GetDocument(getter_AddRefs(ddoc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(ddoc, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(ddoc);
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_INVALID_ARG);
|
||||
nsCOMPtr<nsIDocument> doc = window->GetDoc();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
|
||||
nsIDocument::additionalSheetType type = convertSheetType(aSheetType);
|
||||
|
||||
rv = doc->LoadAdditionalStyleSheet(type, aSheetURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
return doc->LoadAdditionalStyleSheet(type, aSheetURI);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -3248,16 +3234,11 @@ nsDOMWindowUtils::RemoveSheet(nsIURI *aSheetURI, uint32_t aSheetType)
|
||||
aSheetType == USER_SHEET ||
|
||||
aSheetType == AUTHOR_SHEET);
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_INVALID_ARG);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> ddoc;
|
||||
nsresult rv = window->GetDocument(getter_AddRefs(ddoc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(ddoc, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(ddoc);
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_INVALID_ARG);
|
||||
nsCOMPtr<nsIDocument> doc = window->GetDoc();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
|
||||
nsIDocument::additionalSheetType type = convertSheetType(aSheetType);
|
||||
|
||||
|
@ -223,6 +223,7 @@
|
||||
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsLocation.h"
|
||||
#include "nsHTMLDocument.h"
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
#include "nsIAppsService.h"
|
||||
@ -2495,7 +2496,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
"outer and inner globals should have the same prototype");
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIContent> frame = do_QueryInterface(GetFrameElementInternal());
|
||||
nsCOMPtr<Element> frame = GetFrameElementInternal();
|
||||
if (frame) {
|
||||
nsPIDOMWindow* parentWindow = frame->OwnerDoc()->GetWindow();
|
||||
if (parentWindow && parentWindow->TimeoutSuspendCount()) {
|
||||
@ -2835,7 +2836,7 @@ nsGlobalWindow::UpdateParentTarget()
|
||||
// child global, and if it doesn't have one, just use the chrome event
|
||||
// handler itself.
|
||||
|
||||
nsCOMPtr<nsIDOMElement> frameElement = GetFrameElementInternal();
|
||||
nsCOMPtr<Element> frameElement = GetFrameElementInternal();
|
||||
nsCOMPtr<EventTarget> eventTarget =
|
||||
TryGetTabChildGlobalAsEventTarget(frameElement);
|
||||
|
||||
@ -3096,7 +3097,7 @@ nsGlobalWindow::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
// @see nsDocument::PreHandleEvent.
|
||||
mIsDocumentLoaded = true;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(GetFrameElementInternal()));
|
||||
nsCOMPtr<Element> element = GetFrameElementInternal();
|
||||
nsIDocShell* docShell = GetDocShell();
|
||||
|
||||
int32_t itemType = nsIDocShellTreeItem::typeChrome;
|
||||
@ -3105,7 +3106,7 @@ nsGlobalWindow::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
docShell->GetItemType(&itemType);
|
||||
}
|
||||
|
||||
if (content && GetParentInternal() &&
|
||||
if (element && GetParentInternal() &&
|
||||
itemType != nsIDocShellTreeItem::typeChrome) {
|
||||
// If we're not in chrome, or at a chrome boundary, fire the
|
||||
// onload event for the frame element.
|
||||
@ -3119,7 +3120,7 @@ nsGlobalWindow::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
// be a pres context available). Since we're not firing a GUI
|
||||
// event we don't need a pres context anyway so we just pass
|
||||
// null as the pres context all the time here.
|
||||
nsEventDispatcher::Dispatch(content, nullptr, &event, nullptr, &status);
|
||||
nsEventDispatcher::Dispatch(element, nullptr, &event, nullptr, &status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3277,6 +3278,37 @@ nsPIDOMWindow::MaybeCreateDoc()
|
||||
}
|
||||
}
|
||||
|
||||
Element*
|
||||
nsPIDOMWindow::GetFrameElementInternal() const
|
||||
{
|
||||
if (mOuterWindow) {
|
||||
return mOuterWindow->GetFrameElementInternal();
|
||||
}
|
||||
|
||||
NS_ASSERTION(!IsInnerWindow(),
|
||||
"GetFrameElementInternal() called on orphan inner window");
|
||||
|
||||
return mFrameElement;
|
||||
}
|
||||
|
||||
void
|
||||
nsPIDOMWindow::SetFrameElementInternal(Element* aFrameElement)
|
||||
{
|
||||
if (IsOuterWindow()) {
|
||||
mFrameElement = aFrameElement;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mOuterWindow) {
|
||||
NS_ERROR("frameElement set on inner window with no outer!");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
mOuterWindow->SetFrameElementInternal(aFrameElement);
|
||||
}
|
||||
|
||||
void
|
||||
nsPIDOMWindow::AddAudioContext(AudioContext* aAudioContext)
|
||||
{
|
||||
@ -5660,12 +5692,9 @@ nsGlobalWindow::Focus()
|
||||
mDocShell->GetParent(getter_AddRefs(parentDsti));
|
||||
|
||||
// set the parent's current focus to the frame containing this window.
|
||||
nsCOMPtr<nsIDOMWindow> parent(do_GetInterface(parentDsti));
|
||||
nsCOMPtr<nsPIDOMWindow> parent = do_GetInterface(parentDsti);
|
||||
if (parent) {
|
||||
nsCOMPtr<nsIDOMDocument> parentdomdoc;
|
||||
parent->GetDocument(getter_AddRefs(parentdomdoc));
|
||||
|
||||
nsCOMPtr<nsIDocument> parentdoc = do_QueryInterface(parentdomdoc);
|
||||
nsCOMPtr<nsIDocument> parentdoc = parent->GetDoc();
|
||||
if (!parentdoc)
|
||||
return NS_OK;
|
||||
|
||||
@ -6260,11 +6289,10 @@ nsGlobalWindow::FirePopupBlockedEvent(nsIDocument* aDoc,
|
||||
}
|
||||
}
|
||||
|
||||
void FirePopupWindowEvent(nsIDOMDocument* aDoc)
|
||||
static void FirePopupWindowEvent(nsIDocument* aDoc)
|
||||
{
|
||||
// Fire a "PopupWindow" event
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(aDoc));
|
||||
nsContentUtils::DispatchTrustedEvent(doc, aDoc,
|
||||
nsContentUtils::DispatchTrustedEvent(aDoc, aDoc,
|
||||
NS_LITERAL_STRING("PopupWindow"),
|
||||
true, true);
|
||||
}
|
||||
@ -6356,12 +6384,12 @@ nsGlobalWindow::FireAbuseEvents(bool aBlocked, bool aWindow,
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> topWindow;
|
||||
GetTop(getter_AddRefs(topWindow));
|
||||
if (!topWindow)
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(topWindow);
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> topDoc;
|
||||
topWindow->GetDocument(getter_AddRefs(topDoc));
|
||||
|
||||
nsCOMPtr<nsIDocument> topDoc = window->GetDoc();
|
||||
nsCOMPtr<nsIURI> popupURI;
|
||||
|
||||
// build the URI of the would-have-been popup window
|
||||
@ -6369,10 +6397,10 @@ nsGlobalWindow::FireAbuseEvents(bool aBlocked, bool aWindow,
|
||||
|
||||
// first, fetch the opener's base URI
|
||||
|
||||
nsIURI *baseURL = 0;
|
||||
nsIURI *baseURL = nullptr;
|
||||
|
||||
JSContext *cx = nsContentUtils::GetCurrentJSContext();
|
||||
nsCOMPtr<nsIDOMWindow> contextWindow;
|
||||
nsCOMPtr<nsPIDOMWindow> contextWindow;
|
||||
|
||||
if (cx) {
|
||||
nsIScriptContext *currentCX = nsJSUtils::GetDynamicScriptContext(cx);
|
||||
@ -6380,12 +6408,11 @@ nsGlobalWindow::FireAbuseEvents(bool aBlocked, bool aWindow,
|
||||
contextWindow = do_QueryInterface(currentCX->GetGlobalObject());
|
||||
}
|
||||
}
|
||||
if (!contextWindow)
|
||||
contextWindow = static_cast<nsIDOMWindow*>(this);
|
||||
if (!contextWindow) {
|
||||
contextWindow = this;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domdoc;
|
||||
contextWindow->GetDocument(getter_AddRefs(domdoc));
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domdoc));
|
||||
nsCOMPtr<nsIDocument> doc = contextWindow->GetDoc();
|
||||
if (doc)
|
||||
baseURL = doc->GetDocBaseURI();
|
||||
|
||||
@ -6397,8 +6424,7 @@ nsGlobalWindow::FireAbuseEvents(bool aBlocked, bool aWindow,
|
||||
|
||||
// fire an event chock full of informative URIs
|
||||
if (aBlocked) {
|
||||
nsCOMPtr<nsIDocument> topDocument = do_QueryInterface(topDoc);
|
||||
FirePopupBlockedEvent(topDocument, this, popupURI, aPopupWindowName,
|
||||
FirePopupBlockedEvent(topDoc, this, popupURI, aPopupWindowName,
|
||||
aPopupWindowFeatures);
|
||||
}
|
||||
if (aWindow)
|
||||
@ -7608,9 +7634,9 @@ nsGlobalWindow::GetRealFrameElement(nsIDOMElement** aFrameElement)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aFrameElement = mFrameElement;
|
||||
NS_IF_ADDREF(*aFrameElement);
|
||||
|
||||
if (mFrameElement) {
|
||||
CallQueryInterface(mFrameElement, aFrameElement);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -8178,8 +8204,7 @@ nsGlobalWindow::GetPrivateRoot()
|
||||
}
|
||||
}
|
||||
|
||||
return static_cast<nsGlobalWindow *>
|
||||
(static_cast<nsIDOMWindow *>(top));
|
||||
return static_cast<nsGlobalWindow*>(top.get());
|
||||
}
|
||||
|
||||
|
||||
@ -8368,10 +8393,9 @@ nsGlobalWindow::SetChromeEventHandler(EventTarget* aChromeEventHandler)
|
||||
|
||||
static bool IsLink(nsIContent* aContent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLAnchorElement> anchor = do_QueryInterface(aContent);
|
||||
return (anchor || (aContent &&
|
||||
aContent->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
|
||||
nsGkAtoms::simple, eCaseMatters)));
|
||||
return aContent && (aContent->IsHTML(nsGkAtoms::a) ||
|
||||
aContent->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
|
||||
nsGkAtoms::simple, eCaseMatters));
|
||||
}
|
||||
|
||||
void
|
||||
@ -8772,7 +8796,7 @@ nsGlobalWindow::UpdateCanvasFocus(bool aFocusChanged, nsIContent* aNewContent)
|
||||
if (canvasFrame) {
|
||||
canvasFrame->SetHasFocus(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -9138,18 +9162,16 @@ nsGlobalWindow::FireOfflineStatusEvent()
|
||||
}
|
||||
// The event is fired at the body element, or if there is no body element,
|
||||
// at the document.
|
||||
nsCOMPtr<nsISupports> eventTarget = mDoc.get();
|
||||
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(mDoc);
|
||||
nsCOMPtr<EventTarget> eventTarget = mDoc.get();
|
||||
nsHTMLDocument* htmlDoc = mDoc->AsHTMLDocument();
|
||||
if (htmlDoc) {
|
||||
nsCOMPtr<nsIDOMHTMLElement> body;
|
||||
htmlDoc->GetBody(getter_AddRefs(body));
|
||||
Element* body = htmlDoc->GetBody();
|
||||
if (body) {
|
||||
eventTarget = body;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Element* documentElement = mDoc->GetDocumentElement();
|
||||
if(documentElement) {
|
||||
if (documentElement) {
|
||||
eventTarget = documentElement;
|
||||
}
|
||||
}
|
||||
@ -9928,7 +9950,7 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
|
||||
FireAbuseEvents(true, false, aUrl, aName, aOptions);
|
||||
return aDoJSFixups ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> domReturn;
|
||||
|
||||
@ -9989,7 +10011,7 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
|
||||
NS_ENSURE_TRUE(domReturn, NS_OK);
|
||||
domReturn.swap(*aReturn);
|
||||
|
||||
if (aDoJSFixups) {
|
||||
if (aDoJSFixups) {
|
||||
nsCOMPtr<nsIDOMChromeWindow> chrome_win(do_QueryInterface(*aReturn));
|
||||
if (!chrome_win) {
|
||||
// A new non-chrome window was created from a call to
|
||||
@ -10857,7 +10879,7 @@ nsGlobalWindow::BuildURIfromBase(const char *aURL, nsIURI **aBuiltURI,
|
||||
nsAutoCString charset(NS_LITERAL_CSTRING("UTF-8")); // default to utf-8
|
||||
nsIURI* baseURI = nullptr;
|
||||
nsCOMPtr<nsIURI> uriToLoad;
|
||||
nsCOMPtr<nsIDOMWindow> sourceWindow;
|
||||
nsCOMPtr<nsPIDOMWindow> sourceWindow;
|
||||
|
||||
if (cx) {
|
||||
nsIScriptContext *scriptcx = nsJSUtils::GetDynamicScriptContext(cx);
|
||||
@ -10866,14 +10888,12 @@ nsGlobalWindow::BuildURIfromBase(const char *aURL, nsIURI **aBuiltURI,
|
||||
}
|
||||
|
||||
if (!sourceWindow) {
|
||||
sourceWindow = do_QueryInterface(NS_ISUPPORTS_CAST(nsIDOMWindow *, this));
|
||||
sourceWindow = this;
|
||||
*aFreeSecurityPass = true;
|
||||
}
|
||||
|
||||
if (sourceWindow) {
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
sourceWindow->GetDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc = sourceWindow->GetDoc();
|
||||
if (doc) {
|
||||
baseURI = doc->GetDocBaseURI();
|
||||
charset = doc->GetDocumentCharacterSet();
|
||||
@ -11069,7 +11089,7 @@ nsGlobalWindow::SuspendTimeouts(uint32_t aIncrease,
|
||||
|
||||
// This is a bit hackish. Only freeze/suspend windows which are truly our
|
||||
// subwindows.
|
||||
nsCOMPtr<nsIContent> frame = do_QueryInterface(pWin->GetFrameElementInternal());
|
||||
nsCOMPtr<Element> frame = pWin->GetFrameElementInternal();
|
||||
if (!mDoc || !frame || mDoc != frame->OwnerDoc() || !inner) {
|
||||
continue;
|
||||
}
|
||||
@ -11181,7 +11201,7 @@ nsGlobalWindow::ResumeTimeouts(bool aThawChildren)
|
||||
|
||||
// This is a bit hackish. Only thaw/resume windows which are truly our
|
||||
// subwindows.
|
||||
nsCOMPtr<nsIContent> frame = do_QueryInterface(pWin->GetFrameElementInternal());
|
||||
nsCOMPtr<Element> frame = pWin->GetFrameElementInternal();
|
||||
if (!mDoc || !frame || mDoc != frame->OwnerDoc() || !inner) {
|
||||
continue;
|
||||
}
|
||||
|
@ -43,21 +43,13 @@ GetDocumentCharacterSetForURI(const nsAString& aHref, nsACString& aCharset)
|
||||
{
|
||||
aCharset.Truncate();
|
||||
|
||||
nsresult rv;
|
||||
|
||||
JSContext *cx = nsContentUtils::GetCurrentJSContext();
|
||||
if (cx) {
|
||||
nsCOMPtr<nsIDOMWindow> window =
|
||||
nsCOMPtr<nsPIDOMWindow> window =
|
||||
do_QueryInterface(nsJSUtils::GetDynamicScriptGlobal(cx));
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
rv = window->GetDocument(getter_AddRefs(domDoc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
||||
|
||||
if (doc) {
|
||||
if (nsIDocument* doc = window->GetDoc()) {
|
||||
aCharset = doc->GetDocumentCharacterSet();
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsIURI.h"
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
|
||||
#include "js/RootingAPI.h"
|
||||
|
||||
#define DOM_WINDOW_DESTROYED_TOPIC "dom-window-destroyed"
|
||||
@ -54,6 +53,7 @@ class nsPIWindowRoot;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class AudioContext;
|
||||
class Element;
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,34 +196,8 @@ public:
|
||||
// Internal getter/setter for the frame element, this version of the
|
||||
// getter crosses chrome boundaries whereas the public scriptable
|
||||
// one doesn't for security reasons.
|
||||
nsIDOMElement* GetFrameElementInternal() const
|
||||
{
|
||||
if (mOuterWindow) {
|
||||
return mOuterWindow->GetFrameElementInternal();
|
||||
}
|
||||
|
||||
NS_ASSERTION(!IsInnerWindow(),
|
||||
"GetFrameElementInternal() called on orphan inner window");
|
||||
|
||||
return mFrameElement;
|
||||
}
|
||||
|
||||
void SetFrameElementInternal(nsIDOMElement *aFrameElement)
|
||||
{
|
||||
if (IsOuterWindow()) {
|
||||
mFrameElement = aFrameElement;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mOuterWindow) {
|
||||
NS_ERROR("frameElement set on inner window with no outer!");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
mOuterWindow->SetFrameElementInternal(aFrameElement);
|
||||
}
|
||||
mozilla::dom::Element* GetFrameElementInternal() const;
|
||||
void SetFrameElementInternal(mozilla::dom::Element* aFrameElement);
|
||||
|
||||
bool IsLoadingOrRunningTimeout() const
|
||||
{
|
||||
@ -339,9 +313,8 @@ public:
|
||||
nsPIDOMWindow *EnsureInnerWindow()
|
||||
{
|
||||
NS_ASSERTION(IsOuterWindow(), "EnsureInnerWindow called on inner window");
|
||||
// GetDocument forces inner window creation if there isn't one already
|
||||
nsCOMPtr<nsIDOMDocument> doc;
|
||||
GetDocument(getter_AddRefs(doc));
|
||||
// GetDoc forces inner window creation if there isn't one already
|
||||
GetDoc();
|
||||
return GetCurrentInnerWindow();
|
||||
}
|
||||
|
||||
@ -698,7 +671,7 @@ protected:
|
||||
nsCOMPtr<mozilla::dom::EventTarget> mParentTarget; // strong
|
||||
|
||||
// These members are only used on outer windows.
|
||||
nsCOMPtr<nsIDOMElement> mFrameElement;
|
||||
nsCOMPtr<mozilla::dom::Element> mFrameElement;
|
||||
nsIDocShell *mDocShell; // Weak Reference
|
||||
|
||||
// mPerformance is only used on inner windows.
|
||||
|
@ -149,8 +149,7 @@ BrowserElementParent::OpenWindowOOP(TabParent* aOpenerTabParent,
|
||||
const nsAString& aFeatures)
|
||||
{
|
||||
// Create an iframe owned by the same document which owns openerFrameElement.
|
||||
nsCOMPtr<Element> openerFrameElement =
|
||||
do_QueryInterface(aOpenerTabParent->GetOwnerElement());
|
||||
nsCOMPtr<Element> openerFrameElement = aOpenerTabParent->GetOwnerElement();
|
||||
NS_ENSURE_TRUE(openerFrameElement, false);
|
||||
nsRefPtr<HTMLIFrameElement> popupFrameElement =
|
||||
CreateIframe(openerFrameElement, aName, /* aRemote = */ true);
|
||||
@ -262,8 +261,7 @@ private:
|
||||
|
||||
NS_IMETHODIMP DispatchAsyncScrollEventRunnable::Run()
|
||||
{
|
||||
nsIDOMElement* element = mTabParent->GetOwnerElement();
|
||||
nsCOMPtr<Element> frameElement = do_QueryInterface(element);
|
||||
nsCOMPtr<Element> frameElement = mTabParent->GetOwnerElement();
|
||||
// Create the event's detail object.
|
||||
nsRefPtr<nsAsyncScrollEventDetail> detail =
|
||||
new nsAsyncScrollEventDetail(mContentRect.x, mContentRect.y,
|
||||
|
@ -541,6 +541,7 @@ function ContactManager()
|
||||
ContactManager.prototype = {
|
||||
__proto__: DOMRequestIpcHelper.prototype,
|
||||
_oncontactchange: null,
|
||||
_cachedContacts: [] ,
|
||||
|
||||
set oncontactchange(aCallback) {
|
||||
if (DEBUG) debug("set oncontactchange");
|
||||
@ -630,6 +631,13 @@ ContactManager.prototype = {
|
||||
}
|
||||
break;
|
||||
case "Contact:Save:Return:OK":
|
||||
// If a cached contact was saved and a new contact ID was returned, update the contact's ID
|
||||
if (this._cachedContacts[msg.requestID]) {
|
||||
if (msg.contactID) {
|
||||
this._cachedContacts[msg.requestID].id = msg.contactID;
|
||||
}
|
||||
delete this._cachedContacts[msg.requestID];
|
||||
}
|
||||
case "Contacts:Clear:Return:OK":
|
||||
case "Contact:Remove:Return:OK":
|
||||
req = this.getRequest(msg.requestID);
|
||||
@ -643,8 +651,12 @@ ContactManager.prototype = {
|
||||
case "Contacts:GetRevision:Return:KO":
|
||||
case "Contacts:Count:Return:KO":
|
||||
req = this.getRequest(msg.requestID);
|
||||
if (req)
|
||||
Services.DOMRequest.fireError(req.request, msg.errorMsg);
|
||||
if (req) {
|
||||
if (req.request) {
|
||||
req = req.request;
|
||||
}
|
||||
Services.DOMRequest.fireError(req, msg.errorMsg);
|
||||
}
|
||||
break;
|
||||
case "PermissionPromptHelper:AskPermission:OK":
|
||||
if (DEBUG) debug("id: " + msg.requestID);
|
||||
@ -747,7 +759,6 @@ ContactManager.prototype = {
|
||||
},
|
||||
|
||||
save: function save(aContact) {
|
||||
let request;
|
||||
if (DEBUG) debug("save: " + JSON.stringify(aContact) + " :" + aContact.id);
|
||||
let newContact = {};
|
||||
newContact.properties = {
|
||||
@ -777,12 +788,16 @@ ContactManager.prototype = {
|
||||
for (let field in newContact.properties) {
|
||||
newContact.properties[field] = aContact[field];
|
||||
}
|
||||
let request = this.createRequest();
|
||||
let requestID = this.getRequestId({request: request, reason: reason});
|
||||
|
||||
let reason;
|
||||
if (aContact.id == "undefined") {
|
||||
// for example {25c00f01-90e5-c545-b4d4-21E2ddbab9e0} becomes
|
||||
// 25c00f0190e5c545b4d421E2ddbab9e0
|
||||
aContact.id = this._getRandomId().replace('-', '', 'g').replace('{', '').replace('}', '');
|
||||
// Cache the contact so that its ID may be updated later if necessary
|
||||
this._cachedContacts[requestID] = aContact;
|
||||
reason = "create";
|
||||
} else {
|
||||
reason = "update";
|
||||
@ -790,10 +805,9 @@ ContactManager.prototype = {
|
||||
|
||||
this._setMetaData(newContact, aContact);
|
||||
if (DEBUG) debug("send: " + JSON.stringify(newContact));
|
||||
request = this.createRequest();
|
||||
let options = { contact: newContact, reason: reason };
|
||||
let allowCallback = function() {
|
||||
cpmm.sendAsyncMessage("Contact:Save", {requestID: this.getRequestId({request: request, reason: reason}), options: options});
|
||||
cpmm.sendAsyncMessage("Contact:Save", {requestID: requestID, options: options});
|
||||
}.bind(this)
|
||||
this.askPermission(reason, request, allowCallback);
|
||||
return request;
|
||||
@ -920,8 +934,8 @@ ContactManager.prototype = {
|
||||
"Contact:Remove:Return:OK", "Contact:Remove:Return:KO",
|
||||
"Contact:Changed",
|
||||
"PermissionPromptHelper:AskPermission:OK",
|
||||
"Contacts:GetAll:Next", "Contacts:Revision",
|
||||
"Contacts:Count"]);
|
||||
"Contacts:GetAll:Next", "Contacts:Count",
|
||||
"Contacts:Revision", "Contacts:GetRevision:Return:KO",]);
|
||||
},
|
||||
|
||||
// Called from DOMRequestIpcHelper
|
||||
|
@ -4,7 +4,9 @@
|
||||
# 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/.
|
||||
|
||||
TEST_DIRS += ['tests']
|
||||
# Android only supports the Contacts API on the Nightly channel.
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android' or CONFIG['NIGHTLY_BUILD']:
|
||||
TEST_DIRS += ['tests']
|
||||
|
||||
EXTRA_COMPONENTS += [
|
||||
'ContactManager.js',
|
||||
@ -13,5 +15,9 @@ EXTRA_COMPONENTS += [
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
'ContactDB.jsm',
|
||||
'ContactService.jsm',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
|
||||
EXTRA_JS_MODULES += [
|
||||
'ContactService.jsm'
|
||||
]
|
||||
|
@ -30,33 +30,35 @@ SpecialPowers.addPermission("contacts-write", true, document);
|
||||
SpecialPowers.addPermission("contacts-read", true, document);
|
||||
SpecialPowers.addPermission("contacts-create", true, document);
|
||||
|
||||
var isAndroid = (navigator.userAgent.indexOf("Android") !== -1);
|
||||
|
||||
// For Sorting
|
||||
var c1 = {
|
||||
name: "a",
|
||||
name: ["a a"],
|
||||
familyName: ["a"],
|
||||
givenName: ["a"],
|
||||
};
|
||||
|
||||
var c2 = {
|
||||
name: "b",
|
||||
name: ["b b"],
|
||||
familyName: ["b"],
|
||||
givenName: ["b"],
|
||||
};
|
||||
|
||||
var c3 = {
|
||||
name: "c",
|
||||
name: ["c c", "a a", "b b"],
|
||||
familyName: ["c","a","b"],
|
||||
givenName: ["c","a","b"],
|
||||
};
|
||||
|
||||
var c4 = {
|
||||
name: "d",
|
||||
name: ["c c", "a a", "c c"],
|
||||
familyName: ["c","a","c"],
|
||||
givenName: ["c","a","c"],
|
||||
};
|
||||
|
||||
var c5 = {
|
||||
name: "empty"
|
||||
nickname: "empty"
|
||||
};
|
||||
|
||||
var adr1 = {
|
||||
@ -78,18 +80,17 @@ var adr2 = {
|
||||
};
|
||||
|
||||
var properties1 = {
|
||||
name: "Testname1",
|
||||
name: ["Test1 TestFamilyName", "Test2 Wagner"],
|
||||
familyName: ["TestFamilyName","Wagner"],
|
||||
givenName: ["Test1","Test2"],
|
||||
nickname: "nicktest",
|
||||
tel: [{type: ["work"], value: "123456", carrier: "testCarrier"} , {type: ["home", "fax"], value: "+55 (31) 9876-3456"}, {type: ["home"], value: "+49 451 491934"}],
|
||||
adr: adr1,
|
||||
email: [{type: ["work"], value: "x@y.com"}],
|
||||
key: "4343JEGJGERNBEGOI34G3WGVERBERB"
|
||||
};
|
||||
|
||||
var properties2 = {
|
||||
name: ["dummyName", "dummyName2"],
|
||||
name: ["dummyHonorificPrefix dummyGivenName dummyFamilyName dummyHonorificSuffix", "dummyHonorificPrefix2"],
|
||||
familyName: "dummyFamilyName",
|
||||
givenName: "dummyGivenName",
|
||||
honorificPrefix: ["dummyHonorificPrefix","dummyHonorificPrefix2"],
|
||||
@ -102,10 +103,10 @@ var properties2 = {
|
||||
impp: [{type: ["aim"], value:"im1", pref: 1}, {value: "im2"}],
|
||||
org: ["org1", "org2"],
|
||||
jobTitle: ["boss", "superboss"],
|
||||
bday: new Date("1980, 12, 01"),
|
||||
note: "test note",
|
||||
category: ["cat1", "cat2"],
|
||||
url: [{type: ["work", "work2"], value: "www.1.com", pref: 1}, {value:"www2.com"}],
|
||||
bday: new Date("1980, 12, 01"),
|
||||
anniversary: new Date("2000, 12, 01"),
|
||||
sex: "male",
|
||||
genderIdentity: "test",
|
||||
@ -170,7 +171,7 @@ function checkAddress(adr1, adr2) {
|
||||
checkStrArray(adr1.region, adr2.region, "Same region");
|
||||
checkStrArray(adr1.postalCode, adr2.postalCode, "Same postalCode");
|
||||
checkStrArray(adr1.countryName, adr2.countryName, "Same countryName");
|
||||
is(adr1.pref, adr2.pref, "Same pref");
|
||||
checkPref(adr1.pref, adr2.pref);
|
||||
}
|
||||
|
||||
function checkTel(tel1, tel2) {
|
||||
@ -181,7 +182,7 @@ function checkTel(tel1, tel2) {
|
||||
checkStrArray(tel1.type, tel2.type, "Same type");
|
||||
checkStrArray(tel1.value, tel2.value, "Same value");
|
||||
checkStrArray(tel1.carrier, tel2.carrier, "Same carrier");
|
||||
is(tel1.pref, tel2.pref, "Same pref");
|
||||
checkPref(tel1.pref, tel2.pref);
|
||||
}
|
||||
|
||||
function checkField(field1, field2) {
|
||||
@ -191,7 +192,42 @@ function checkField(field1, field2) {
|
||||
}
|
||||
checkStrArray(field1.type, field2.type, "Same type");
|
||||
checkStrArray(field1.value, field2.value, "Same value");
|
||||
is(field1.pref, field2.pref, "Same pref");
|
||||
checkPref(field1.pref, field2.pref);
|
||||
}
|
||||
|
||||
function checkPref(pref1, pref2) {
|
||||
// If on Android treat one preference as 0 and the other as undefined as matching
|
||||
if (isAndroid) {
|
||||
if ((pref1 == 0 && pref2 == undefined) || (pref1 == undefined && pref2 == 0)) {
|
||||
pref1 = 0;
|
||||
pref2 = 0;
|
||||
}
|
||||
}
|
||||
is(pref1, pref2, "Same pref");
|
||||
}
|
||||
|
||||
function checkCategory(category1, category2) {
|
||||
// Android adds contacts to the a default category. This should be removed from the
|
||||
// results before comparing them
|
||||
if (isAndroid) {
|
||||
category1 = removeAndroidDefaultCategory(category1);
|
||||
category2 = removeAndroidDefaultCategory(category2);
|
||||
}
|
||||
checkStrArray(category1, category2, "Same Category")
|
||||
}
|
||||
|
||||
function removeAndroidDefaultCategory(category) {
|
||||
if (category == undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < category.length; i++) {
|
||||
if (category[i] == "My Contacts") {
|
||||
category.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
return category;
|
||||
}
|
||||
|
||||
function checkContacts(contact1, contact2) {
|
||||
@ -202,7 +238,7 @@ function checkContacts(contact1, contact2) {
|
||||
checkStrArray(contact1.familyName, contact2.familyName, "Same familyName");
|
||||
checkStrArray(contact1.honorificSuffix, contact2.honorificSuffix, "Same honorificSuffix");
|
||||
checkStrArray(contact1.nickname, contact2.nickname, "Same nickname");
|
||||
checkStrArray(contact1.category, contact2.category, "Same category");
|
||||
checkCategory(contact1.category, contact2.category);
|
||||
checkStrArray(contact1.org, contact2.org, "Same org");
|
||||
checkStrArray(contact1.jobTitle, contact2.jobTitle, "Same jobTitle");
|
||||
is(contact1.bday ? contact1.bday.valueOf() : null, contact2.bday ? contact2.bday.valueOf() : null, "Same birthday");
|
||||
@ -240,7 +276,14 @@ function checkRevision(revision, msg, then) {
|
||||
is(e.target.result, initialRev+revision, msg);
|
||||
then();
|
||||
};
|
||||
revReq.onerror = onFailure;
|
||||
// The revision function isn't supported on Android so treat on failure as success
|
||||
if (isAndroid) {
|
||||
revReq.onerror = function(e) {
|
||||
then();
|
||||
};
|
||||
} else {
|
||||
revReq.onerror = onFailure;
|
||||
}
|
||||
}
|
||||
|
||||
function checkCount(count, msg, then) {
|
||||
@ -262,7 +305,16 @@ var steps = [
|
||||
initialRev = e.target.result;
|
||||
next();
|
||||
};
|
||||
req.onerror = onFailure;
|
||||
|
||||
// Android does not support the revision function. Treat errors as success.
|
||||
if (isAndroid) {
|
||||
req.onerror = function(e) {
|
||||
initialRev = 0;
|
||||
next();
|
||||
};
|
||||
} else {
|
||||
req.onerror = onFailure;
|
||||
}
|
||||
},
|
||||
function () {
|
||||
ok(true, "Deleting database");
|
||||
@ -744,6 +796,12 @@ var steps = [
|
||||
req.onerror = onFailure;
|
||||
},
|
||||
function() {
|
||||
// Android does not support published/updated fields. Skip this.
|
||||
if (isAndroid) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
ok(true, "Saving old contact, should abort!");
|
||||
req = mozContacts.save(createResult1);
|
||||
req.onsuccess = onUnwantedSuccess;
|
||||
@ -1006,7 +1064,7 @@ var steps = [
|
||||
req = mozContacts.save(createResult1);
|
||||
req.onsuccess = function () {
|
||||
ok(createResult1.id, "The contact now has an ID.");
|
||||
ok(createResult1.name == properties1.name, "Same Name");
|
||||
checkStrArray(createResult1.name, properties1.name, "Same Name");
|
||||
checkCount(20, "20 contacts in DB", next);
|
||||
};
|
||||
req.onerror = onFailure;
|
||||
@ -1085,7 +1143,7 @@ var steps = [
|
||||
req = mozContacts.save(createResult1);
|
||||
req.onsuccess = function () {
|
||||
ok(createResult1.id, "The contact now has an ID.");
|
||||
ok(createResult1.name == properties1.name, "Same Name");
|
||||
checkStrArray(createResult1.name, properties1.name, "Same Name");
|
||||
next();
|
||||
}
|
||||
req.onerror = onFailure;
|
||||
@ -1330,7 +1388,7 @@ var steps = [
|
||||
function () {
|
||||
ok(true, "Adding empty contact");
|
||||
createResult1 = new mozContact();
|
||||
createResult1.init({givenName: "5"});
|
||||
createResult1.init({name: "5", givenName: "5"});
|
||||
req = navigator.mozContacts.save(createResult1);
|
||||
req.onsuccess = function () {
|
||||
ok(createResult1.id, "The contact now has an ID.");
|
||||
@ -1431,9 +1489,9 @@ var steps = [
|
||||
req.onerror = onFailure;
|
||||
},
|
||||
function () {
|
||||
ok(true, "Testing numbersOnly search");
|
||||
ok(true, "Testing numbersOnly search 1");
|
||||
createResult1 = new mozContact();
|
||||
createResult1.init({ givenName: ["aaaaaaaaa"], tel: [{ value: "1234567890"}]});
|
||||
createResult1.init({ name: ["aaaaaaaaa"], givenName: ["aaaaaaaaa"], tel: [{ value: "1234567890"}]});
|
||||
req = navigator.mozContacts.save(createResult1);
|
||||
req.onsuccess = function () {
|
||||
ok(createResult1.id, "The contact now has an ID.");
|
||||
@ -1442,7 +1500,7 @@ var steps = [
|
||||
req.onerror = onFailure;
|
||||
},
|
||||
function () {
|
||||
ok(true, "Test numbersOnly search");
|
||||
ok(true, "Test numbersOnly search 2");
|
||||
var options = {filterBy: ["givenName", "tel"],
|
||||
filterOp: "contains",
|
||||
filterValue: "a"};
|
||||
@ -1455,7 +1513,7 @@ var steps = [
|
||||
req.onerror = onFailure;
|
||||
},
|
||||
function () {
|
||||
ok(true, "Test numbersOnly search");
|
||||
ok(true, "Test numbersOnly search 3");
|
||||
var options = {filterBy: ["givenName", "tel"],
|
||||
filterOp: "contains",
|
||||
filterValue: "b"};
|
||||
@ -1467,7 +1525,7 @@ var steps = [
|
||||
req.onerror = onFailure;
|
||||
},
|
||||
function () {
|
||||
ok(true, "Test numbersOnly search");
|
||||
ok(true, "Test numbersOnly search 4");
|
||||
var options = {filterBy: ["givenName", "tel"],
|
||||
filterOp: "contains",
|
||||
filterValue: "1a"};
|
||||
@ -1479,7 +1537,7 @@ var steps = [
|
||||
req.onerror = onFailure;
|
||||
},
|
||||
function () {
|
||||
ok(true, "Test numbersOnly search");
|
||||
ok(true, "Test numbersOnly search 5");
|
||||
var options = {filterBy: ["givenName", "tel"],
|
||||
filterOp: "contains",
|
||||
filterValue: "1(23)"};
|
||||
@ -1491,7 +1549,7 @@ var steps = [
|
||||
req.onerror = onFailure;
|
||||
},
|
||||
function () {
|
||||
ok(true, "Test numbersOnly search");
|
||||
ok(true, "Test numbersOnly search 6");
|
||||
var options = {filterBy: ["givenName", "tel"],
|
||||
filterOp: "contains",
|
||||
filterValue: "1(23)a"};
|
||||
|
@ -85,11 +85,13 @@ var randomBlob = getRandomBlob(1024);
|
||||
var randomBlob2 = getRandomBlob(1024);
|
||||
|
||||
var properties1 = {
|
||||
name: "xTestname1",
|
||||
givenName: "xTestname1",
|
||||
photo: [randomBlob]
|
||||
};
|
||||
|
||||
var properties2 = {
|
||||
name: "yTestname2",
|
||||
givenName: "yTestname2",
|
||||
photo: [randomBlob, randomBlob2]
|
||||
};
|
||||
|
@ -40,7 +40,7 @@ let adr1 = {
|
||||
};
|
||||
|
||||
let properties1 = {
|
||||
name: "Testname1",
|
||||
name: ["Testname1 TestFamilyName"],
|
||||
familyName: ["TestFamilyName","Wagner"],
|
||||
givenName: ["Test1","Test2"],
|
||||
nickname: "nicktest",
|
||||
@ -165,6 +165,7 @@ function addContacts() {
|
||||
for (let i = 0; i < 39; ++i) {
|
||||
createResult1 = new mozContact();
|
||||
properties1.familyName[0] = "Testname" + (i < 10 ? "0" + i : i);
|
||||
properties1.name = properties1.givenName[0] + " " + properties1.familyName[0];
|
||||
createResult1.init(properties1);
|
||||
req = mozContacts.save(createResult1);
|
||||
req.onsuccess = function() {
|
||||
@ -174,6 +175,7 @@ function addContacts() {
|
||||
};
|
||||
createResult1 = new mozContact();
|
||||
properties1.familyName[0] = "Testname39";
|
||||
properties1.name = properties1.givenName[0] + " Testname39";
|
||||
createResult1.init(properties1);
|
||||
req = mozContacts.save(createResult1);
|
||||
req.onsuccess = function() {
|
||||
|
@ -77,23 +77,3 @@ interface nsITouchEventReceiver : nsISupports {
|
||||
[implicit_jscontext] attribute jsval ontouchleave;
|
||||
[implicit_jscontext] attribute jsval ontouchcancel;
|
||||
};
|
||||
|
||||
[scriptable, uuid(974cff68-6f0b-4520-8523-fa68b2754656)]
|
||||
interface nsIDOMDocumentTouch : nsITouchEventReceiver {
|
||||
nsIDOMTouch createTouch([optional] in nsIDOMWindow view,
|
||||
[optional] in nsIDOMEventTarget target,
|
||||
[optional] in long identifier,
|
||||
[optional] in long pageX,
|
||||
[optional] in long pageY,
|
||||
[optional] in long screenX,
|
||||
[optional] in long screenY,
|
||||
[optional] in long clientX,
|
||||
[optional] in long clientY,
|
||||
[optional] in long radiusX,
|
||||
[optional] in long radiusY,
|
||||
[optional] in float rotationAngle,
|
||||
[optional] in float force);
|
||||
|
||||
|
||||
nsIDOMTouchList createTouchList([optional] in nsIVariant aPoints);
|
||||
};
|
||||
|
@ -461,7 +461,7 @@ PrivilegesForApp(mozIApplication* aApp)
|
||||
}
|
||||
|
||||
/*static*/ ProcessPriority
|
||||
ContentParent::GetInitialProcessPriority(nsIDOMElement* aFrameElement)
|
||||
ContentParent::GetInitialProcessPriority(Element* aFrameElement)
|
||||
{
|
||||
// Frames with mozapptype == critical which are expecting a system message
|
||||
// get FOREGROUND_HIGH priority. All other frames get FOREGROUND priority.
|
||||
@ -470,10 +470,8 @@ ContentParent::GetInitialProcessPriority(nsIDOMElement* aFrameElement)
|
||||
return PROCESS_PRIORITY_FOREGROUND;
|
||||
}
|
||||
|
||||
nsAutoString appType;
|
||||
nsCOMPtr<Element> frameElement = do_QueryInterface(aFrameElement);
|
||||
frameElement->GetAttr(kNameSpaceID_None, nsGkAtoms::mozapptype, appType);
|
||||
if (appType != NS_LITERAL_STRING("critical")) {
|
||||
if (!aFrameElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::mozapptype,
|
||||
NS_LITERAL_STRING("critical"), eCaseMatters)) {
|
||||
return PROCESS_PRIORITY_FOREGROUND;
|
||||
}
|
||||
|
||||
@ -490,7 +488,7 @@ ContentParent::GetInitialProcessPriority(nsIDOMElement* aFrameElement)
|
||||
|
||||
/*static*/ TabParent*
|
||||
ContentParent::CreateBrowserOrApp(const TabContext& aContext,
|
||||
nsIDOMElement* aFrameElement)
|
||||
Element* aFrameElement)
|
||||
{
|
||||
if (!sCanLaunchSubprocesses) {
|
||||
return nullptr;
|
||||
@ -745,7 +743,7 @@ NS_IMPL_ISUPPORTS1(SystemMessageHandledListener,
|
||||
} // anonymous namespace
|
||||
|
||||
void
|
||||
ContentParent::MaybeTakeCPUWakeLock(nsIDOMElement* aFrameElement)
|
||||
ContentParent::MaybeTakeCPUWakeLock(Element* aFrameElement)
|
||||
{
|
||||
// Take the CPU wake lock on behalf of this processs if it's expecting a
|
||||
// system message. We'll release the CPU lock once the message is
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
*/
|
||||
static TabParent*
|
||||
CreateBrowserOrApp(const TabContext& aContext,
|
||||
nsIDOMElement* aFrameElement);
|
||||
Element* aFrameElement);
|
||||
|
||||
static void GetAll(nsTArray<ContentParent*>& aArray);
|
||||
static void GetAllEvenIfDead(nsTArray<ContentParent*>& aArray);
|
||||
@ -195,7 +195,7 @@ private:
|
||||
ChildPrivileges aPrivs,
|
||||
hal::ProcessPriority aInitialPriority);
|
||||
|
||||
static hal::ProcessPriority GetInitialProcessPriority(nsIDOMElement* aFrameElement);
|
||||
static hal::ProcessPriority GetInitialProcessPriority(Element* aFrameElement);
|
||||
|
||||
// Hide the raw constructor methods since we don't want client code
|
||||
// using them.
|
||||
@ -218,7 +218,7 @@ private:
|
||||
// has a pending system message, this function acquires the CPU wake lock on
|
||||
// behalf of the child. We'll release the lock when the system message is
|
||||
// handled or after a timeout, whichever comes first.
|
||||
void MaybeTakeCPUWakeLock(nsIDOMElement* aFrameElement);
|
||||
void MaybeTakeCPUWakeLock(Element* aFrameElement);
|
||||
|
||||
// Set the child process's priority and then check whether the child is
|
||||
// still alive. Returns true if the process is still alive, and false
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "ProcessPriorityManager.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
@ -829,8 +830,7 @@ ParticularProcessPriorityManager::IsExpectingSystemMessage()
|
||||
mContentParent->ManagedPBrowserParent();
|
||||
for (uint32_t i = 0; i < browsers.Length(); i++) {
|
||||
TabParent* tp = static_cast<TabParent*>(browsers[i]);
|
||||
nsCOMPtr<nsIDOMElement> ownerElement = tp->GetOwnerElement();
|
||||
nsCOMPtr<nsIMozBrowserFrame> bf = do_QueryInterface(ownerElement);
|
||||
nsCOMPtr<nsIMozBrowserFrame> bf = do_QueryInterface(tp->GetOwnerElement());
|
||||
if (!bf) {
|
||||
continue;
|
||||
}
|
||||
|