--HG--
rename : layout/style/test/test_hover.html => layout/style/test/hover_helper.html
This commit is contained in:
Chris Jones 2010-08-31 00:35:03 -05:00
Родитель 81e73c9175 7f643ab37a
Коммит 76dde2a6bc
342 изменённых файлов: 5635 добавлений и 2395 удалений

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

@ -9,7 +9,7 @@
# User files that may appear at the root
^\.mozconfig
^mozconfig
^mozconfig$
^configure$
^config\.cache$
^config\.log$

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

@ -59,8 +59,6 @@ DEFINES += -DAB_CD=$(AB_CD)
APP_VERSION = $(shell cat $(srcdir)/../config/version.txt)
DEFINES += -DAPP_VERSION="$(APP_VERSION)"
APP_UA_NAME = $(shell echo $(MOZ_APP_DISPLAYNAME) | sed -e's/[^A-Za-z]//g')
DEFINES += -DAPP_UA_NAME="$(APP_UA_NAME)"
DIST_FILES = application.ini

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

@ -191,7 +191,6 @@ pref("keyword.URL", "");
pref("general.useragent.locale", "@AB_CD@");
pref("general.skins.selectedSkin", "classic/1.0");
pref("general.useragent.extra.firefox", "@APP_UA_NAME@/@APP_VERSION@");
pref("general.smoothScroll", false);
#ifdef UNIX_BUT_NOT_MAC

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

@ -505,6 +505,10 @@ const gPopupBlockerObserver = {
var pageReport = gBrowser.pageReport;
if (pageReport) {
for (var i = 0; i < pageReport.length; ++i) {
// popupWindowURI will be null if the file picker popup is blocked.
// xxxdz this should make the option say "Show file picker" and do it (Bug 590306)
if (!pageReport[i].popupWindowURI)
continue;
var popupURIspec = pageReport[i].popupWindowURI.spec;
// Sometimes the popup URI that we get back from the pageReport
@ -1347,10 +1351,6 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
PlacesStarButton.init();
// called when we go into full screen, even if it is
// initiated by a web page script
window.addEventListener("fullscreen", onFullScreen, true);
if (isLoadingBlank && gURLBar && isElementVisible(gURLBar))
gURLBar.focus();
else
@ -1514,6 +1514,12 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
if (Win7Features)
Win7Features.onOpenWindow();
// called when we go into full screen, even if it is
// initiated by a web page script
window.addEventListener("fullscreen", onFullScreen, true);
if (window.fullScreen)
onFullScreen();
#ifdef MOZ_SERVICES_SYNC
// initialize the sync UI
gSyncUI.init();
@ -2635,9 +2641,8 @@ function BrowserFullScreen()
window.fullScreen = !window.fullScreen;
}
function onFullScreen()
{
FullScreen.toggle();
function onFullScreen(event) {
FullScreen.toggle(event);
}
function getWebNavigation()
@ -2788,6 +2793,17 @@ function FillInHTMLTooltip(tipElement)
#endif // MOZ_SVG
var direction = tipElement.ownerDocument.dir;
// If the element is invalid per HTML5 Forms specifications,
// show the constraint validation error message instead of @tooltip.
if (tipElement instanceof HTMLInputElement ||
tipElement instanceof HTMLTextAreaElement ||
tipElement instanceof HTMLSelectElement ||
tipElement instanceof HTMLButtonElement) {
// If the element is barred from constraint validation or valid,
// the validation message will be the empty string.
titleText = tipElement.validationMessage;
}
while (!titleText && !XLinkTitleText && !SVGTitleText && tipElement) {
if (tipElement.nodeType == Node.ELEMENT_NODE) {
titleText = tipElement.getAttribute("title");
@ -3620,17 +3636,21 @@ function updateEditUIVisibility()
#endif
}
var FullScreen =
{
var FullScreen = {
_XULNS: "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
toggle: function()
{
// show/hide all menubars, toolbars, and statusbars (except the full screen toolbar)
this.showXULChrome("toolbar", window.fullScreen);
this.showXULChrome("statusbar", window.fullScreen);
document.getElementById("View:FullScreen").setAttribute("checked", !window.fullScreen);
toggle: function (event) {
var enterFS = window.fullScreen;
if (!window.fullScreen) {
// We get the fullscreen event _before_ the window transitions into or out of FS mode.
if (event && event.type == "fullscreen")
enterFS = !enterFS;
// show/hide all menubars, toolbars, and statusbars (except the full screen toolbar)
this.showXULChrome("toolbar", !enterFS);
this.showXULChrome("statusbar", !enterFS);
document.getElementById("View:FullScreen").setAttribute("checked", enterFS);
if (enterFS) {
// Add a tiny toolbar to receive mouseover and dragenter events, and provide affordance.
// This will help simulate the "collapse" metaphor while also requiring less code and
// events than raw listening of mouse coords.
@ -6993,8 +7013,13 @@ var gIdentityHandler = {
if (!this._eTLDService)
this._eTLDService = Cc["@mozilla.org/network/effective-tld-service;1"]
.getService(Ci.nsIEffectiveTLDService);
if (!this._IDNService)
this._IDNService = Cc["@mozilla.org/network/idn-service;1"]
.getService(Ci.nsIIDNService);
try {
return this._eTLDService.getBaseDomainFromHost(this._lastLocation.hostname);
let baseDomain =
this._eTLDService.getBaseDomainFromHost(this._lastLocation.hostname);
return this._IDNService.convertToDisplayIDN(baseDomain, {});
} catch (e) {
// If something goes wrong (e.g. hostname is an IP address) just fail back
// to the full domain.

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

@ -485,7 +485,6 @@
<menuitem id="appmenu_privateBrowsing"
class="menuitem-iconic"
label="&privateBrowsingCmd.start.label;"
accesskey="&privateBrowsingCmd.start.accesskey;"
startlabel="&privateBrowsingCmd.start.label;"
stoplabel="&privateBrowsingCmd.stop.label;"
command="Tools:PrivateBrowsing"/>
@ -560,7 +559,6 @@
command="View:PageSource"/>
<menuseparator/>
<menuitem label="&goOfflineCmd.label;"
accesskey="&goOfflineCmd.accesskey;"
type="checkbox"
oncommand="BrowserOffline.toggleOfflineStatus();"/>
</menupopup>
@ -1213,7 +1211,7 @@
</vbox>
</hbox>
<vbox id="browser-bottombox">
<vbox id="browser-bottombox" layer="true">
<statusbar class="chromeclass-status" id="status-bar"
#ifdef WINCE
hidden="true"

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

@ -109,7 +109,7 @@ Drag.prototype = {
// checkItemStatus - (boolean) make sure this is a valid item which should be snapped
snapBounds: function Drag_snapBounds(bounds, stationaryCorner, assumeConstantSize, keepProportional, checkItemStatus) {
if (!stationaryCorner)
stationaryCorner || 'topleft';
stationaryCorner = 'topleft';
var update = false; // need to update
var updateX = false;
var updateY = false;

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

@ -722,19 +722,6 @@ window.GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
});
},
// ----------
// Function: setNewTabButtonBounds
// Used for positioning the "new tab" button in the "new tabs" groupItem.
setNewTabButtonBounds: function(box, immediately) {
if (!immediately)
this.$ntb.animate(box.css(), {
duration: 320,
easing: "tabviewBounce"
});
else
this.$ntb.css(box.css());
},
// ----------
// Function: hideExpandControl
// Hide the control which expands a stacked groupItem into a quick-look view.

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

@ -142,6 +142,7 @@ _BROWSER_FILES = \
browser_bug577121.js \
browser_bug580956.js \
browser_bug581242.js \
browser_bug581947.js \
browser_bug585830.js \
browser_contextSearchTabPosition.js \
browser_ctrlTab.js \

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

@ -18,10 +18,21 @@ function test() {
content.location = "http://test1.example.org/";
}
// Greek IDN for 'example.test'.
var idnDomain = "\u03C0\u03B1\u03C1\u03AC\u03B4\u03B5\u03B9\u03B3\u03BC\u03B1.\u03B4\u03BF\u03BA\u03B9\u03BC\u03AE";
function testNormalDomain() {
is(gIdentityHandler._lastLocation.host, 'test1.example.org', "Identity handler is getting the full location");
is(gIdentityHandler.getEffectiveHost(), 'example.org', "getEffectiveHost should return example.org for test1.example.org");
listener.testFunction = testIDNDomain;
content.location = "http://sub1." + idnDomain + "/";
}
function testIDNDomain() {
is(gIdentityHandler._lastLocation.host, "sub1." + idnDomain, "Identity handler is getting the full location");
is(gIdentityHandler.getEffectiveHost(), idnDomain, "getEffectiveHost should return the IDN base domain in UTF-8");
listener.testFunction = testNormalDomainWithPort;
content.location = "http://sub1.test1.example.org:8000/";
}

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

@ -0,0 +1,85 @@
function check(aElementName, aBarred, aType) {
let doc = gBrowser.contentDocument;
let tooltip = document.getElementById("aHTMLTooltip");
let content = doc.getElementById('content');
let e = doc.createElement(aElementName);
content.appendChild(e);
if (aType) {
e.type = aType;
}
ok(!FillInHTMLTooltip(e),
"No tooltip should be shown when the element is valid");
e.setCustomValidity('foo');
if (aBarred) {
ok(!FillInHTMLTooltip(e),
"No tooltip should be shown when the element is barred from constraint validation");
} else {
ok(FillInHTMLTooltip(e),
"A tooltip should be shown when the element isn't valid");
}
content.removeChild(e);
}
function todo_check(aElementName, aBarred) {
let doc = gBrowser.contentDocument;
let tooltip = document.getElementById("aHTMLTooltip");
let content = doc.getElementById('content');
let e = doc.createElement(aElementName);
content.appendChild(e);
let cought = false;
try {
e.setCustomValidity('foo');
} catch (e) {
cought = true;
}
todo(!cought, "setCustomValidity should exist for " + aElementName);
content.removeChild(e);
}
function test () {
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
let testData = [
/* element name, barred, type */
[ 'input', false, null],
[ 'textarea', false, null],
[ 'button', true, 'button'],
[ 'button', false, 'submit' ],
[ 'select', false, null],
[ 'output', true, null],
[ 'fieldset', true, null],
];
for each (let data in testData) {
check(data[0], data[1], data[2]);
}
let todo_testData = [
[ 'keygen', 'false' ],
[ 'object', 'false' ],
];
for each(let data in todo_testData) {
todo_check(data[0], data[1]);
}
gBrowser.removeCurrentTab();
finish();
}, true);
content.location =
"data:text/html,<!DOCTYPE html><html><body><div id='content'></div></body></html>";
}

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

@ -1 +1 @@
MOZ_APP_DISPLAYNAME="MozillaDeveloperPreview"
MOZ_APP_DISPLAYNAME=MozillaDeveloperPreview

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

@ -546,7 +546,7 @@ var BookmarkPropertiesPanel = {
try {
var value = this._element(aTextboxID).value;
if (value) {
var uri = PlacesUIUtils.createFixedURI(value);
PlacesUIUtils.createFixedURI(value);
return true;
}
} catch (e) { }

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

@ -1,7 +1,3 @@
#contentTitle {
width: 0px;
}
#searchFilter {
width: 23em;
}

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

@ -391,8 +391,7 @@ var PlacesOrganizer = {
if (fp.file) {
var importer = Cc["@mozilla.org/browser/places/import-export-service;1"].
getService(Ci.nsIPlacesImportExportService);
var file = fp.file.QueryInterface(Ci.nsILocalFile);
importer.importHTMLFromFile(file, false);
importer.importHTMLFromFile(fp.file, false);
}
}
},

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

@ -40,6 +40,7 @@ DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = browser/components/places/tests
include $(DEPTH)/config/autoconf.mk

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

@ -45,7 +45,7 @@ const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
// Import common head.
let (commonFile = do_get_file("../../test_places/head_common.js", false)) {
let (commonFile = do_get_file("../../../../../toolkit/components/places/tests/head_common.js", false)) {
let uri = Services.io.newFileURI(commonFile);
Services.scriptloader.loadSubScript(uri.spec, this);
}

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

@ -2078,19 +2078,33 @@ SessionStoreService.prototype = {
}
if (aTabs.length > 0) {
// Load hidden tabs last, by pushing them to the end of the list
let unhiddenTabs = aTabs.length;
for (let t = 0; t < unhiddenTabs; ) {
if (aTabs[t].hidden) {
aTabs = aTabs.concat(aTabs.splice(t, 1));
aTabData = aTabData.concat(aTabData.splice(t, 1));
if (aSelectTab > t)
--aSelectTab;
--unhiddenTabs;
continue;
}
++t;
}
// Determine if we can optimize & load visible tabs first
let maxVisibleTabs = Math.ceil(tabbrowser.tabContainer.mTabstrip.scrollClientSize /
aTabs[aTabs.length - 1].clientWidth);
aTabs[unhiddenTabs - 1].clientWidth);
// make sure we restore visible tabs first, if there are enough
if (maxVisibleTabs < aTabs.length && aSelectTab > 1) {
if (maxVisibleTabs < unhiddenTabs && aSelectTab > 1) {
let firstVisibleTab = 0;
if (aTabs.length - maxVisibleTabs > aSelectTab) {
if (unhiddenTabs - maxVisibleTabs > aSelectTab) {
// aSelectTab is leftmost since we scroll to it when possible
firstVisibleTab = aSelectTab - 1;
} else {
// aSelectTab is rightmost or no more room to scroll right
firstVisibleTab = aTabs.length - maxVisibleTabs;
firstVisibleTab = unhiddenTabs - maxVisibleTabs;
}
aTabs = aTabs.splice(firstVisibleTab, maxVisibleTabs).concat(aTabs);
aTabData = aTabData.splice(firstVisibleTab, maxVisibleTabs).concat(aTabData);

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

@ -52,10 +52,16 @@ function test() {
waitForExplicitFinish();
// builds the tests state based on a few parameters
function buildTestState(num, selected) {
function buildTestState(num, selected, hidden) {
let state = { windows: [ { "tabs": [], "selected": selected } ] };
while (num--)
while (num--) {
state.windows[0].tabs.push({entries: [{url: "http://example.com/"}]});
let i = state.windows[0].tabs.length - 1;
if (hidden.length > 0 && i == hidden[0]) {
state.windows[0].tabs[i].hidden = true;
hidden.splice(0, 1);
}
}
return state;
}
@ -80,17 +86,17 @@ function test() {
}
// the number of tests we're running
let numTests = 4;
let numTests = 6;
let completedTests = 0;
let tabMinWidth = parseInt(getComputedStyle(gBrowser.selectedTab, null).minWidth);
function runTest(testNum, totalTabs, selectedTab, shownTabs, order) {
function runTest(testNum, totalTabs, selectedTab, shownTabs, hiddenTabs, order) {
let test = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMEventListener,
Ci.nsISupportsWeakReference]),
state: buildTestState(totalTabs, selectedTab),
state: buildTestState(totalTabs, selectedTab, hiddenTabs),
numTabsToShow: shownTabs,
expectedOrder: order,
actualOrder: [],
@ -157,10 +163,12 @@ function test() {
}
// actually create & run the tests
runTest(1, 13, 1, 6, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
runTest(2, 13, 13, 6, [12, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6]);
runTest(3, 13, 4, 6, [3, 4, 5, 6, 7, 8, 0, 1, 2, 9, 10, 11, 12]);
runTest(4, 13, 11, 6, [10, 7, 8, 9, 11, 12, 0, 1, 2, 3, 4, 5, 6]);
runTest(1, 13, 1, 6, [], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
runTest(2, 13, 13, 6, [], [12, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6]);
runTest(3, 13, 4, 6, [], [3, 4, 5, 6, 7, 8, 0, 1, 2, 9, 10, 11, 12]);
runTest(4, 13, 11, 6, [], [10, 7, 8, 9, 11, 12, 0, 1, 2, 3, 4, 5, 6]);
runTest(5, 13, 13, 6, [0, 4, 9], [12, 6, 7, 8, 10, 11, 1, 2, 3, 5, 0, 4, 9]);
runTest(6, 13, 4, 6, [1, 7, 12], [3, 4, 5, 6, 8, 9, 0, 2, 10, 11, 1, 7, 12]);
// finish() is run by the last test to finish, so no cleanup down here
}

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

@ -68,6 +68,11 @@
padding-top: 0;
}
#browser-bottombox:not([lwthemefooter="true"]) {
/* opaque for layers optimization */
background-color: -moz-Dialog;
}
#urlbar:-moz-lwtheme:not([focused="true"]),
.searchbar-textbox:-moz-lwtheme:not([focused="true"]),
.tabbrowser-tab:-moz-lwtheme:not([selected="true"]) {

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

@ -21,7 +21,7 @@
display: none;
}
#main-window:not(:-moz-lwtheme) {
#main-window {
-moz-appearance: -moz-win-borderless-glass;
background: transparent;
}
@ -40,7 +40,7 @@
text-shadow: 0 0 .7em white, 0 0 .7em white, 0 1px 0 rgba(255,255,255,.4);
}
#navigator-toolbox[tabsontop="true"] > toolbar:not(#toolbar-menubar):not(#TabsToolbar) {
#main-window[sizemode="normal"] #navigator-toolbox[tabsontop="true"] > toolbar:not(#toolbar-menubar):not(#TabsToolbar) {
border-left: 1px solid ThreeDShadow;
border-right: 1px solid ThreeDShadow;
}

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

@ -92,6 +92,12 @@
background-image: -moz-linear-gradient(@toolbarHighlight@, @toolbarHighlight@);
}
#navigator-toolbox[tabsontop="true"] > #nav-bar:not(:-moz-lwtheme),
#navigator-toolbox[tabsontop="true"]:not([customizing]) > #nav-bar[collapsed="true"] + toolbar:not(:-moz-lwtheme),
#navigator-toolbox[tabsontop="true"]:not([customizing]) > #nav-bar[collapsed="true"] + #customToolbars + #PersonalToolbar:not(:-moz-lwtheme) {
border-top: 1px solid ThreeDShadow;
}
#personal-bookmarks {
min-height: 24px;
}
@ -1277,8 +1283,15 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
rgba(0,0,0,.05) 90%, rgba(0,0,0,.1));
}
#TabsToolbar[tabsontop="true"]:not(:-moz-lwtheme) {
-moz-box-shadow: 0 -1px ThreeDShadow inset;
#tabbrowser-tabs[tabsontop="true"] > .tabbrowser-arrowscrollbox > scrollbox:not(:-moz-lwtheme) {
padding-bottom: 1px;
margin-bottom: -1px;
position: relative;
}
#tabbrowser-tabs[tabsontop="true"] > .tabbrowser-tab[selected="true"]:not(:-moz-lwtheme) {
margin-bottom: -1px;
padding-bottom: 1px;
}
.tabbrowser-tabs:-moz-system-metric(touch-enabled) {

Двоичные данные
build/mobile/sutagent/android/res/drawable/ateamlogo.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.5 KiB

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

@ -1,35 +0,0 @@
--- ateamlogo.png
+++ ateamlogo.png
GIT binary patch
literal 1512
zc$@*~1sD2>P)<h;3K|Lk000e1NJLTq001@s000>X1^@s6dcWO100001b5ch_0Itp)
z=>Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!~g&e!~vBn4jTXf06}y`Sad^gZEa<4
zbO1wAML|?gQaT`KWG!lNWoICEF)lD5D0OpbZf77#N=G0{P(?=|b~Z98EFf`pVQgu1
zc_2L?I5i5)@W$Z)00l5fL_t(oN5xoKD0W>Ge#;jZ=6RmSl&J`1jG~APxiJ(X7fNKf
zKoaG`5Em#iyPyn7Q8JV<ajBG{xKToqxG=51XVrc?Ug!8;ec${2yLM-vea;@9z1Dix
zT3hAk=SQBNp5*B0NVc}N<mBYUZF_rrva_?}Hu~_6>gDA{7~|{f%TLXUej6JbvbMJV
zQZZg`j4t|A0F{xEK@$@bw6d~7Jv}|t-Q7(yGcz<jJxzUmeN<apOLKE`w79rPVPRq9
z?d?rIK0dObtgNhPe}A9$_V#FJXNPuoce$c(YHErPM;Aae=VV~1si{;`Q$r}x(a|(I
zI!c?Ho3y&R%I&JEDtdf;q`bU53JeTnP;$T^&4`Eyo=2&enwly~`)>kPVKN5?2P!Qs
z<-Mp>DjFLb<I_GqKBj?z0jj8|pqrZ;YHDg?)r7jqsUm;{2M4P$eSCa;X(uKol81+f
z&ZWk{U_%`p9lQyg==SzDU0z<&$;k<=udlOezP!A!YNn;7u}unKQpusu$jC?**!%lC
z_qVjP@Opn!I&yO{Fl-2??d<H#D(3F)PA)DkT;1H<_#K<UH~c3jF#!}3-PqV*5K@T=
zU{G-oi`a}33H>Q>1}4B^<6_fjgCy`So=Ucb@c>^`R73>@1=QHss0a)njE#+TZf9y>
z-<^;+Rq5$!k_YT`a&nSJMn-;1Ah1K>HvUvHO5?QxrsS`r{bpunbbWnIS65d|K$=CU
zBKj*UD_QMz1q$;j0+ZU2R8mUPgKeQ49v(8V)6-K$%AcQ~=U_mmz`iqHIS_JvuCA_B
zQc}V|U|%LCCNwlOqzLTc;epv#r@)jZ{~cRNzvJ`~nV^J(gs`tGEG$$6h7ULlkdm&z
zDXOBTe^QDMh3^8j!;Zjs*f4zEcLnSTaQ_^bbU|Tna;yk;3knKi43HY6hyS3C&(F__
z*oKFPbs9Hn&5D|;Dc<3@8yXrIKyh)gS_+8pmzS3nft{b9lZA!F|06MN$OBOX;z|@m
z?x1~hb92(y*Qc_wvQNN7BqE-cmX<nm)Sn^`ZHPpZ`e9Qj7Z(>y^KWl&bbo(OcXxMm
zdwVM@F#!x&1tJz**qK(q1aWApBck-Aq$J*aS63IOJlYfiti8RR8T6k66U-<_9wOaA
z<c|V?{{H?HA0JOKF)>_`yPch#@prit2FWK9Q>Dm8#HLtZ+Q$Eyajp1A9KKfMq2$w`
zhDdKvq%;qzN5!U*&!I>|Dk(_0fEepxJk%5wnt@D1WEXHJa23cr@Gl4qZIPXzPb*-W
zCyIdxdLttvdDE}2ucW7^_k{?scy4a)7l{F+02dk>${?_Y*c{Yzc6OGIj*d7)8yp<u
zIiR|@zWDX)7r)on*Hc150=EMK0{EGdlEMe^V_*OUnodto|71?h&COrZ5in$3U7Z@3
zlodrA*}8#&0fVZpuBP7JUbZ`I4oNQJN<%|Ko&$F-QBhHpnVHGo*4EZ|&8Md)zREy>
zPla#&F)&a%7LY5r7XgKftQ>@*O+iM0!wL@%r`Xt7j$GhIwzjrtX=zEFE#U4YJ3E{G
z<-)=OPmMzWsJ6B?eitdxkAdN2^Yioh)(KY#qT;>3zhBLAu#K#&EIK$iU_U4QS94rv
zXD8bU0Ewg)s*VH1%@&+J)DnTf`1m*n*l}@jOibnF<<#2RN;x?>oKYkvC$nmQ3rvYL
z08Z}iP?Nd=PU((OdhaNA2ZFVs9RLW@z&s!atRYktbHI+#k3HdC*z14S7)K2k6Hd?o
O0000<MNUMnLSTZ(cchyD

Двоичные данные
build/mobile/sutagent/android/res/drawable/ic_stat_first.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.6 KiB

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

@ -1,37 +0,0 @@
--- ic_stat_first.png
+++ ic_stat_first.png
GIT binary patch
literal 1636
zc$@)b2AlbbP)<h;3K|Lk000e1NJLTq000>P000>X1^@s6#OZ}&00001b5ch_0Itp)
z=>Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!T<mc!T}X1N`L?W1^G!tK~zXfjaCV4
z6lEBFbL_p_ld>(ngx0oTfff-3#Tb${VjzO86r|A*qC|@U1&u%mLD7g2kP23!oYDe<
z22>ObiN*spM3AF&UDg(QShn4^+wOL^d(HU$f7#M<2w$?<%*;RE`QH0R@Or(f+wF!Z
zieMHo839Fs<nMzj2#Ca3_<hOS3q_}cs*xdt!~Bd&*HU*6BC#<L0zs%+4OB_u&*dHu
z^m;w^?%fNasi{e|*=&$y8DVmm`PO;_(^Ap;+<b_1cy#$f2%!k<TQ|UZ;1JBG&%!%?
zECT6i7+&)^{`%<{3Lh>)TUiMbj-P<8^(una;ka0{6LFMCSy>q?K;!`=tro^M7c`;-
zi{l??D5EipUxjnYOK4uZ5(#I{LbRBHq+#fqTLRH!f=ro@UGO4gI_sbEAe!D=2hnVX
z?eKo+{eEaP8W@d6^!JENG3b%Jrv{S81KHh;VPAg5Gd7*S2(hmZ)?L-qJ`sJH8SrOk
zLGt<G9hZ;h#fzY8Y2`kIKmY=r6{rHJYSi`hAgurTD~-6kW+fU|EQ6Uczp`REgkTU!
zhmYdi@x$=vWb=Nfeee-{*&`9iNQZYq0Xk+pPP3wUP&YgiC-C_UHld}ZMYY@Q{WCF}
zc!r>Wie3k?*T;v-?#KW53sNhq28P@_CJ)YM=OLUBPiTp7piugV=nas2dwC3t#e(wk
zatsMFBs^V&DS+XU1DS8GhxvRh6v{MeB2^elOhi}lG^%(Rwb{#oGT81IBurV1_+$so
z=4(h)k!!|ubUsl`mHPUjPSuTEy$<^N26zj`q2cW{2*<@jpsJ!44KgtJ!5J{DYunqA
zbm#~~LJ4!2_|13ddFTOn3da*5^5MHT8@BCR(fa%Xn9rVvb^jrL?pAioAQ2*wwfX=g
zB2;_HEMAGK(_-w*IZz0?LMRN0P{iiuoIeMB1c3Ns#F5KaI2muWn}RUlG3J_TZSZG}
zLc_Y%aBO^s!&>Wf;=ZSzK`1GatAR+tLc<cN0y8~#L(|!Hmq7@MF(?1v%w{OlbacWq
zp%C^@w?OW6^ET!`Id344<n^NQjb%`Y)EVz?M8s&gb0z$QBvMA#i<HTchlp2Kvz>yv
zt_7M)=!z%jq*b91e~oeFu4W=A5d>0Fxc)HQlkoJ%C4uzi<&q}tf=tzE+o+<Fa)c?6
z<<B$xOwXi=)WZINgYBl72oVK=%yfiFqvS3(cgR{H&|4yrtao%SY`eBWB+_cHI*~`(
z6@TIf4&CmllSv`&A_&i#h}BHOsB8Hbc?&B@uhRR8NXU_?BG3H=XnJiakwt;gW~UZ*
zz?VM;-ok=`*8OiK>>=y1hq&M+XS(JVj4z(WwTvMsNN7?B;(-y#P)L;-%CzlmXsLLC
z3n{DkM!T)7FuXG&ChysY<lWVLVFi+{2*<~9)EVp!kj6umHMq2SJ^Jp+<jOlZ$SoPq
zvQkJW*$=9M2uVxRD;22Qy^YH{gRhaa%v4*4NL&mps#4S*+(UrK;rvkPJ?7)Kl}H3X
zR<73B#)lfnNTXhNacS?Sg~ZU5c;qN;#8gt=1VW${GR;n<YJyfPbd61%jJ}*KA~PvC
z3Fu9guw4-Q+bJ%3%(21IfSg532)bV6(tp~Pk6|D&G*X)k4hQMg1*C4S!l>6*^TB5=
zUj<{`-^h6XLs(9o9>SR+5LWbBzNED6E(B9k_(wzRufL;>)-6MquCbYPtQYP_A3^TY
zmtn8kKq#!hs8wqbp!4Q)7ic!LIkQIc9TPQC7}P_NHd=^=>zX~2YZX(~?x|Cdvg0#O
zvaX_O<fxYK7H7#kr0lGQb>Bfa%gcB>+n=6|#BaZc*5%@=5jCN+vs10FuZKkF(bAVj
z?9V4TyWNjXrMA@54k<#?!6WeJX3^HubM!Ehc1$m(7H;D^zhin4h9CF>J(DNVH$g3e
zBU1Q%i@|`>(ozVOm6htIO`BjM3Fip8w*44aIE<-%48D9BML!OxdiI?0g?)bwoMG<}
i!q{2%V=JB3JN^TR5x6H(GzMA#0000<MNUMnLSTY%<QAm>

Двоичные данные
build/mobile/sutagent/android/res/drawable/ic_stat_neterror.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 777 B

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

@ -1,21 +0,0 @@
--- ic_stat_neterror.png
+++ ic_stat_neterror.png
GIT binary patch
literal 777
zc$@(V1NQuhP)<h;3K|Lk000e1NJLTq000>P000>X1^@s6#OZ}&00001b5ch_0Itp)
z=>Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!T<mc!T}X1N`L?W0-i}kK~zXf-Bn9Z
z6HydCgVIisAh<HRAR&m4V2q+z!A4O77!wi}hG;Y-n$!&&{RbNO5xNqeVdut3yE00;
zp>>*Wkf5f<Xws=OeT1QPhUxL1t260iI)w!+_>#%Yo%@~d%)N8Ia|L98Ek@H8>vQ>?
zlSJ6aKQR^}P<%B9#(WsS;{nih@Qe<F_vQpNpC4$v<CLTxOgWAD+jlVqfHE{;ZtOZ{
zN5=S_#`K=%iRT8WH)+HZm~L)EwYLuoFJ7auv|LGD`GSRKFY)(*E|$=X#IFa(B=lvJ
zAT4%a{>EfQY$B1sWHO0AQYrhr+Bbk{p#_akamPH4NoWhQC;Cylbq5vjVdmn99qjk}
z$yXSSMk@p}T}M&vKJK1G*L5@*MR^xSm5FF<D@tsfxiE~HZy)9YSGd5V>1m$Cf@zwZ
zr#*d+84!3p>5!fUn@xdq%`hS!>_+kbnBIlGZK&_vk8jz}ws_Td;#1sAS)7%`E@43s
zp!3XWSSbpyyi0(&;3TxK6~JU_Ij;vEzL|$oOoGMY8Z68{hTT7Z0hCI1`DR;uF!5v-
zdRRb@Sc311QCh&id3#Char|BoacC4*uZ=tIt$OMl=GoSnjN=3zH*}Tjly50-E1^&b
zg25oP?rDW@QXG&B=YWn_1lEro0p<M%$es<<GFaSKN#Z)BN4ga&vA#^3y3dWazVx|n
z-K+fp#$i=Ac**7vpW?Ks2Q_guCH&`Oggd#&s>=<T!OPr)R(ThhVJVK{t5Me{<m5)6
z1TuIq#|*2U^f&fNxga@S1`)~0jX)iNIs;vsay$uBFOpfSP&yCu9#!4DXiPngR*)9k
zH{ZLguQy^6Du;SqyD-fY&kfsho@^*d<5S6<v2)J&ZCS}*W1f+TE7&gi00000NkvXX
Hu0mjfOOjpk

Двоичные данные
build/mobile/sutagent/android/res/drawable/ic_stat_second.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB

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

@ -1,30 +0,0 @@
--- ic_stat_second.png
+++ ic_stat_second.png
GIT binary patch
literal 1256
zc$@*~1Q+{>P)<h;3K|Lk000e1NJLTq000>P000>X1^@s6#OZ}&00001b5ch_0Itp)
z=>Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!T<mc!T}X1N`L?W1bs<FK~zXfwN`Cx
zQ&kv#Zg0D;?dV)L9h=J7m>Zj8-?PGSpkpI|qG1w|AI2Xf5|RahEF*llAcBb+jS?fE
z=n|)qm`F635KT}R;#hE7ConKEaWHlC<KA}tTyO7vJ@+oo)VA9&@gyf{?|skvocBG?
zbDql)8~C4x?%(<S+qNV0){*JQVnscKk|iLo4}snLAvP>WuwxIxA9O<~D%avX1tkc-
zdkkV-BRsZzh&2z#rHunod_Hip4EfS!Ey%mP8J4%-fc50Zh@SZdT!sa@`MF5n*$&QP
z0eBrIo@fIULfV>ESkIgSXSN_~urD=8sOumUL4@pbBGTOh!^$SadVc@~LI}Qe5S&g2
zeR&!9ygZQK4@1*(SdP32W$af#ZF)EY3WXAyA6H52>Ikf#e}Z{EA0c}7J6K-n0!>C(
zD~`hU%P{oywIE4C@W3JHt1G7f7Z$+y{1$M=G;rzZFtn~p0O96(@UekG1h%~hE++?w
zgke}}hpB5XIK6&$+NdBijo5FaBtG;AIiVvbXZ~lh|L*L2$-lF6wiJY!B7(2JPVT%y
za+z!t*wIPS)e(yJ^=nfaxj~-NN(Ro6xO64S9wB9_lpsnVK<;}Mkjs)Y1!T@nNTNs*
z1rHq7stk1OxpNSv33Bln6xjbV1Ii}1EuVxcdm@l5lc%VR+;`tk^7wdCpp=z(n_5Vy
zTc$0F_FrbZO(T~zmxLwt35nD=C(=n8bj%$j`r{?GNKZmT<MblQ;b6}|?#%fKK(T8h
z<kXo-s7Ty^njqm?(fFv*l8>XNzOoWoBiAAO#-ZFCgIL)x{hlT#wcni4n3T>*LHI?5
z;1?9IeaGLO`o*QNUB96L$)mR*R@=3t(QnUciZ`rXom?}iDB)f9D7o(|PWoCJ8fJR2
zXlLYIw?S*4dS=ql9h`}pS#q#MOanrBZBn36ch3~-7^_s~sai=jW)!2?*i0_{JQAwy
z6uodUPH@rQi{xRIx^oNYHfxr|82Fz+lyH~=o%=LasTB1TmXT<0(su1KST%vV@5&?T
z%C#A<mKiJgd!^*~nZy+>nmE<UG{F2KruIXmL?W}^U2(TCg~E(Aqs%J;;1`!b`I9w*
zUG4gcDF+N6I|07*0qB^Y@I?zjqF1B4&XxuF_dh`6x53xefaBsx7DwUe>965m|Fo7^
z9vX(X#?DMkz(m`#@bBn=JbVSQp9T>d7=ZMBF9KWJG12lkGqoUm&1)d_^&_xlE2MMh
zQ#&JPHi06OP;QNZFJ1&NaYes84O8bXa3&LECPvlkjT_q_wl>51#b>Y_eFwg^PigVe
zxnA%OmV>XVN)4j6i!WqOw`n63rwd$WCX5@NL}+gpGpY!T&uxZu{(?5mFSH|a`~<>>
zUxRtyZYZNSVcNAFlkb1X?075=B<@UP78pJC6%^KM<1=lD4LOj$c@x6#9f!WImVHQM
zu*C#roJsGo6$rDh8lG8j+Uiw^e0maT>(?R1HozAbfiEeU2AZ?|&hD|PBmM$!rt6n6
Sg)=Jv0000<MNUMnLSTXxt4GHG

Двоичные данные
build/mobile/sutagent/android/res/drawable/ic_stat_warning.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 651 B

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

@ -1,18 +0,0 @@
--- ic_stat_warning.png
+++ ic_stat_warning.png
GIT binary patch
literal 651
zc$@)?0(AX}P)<h;3K|Lk000e1NJLTq000>P000>X1^@s6#OZ}&0000PbVXQnQ*UN;
zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU!ElET{RCwCVR=bKKQ4p>6{Q_GQ6r)xU
z1VLsZACY5Xs^ACACkTGPbZpXJAd{II8g6Q~n;Yx~1_q)cg81yMbJ-S^R;HbvWeSS2
z@2$r@r*3sC>AFr|Ee`q*^8Jbwi^Wzpo7GFDQp-x5^wFNwYBfcYq@QlLTi);Y3tmbM
z27`sINRG#&=J9ysXf#Srr&Hc;x0<bVRjbtsBd!Mm0Rr-1Fi4E*73;PYVS3)ZUN1Qu
z4%+Q@Ktg!tb<LI{<#Ji&Q!757kDARU^?E&FQH0l@u>YyX7YYT1&F^qHOn$$g`u)B@
z!~LN~qe1KSnwHBYn*Tf;4*xua1T=vfC^uRZ5J7B>XGSA4h1x@O<@5Ra;c%$9TrS#d
zHbTz@&nSd_K1`kcE0&7nayiU`1_Yo6$)M+AtbuO$F`9QvML4*{!HPl4y&_N)fqy2G
zQ9o29l}bG^iZ|w3BrvElqsvgEKZxUa<vOR!q}dvH1`XGz$Bgi6McC`T^UK2K<tCDN
zJpRf~nC^>{8rto4g&(ZhKH?CcNF?f}a}tZiWXuGkkb&e;;UZAX%=2_QU0fhx3f}n2
z%ICM~THEb5jmKkQZ~1TzsDgYKNJ60y?)VSf5@X=ZWImsten%padv9z}3}{xX)i05e
z7c^r7O}(X^PDdnxz2}EK|MF=kB*|n_$9G~h8rk;AO{dc|o6Tr4nMkL`tE#HsqspoP
l3Fnk7eSW|Fzm>lN3;+?=xV(guKZO7Q002ovPDHLkV1kv~Eqnj~

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

@ -38,6 +38,7 @@
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
relativesrcdir = chrome/test
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk

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

@ -50,8 +50,8 @@ FIREFOX_VERSION = @FIREFOX_VERSION@
MOZ_BUILD_APP = @MOZ_BUILD_APP@
MOZ_APP_NAME = @MOZ_APP_NAME@
MOZ_APP_DISPLAYNAME = @MOZ_APP_DISPLAYNAME@
MOZ_APP_UA_NAME = @MOZ_APP_UA_NAME@
MOZ_APP_VERSION = @MOZ_APP_VERSION@
MOZ_APP_UA_EXTRA = @MOZ_APP_UA_EXTRA@
MOZ_PKG_SPECIAL = @MOZ_PKG_SPECIAL@

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

@ -147,9 +147,9 @@ endif
ifdef ENABLE_TESTS
ifdef XPCSHELL_TESTS
ifndef MODULE
$(error Must define MODULE when defining XPCSHELL_TESTS.)
endif
#ifndef MODULE
#$(error Must define MODULE when defining XPCSHELL_TESTS.)
#endif
testxpcobjdir = $(DEPTH)/_tests/xpcshell
@ -162,7 +162,7 @@ TEST_INSTALLER = $(INSTALL)
endif
define _INSTALL_TESTS
$(TEST_INSTALLER) $(wildcard $(srcdir)/$(dir)/*) $(testxpcobjdir)/$(MODULE)/$(dir)
$(TEST_INSTALLER) $(wildcard $(srcdir)/$(dir)/*) $(testxpcobjdir)/$(relativesrcdir)/$(dir)
endef # do not remove the blank line!
@ -172,7 +172,7 @@ libs::
$(foreach dir,$(XPCSHELL_TESTS),$(_INSTALL_TESTS))
$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py \
$(testxpcobjdir)/all-test-dirs.list \
$(addprefix $(MODULE)/,$(XPCSHELL_TESTS))
$(addprefix $(relativesrcdir)/,$(XPCSHELL_TESTS))
testxpcsrcdir = $(topsrcdir)/testing/xpcshell
@ -185,7 +185,7 @@ xpcshell-tests:
--symbols-path=$(DIST)/crashreporter-symbols \
$(EXTRA_TEST_ARGS) \
$(DIST)/bin/xpcshell \
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
# Execute a single test, specified in $(SOLO_FILE), but don't automatically
# start the test. Instead, present the xpcshell prompt so the user can
@ -199,7 +199,7 @@ check-interactive:
--profile-name=$(MOZ_APP_NAME) \
--interactive \
$(DIST)/bin/xpcshell \
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
# Execute a single test, specified in $(SOLO_FILE)
check-one:
@ -212,7 +212,7 @@ check-one:
--verbose \
$(EXTRA_TEST_ARGS) \
$(DIST)/bin/xpcshell \
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
endif # XPCSHELL_TESTS

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

@ -2034,7 +2034,7 @@ case "$target" in
*-darwin*)
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
MOZ_OPTIMIZE_FLAGS="-O3"
MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer"
_PEDANTIC=
CFLAGS="$CFLAGS -fpascal-strings -fno-common"
CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
@ -8767,8 +8767,11 @@ AC_SUBST(OGLES_SDK_DIR)
AC_SUBST(MOZ_APP_NAME)
AC_SUBST(MOZ_APP_DISPLAYNAME)
AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
AC_SUBST(MOZ_APP_UA_NAME)
AC_DEFINE_UNQUOTED(MOZ_APP_VERSION, "$MOZ_APP_VERSION")
AC_SUBST(MOZ_APP_VERSION)
AC_SUBST(MOZ_APP_UA_EXTRA)
AC_DEFINE_UNQUOTED(FIREFOX_VERSION, "$FIREFOX_VERSION")
AC_SUBST(FIREFOX_VERSION)
AC_SUBST(MOZ_PKG_SPECIAL)

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

@ -41,6 +41,7 @@ interface imgIRequest;
interface nsIChannel;
interface nsIStreamListener;
interface nsIURI;
interface nsIDocument;
/**
* This interface represents a content node that loads images. The interface
@ -64,7 +65,7 @@ interface nsIURI;
* sufficient, when combined with the imageBlockingStatus information.)
*/
[scriptable, uuid(e036857e-3417-4812-a5f2-89668a616781)]
[scriptable, uuid(7974082c-3267-4ab1-96fa-bd47d7e3a093)]
interface nsIImageLoadingContent : imgIDecoderObserver
{
/**
@ -174,5 +175,9 @@ interface nsIImageLoadingContent : imgIDecoderObserver
* as PR_FALSE to revert ImageState() to its original behaviour.
*/
void forceImageState(in boolean aForce, in long aState);
/**
* We need to be notified when our document changes.
*/
[noscript, notxpcom] void NotifyOwnerDocumentChanged(in nsIDocument aOldDoc);
};

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

@ -6718,14 +6718,11 @@ nsDocument::RetrieveRelevantHeaders(nsIChannel *aChannel)
}
}
} else {
nsCOMPtr<nsIMultiPartChannel> partChannel = do_QueryInterface(aChannel);
if (partChannel) {
nsCAutoString contentDisp;
rv = partChannel->GetContentDisposition(contentDisp);
if (NS_SUCCEEDED(rv) && !contentDisp.IsEmpty()) {
SetHeaderData(nsGkAtoms::headerContentDisposition,
NS_ConvertASCIItoUTF16(contentDisp));
}
nsCAutoString contentDisp;
rv = aChannel->GetContentDisposition(contentDisp);
if (NS_SUCCEEDED(rv) && !contentDisp.IsEmpty()) {
SetHeaderData(nsGkAtoms::headerContentDisposition,
NS_ConvertASCIItoUTF16(contentDisp));
}
}
}

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

@ -617,7 +617,7 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
channel->Open(getter_AddRefs(input));
nsString dataString;
if (input) {
const PRUint32 bufferSize = 1024;
const PRUint32 bufferSize = 8192;
char buffer[bufferSize];
nsCString data;
PRUint32 avail = 0;

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

@ -555,6 +555,24 @@ NS_IMETHODIMP nsImageLoadingContent::ForceReload()
* Non-interface methods
*/
void
nsImageLoadingContent::NotifyOwnerDocumentChanged(nsIDocument *aOldDoc)
{
// If we had a document before, unregister ourselves with it.
if (aOldDoc) {
if (mCurrentRequest)
aOldDoc->RemoveImage(mCurrentRequest);
if (mPendingRequest)
aOldDoc->RemoveImage(mPendingRequest);
}
// Re-track the images
if (mCurrentRequest)
TrackImage(mCurrentRequest);
if (mPendingRequest)
TrackImage(mPendingRequest);
}
nsresult
nsImageLoadingContent::LoadImage(const nsAString& aNewURI,
PRBool aForce,

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

@ -60,6 +60,7 @@
#ifdef MOZ_MEDIA
#include "nsHTMLMediaElement.h"
#endif // MOZ_MEDIA
#include "nsImageLoadingContent.h"
using namespace mozilla::dom;
@ -530,6 +531,13 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, PRBool aClone, PRBool aDeep,
}
#endif
// nsImageLoadingContent needs to know when its document changes
if (oldDoc != newDoc) {
nsCOMPtr<nsIImageLoadingContent> imageContent(do_QueryInterface(aNode));
if (imageContent)
imageContent->NotifyOwnerDocumentChanged(oldDoc);
}
if (elem) {
elem->RecompileScriptEventListeners();
}

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

@ -2407,6 +2407,7 @@ NOT_IMPLEMENTED_IF_FUNC_1(GetContentType, nsACString &value)
NOT_IMPLEMENTED_IF_FUNC_1(SetContentType, const nsACString &value)
NOT_IMPLEMENTED_IF_FUNC_1(GetContentCharset, nsACString &value)
NOT_IMPLEMENTED_IF_FUNC_1(SetContentCharset, const nsACString &value)
NOT_IMPLEMENTED_IF_FUNC_1(GetContentDisposition, nsACString &value)
NOT_IMPLEMENTED_IF_FUNC_1(GetContentLength, PRInt64 *value)
NOT_IMPLEMENTED_IF_FUNC_1(SetContentLength, PRInt64 value)
NOT_IMPLEMENTED_IF_FUNC_1(Open, nsIInputStream **_retval)

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

@ -72,7 +72,7 @@ texture-formats-test.html
texture-npot.html
texture-transparent-pixels-initialized.html
triangle.html
uniform-location.html
#uniform-location.html
uniform-samplers-test.html
uninitialized-test.html
viewport-unchanged-upon-resize.html

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

@ -39,7 +39,6 @@ conformance/texparameter-test.html
conformance/texture-active-bind-2.html
conformance/texture-formats-test.html
conformance/texture-npot.html
conformance/uniform-location.html
conformance/uniform-samplers-test.html
conformance/viewport-unchanged-upon-resize.html
more/conformance/constants.html

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

@ -90,6 +90,7 @@ _TEST_FILES = \
test_bug547996-1.html \
test_bug547996-2.xhtml \
test_bug556493.html \
test_bug586961.xul \
$(NULL)
#bug 585630

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

@ -0,0 +1,48 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=586961
-->
<window title="Mozilla Bug 586961"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<title>Test for Bug 586961</title>
<script type="application/javascript" src="/MochiKit/packed.js" />
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"/>
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=586961">Mozilla Bug 586961</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
</body>
<box onclick="clicked(event)">
<label id="controllabel" control="controlbutton" accesskey="k" value="Click here" />
<button id="controlbutton" label="Button" />
</box>
<script class="testbody" type="application/javascript;version=1.7"><![CDATA[
/** Test for Bug 586961 **/
function clicked(event) {
is(event.target.id, "controlbutton", "Accesskey was directed to controlled element.");
SimpleTest.finish();
}
function test() {
var accessKeyDetails = (navigator.platform.indexOf("Mac") >= 0) ?
{ ctrlKey : true } :
{ altKey : true, shiftKey: true };
synthesizeKey("k", accessKeyDetails);
}
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(test, window);
]]></script>
</window>

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

@ -52,6 +52,7 @@ XPIDLSRCS = \
$(NULL)
EXPORTS = \
nsIConstraintValidation.h \
nsIFormControl.h \
nsIForm.h \
nsIFormProcessor.h \

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

@ -71,6 +71,8 @@ public:
PRBool IsCandidateForConstraintValidation() const;
NS_IMETHOD GetValidationMessage(nsAString& aValidationMessage);
protected:
enum ValidityStateType
@ -89,7 +91,6 @@ protected:
nsIConstraintValidation();
nsresult GetValidity(nsIDOMValidityState** aValidity);
nsresult GetValidationMessage(nsAString& aValidationMessage);
nsresult CheckValidity(PRBool* aValidity);
void SetCustomValidity(const nsAString& aError);

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

@ -93,14 +93,24 @@
#include "nsRuleData.h"
// input type=radio
#include "nsIRadioGroupContainer.h"
// input type=radio
#include "nsIRadioGroupContainer.h"
// input type=file
#include "nsIFile.h"
#include "nsILocalFile.h"
#include "nsNetUtil.h"
#include "nsDOMFile.h"
#include "nsFileControlFrame.h"
#include "nsTextControlFrame.h"
#include "nsIFilePicker.h"
#include "nsDirectoryServiceDefs.h"
#include "nsIPrivateBrowsingService.h"
#include "nsIContentURIGrouper.h"
#include "nsIContentPrefService.h"
#include "nsIObserverService.h"
#include "nsIPopupWindowManager.h"
#include "nsGlobalWindow.h"
// input type=image
#include "nsImageLoadingContent.h"
@ -139,6 +149,7 @@ static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
// whether textfields should be selected once focused:
// -1: no, 1: yes, 0: uninitialized
static PRInt32 gSelectTextFieldOnFocus;
UploadLastDir* nsHTMLInputElement::gUploadLastDir;
static const nsAttrValue::EnumTable kInputTypeTable[] = {
{ "button", NS_FORM_INPUT_BUTTON },
@ -220,6 +231,364 @@ class nsHTMLInputElementState : public nsISupports
NS_IMPL_ISUPPORTS1(nsHTMLInputElementState, nsHTMLInputElementState)
NS_DEFINE_STATIC_IID_ACCESSOR(nsHTMLInputElementState, NS_INPUT_ELEMENT_STATE_IID)
class AsyncClickHandler : public nsRunnable {
public:
AsyncClickHandler(nsHTMLInputElement* aInput)
: mInput(aInput) {
nsIDocument* doc = aInput->GetOwnerDoc();
if (doc) {
nsPIDOMWindow* win = doc->GetWindow();
if (win)
mPopupControlState = win->GetPopupControlState();
}
};
NS_IMETHOD Run();
protected:
nsRefPtr<nsHTMLInputElement> mInput;
PopupControlState mPopupControlState;
};
NS_IMETHODIMP
AsyncClickHandler::Run()
{
nsresult rv;
// Get parent nsIDOMWindowInternal object.
nsCOMPtr<nsIDocument> doc = mInput->GetOwnerDoc();
if (!doc)
return NS_ERROR_FAILURE;
nsPIDOMWindow* win = doc->GetWindow();
if (!win) {
return NS_ERROR_FAILURE;
}
// Check if page is allowed to open the popup
if (mPopupControlState != openAllowed) {
nsCOMPtr<nsIPopupWindowManager> pm =
do_GetService(NS_POPUPWINDOWMANAGER_CONTRACTID);
if (!pm) {
return NS_OK;
}
PRUint32 permission;
pm->TestPermission(doc->GetDocumentURI(), &permission);
if (permission == nsIPopupWindowManager::DENY_POPUP) {
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc);
nsGlobalWindow::FirePopupBlockedEvent(domDoc, win, nsnull, EmptyString(), EmptyString());
return NS_OK;
}
}
// Get Loc title
nsXPIDLString title;
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
"FileUpload", title);
nsCOMPtr<nsIFilePicker> filePicker = do_CreateInstance("@mozilla.org/filepicker;1");
if (!filePicker)
return NS_ERROR_FAILURE;
nsFileControlFrame* frame = static_cast<nsFileControlFrame*>(mInput->GetPrimaryFrame());
nsTextControlFrame* textFrame = nsnull;
if (frame)
textFrame = static_cast<nsTextControlFrame*>(frame->GetTextFrame());
PRBool multi;
rv = mInput->GetMultiple(&multi);
NS_ENSURE_SUCCESS(rv, rv);
rv = filePicker->Init(win, title, multi ?
(PRInt16)nsIFilePicker::modeOpenMultiple :
(PRInt16)nsIFilePicker::modeOpen);
NS_ENSURE_SUCCESS(rv, rv);
// We want to get the file filter from the accept attribute and we add the
// |filterAll| filter to be sure the user has a valid fallback.
PRUint32 filter = 0;
if (frame)
filter = frame->GetFileFilterFromAccept();
filePicker->AppendFilters(filter | nsIFilePicker::filterAll);
// If the accept attribute asks for a filter, it has to be the default one.
if (filter) {
// We have two filters: |filterAll| and another one. |filterAll| is
// always the first one (index=0) so we can assume the one we want to be
// the default is at index 1.
filePicker->SetFilterIndex(1);
}
// Set default directry and filename
nsAutoString defaultName;
nsCOMArray<nsIFile> oldFiles;
mInput->GetFileArray(oldFiles);
if (oldFiles.Count()) {
// set directory
nsCOMPtr<nsIFile> parentFile;
oldFiles[0]->GetParent(getter_AddRefs(parentFile));
if (parentFile) {
nsCOMPtr<nsILocalFile> parentLocalFile = do_QueryInterface(parentFile, &rv);
if (parentLocalFile) {
filePicker->SetDisplayDirectory(parentLocalFile);
}
}
// Unfortunately nsIFilePicker doesn't allow multiple files to be
// default-selected, so only select something by default if exactly
// one file was selected before.
if (oldFiles.Count() == 1) {
nsAutoString leafName;
oldFiles[0]->GetLeafName(leafName);
if (!leafName.IsEmpty()) {
filePicker->SetDefaultString(leafName);
}
}
} else {
// Attempt to retrieve the last used directory from the content pref service
nsCOMPtr<nsILocalFile> localFile;
nsHTMLInputElement::gUploadLastDir->FetchLastUsedDirectory(doc->GetDocumentURI(),
getter_AddRefs(localFile));
if (!localFile) {
// Default to "desktop" directory for each platform
nsCOMPtr<nsIFile> homeDir;
NS_GetSpecialDirectory(NS_OS_DESKTOP_DIR, getter_AddRefs(homeDir));
localFile = do_QueryInterface(homeDir);
}
filePicker->SetDisplayDirectory(localFile);
}
// Tell our textframe to remember the currently focused value
if (textFrame)
textFrame->InitFocusedValue();
// Open dialog
PRInt16 mode;
rv = filePicker->Show(&mode);
NS_ENSURE_SUCCESS(rv, rv);
if (mode == nsIFilePicker::returnCancel)
return NS_OK;
// Collect new selected filenames
nsTArray<nsString> newFileNames;
if (multi) {
nsCOMPtr<nsISimpleEnumerator> iter;
rv = filePicker->GetFiles(getter_AddRefs(iter));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISupports> tmp;
PRBool prefSaved = PR_FALSE;
while (NS_SUCCEEDED(iter->GetNext(getter_AddRefs(tmp)))) {
nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(tmp);
if (localFile) {
nsString unicodePath;
rv = localFile->GetPath(unicodePath);
if (!unicodePath.IsEmpty()) {
newFileNames.AppendElement(unicodePath);
}
if (!prefSaved) {
// Store the last used directory using the content pref service
rv = nsHTMLInputElement::gUploadLastDir->StoreLastUsedDirectory(doc->GetDocumentURI(),
localFile);
NS_ENSURE_SUCCESS(rv, rv);
prefSaved = PR_TRUE;
}
}
}
}
else {
nsCOMPtr<nsILocalFile> localFile;
rv = filePicker->GetFile(getter_AddRefs(localFile));
if (localFile) {
nsString unicodePath;
rv = localFile->GetPath(unicodePath);
if (!unicodePath.IsEmpty()) {
newFileNames.AppendElement(unicodePath);
}
// Store the last used directory using the content pref service
rv = nsHTMLInputElement::gUploadLastDir->StoreLastUsedDirectory(doc->GetDocumentURI(),
localFile);
NS_ENSURE_SUCCESS(rv, rv);
}
}
// Set new selected files
if (!newFileNames.IsEmpty()) {
// Tell mTextFrame that this update of the value is a user initiated
// change. Otherwise it'll think that the value is being set by a script
// and not fire onchange when it should.
PRBool oldState;
if (textFrame) {
oldState = textFrame->GetFireChangeEventState();
textFrame->SetFireChangeEventState(PR_TRUE);
}
mInput->SetFileNames(newFileNames);
if (textFrame) {
textFrame->SetFireChangeEventState(oldState);
// May need to fire an onchange here
textFrame->CheckFireOnChange();
}
}
return NS_OK;
}
#define CPS_PREF_NAME NS_LITERAL_STRING("browser.upload.lastDir")
NS_IMPL_ISUPPORTS2(UploadLastDir, nsIObserver, nsISupportsWeakReference)
void
nsHTMLInputElement::InitUploadLastDir() {
gUploadLastDir = new UploadLastDir();
NS_ADDREF(gUploadLastDir);
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (observerService && gUploadLastDir) {
observerService->AddObserver(gUploadLastDir, NS_PRIVATE_BROWSING_SWITCH_TOPIC, PR_TRUE);
observerService->AddObserver(gUploadLastDir, "browser:purge-session-history", PR_TRUE);
}
}
void
nsHTMLInputElement::DestroyUploadLastDir() {
NS_IF_RELEASE(gUploadLastDir);
}
UploadLastDir::UploadLastDir():
mInPrivateBrowsing(PR_FALSE)
{
nsCOMPtr<nsIPrivateBrowsingService> pbService =
do_GetService(NS_PRIVATE_BROWSING_SERVICE_CONTRACTID);
if (pbService) {
pbService->GetPrivateBrowsingEnabled(&mInPrivateBrowsing);
}
mUploadLastDirStore.Init();
}
nsresult
UploadLastDir::FetchLastUsedDirectory(nsIURI* aURI, nsILocalFile** aFile)
{
NS_PRECONDITION(aURI, "aURI is null");
NS_PRECONDITION(aFile, "aFile is null");
// Retrieve the data from memory if it's present during private browsing mode,
// otherwise fall through to check the CPS
if (mInPrivateBrowsing) {
nsCOMPtr<nsIContentURIGrouper> hostnameGrouperService =
do_GetService(NS_HOSTNAME_GROUPER_SERVICE_CONTRACTID);
if (!hostnameGrouperService)
return NS_ERROR_NOT_AVAILABLE;
nsString group;
hostnameGrouperService->Group(aURI, group);
if (mUploadLastDirStore.Get(group, aFile)) {
return NS_OK;
}
}
// Attempt to get the CPS, if it's not present we'll just return
nsCOMPtr<nsIContentPrefService> contentPrefService =
do_GetService(NS_CONTENT_PREF_SERVICE_CONTRACTID);
if (!contentPrefService)
return NS_ERROR_NOT_AVAILABLE;
nsCOMPtr<nsIWritableVariant> uri = do_CreateInstance(NS_VARIANT_CONTRACTID);
if (!uri)
return NS_ERROR_OUT_OF_MEMORY;
uri->SetAsISupports(aURI);
// Get the last used directory, if it is stored
PRBool hasPref;
if (NS_SUCCEEDED(contentPrefService->HasPref(uri, CPS_PREF_NAME, &hasPref)) && hasPref) {
nsCOMPtr<nsIVariant> pref;
contentPrefService->GetPref(uri, CPS_PREF_NAME, nsnull, getter_AddRefs(pref));
nsString prefStr;
pref->GetAsAString(prefStr);
nsCOMPtr<nsILocalFile> localFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
if (!localFile)
return NS_ERROR_OUT_OF_MEMORY;
localFile->InitWithPath(prefStr);
*aFile = localFile;
NS_ADDREF(*aFile);
}
return NS_OK;
}
nsresult
UploadLastDir::StoreLastUsedDirectory(nsIURI* aURI, nsILocalFile* aFile)
{
NS_PRECONDITION(aURI, "aURI is null");
NS_PRECONDITION(aFile, "aFile is null");
nsCOMPtr<nsIFile> parentFile;
aFile->GetParent(getter_AddRefs(parentFile));
nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(parentFile);
// Store the data in memory instead of the CPS during private browsing mode
if (mInPrivateBrowsing) {
nsCOMPtr<nsIContentURIGrouper> hostnameGrouperService =
do_GetService(NS_HOSTNAME_GROUPER_SERVICE_CONTRACTID);
if (!hostnameGrouperService)
return NS_ERROR_NOT_AVAILABLE;
nsString group;
hostnameGrouperService->Group(aURI, group);
return mUploadLastDirStore.Put(group, localFile);
}
// Attempt to get the CPS, if it's not present we'll just return
nsCOMPtr<nsIContentPrefService> contentPrefService =
do_GetService(NS_CONTENT_PREF_SERVICE_CONTRACTID);
if (!contentPrefService)
return NS_ERROR_NOT_AVAILABLE;
nsCOMPtr<nsIWritableVariant> uri = do_CreateInstance(NS_VARIANT_CONTRACTID);
if (!uri)
return NS_ERROR_OUT_OF_MEMORY;
uri->SetAsISupports(aURI);
// Find the parent of aFile, and store it
nsString unicodePath;
parentFile->GetPath(unicodePath);
if (unicodePath.IsEmpty()) // nothing to do
return NS_OK;
nsCOMPtr<nsIWritableVariant> prefValue = do_CreateInstance(NS_VARIANT_CONTRACTID);
if (!prefValue)
return NS_ERROR_OUT_OF_MEMORY;
prefValue->SetAsAString(unicodePath);
return contentPrefService->SetPref(uri, CPS_PREF_NAME, prefValue);
}
NS_IMETHODIMP
UploadLastDir::Observe(nsISupports *aSubject, char const *aTopic, PRUnichar const *aData)
{
if (strcmp(aTopic, NS_PRIVATE_BROWSING_SWITCH_TOPIC) == 0) {
if (NS_LITERAL_STRING(NS_PRIVATE_BROWSING_ENTER).Equals(aData)) {
mInPrivateBrowsing = PR_TRUE;
} else if (NS_LITERAL_STRING(NS_PRIVATE_BROWSING_LEAVE).Equals(aData)) {
mInPrivateBrowsing = PR_FALSE;
if (mUploadLastDirStore.IsInitialized()) {
mUploadLastDirStore.Clear();
}
}
} else if (strcmp(aTopic, "browser:purge-session-history") == 0) {
if (mUploadLastDirStore.IsInitialized()) {
mUploadLastDirStore.Clear();
}
nsCOMPtr<nsIContentPrefService> contentPrefService =
do_GetService(NS_CONTENT_PREF_SERVICE_CONTRACTID);
if (contentPrefService)
contentPrefService->RemovePrefsByName(CPS_PREF_NAME);
}
return NS_OK;
}
#ifdef ACCESSIBILITY
//Helper method
static nsresult FireEventForAccessibility(nsIDOMHTMLInputElement* aTarget,
@ -244,6 +613,9 @@ nsHTMLInputElement::nsHTMLInputElement(already_AddRefed<nsINodeInfo> aNodeInfo,
aFromParser & NS_FROM_PARSER_FRAGMENT);
mInputData.mState = new nsTextEditorState(this);
NS_ADDREF(mInputData.mState);
if (!gUploadLastDir)
nsHTMLInputElement::InitUploadLastDir();
}
nsHTMLInputElement::~nsHTMLInputElement()
@ -1414,7 +1786,8 @@ nsHTMLInputElement::Click()
mType == NS_FORM_INPUT_RADIO ||
mType == NS_FORM_INPUT_RESET ||
mType == NS_FORM_INPUT_SUBMIT ||
mType == NS_FORM_INPUT_IMAGE) {
mType == NS_FORM_INPUT_IMAGE ||
mType == NS_FORM_INPUT_FILE) {
// Strong in case the event kills it
nsCOMPtr<nsIDocument> doc = GetCurrentDoc();
@ -1446,7 +1819,9 @@ nsHTMLInputElement::Click()
nsEventStatus status = nsEventStatus_eIgnore;
SET_BOOLBIT(mBitField, BF_HANDLING_CLICK, PR_TRUE);
if (mType == NS_FORM_INPUT_FILE){
FireAsyncClickHandler();
}
nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this), context,
&event, nsnull, &status);
@ -1457,6 +1832,13 @@ nsHTMLInputElement::Click()
return NS_OK;
}
NS_IMETHODIMP
nsHTMLInputElement::FireAsyncClickHandler()
{
nsCOMPtr<nsIRunnable> event = new AsyncClickHandler(this);
return NS_DispatchToMainThread(event);
}
PRBool
nsHTMLInputElement::NeedToInitializeEditorForEvent(nsEventChainPreVisitor& aVisitor) const
{

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

@ -75,6 +75,39 @@
class nsDOMFileList;
class UploadLastDir : public nsIObserver, public nsSupportsWeakReference {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
UploadLastDir();
/**
* Fetch the last used directory for this location from the content
* pref service, if it is available.
*
* @param aURI URI of the current page
* @param aFile path to the last used directory
*/
nsresult FetchLastUsedDirectory(nsIURI* aURI, nsILocalFile** aFile);
/**
* Store the last used directory for this location using the
* content pref service, if it is available
* @param aURI URI of the current page
* @param aFile file chosen by the user - the path to the parent of this
* file will be stored
*/
nsresult StoreLastUsedDirectory(nsIURI* aURI, nsILocalFile* aFile);
private:
// Directories are stored here during private browsing mode
nsInterfaceHashtable<nsStringHashKey, nsILocalFile> mUploadLastDirStore;
PRBool mInPrivateBrowsing;
};
class nsIRadioGroupContainer;
class nsIRadioVisitor;
class nsHTMLInputElement : public nsGenericHTMLFormElement,
public nsImageLoadingContent,
public nsIDOMHTMLInputElement,
@ -199,6 +232,8 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
NS_IMETHOD FireAsyncClickHandler();
virtual void UpdateEditableState()
{
return UpdateEditableFormControlState();
@ -207,6 +242,12 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsHTMLInputElement,
nsGenericHTMLFormElement)
static UploadLastDir* gUploadLastDir;
// create and destroy the static UploadLastDir object for remembering
// which directory was last used on a site-by-site basis
static void InitUploadLastDir();
static void DestroyUploadLastDir();
void MaybeLoadImage();
virtual nsXPCClassInfo* GetClassInfo();

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

@ -68,7 +68,7 @@ nsIConstraintValidation::GetValidity(nsIDOMValidityState** aValidity)
return NS_OK;
}
nsresult
NS_IMETHODIMP
nsIConstraintValidation::GetValidationMessage(nsAString& aValidationMessage)
{
aValidationMessage.Truncate();

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

@ -52,15 +52,15 @@ MockFilePicker.prototype = {
}
};
var mockFilePickerRegisterer =
var mockFilePickerRegisterer =
new MockObjectRegisterer("@mozilla.org/filepicker;1",MockFilePicker);
function test() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var wu = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
mockFilePickerRegisterer.register();
try {
var domActivateEvents;
@ -82,8 +82,14 @@ function test() {
is(domActivateEvents, 1, "click on button should only fire 1 DOMActivate event");
} finally {
mockFilePickerRegisterer.unregister();
SimpleTest.executeSoon(unregister);
}
}
function unregister()
{
mockFilePickerRegisterer.unregister();
SimpleTest.finish();
}

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

@ -206,6 +206,19 @@ MyPrefChangedCallback(const char*aPrefName, void* instance_data)
// ==================================================================
// =
// ==================================================================
static void
ReportUseOfDeprecatedMethod(nsHTMLDocument* aDoc, const char* aWarning)
{
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
aWarning,
nsnull, 0,
static_cast<nsIDocument*>(aDoc)->
GetDocumentURI(),
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM Events");
}
nsresult
NS_NewHTMLDocument(nsIDocument** aInstancePtrResult)
{
@ -2356,7 +2369,10 @@ NS_IMETHODIMP
nsHTMLDocument::GetWidth(PRInt32* aWidth)
{
NS_ENSURE_ARG_POINTER(aWidth);
if (!mWarnedWidthHeight) {
ReportUseOfDeprecatedMethod(this, "UseOfDocumentWidthWarning");
mWarnedWidthHeight = true;
}
PRInt32 height;
return GetBodySize(aWidth, &height);
}
@ -2365,7 +2381,10 @@ NS_IMETHODIMP
nsHTMLDocument::GetHeight(PRInt32* aHeight)
{
NS_ENSURE_ARG_POINTER(aHeight);
if (!mWarnedWidthHeight) {
ReportUseOfDeprecatedMethod(this, "UseOfDocumentHeightWarning");
mWarnedWidthHeight = true;
}
PRInt32 width;
return GetBodySize(&width, aHeight);
}
@ -2540,19 +2559,6 @@ nsHTMLDocument::GetSelection(nsAString& aReturn)
return rv;
}
static void
ReportUseOfDeprecatedMethod(nsHTMLDocument* aDoc, const char* aWarning)
{
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
aWarning,
nsnull, 0,
static_cast<nsIDocument*>(aDoc)->
GetDocumentURI(),
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM Events");
}
NS_IMETHODIMP
nsHTMLDocument::CaptureEvents(PRInt32 aEventFlags)
{

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

@ -361,6 +361,8 @@ protected:
PRPackedBool mDisableDocWrite;
PRPackedBool mWarnedWidthHeight;
nsCOMPtr<nsIWyciwygChannel> mWyciwygChannel;
/* Midas implementation */

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

@ -264,6 +264,13 @@ nsWyciwygChannel::SetContentCharset(const nsACString &aContentCharset)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsWyciwygChannel::GetContentDisposition(nsACString &aContentDisposition)
{
aContentDisposition.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsWyciwygChannel::GetContentLength(PRInt64 *aContentLength)
{

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

@ -123,6 +123,8 @@ _TEST_FILES = \
test_play_twice.html \
test_playback.html \
test_playback_errors.html \
test_preload_actions.html \
test_preload_attribute.html \
test_progress.html \
test_reactivate.html \
test_readyState.html \

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

@ -132,6 +132,10 @@ function nextTest() {
if (gVideo && gVideo.parentNode)
gVideo.parentNode.removeChild(gVideo);
gVideo = null;
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
Components.utils.forceGC();
gVideo = createVideo();
gVideo.expectedResult = gTests[gTestNum].result;
@ -154,6 +158,7 @@ function done() {
.getService(Components.interfaces.nsIPrefService);
var branch = prefService.getBranch("media.");
branch.setBoolPref("enforce_same_site_origin", gOldPref);
mediaTestCleanup();
opener.done();
}

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

@ -251,19 +251,6 @@ function checkMetadata(msg, e, test) {
}
}
// Returns true if all members of array 'v' have their _finished field set to true.
function AllFinished(v) {
if (v.length == 0) {
return false;
}
for (var i=0; i<v.length; ++i) {
if (!v[i]._finished) {
return false;
}
}
return true;
}
// Returns the first test from candidates array which we can play with the
// installed video backends.
function getPlayableVideo(candidates) {
@ -273,3 +260,118 @@ function getPlayableVideo(candidates) {
return resources[0];
return null;
}
// Number of tests to run in parallel. Warning: Each media element requires
// at least 3 threads (4 on Linux), and on Linux each thread uses 10MB of
// virtual address space. Beware!
var PARALLEL_TESTS = 2;
// Manages a run of media tests. Runs them in chunks in order to limit
// the number of media elements/threads running in parallel. This limits peak
// memory use, particularly on Linux x86 where thread stacks use 10MB of
// virtual address space.
// Usage:
// 1. Create a new MediaTestManager object.
// 2. Create a test startTest function. This takes a test object and a token,
// and performs anything necessary to start the test. The test object is an
// element in one of the g*Tests above. Your startTest function must call
// MediaTestManager.start(token) if it starts a test. The test object is
// guaranteed to be playable by our supported decoders; you don't need to
// check canPlayType.
// 3. When your tests finishes, call MediaTestManager.finished(), passing
// the token back to the manager. The manager may either start the next run
// or end the mochitest if all the tests are done.
function MediaTestManager() {
// Sets up a MediaTestManager to runs through the 'tests' array, which needs
// to be one of, or have the same fields as, the g*Test arrays of tests. Uses
// the user supplied 'startTest' function to initialize the test. This
// function must accept two arguments, the test entry from the 'tests' array,
// and a token. Call MediaTestManager.started(token) if you start the test,
// and MediaTestManager.finished(token) when the test finishes. You don't have
// to start every test, but if you call started() you *must* call finish()
// else you'll timeout.
this.runTests = function(tests, startTest) {
this.testNum = 0;
this.tests = tests;
this.startTest = startTest;
this.tokens = [];
// Always wait for explicit finish.
SimpleTest.waitForExplicitFinish();
this.nextTest();
}
// Registers that the test corresponding to 'token' has been started.
// Don't call more than once per token.
this.started = function(token) {
this.tokens.push(token);
}
// Registers that the test corresponding to 'token' has finished. Call when
// you've finished your test. If all tests are complete this will finish the
// run, otherwise it may start up the next run. It's ok to call multiple times
// per token.
this.finished = function(token) {
var i = this.tokens.indexOf(token);
if (i != -1) {
// Remove the element from the list of running tests.
this.tokens.splice(i, 1);
}
if (this.tokens.length == 0) {
this.nextTest();
}
}
// Starts the next batch of tests, or finishes if they're all done.
// Don't call this directly, call finished(token) when you're done.
this.nextTest = function() {
// Force a GC after every completed testcase. This ensures that any decoders
// with live threads waiting for the GC are killed promptly, to free up the
// thread stacks' address space.
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
Components.utils.forceGC();
if (this.testNum == this.tests.length) {
if (this.onFinished) {
this.onFinished();
}
mediaTestCleanup();
SimpleTest.finish();
return;
}
while (this.testNum < this.tests.length && this.tokens.length < PARALLEL_TESTS) {
var test = this.tests[this.testNum];
var token = (test.name ? (test.name + "-"): "") + this.testNum;
this.testNum++;
// Ensure we can play the resource type.
if (test.type && !document.createElement('video').canPlayType(test.type))
continue;
// Do the init. This should start the test.
this.startTest(test, token);
}
if (this.tokens.length == 0) {
// No tests were added, we must have tried everything, exit.
SimpleTest.finish();
}
}
}
// Ensures we've got no active video or audio elements in the document, and
// forces a GC to release the address space reserved by the decoders' threads'
// stacks.
function mediaTestCleanup() {
var V = document.getElementsByTagName("video");
for (i=0; i<V.length; i++) {
V[i].parentNode.removeChild(V[i]);
V[i] = null;
}
var A = document.getElementsByTagName("audio");
for (i=0; i<A.length; i++) {
A[i].parentNode.removeChild(A[i]);
A[i] = null;
}
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
Components.utils.forceGC();
}

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

@ -5,11 +5,17 @@ function test_seek6(v, seekTime, is, ok, finish) {
var seekCount = 0;
var completed = false;
var interval;
var sum = 0;
function poll() {
sum += v.currentTime;
}
function startTest() {
if (completed)
return false;
interval = setInterval(function() { v.currentTime=Math.random()*v.duration; }, 10);
interval = setInterval(poll, 10);
v.currentTime = Math.random() * v.duration;
return false;
}
@ -22,7 +28,10 @@ function seekEnded() {
if (seekCount == 3) {
clearInterval(interval);
completed = true;
dump("Seek test 6 time sum:" + sum + "\n");
finish();
} else {
v.currentTime = Math.random() * v.duration;
}
return false;
}

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

@ -8,6 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=451958
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=451958">Mozilla Bug 451958</a>
@ -24,6 +25,7 @@ function run() {
}
function done() {
mediaTestCleanup();
SimpleTest.finish();
}

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

@ -10,15 +10,23 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
for (var i = 0; i < gAudioTests.length; ++i) {
var test = gAudioTests[i];
var manager = new MediaTestManager;
function startTest(test, token) {
var a1 = new Audio();
if (!a1.canPlayType(test.type))
continue;
return;
manager.started(token);
is(a1.getAttribute("preload"), "auto", "preload:auto automatically set");
is(a1.src, "", "Src set?");
a1 = null;
manager.finished(token);
}
manager.runTests(gAudioTests, startTest);
</script>
</pre>
</body>

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

@ -10,16 +10,23 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var tmpAudio = new Audio();
for (var i = 0; i < gAudioTests.length; ++i) {
var test = gAudioTests[i];
var manager = new MediaTestManager;
function startTest(test, token) {
if (!tmpAudio.canPlayType(test.type))
continue;
manager.started(token);
var a1 = new Audio(test.name);
is(a1.getAttribute("preload"), "auto", "Preload automatically set to auto");
is(a1.src.match("/[^/]+$"), "/" + test.name, "src OK");
manager.finished(token);
}
manager.runTests(gAudioTests, startTest);
</script>
</pre>
</body>

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

@ -5,6 +5,7 @@
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<video id='v1' onerror="event.stopPropagation();"></video><audio id='a1' onerror="event.stopPropagation();"></audio>
@ -26,6 +27,9 @@ ok(v1.autoplay, "video.autoplay not true");
ok(a1.autoplay, "audio.autoplay not true");
is(v1.getAttribute("autoplay"), "", "video autoplay attribute not set");
is(a1.getAttribute("autoplay"), "", "video autoplay attribute not set");
mediaTestCleanup();
</script>
</pre>
</body>

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

@ -23,7 +23,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=462957
// Test for Bug 462957; HTMLMediaElement.buffered.
var videos = [];
var manager = new MediaTestManager;
function ended(e) {
var v = e.target;
@ -67,10 +67,9 @@ function ended(e) {
}
is(caught, true, "Should throw INDEX_SIZE_ERR on over end bounds range");
v._finished = true;
if (AllFinished(videos)) {
SimpleTest.finish();
}
v.parentNode.removeChild(v);
manager.finished(v.token);
return false;
}
@ -81,11 +80,13 @@ function supportsBuffered(type) {
return /ogg$/.test(s) || /wav$/.test(s)
}
for (var i=0; i<gSeekTests.length; ++i) {
function startTest(test, token) {
var v = document.createElement('video');
var test = gSeekTests[i];
if (!v.canPlayType(test.type) || !supportsBuffered(test.type))
continue;
if (!supportsBuffered(test.type))
return;
v.token = token;
manager.started(token);
v.src = test.name;
v._name = test.name;
v._test = test;
@ -93,14 +94,9 @@ for (var i=0; i<gSeekTests.length; ++i) {
v.autoplay = true;
v.addEventListener("ended", ended, false);
document.body.appendChild(v);
videos.push(v);
}
if (videos.length == 0) {
todo(false, "No types supported");
} else {
SimpleTest.waitForExplicitFinish();
}
manager.runTests(gSeekTests, startTest);
</script>
</pre>

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

@ -16,7 +16,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=448534
<pre id="test">
<script class="testbody" type="text/javascript">
var videos = [];
var manager = new MediaTestManager;
function loaded(event) {
var v = event.target;
@ -42,17 +42,15 @@ function stopped(event) {
return false;
v._finished = true;
ok(v.paused, "Video should be paused after removing from the Document");
if (AllFinished(videos))
SimpleTest.finish();
manager.finished(v.token);
return false;
}
for (var i=0; i<gSmallTests.length; ++i) {
function startTest(test, token) {
var v = document.createElement('video');
var test = gSmallTests[i];
if (!v.canPlayType(test.type))
continue;
v.token = token;
manager.started(token);
v.src = test.name;
v._played = false;
v._finished = false;
@ -60,14 +58,9 @@ for (var i=0; i<gSmallTests.length; ++i) {
v.addEventListener("play", started, false);
v.addEventListener("pause", stopped, false);
document.body.appendChild(v);
videos.push(v);
}
if (videos.length == 0) {
todo(false, "No types supported");
} else {
SimpleTest.waitForExplicitFinish();
}
manager.runTests(gSmallTests, startTest);
</script>
</pre>

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

@ -12,7 +12,7 @@
<pre id="test">
<script class="testbody" type="text/javascript">
var videos = [];
var manager = new MediaTestManager;
function startTest(e) {
e.target.play();
@ -39,17 +39,17 @@ function seekEnded(e) {
v.currentTime + " for " + v._name);
ok(!v.ended, "Checking ended is false for " + v._name);
v._finished = true;
if (AllFinished(videos))
SimpleTest.finish();
v.parentNode.removeChild(v);
manager.finished(v.token);
}
for (var i=0; i<gSmallTests.length; ++i) {
var test = gSmallTests[i];
function initTest(test, token) {
var type = /^video/.test(test.type) ? "video" : "audio";
var v = document.createElement(type);
var test = gSmallTests[i];
if (!v.canPlayType(test.type))
continue;
return;
v.token = token;
manager.started(token);
v._name = test.name;
var s = document.createElement("source");
@ -63,14 +63,9 @@ for (var i=0; i<gSmallTests.length; ++i) {
v.addEventListener("ended", playbackEnded, false);
v.addEventListener("seeked", seekEnded, false);
document.body.appendChild(v);
videos.push(v);
}
if (videos.length == 0) {
todo(false, "No types supported");
} else {
SimpleTest.waitForExplicitFinish();
}
manager.runTests(gSmallTests, initTest);
</script>
</pre>

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

@ -17,7 +17,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=493187
<pre id="test">
<script class="testbody" type="text/javascript">
var videos = [];
var manager = new MediaTestManager;
function start(e) {
e.target.currentTime = e.target.duration / 4;
@ -32,24 +32,23 @@ function canPlayThrough(e) {
if (v._seeked && !v._finished) {
ok(true, "Got canplaythrough after seek for " + v._name);
v._finished = true;
if (AllFinished(videos))
SimpleTest.finish();
v.parentNode.removeChild(v);
manager.finished(v.token);
}
}
for (var i=0; i<gSeekTests.length; ++i) {
var test = gSeekTests[i];
function startTest(test, token) {
// TODO: Bug 568402, there's a bug in the WAV backend where we sometimes
// don't send canplaythrough events after seeking. Once that is fixed,
// we should remove this guard below so that we run this test for audio.
var isVideo = /^video/.test(test.type) ? true : false;
if (!isVideo)
continue;
return;
var v = document.createElement('video');
if (!v.canPlayType(test.type))
continue;
v.token = token;
manager.started(token);
v.src = test.name;
v._name = test.name;
v._seeked = false;
@ -59,14 +58,9 @@ for (var i=0; i<gSeekTests.length; ++i) {
v.addEventListener("canplaythrough", canPlayThrough, false);
v.addEventListener("seeking", startSeeking, false);
document.body.appendChild(v);
videos.push(v);
}
if (videos.length == 0) {
todo(false, "No types supported");
} else {
SimpleTest.waitForExplicitFinish();
}
manager.runTests(gSeekTests, startTest);
</script>
</pre>

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

@ -17,7 +17,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=495145
<pre id="test">
<script class="testbody" type="text/javascript">
var videos = [];
var manager = new MediaTestManager;
function start(e) {
e.target.play();
@ -32,8 +32,8 @@ function ended1(e) {
if (v._endCount == 2) {
ok(true, "Playing after pause while ended works for " + v._name);
v._finished = true;
if (AllFinished(videos))
SimpleTest.finish();
v.parentNode.removeChild(v);
manager.finished(v.token);
return;
}
@ -57,14 +57,14 @@ function seeked2(e) {
ok(v.paused, "Paused after seek after pause while ended for " + v._name);
v._finished = true;
if (AllFinished(videos))
SimpleTest.finish();
v.parentNode.removeChild(v);
manager.finished(v.token);
}
function createVideo(test, x) {
function createVideo(test, x, token) {
var v = document.createElement('video');
if (!v.canPlayType(test.type))
return null;
v.token = token;
manager.started(token);
v.src = test.name;
v._name = test.name + "#" + x;
v._endCount = 0;
@ -74,20 +74,15 @@ function createVideo(test, x) {
if (x == 2)
v.addEventListener("seeked", seeked2, false);
document.body.appendChild(v);
videos.push(v);
}
for (var i=0; i<gSmallTests.length; ++i) {
var test = gSmallTests[i];
createVideo(test, 1);
createVideo(test, 2);
function startTest(test, token) {
createVideo(test, 1, token + "a");
createVideo(test, 2, token + "b");
}
if (videos.length == 0) {
todo(false, "No types supported");
} else {
SimpleTest.waitForExplicitFinish();
}
manager.runTests(gSmallTests, startTest);
</script>
</pre>

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

@ -8,6 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=469247
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469247">Mozill
@ -32,6 +33,8 @@ check("foo/bar", "");
check("", "");
check("!!!", "");
mediaTestCleanup();
</script>
</pre>
</body>

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

@ -8,6 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=469247
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469247">Mozill
@ -23,6 +24,7 @@ a Bug 469247</a>
check_ogg(document.getElementById('v'), false);
mediaTestCleanup();
</script>
</pre>
</body>

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

@ -8,6 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=469247
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469247">Mozill
@ -23,6 +24,8 @@ a Bug 469247</a>
check_wave(document.getElementById('v'), false);
mediaTestCleanup();
</script>
</pre>
</body>

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

@ -8,6 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=566245
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=566245">Mozill
@ -23,6 +24,8 @@ a Bug 566245</a>
check_webm(document.getElementById('v'), false);
mediaTestCleanup();
</script>
</pre>
</body>

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

@ -8,6 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=469247
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469247">Mozill
@ -22,6 +23,8 @@ a Bug 469247</a>
<script src="can_play_type_ogg.js"></script>
<script>
check_ogg(document.getElementById('v'), true);
mediaTestCleanup();
</script>
</pre>
</body>

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

@ -8,6 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=469247
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469247">Mozill
@ -22,6 +23,8 @@ a Bug 469247</a>
<script src="can_play_type_wave.js"></script>
<script>
check_wave(document.getElementById('v'), true);
mediaTestCleanup();
</script>
</pre>
</body>

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

@ -8,6 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=566245
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=566245">Mozill
@ -22,6 +23,7 @@ a Bug 566245</a>
<script src="can_play_type_webm.js"></script>
<script>
check_webm(document.getElementById('v'), true);
mediaTestCleanup();
</script>
</pre>
</body>

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

@ -21,6 +21,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=479863
<script type="application/javascript">
window.onload = function() {
ok(true, "loaded metadata for all videos");
mediaTestCleanup();
SimpleTest.finish();
}

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

@ -6,7 +6,7 @@
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<body onunload="mediaTestCleanup();">
<pre id="test">
<script class="testbody" type="text/javascript">

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

@ -6,7 +6,7 @@
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<body onunload="mediaTestCleanup();">
<pre id="test">
<script class="testbody" type="text/javascript">

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

@ -6,7 +6,7 @@
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<body onunload="mediaTestCleanup();">
<pre id="test">
<script class="testbody" type="text/javascript">

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

@ -6,7 +6,7 @@
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<body onunload="mediaTestCleanup();">
<pre id="test">
<script class="testbody" type="text/javascript">

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

@ -6,7 +6,7 @@
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<body onunload="mediaTestCleanup();">
<pre id="test">
<script class="testbody" type="text/javascript">

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

@ -6,7 +6,7 @@
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<body onunload="mediaTestCleanup();">
<pre id="test">
<script class="testbody" type="text/javascript">

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

@ -5,8 +5,9 @@
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<body onunload="mediaTestCleanup();">
<pre id="test">
<script class="testbody" type="text/javascript">

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

@ -11,15 +11,12 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var testsWaiting = 0;
var manager = new MediaTestManager;
gDecodeErrorTests.forEach(function (test, index) {
var v1 = document.createElement("video");
if (!v1.canPlayType(test.type)) {
return;
}
v1.addEventListener("error", function (event) {
function startTest(test, token) {
var v = document.createElement("video");
manager.started(token);
v.addEventListener("error", function (event) {
event.stopPropagation();
var el = event.currentTarget;
is(event.type, "error", "Expected event of type 'error'");
@ -30,35 +27,28 @@ gDecodeErrorTests.forEach(function (test, index) {
el._sawError = true;
}, false);
v1.addEventListener("emptied", function (event) {
v.addEventListener("emptied", function (event) {
var el = event.currentTarget;
is(el.networkState, HTMLMediaElement.NETWORK_EMPTY, "networkState should be EMPTY");
ok(el._sawError, "Expected error event");
testsWaiting -= 1;
if (testsWaiting == 0) {
SimpleTest.finish();
}
manager.finished(token);
}, false);
v1.addEventListener("loadedmetadata", function () {
v.addEventListener("loadedmetadata", function () {
ok(false, "Unexpected loadedmetadata event");
}, false);
v1.autoplay = true;
v1.addEventListener("ended", function () {
v.autoplay = true;
v.addEventListener("ended", function () {
ok(false, "Unexpected ended event");
}, false);
v1.src = test.name;
testsWaiting += 1;
v1.load();
});
if (testsWaiting > 0) {
SimpleTest.waitForExplicitFinish();
} else {
todo(false, "No types supported");
v.src = test.name;
v.load();
}
manager.runTests(gDecodeErrorTests, startTest);
</script>
</pre>
</body>

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

@ -40,6 +40,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=479711
testWindows[i].close();
}
mediaTestCleanup();
SimpleTest.finish();
}
@ -64,9 +66,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=479711
function createVideo(name, type, id) {
var v = document.createElement("video");
if (!v.canPlayType(type)) {
return null;
}
v.src = name;
v._name = name;
v.id = id;
@ -74,47 +73,38 @@ function createVideo(name, type, id) {
return v;
}
for (var i=0; i<gSmallTests.length; ++i) {
var test = gSmallTests[i];
var test = getPlayableVideo(gSmallTests);
// Straightforward add, causing a load.
var v1 = createVideo(test.name, test.type, "1");
if (v1 == null) {
continue;
}
document.body.appendChild(v1);
// Straightforward add, causing a load.
var v = createVideo(test.name, test.type, "1");
document.body.appendChild(v);
// Load, add, then remove.
var v1 = createVideo(test.name, test.type, "1");
if (!v1) {
continue;
}
v1.load();
document.body.appendChild(v1);
v1.parentNode.removeChild(v1);
// Load, add, then remove.
v = createVideo(test.name, test.type, "1");
v.load();
document.body.appendChild(v);
v.parentNode.removeChild(v);
// Load and add.
var v2 = createVideo(test.name, test.type, "2");
v2.load();
document.body.appendChild(v2);
// Load and add.
v = createVideo(test.name, test.type, "2");
v.load();
document.body.appendChild(v);
// Load outside of doc.
var v3 = createVideo(test.name, test.type, "3");
v3.load();
// Load outside of doc.
v = createVideo(test.name, test.type, "3");
v.load();
// Load and move to another document.
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var v4 = createVideo(test.name, test.type, "4");
v4.load(); // load started while in this document, this doc's load will block until
// the video's finished loading (in the other document).
// Opening a new window to do this is a bit annoying, but if we use an iframe here,
// delaying of the iframe's load event might interfere with the firing of our load event
// in some confusing way. So it's simpler just to open another window.
var w = window.open("", "testWindow"+i, "width=400,height=400");
w.document.body.appendChild(v4);
testWindows.push(w);
}
// Load and move to another document.
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
v = createVideo(test.name, test.type, "4");
v.load(); // load started while in this document, this doc's load will block until
// the video's finished loading (in the other document).
// Opening a new window to do this is a bit annoying, but if we use an iframe here,
// delaying of the iframe's load event might interfere with the firing of our load event
// in some confusing way. So it's simpler just to open another window.
var w = window.open("", "testWindow"+i, "width=400,height=400");
w.document.body.appendChild(v);
testWindows.push(w);
if (gRegisteredElements.length > 0) {
SimpleTest.waitForExplicitFinish();

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

@ -42,6 +42,7 @@ function log(msg) {
}
function nextTest() {
mediaTestCleanup();
if (gTestNum == gInfoLeakTests.length) {
gFinished = true;
SimpleTest.finish();

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

@ -21,14 +21,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=465458
/** Test for Bug 465458 **/
var videos = [];
var manager = new MediaTestManager;
function finish(evt) {
is(evt.target._error, false, "Shouldn't have thrown an error - " + evt.target._name);
evt.target._finished = true;
if (AllFinished(videos)) {
SimpleTest.finish();
}
var v = evt.target;
is(v._error, false, "Shouldn't have thrown an error - " + v._name);
v._finished = true;
v.parentNode.removeChild(v);
manager.finished(v.token);
}
function errorHandler(evt) {
@ -45,11 +45,10 @@ var extenstion = {
"video/webm" : "webm"
};
for (var i=0; i<gSmallTests.length; ++i) {
function startTest(test, token) {
var v = document.createElement('video');
var test = gSmallTests[i];
if (!v.canPlayType(test.type))
continue;
v.token = token;
manager.started(token);
v._error = false;
v._finished = false;
v._name = test.name;
@ -68,16 +67,9 @@ for (var i=0; i<gSmallTests.length; ++i) {
v.addEventListener("loadeddata", finish, false);
document.body.appendChild(v);
videos.push(v);
}
if (videos.length == 0) {
todo(false, "No types supported");
} else {
SimpleTest.waitForExplicitFinish();
}
manager.runTests(gSmallTests, startTest);
</script>
</pre>

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

@ -10,23 +10,24 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
var manager = new MediaTestManager;
function maketest(attach_media, name, type, check_metadata) {
return function (testNum) {
return function (token) {
var e = document.createElement('video');
manager.started(token);
var errorRun = false;
if (check_metadata) {
e.addEventListener('loadedmetadata', function () {
ok(e.readyState >= HTMLMediaElement.HAVE_METADATA,
'test ' + testNum + ' readyState ' + e.readyState + ' expected >= ' + HTMLMediaElement.HAVE_METADATA);
is(e.currentSrc.substring(e.currentSrc.length - name.length), name, 'test ' + testNum);
'test ' + token + ' readyState ' + e.readyState + ' expected >= ' + HTMLMediaElement.HAVE_METADATA);
is(e.currentSrc.substring(e.currentSrc.length - name.length), name, 'test ' + token);
// The load can go idle due to cache size limits
ok(e.networkState >= HTMLMediaElement.NETWORK_IDLE,
'test ' + testNum + ' networkState = ' + e.networkState + ' expected >= ' + HTMLMediaElement.NETWORK_IDLE);
'test ' + token + ' networkState = ' + e.networkState + ' expected >= ' + HTMLMediaElement.NETWORK_IDLE);
check_metadata(e);
e.parentNode.removeChild(e);
runNextTest();
manager.finished(token);
}, false);
e.addEventListener('error', function(e) { e.stopPropagation();}, false);
} else {
@ -35,11 +36,11 @@ function maketest(attach_media, name, type, check_metadata) {
is(errorRun, false, "error handler should run once only!");
errorRun = true;
is(e.readyState, HTMLMediaElement.HAVE_NOTHING,
'test ' + testNum + ' readyState should be HAVE_NOTHING when load fails.');
'test ' + token + ' readyState should be HAVE_NOTHING when load fails.');
e.parentNode.removeChild(e);
runNextTest();
manager.finished(token);
}, false);
}
}
attach_media(e, name, type);
}
}
@ -128,18 +129,12 @@ for (var i = 0; i < gSmallTests.length; ++i) {
maketest(late_add_sources_first, src, type, check));
}
function runNextTest() {
if (nextTest >= subtests.length) {
SimpleTest.finish();
return;
}
setTimeout(function () {
subtests[nextTest](nextTest);
nextTest += 1;
}, 0);
function startTest(test, token) {
test(token);
}
addLoadEvent(runNextTest);
manager.runTests(subtests, startTest);
</script>
</pre>
</body>

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

@ -12,7 +12,7 @@
<pre id="test">
<script class="testbody" type="text/javascript">
var testsWaiting = 0;
var manager = new MediaTestManager;
function cloneLoaded(event) {
ok(true, "Clone loaded OK");
@ -23,16 +23,14 @@ function cloneLoaded(event) {
"Clone " + e.currentSrc + " duration: " + e.duration + " expected: " + e._expectedDuration);
}
--testsWaiting;
if (testsWaiting == 0) {
SimpleTest.finish();
}
manager.finished(e.token);
}
function tryClone(event) {
var e = event.target;
var clone = e.cloneNode(false);
clone.token = e.token;
if (e._expectedDuration) {
ok(Math.abs(e.duration - e._expectedDuration) < 0.1,
e.currentSrc + " duration: " + e.duration + " expected: " + e._expectedDuration);
@ -45,9 +43,7 @@ function tryClone(event) {
clone.addEventListener("loadeddata", cloneLoaded, false);
}
// Find something we can play
for (var i = 0; i < gCloneTests.length; ++i) {
var test = gCloneTests[i];
function initTest(test, token) {
var elemType = /^audio/.test(test.type) ? "audio" : "video";
var e = document.createElement(elemType);
if (e.canPlayType(test.type)) {
@ -57,15 +53,12 @@ for (var i = 0; i < gCloneTests.length; ++i) {
}
e.addEventListener("loadeddata", tryClone, false);
e.load();
++testsWaiting;
e.token = token;
manager.started(token);
}
}
if (testsWaiting == 0) {
todo(false, "Can't play anything");
} else {
SimpleTest.waitForExplicitFinish();
}
manager.runTests(gCloneTests, initTest);
</script>
</pre>

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

@ -5,8 +5,9 @@
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<body onunload="mediaTestCleanup();">
<video id='v1' onerror="event.stopPropagation();"></video><audio id='a1' onerror="event.stopPropagation();"></audio>
<pre id="test">
<script class="testbody" type="text/javascript">

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

@ -21,18 +21,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=528566
/** Test for Bug 528566 **/
var testsStarted = 0;
var testsComplete = 0;
var manager = new MediaTestManager;
var player = new Audio();
var audios = [];
for (var i=0; i<gAudioTests.length; i++) {
var test = gAudioTests[i];
function startTest(test, token) {
if (!player.canPlayType(test.type))
continue;
return;
manager.started(token);
var a = new Audio(test.name);
++testsStarted;
a.setAttribute("autoplay", false);
a.addEventListener("canplaythrough",
function(e){ e.target.play(); },
@ -40,20 +37,12 @@ for (var i=0; i<gAudioTests.length; i++) {
a.addEventListener("ended",
function(e){
ok(true, "We should get to the end. Oh look we did.");
testsComplete++;
if (testsStarted == testsComplete) {
SimpleTest.finish();
}
manager.finished(token);
},
false);
audios.push(a);
}
if (testsStarted != 0) {
SimpleTest.waitForExplicitFinish();
} else {
todo(false, "No types supported");
}
manager.runTests(gAudioTests, startTest);
</script>
</pre>

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

@ -5,6 +5,7 @@
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<video id='v1' onerror="event.stopPropagation();"></video><audio id='a1' onerror="event.stopPropagation();"></audio>
@ -14,6 +15,7 @@ var v1 = document.getElementById('v1');
var a1 = document.getElementById('a1');
ok(v1.paused, "v1.paused must initially be true");
ok(a1.paused, "a1.paused must initially be true");
mediaTestCleanup();
</script>
</pre>
</body>

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

@ -11,21 +11,18 @@
<pre id="test">
<script class="testbody" type="text/javascript">
var videos = [];
var manager = new MediaTestManager;
function ended(evt) {
var v = evt.target;
is(v.paused, false, v._name + " must not be paused after end");
if (AllFinished(videos)) {
SimpleTest.finish();
}
manager.finished(v.token);
}
for (var i=0; i<gPausedAfterEndedTests.length; ++i) {
function startTest(test, token) {
var v = document.createElement('video');
var test = gPausedAfterEndedTests[i];
if (!v.canPlayType(test.type))
continue;
v.token = v;
manager.started(v);
v.src = test.name;
v._name = test.name;
v._finished = false;
@ -38,11 +35,7 @@ for (var i=0; i<gPausedAfterEndedTests.length; ++i) {
v.addEventListener("ended", ended, false);
}
if (videos.length == 0) {
todo(false, "No types supported");
} else {
SimpleTest.waitForExplicitFinish();
}
manager.runTests(gPausedAfterEndedTests, startTest);
</script>
</pre>

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

@ -11,7 +11,8 @@
<pre id="test">
<script>
var videos = [];
var manager = new MediaTestManager;
var tokens = {
0: ["play"],
@ -30,21 +31,17 @@ function gotPlayEvent(event) {
function ended(event) {
var v = event.target;
v._finished = true;
is(v._state, "canplaythrough", "Last event should be canplaythrough for " + v.src);
if (AllFinished(videos)) {
SimpleTest.finish();
}
v.parentNode.removeChild(v);
manager.finished(v.token);
}
for (var i=0; i<gSmallTests.length; ++i) {
function initTest(test, token) {
var v = document.createElement('video');
var test = gSmallTests[i];
if (!v.canPlayType(test.type))
continue;
v.token = token;
manager.started(token);
v._state = 0;
v._finished = false;
["play", "canplay", "playing", "canplaythrough"].forEach(function (e) {
v.addEventListener(e, gotPlayEvent, false);
});
@ -54,15 +51,9 @@ for (var i=0; i<gSmallTests.length; ++i) {
v.src = test.name;
document.body.appendChild(v); // Causes load.
v.play();
videos.push(v);
}
if (videos.length == 0) {
todo(false, "No types supported");
} else {
SimpleTest.waitForExplicitFinish();
}
manager.runTests(gSmallTests, initTest);
</script>
</pre>

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

@ -11,7 +11,7 @@
<pre id="test">
<script>
var videos = [];
var manager = new MediaTestManager;
var tokens = {
0: ["play"],
@ -32,16 +32,14 @@ function ended(event) {
var v = event.target;
v._finished = true;
is(v._state, "canplaythrough", "Last event should be canplaythrough for " + v.src);
if (AllFinished(videos)) {
SimpleTest.finish();
}
v.parentNode.removeChild(v);
manager.finished(v.token);
}
for (var i=0; i<gSmallTests.length; ++i) {
function startTest(test, token) {
var v = document.createElement('video');
var test = gSmallTests[i];
if (!v.canPlayType(test.type))
continue;
v.token = token;
manager.started(token);
v._state = 0;
v._finished = false;
@ -54,15 +52,9 @@ for (var i=0; i<gSmallTests.length; ++i) {
v.src = test.name;
document.body.appendChild(v); // Causes load.
v.play();
videos.push(v);
}
if (videos.length == 0) {
todo(false, "No types supported");
} else {
SimpleTest.waitForExplicitFinish();
}
manager.runTests(gSmallTests, startTest);
</script>
</pre>

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

@ -10,92 +10,69 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var PARALLEL_TESTS = 2;
var testIndex = 0;
var videos = [];
var manager = new MediaTestManager;
var testsWaiting = 0;
function startTests() {
for (var i = 0; i < videos.length; ++i) {
document.body.removeChild(videos[i]);
}
videos = [];
while (videos.length < PARALLEL_TESTS && testIndex < gReplayTests.length) {
var v = document.createElement('video');
var test = gReplayTests[testIndex];
++testIndex;
if (!v.canPlayType(test.type))
continue;
v.src = test.name;
v.name = test.name;
function startTest(test, token) {
var v = document.createElement('video');
v.token = token;
manager.started(token);
v.src = test.name;
v.name = test.name;
v.playingCount = 0;
var check = function(test, v) { return function() {
checkMetadata(test.name, v, test);
}}(test, v);
var noLoad = function(test, v) { return function() {
ok(false, test.name + " should not fire 'load' event");
}}(test, v);
var checkEnded = function(test, v) { return function() {
if (test.duration) {
ok(Math.abs(v.currentTime - test.duration) < 0.1,
test.name + " current time at end: " + v.currentTime);
}
is(v.readyState, v.HAVE_CURRENT_DATA, test.name + " checking readyState");
ok(v.readyState != v.NETWORK_LOADED, test.name + " shouldn't report NETWORK_LOADED");
ok(v.ended, test.name + " checking playback has ended");
ok(v.playingCount > 0, "Expect at least one playing event");
v.playingCount = 0;
var check = function(test, v) { return function() {
checkMetadata(test.name, v, test);
}}(test, v);
var noLoad = function(test, v) { return function() {
ok(false, test.name + " should not fire 'load' event");
}}(test, v);
var checkEnded = function(test, v) { return function() {
if (test.duration) {
ok(Math.abs(v.currentTime - test.duration) < 0.1,
test.name + " current time at end: " + v.currentTime);
}
is(v.readyState, v.HAVE_CURRENT_DATA, test.name + " checking readyState");
ok(v.readyState != v.NETWORK_LOADED, test.name + " shouldn't report NETWORK_LOADED");
ok(v.ended, test.name + " checking playback has ended");
ok(v.playingCount > 0, "Expect at least one playing event");
v.playingCount = 0;
if (v._playedOnce) {
--testsWaiting;
if (testsWaiting == 0) {
setTimeout(startTests, 0);
}
} else {
v._playedOnce = true;
v.play();
}
}}(test, v);
var checkSuspended = function(test, v) { return function() {
if (v.seenSuspend)
return;
if (v._playedOnce && v.seenSuspend) {
v.parentNode.removeChild(v);
manager.finished(v.token);
} else {
v._playedOnce = true;
v.play();
}
}}(test, v);
var checkSuspended = function(test, v) { return function() {
if (v.seenSuspend)
return;
v.seenSuspend = true;
ok(true, test.name + " got suspend");
--testsWaiting;
if (testsWaiting == 0) {
setTimeout(startTests, 0);
}
}}(test, v);
var checkPlaying = function(test, v) { return function() {
is(test.name, v.name, "Should be testing file we think we're testing...");
v.playingCount++;
}}(test, v);
v.addEventListener("load", noLoad, false);
v.addEventListener("loadedmetadata", check, false);
v.addEventListener("playing", checkPlaying, false);
v.seenSuspend = true;
ok(true, test.name + " got suspend");
if (v._playedOnce && v.seenSuspend) {
v.parentNode.removeChild(v);
manager.finished(v.token);
}
}}(test, v);
var checkPlaying = function(test, v) { return function() {
is(test.name, v.name, "Should be testing file we think we're testing...");
v.playingCount++;
}}(test, v);
v.addEventListener("load", noLoad, false);
v.addEventListener("loadedmetadata", check, false);
v.addEventListener("playing", checkPlaying, false);
// We should get "ended" and "suspend" events for every resource
v.addEventListener("ended", checkEnded, false);
v.addEventListener("suspend", checkSuspended, false);
testsWaiting += 2;
document.body.appendChild(v);
v.play();
videos.push(v);
}
if (videos.length == 0) {
// No new tests were spawned, perhaps the remaining tests on the list are
// not supported, or we just reached the end of the list.
SimpleTest.finish();
}
// We should get "ended" and "suspend" events for every resource
v.addEventListener("ended", checkEnded, false);
v.addEventListener("suspend", checkSuspended, false);
document.body.appendChild(v);
v.play();
}
SimpleTest.waitForExplicitFinish();
manager.runTests(gReplayTests, startTest);
addLoadEvent(startTests);
</script>
</pre>
</body>

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

@ -10,92 +10,74 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var PARALLEL_TESTS = 2;
var testIndex = 0;
var videos = [];
var manager = new MediaTestManager;
var testsWaiting = 0;
function startTest(test, token) {
var v = document.createElement('video');
v.token = token;
manager.started(token);
function startTests() {
for (var i = 0; i < videos.length; ++i) {
document.body.removeChild(videos[i]);
}
videos = [];
while (videos.length < PARALLEL_TESTS && testIndex < gPlayTests.length) {
var v = document.createElement('video');
var test = gPlayTests[testIndex];
++testIndex;
if (!v.canPlayType(test.type))
continue;
v.src = test.name;
v.name = test.name;
var check = function(test, v) { return function() {
is(test.name, v.name, "Name should match test.name #1");
checkMetadata(test.name, v, test);
}}(test, v);
var noLoad = function(test, v) { return function() {
ok(false, test.name + " should not fire 'load' event");
}}(test, v);
var checkEnded = function(test, v) { return function() {
if (test.duration) {
ok(Math.abs(v.currentTime - test.duration) < 0.1,
test.name + " current time at end: " + v.currentTime + " should be: " + test.duration);
}
is(test.name, v.name, "Name should match test.name #2");
is(v.readyState, v.HAVE_CURRENT_DATA, test.name + " checking readyState");
ok(v.readyState != v.NETWORK_LOADED, test.name + " shouldn't report NETWORK_LOADED");
ok(v.ended, test.name + " checking playback has ended");
if (v.ended && v.seenSuspend) {
if (v.parentNode)
v.parentNode.removeChild(v);
manager.finished(v.token);
}
}}(test, v);
var checkSuspended = function(test, v) { return function() {
is(test.name, v.name, "Name should match test.name #3");
if (v.seenSuspend)
return;
v.src = test.name;
v.name = test.name;
var check = function(test, v) { return function() {
is(test.name, v.name, "Name should match test.name #1");
checkMetadata(test.name, v, test);
}}(test, v);
var noLoad = function(test, v) { return function() {
ok(false, test.name + " should not fire 'load' event");
}}(test, v);
var checkEnded = function(test, v) { return function() {
if (test.duration) {
ok(Math.abs(v.currentTime - test.duration) < 0.1,
test.name + " current time at end: " + v.currentTime + " should be: " + test.duration);
}
is(test.name, v.name, "Name should match test.name #2");
is(v.readyState, v.HAVE_CURRENT_DATA, test.name + " checking readyState");
ok(v.readyState != v.NETWORK_LOADED, test.name + " shouldn't report NETWORK_LOADED");
ok(v.ended, test.name + " checking playback has ended");
--testsWaiting;
if (testsWaiting == 0) {
setTimeout(startTests, 0);
}
}}(test, v);
var checkSuspended = function(test, v) { return function() {
is(test.name, v.name, "Name should match test.name #3");
if (v.seenSuspend)
return;
v.seenSuspend = true;
ok(true, test.name + " got suspend");
if (v.ended && v.seenSuspend) {
if (v.parentNode)
v.parentNode.removeChild(v);
manager.finished(v.token);
}
}}(test, v);
v.prevTime = 0;
var timeUpdate = function(test, v) { return function() {
is(test.name, v.name, "Name should match test.name #4");
checkMetadata(test.name, v, test);
ok(v.prevTime <= v.currentTime,
test.name + " time should run forwards: p=" +
v.prevTime + " c=" + v.currentTime);
v.prevTime = v.currentTime;
}}(test, v);
v.addEventListener("load", noLoad, false);
v.addEventListener("loadedmetadata", check, false);
v.addEventListener("timeupdate", timeUpdate, false);
v.seenSuspend = true;
ok(true, test.name + " got suspend");
--testsWaiting;
if (testsWaiting == 0) {
setTimeout(startTests, 0);
}
}}(test, v);
v.prevTime = 0;
var timeUpdate = function(test, v) { return function() {
is(test.name, v.name, "Name should match test.name #4");
checkMetadata(test.name, v, test);
ok(v.prevTime <= v.currentTime,
test.name + " time should run forwards: p=" +
v.prevTime + " c=" + v.currentTime);
v.prevTime = v.currentTime;
}}(test, v);
v.addEventListener("load", noLoad, false);
v.addEventListener("loadedmetadata", check, false);
v.addEventListener("timeupdate", timeUpdate, false);
// We should get "ended" and "suspend" events for every resource
v.addEventListener("ended", checkEnded, false);
v.addEventListener("suspend", checkSuspended, false);
// We should get "ended" and "suspend" events for every resource
v.addEventListener("ended", checkEnded, false);
v.addEventListener("suspend", checkSuspended, false);
testsWaiting += 2;
document.body.appendChild(v);
v.play();
videos.push(v);
}
if (videos.length == 0) {
// No new tests were spawned, perhaps the remaining tests on the list are
// not supported, or we just reached the end of the list.
SimpleTest.finish();
}
document.body.appendChild(v);
v.play();
}
SimpleTest.waitForExplicitFinish();
manager.runTests(gPlayTests, startTest);
addLoadEvent(startTests);
</script>
</pre>
</body>

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

@ -10,64 +10,40 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var PARALLEL_TESTS = 2;
var testIndex = 0;
var videos = [];
var manager = new MediaTestManager;
var testsWaiting = 0;
function startTests() {
for (var i = 0; i < videos.length; ++i) {
document.body.removeChild(videos[i]);
}
videos = [];
while (videos.length < PARALLEL_TESTS && testIndex < gErrorTests.length) {
var v = document.createElement('video');
var test = gErrorTests[testIndex];
++testIndex;
if (!v.canPlayType(test.type))
continue;
v.src = test.name;
v._errorCount = 0;
v._ignore = false;
function endedTest(v) {
if (v._ignore)
return;
v._ignore = true;
--testsWaiting;
if (testsWaiting == 0) {
setTimeout(startTests, 0);
}
}
var checkError = function(test, v) { return function(evt) {
evt.stopPropagation();
v._errorCount++;
is(v._errorCount, 1, test.name + " only one error fired");
endedTest(v);
}}(test, v);
var checkEnded = function(test, v) { return function() {
ok(false, test.name + " successfully played");
endedTest(v);
}}(test, v);
v.addEventListener("error", checkError, false);
v.addEventListener("ended", checkEnded, false);
++testsWaiting;
document.body.appendChild(v);
v.play();
videos.push(v);
}
if (videos.length == 0) {
// No new tests were spawned, perhaps the remaining tests on the list are
// not supported, or we just reached the end of the list.
SimpleTest.finish();
function startTest(test, token) {
var v = document.createElement('video');
manager.started(token);
v._errorCount = 0;
v._ignore = false;
function endedTest(v) {
if (v._ignore)
return;
v._ignore = true;
v.parentNode.removeChild(v);
manager.finished(token);
}
var checkError = function(test, v) { return function(evt) {
evt.stopPropagation();
v._errorCount++;
is(v._errorCount, 1, test.name + " only one error fired");
endedTest(v);
}}(test, v);
var checkEnded = function(test, v) { return function() {
ok(false, test.name + " successfully played");
endedTest(v);
}}(test, v);
v.addEventListener("error", checkError, false);
v.addEventListener("ended", checkEnded, false);
v.src = test.name;
document.body.appendChild(v);
v.play();
}
SimpleTest.waitForExplicitFinish();
manager.runTests(gErrorTests, startTest);
addLoadEvent(startTests);
</script>
</pre>
</body>

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

@ -24,9 +24,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=548523
/** Test for Bug 548523 **/
var videos = [];
var manager = new MediaTestManager;
manager.onFinished = function() {
is(gotLoadEvent, true, "Should not have delayed the load event indefinitely");
};
var test = getPlayableVideo(gSeekTests);
var gTest = test;
var bogusSrc = "bogus.duh";
var bogusType = "video/bogus";
var gotLoadEvent = false;
@ -39,16 +44,10 @@ function log(m) {
l.innerHTML += m;
}
function maybeFinish(n) {
function maybeFinish(v, n) {
log(n + ",");
setTimeout(
function() {
if (!finished && AllFinished(videos)) {
finished = true;
is(gotLoadEvent, true, "Should not have delayed the load event indefinitely");
SimpleTest.finish();
}
}, 0);
v.parentNode.removeChild(v);
manager.finished(v.token);
}
function filename(uri) {
@ -71,7 +70,7 @@ var tests = [
is(v.readyState, v.HAVE_NOTHING, "(1) ReadyState must be HAVE_NOTHING");
is(v.networkState, v.NETWORK_IDLE, "(1) NetworkState must be NETWORK_IDLE");
v._finished = true;
maybeFinish(1);
maybeFinish(v, 1);
},
setup:
@ -98,7 +97,7 @@ var tests = [
ok(v.readyState >= v.HAVE_CURRENT_DATA, "(2) ReadyState must be >= HAVE_CURRENT_DATA");
is(v.networkState, v.NETWORK_IDLE, "(2) NetworkState must be NETWORK_IDLE");
v._finished = true;
maybeFinish(2);
maybeFinish(v, 2);
},
setup:
@ -123,7 +122,7 @@ var tests = [
is(v._gotLoadStart, true, "(3) Must get loadstart.");
is(v._gotLoadedMetaData, true, "(3) Must get loadedmetadata.");
v._finished = true;
maybeFinish(3);
maybeFinish(v, 3);
},
setup:
@ -158,7 +157,7 @@ var tests = [
function(e) {
ok(true, "(4) Got playback ended");
e.target._finished = true;
maybeFinish(4);
maybeFinish(e.target, 4);
},
setup:
@ -187,7 +186,7 @@ var tests = [
is(v.readyState, v.HAVE_NOTHING, "(5) ReadyState must be HAVE_NOTHING");
is(v.networkState, v.NETWORK_IDLE, "(5) NetworkState must be NETWORK_IDLE");
v._finished = true;
maybeFinish(5);
maybeFinish(v, 5);
},
setup:
@ -214,7 +213,7 @@ var tests = [
is(v.readyState, v.HAVE_NOTHING, "(6) ReadyState must be HAVE_NOTHING");
is(v.networkState, v.NETWORK_IDLE, "(6) NetworkState must be NETWORK_IDLE");
v._finished = true;
maybeFinish(6);
maybeFinish(v, 6);
},
setup:
@ -252,8 +251,9 @@ var tests = [
ended:
function(e) {
ok(true, "(7) Got playback ended");
e.target._finished = true;
maybeFinish(7);
var v = e.target;
v._finished = true;
maybeFinish(v, 7);
},
setup:
@ -286,7 +286,7 @@ var tests = [
ok(v.readyState >= v.HAVE_CURRENT_DATA, "(8) ReadyState must be >= HAVE_CURRENT_DATA on suspend.");
is(v.networkState, v.NETWORK_IDLE, "(8) NetworkState must be NETWORK_IDLE when load is halted");
v._finished = true;
maybeFinish(8);
maybeFinish(v, 8);
},
setup:
@ -313,7 +313,7 @@ var tests = [
is(v._gotLoadStart, true, "(9) Must get loadstart.");
is(v._gotLoadedMetaData, true, "(9) Must get loadedmetadata.");
v._finished = true;
maybeFinish(9);
maybeFinish(v, 9);
},
setup:
@ -337,7 +337,7 @@ var tests = [
var v = e.target;
is(v._gotLoadedMetaData, true, "(10) Must get loadedmetadata.");
v._finished = true;
maybeFinish(10);
maybeFinish(v, 10);
},
setup:
@ -361,7 +361,7 @@ var tests = [
ok(v.readyState >= v.HAVE_CURRENT_DATA, "(11) ReadyState must be >= HAVE_CURRENT_DATA.");
is(v.networkState, v.NETWORK_IDLE, "(11) NetworkState must be NETWORK_IDLE.");
v._finished = true;
maybeFinish(11);
maybeFinish(v, 11);
},
setup:
@ -385,7 +385,7 @@ var tests = [
is(v._gotLoadedMetaData, true, "(12) Must get loadedmetadata.");
is(v._gotLoadStart, true, "(12) Must get loadstart.");
v._finished = true;
maybeFinish(12);
maybeFinish(v, 12);
},
setup:
@ -414,7 +414,7 @@ var tests = [
ok(v.readyState >= v.HAVE_CURRENT_DATA, "(13) ReadyState must be >= HAVE_CURRENT_DATA.");
is(v.networkState, v.NETWORK_IDLE, "(13) NetworkState must be NETWORK_IDLE.");
v._finished = true;
maybeFinish(13);
maybeFinish(v, 13);
},
setup:
@ -446,8 +446,9 @@ var tests = [
ended:
function(e) {
ok(true, "(14) Got playback ended");
e.target._finished = true;
maybeFinish(14);
var v = e.target;
v._finished = true;
maybeFinish(v, 14);
},
setup:
@ -470,8 +471,9 @@ var tests = [
ended:
function(e) {
ok(true, "(15) Got playback ended.");
e.target._finished = true;
maybeFinish(15);
var v = e.target;
v._finished = true;
maybeFinish(v, 15);
},
setup:
@ -493,8 +495,9 @@ var tests = [
ended:
function(e) {
ok(true, "(16) Got playback ended.");
e.target._finished = true;
maybeFinish(16);
var v = e.target;
v._finished = true;
maybeFinish(v, 16);
},
setup:
@ -512,8 +515,9 @@ var tests = [
ended:
function(e) {
ok(true, "(17) Got playback ended.");
e.target._finished = true;
maybeFinish(17);
var v = e.target;
v._finished = true;
maybeFinish(v, 17);
},
setup:
@ -528,21 +532,14 @@ var tests = [
},
];
if (test) {
for (var i=0; i<tests.length; i++) {
var t = tests[i];
var v = document.createElement("video");
videos.push(v);
t.setup(v);
}
}
if (test && videos.length == 0) {
todo(false, "No types or tests supported");
} else {
SimpleTest.waitForExplicitFinish();
function startTest(test, token) {
var v = document.createElement("video");
v.token = token;
test.setup(v);
manager.started(token);
}
manager.runTests(tests, startTest);
</script>
</pre>

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

@ -12,7 +12,7 @@
<script src="use_large_cache.js"></script>
<script class="testbody" type="text/javascript">
var videos = [];
var manager = new MediaTestManager;
function do_progress(e) {
var v = e.target;
@ -28,16 +28,15 @@ function do_ended(e) {
var v = e.target;
ok(!v._finished, "Only one ended event for " + v._name);
v._finished = true;
if (AllFinished(videos))
SimpleTest.finish();
v.parentNode.removeChild(v);
manager.finished(v.token);
}
for (var i=0; i<gProgressTests.length; ++i) {
var test = gProgressTests[i];
function startTest(test, token) {
var type = /^video/.test(test.type) ? "video" : "audio";
var v = document.createElement(type);
if (!v.canPlayType(test.type))
continue;
v.token = token;
manager.started(token);
v.src = test.name;
v.autoplay = true;
v._name = test.name;
@ -47,14 +46,9 @@ for (var i=0; i<gProgressTests.length; ++i) {
v.addEventListener("ended", do_ended, false);
v.addEventListener("progress", do_progress, false);
document.body.appendChild(v);
videos.push(v);
}
if (videos.length == 0) {
todo(false, "No types supported");
} else {
SimpleTest.waitForExplicitFinish();
}
manager.runTests(gProgressTests, startTest);
</script>
</pre>

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

@ -23,7 +23,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=467972
// Test for Bug 467972. Tests that when we play to end, seek to 0, and play again, that we don't
// send/receive multiple loadeddata and loadedmetadata events.
var videos = [];
var manager = new MediaTestManager;
function seekStarted(evt) {
var v = evt.target;
@ -75,18 +75,16 @@ function playbackEnded(evt) {
is(v._endCount, 2, "Should have received two ended events for " + v._name);
ok(v._playingCount > 0, "Should have at least one playing event for " + v._name);
v._finished = true;
if (AllFinished(videos)) {
SimpleTest.finish();
}
v.parentNode.removeChild(v);
manager.finished(v.token);
}
return false;
}
for (var i=0; i<gSmallTests.length; ++i) {
function startTest(test, token) {
var v = document.createElement('video');
var test = gSmallTests[i];
if (!v.canPlayType(test.type))
continue;
v.token = token;
manager.started(token);
v.src = test.name;
v._name = test.name;
v._playedOnce = false;
@ -105,14 +103,9 @@ for (var i=0; i<gSmallTests.length; ++i) {
v.addEventListener("seeking", seekStarted, false);
v.addEventListener("seeked", seekEnded, false);
document.body.appendChild(v);
videos.push(v);
}
if (videos.length == 0) {
todo(false, "No types supported");
} else {
SimpleTest.waitForExplicitFinish();
}
manager.runTests(gSmallTests, startTest);
</script>
</pre>

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