Merge mozilla-central to b2g-inbound

This commit is contained in:
Carsten "Tomcat" Book 2013-10-09 14:14:15 +02:00
commit 30cc46554b
420 changed files with 4286 additions and 2762 deletions

View File

@ -15,6 +15,7 @@
#include "nsLayoutUtils.h"
#include "HyperTextAccessible.h"
#include "mozilla/AppUnits.h"
#include "mozilla/gfx/2D.h"
using namespace mozilla;
using namespace mozilla::a11y;

View File

@ -17,6 +17,7 @@
#include "nsLayoutUtils.h"
#include "gfxFont.h"
#include "nsIAccessibleTypes.h"
#include "mozilla/gfx/2D.h"
using namespace mozilla::a11y;

View File

@ -324,7 +324,6 @@ pref("browser.safebrowsing.provider.0.reportMalwareURL", "http://{moz:locale}.ma
pref("browser.safebrowsing.provider.0.reportMalwareErrorURL", "http://{moz:locale}.malware-error.mozilla.com/?hl={moz:locale}");
// FAQ URLs
pref("browser.safebrowsing.warning.infoURL", "http://www.mozilla.com/%LOCALE%/%APP%/phishing-protection/");
pref("browser.geolocation.warning.infoURL", "http://www.mozilla.com/%LOCALE%/%APP%/geolocation/");
// Name of the about: page contributed by safebrowsing to handle display of error

View File

@ -795,7 +795,6 @@ pref("browser.safebrowsing.reportPhishURL", "http://%LOCALE%.phish-report.mozill
pref("browser.safebrowsing.reportMalwareURL", "http://%LOCALE%.malware-report.mozilla.com/?hl=%LOCALE%");
pref("browser.safebrowsing.reportMalwareErrorURL", "http://%LOCALE%.malware-error.mozilla.com/?hl=%LOCALE%");
pref("browser.safebrowsing.warning.infoURL", "https://www.mozilla.org/%LOCALE%/firefox/phishing-protection/");
pref("browser.safebrowsing.malware.reportURL", "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?client=%NAME%&hl=%LOCALE%&site=");
// Since the application reputation query isn't hooked in anywhere yet, this
// preference does not matter. To be extra safe, don't turn this preference on

View File

@ -67,6 +67,6 @@
<button class="launchButton" id="restorePreviousSession">&historyRestoreLastSession.label;</button>
</div>
<a id="aboutMozilla" href="http://www.mozilla.org/about/"/>
<a id="aboutMozilla" href="https://www.mozilla.org/about/?utm_source=about-home&amp;utm_medium=Referral"/>
</body>
</html>

View File

@ -2404,11 +2404,7 @@ let BrowserOnClick = {
}
}
else { // It's a phishing site, not malware
try {
content.location = formatURL("browser.safebrowsing.warning.infoURL", true);
} catch (e) {
Components.utils.reportError("Couldn't get phishing info URL: " + e);
}
openHelpLink("phishing-malware", false, "current");
}
break;

View File

@ -1912,7 +1912,7 @@
// Prevent this tab from showing further dialogs, since we're closing it
var windowUtils = browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
windowUtils.preventFurtherDialogs();
windowUtils.disableDialogs();
}
// Remove the tab's filter and progress listener.

View File

@ -1,8 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']

View File

@ -282,3 +282,5 @@ support-files =
[browser_visibleTabs_tabPreview.js]
[browser_wyciwyg_urlbarCopying.js]
[browser_zbug569342.js]
[browser_registerProtocolHandler_notification.js]
[browser_registerProtocolHandler_notification.html]

View File

@ -0,0 +1,15 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Protocol registrar page</title>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
</head>
<body>
<script type="text/javascript">
navigator.registerProtocolHandler("testprotocol",
"https://example.com/foobar?uri=%s",
"Test Protocol");
</script>
</body>
</html>

View File

@ -0,0 +1,39 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function test() {
waitForExplicitFinish();
let notificationValue = "Protocol Registration: testprotocol";
let testURI = "http://example.com/browser/" +
"browser/base/content/test/general/browser_registerProtocolHandler_notification.html";
waitForCondition(function() {
// Do not start until the notification is up
let notificationBox = window.gBrowser.getNotificationBox();
let notification = notificationBox.getNotificationWithValue(notificationValue);
return notification;
},
function() {
let notificationBox = window.gBrowser.getNotificationBox();
let notification = notificationBox.getNotificationWithValue(notificationValue);
ok(notification, "Notification box should be displayed");
is(notification.type, "info", "We expect this notification to have the type of 'info'.");
isnot(notification.image, null, "We expect this notification to have an icon.");
let buttons = notification.getElementsByClassName("notification-button-default");
is(buttons.length, 1, "We expect see one default button.");
buttons = notification.getElementsByClassName("notification-button");
is(buttons.length, 1, "We expect see one button.");
let button = buttons[0];
isnot(button.label, null, "We expect the add button to have a label.");
todo_isnot(button.accesskey, null, "We expect the add button to have a accesskey.");
finish();
}, 100);
window.gBrowser.selectedBrowser.loadURI(testURI);
}

View File

@ -1,134 +1,73 @@
function notify(event)
{
if (event.target.location == "about:blank")
return;
var eventname = event.type;
if (eventname == "pagehide")
details.pagehides++;
else if (eventname == "beforeunload")
details.beforeunloads++;
else if (eventname == "unload")
details.unloads++;
}
var details;
var gUseFrame = false;
const windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
const TEST_BASE_URL = "data:text/html,<script>" +
"function note(event) { try { alert(event.type); } catch(ex) { return; } throw 'alert appeared'; }" +
"</script>" +
"<body onpagehide='note(event)' onbeforeunload='alert(event.type);' onunload='note(event)'>";
const TEST_URL = TEST_BASE_URL + "Test</body>";
const TEST_FRAME_URL = TEST_BASE_URL + "Frames</body>";
var testUrls =
[
"data:text/html,<script>" +
"function handle(evt) {" +
"evt.target.removeEventListener(evt.type, handle, true);" +
"try { alert('This should NOT appear'); } catch(e) { }" +
"}" +
"window.addEventListener('pagehide', handle, true);" +
"window.addEventListener('beforeunload', handle, true);" +
"window.addEventListener('unload', handle, true);" +
"</script><body>Testing alert during pagehide/beforeunload/unload</body>",
"data:text/html,<script>" +
"function handle(evt) {" +
"evt.target.removeEventListener(evt.type, handle, true);" +
"try { prompt('This should NOT appear'); } catch(e) { }" +
"}" +
"window.addEventListener('pagehide', handle, true);" +
"window.addEventListener('beforeunload', handle, true);" +
"window.addEventListener('unload', handle, true);" +
"</script><body>Testing prompt during pagehide/beforeunload/unload</body>",
"data:text/html,<script>" +
"function handle(evt) {" +
"evt.target.removeEventListener(evt.type, handle, true);" +
"try { confirm('This should NOT appear'); } catch(e) { }" +
"}" +
"window.addEventListener('pagehide', handle, true);" +
"window.addEventListener('beforeunload', handle, true);" +
"window.addEventListener('unload', handle, true);" +
"</script><body>Testing confirm during pagehide/beforeunload/unload</body>",
];
var testsDone = 0;
function test()
{
waitForExplicitFinish();
windowMediator.addListener(promptListener);
runTest();
}
function runTest()
{
details = {
testNumber : 0,
beforeunloads : 0,
pagehides : 0,
unloads : 0,
prompts : 0
};
var tab = gBrowser.addTab(TEST_URL);
gBrowser.selectedTab = tab;
tab.linkedBrowser.addEventListener("pageshow", shown, true);
tab.linkedBrowser.addEventListener("pagehide", notify, true);
tab.linkedBrowser.addEventListener("beforeunload", notify, true);
tab.linkedBrowser.addEventListener("unload", notify, true);
whenNewTabLoaded(window, function() {
gBrowser.selectedBrowser.addEventListener("load", onLoad, true);
executeSoon(function() {
info("Loading page with pagehide, beforeunload, and unload handlers that attempt to create dialogs");
gBrowser.selectedBrowser.loadURI(testUrls[testsDone]);
});
});
}
function shown(event)
function onLoad(event)
{
if (details.testNumber == 0) {
var browser;
var iframe;
if (gUseFrame) {
iframe = event.target.createElement("iframe");
iframe.src = TEST_FRAME_URL;
event.target.documentElement.appendChild(iframe);
browser = iframe.contentWindow;
}
else {
browser = gBrowser.selectedTab.linkedBrowser;
details.testNumber = 1; // Move onto to the next step immediately
}
}
info("Page loaded");
if (details.testNumber == 1) {
// Test going to another page
executeSoon(function () {
const urlToLoad = "data:text/html,<body>Another Page</body>";
if (gUseFrame) {
event.target.location = urlToLoad;
}
else {
gBrowser.selectedBrowser.loadURI(urlToLoad);
}
});
}
else if (details.testNumber == 2) {
is(details.pagehides, 1, "pagehides after next page")
is(details.beforeunloads, 1, "beforeunloads after next page")
is(details.unloads, 1, "unloads after next page")
is(details.prompts, 1, "prompts after next page")
event.target.removeEventListener("load", onLoad, true);
gBrowser.selectedBrowser.addEventListener("unload", done, true);
executeSoon(function () gUseFrame ? gBrowser.goBack() : event.target.defaultView.back());
}
else if (details.testNumber == 3) {
is(details.pagehides, 2, "pagehides after back")
is(details.beforeunloads, 2, "beforeunloads after back")
// No cache, so frame is unloaded
is(details.unloads, gUseFrame ? 2 : 1, "unloads after back")
is(details.prompts, 1, "prompts after back")
executeSoon(function () {
info("Closing page");
gBrowser.removeCurrentTab();
});
}
// Test closing the tab
gBrowser.selectedBrowser.removeEventListener("pageshow", shown, true);
gBrowser.removeTab(gBrowser.selectedTab);
// When the frame is present, there is are two beforeunload and prompts,
// one for the frame and the other for the parent.
is(details.pagehides, 3, "pagehides after close")
is(details.beforeunloads, gUseFrame ? 4 : 3, "beforeunloads after close")
is(details.unloads, gUseFrame ? 3 : 2, "unloads after close")
is(details.prompts, gUseFrame ? 3 : 2, "prompts after close")
// Now run the test again using a child frame.
if (gUseFrame) {
windowMediator.removeListener(promptListener);
finish();
}
else {
gUseFrame = true;
runTest();
}
function done() {
ok(true, "Page closed (hopefully) without timeout");
testsDone++;
if (testsDone == testUrls.length) {
finish();
return;
}
details.testNumber++;
executeSoon(runTest);
}
var promptListener = {
onWindowTitleChange: function () {},
onOpenWindow: function (win) {
details.prompts++;
let domWin = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
executeSoon(function () { domWin.close() });
},
onCloseWindow: function () {},
};

View File

@ -3,8 +3,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MOCHITEST_MANIFESTS += ['mochitest.ini']
BROWSER_CHROME_MANIFESTS += ['browser.ini']

View File

@ -1,8 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ['chrome', 'general', 'newtab', 'social']

View File

@ -1,8 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
BROWSER_CHROME_MANIFESTS += ['browser.ini']

View File

@ -3,6 +3,11 @@ support-files =
blocklist.xml
checked.jpg
head.js
opengraph/og_invalid_url.html
opengraph/opengraph.html
opengraph/shortlink_linkrel.html
opengraph/shorturl_link.html
opengraph/shorturl_linkrel.html
share.html
social_activate.html
social_activate_iframe.html

View File

@ -1,10 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ['opengraph']
BROWSER_CHROME_MANIFESTS += ['browser.ini']

View File

@ -1,11 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MOCHITEST_BROWSER_FILES := \
opengraph.html \
og_invalid_url.html \
shortlink_linkrel.html \
shorturl_link.html \
shorturl_linkrel.html \
$(NULL)

View File

@ -1,4 +0,0 @@
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

View File

@ -656,13 +656,16 @@ function isValidFeed(aLink, aPrincipal, aIsFeed)
}
// aCalledFromModal is optional
function openHelpLink(aHelpTopic, aCalledFromModal) {
function openHelpLink(aHelpTopic, aCalledFromModal, aWhere) {
var url = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
.getService(Components.interfaces.nsIURLFormatter)
.formatURLPref("app.support.baseURL");
url += aHelpTopic;
var where = aCalledFromModal ? "window" : "tab";
var where = aWhere;
if (!aWhere)
where = aCalledFromModal ? "window" : "tab";
openUILinkIn(url, where);
}

View File

@ -4,4 +4,20 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
TEST_DIRS += ['content/test']
TEST_DIRS += [
'content/test/general',
]
MOCHITEST_MANIFESTS += [
'content/test/general/mochitest.ini',
]
MOCHITEST_CHROME_MANIFESTS += [
'content/test/chrome/chrome.ini',
]
BROWSER_CHROME_MANIFESTS += [
'content/test/general/browser.ini',
'content/test/newtab/browser.ini',
'content/test/social/browser.ini',
]

View File

@ -757,6 +757,7 @@ DownloadsDataCtor.prototype = {
*/
_updateDataItemState: function (aDataItem)
{
let oldState = aDataItem.state;
let wasInProgress = aDataItem.inProgress;
let wasDone = aDataItem.done;
@ -766,11 +767,13 @@ DownloadsDataCtor.prototype = {
aDataItem.endTime = Date.now();
}
for (let view of this._views) {
try {
view.getViewItem(aDataItem).onStateChange({});
} catch (ex) {
Cu.reportError(ex);
if (oldState != aDataItem.state) {
for (let view of this._views) {
try {
view.getViewItem(aDataItem).onStateChange(oldState);
} catch (ex) {
Cu.reportError(ex);
}
}
}

View File

@ -451,14 +451,13 @@ WebContentConverterRegistrar.prototype = {
hs.store(handlerInfo);
}
};
var buttons;
var browserElement = this._getBrowserForContentWindow(browserWindow, aContentWindow);
var notificationBox = browserWindow.getBrowser().getNotificationBox(browserElement);
notificationBox.appendNotification(message,
notificationValue,
notificationIcon,
notificationBox.PRIORITY_INFO_LOW,
buttons);
[addButton]);
},
/**

View File

@ -197,18 +197,18 @@
hideifprivatebrowsing="true"
forcehideselection="bookmark"/>
<menuseparator id="placesContext_deleteSeparator"/>
<menuitem id="placesContext_reload"
command="placesCmd_reload"
label="&cmd.reloadLivebookmark.label;"
accesskey="&cmd.reloadLivebookmark.accesskey;"
closemenu="single"
selection="livemark/feedURI"/>
<menuitem id="placesContext_sortBy:name"
command="placesCmd_sortBy:name"
label="&cmd.sortby_name.label;"
accesskey="&cmd.context_sortby_name.accesskey;"
closemenu="single"
selection="folder"/>
<menuitem id="placesContext_reload"
command="placesCmd_reload"
label="&cmd.reloadLivebookmark.label;"
accesskey="&cmd.reloadLivebookmark.accesskey;"
closemenu="single"
selection="livemark/feedURI"/>
<menuseparator id="placesContext_sortSeparator"/>
<menuitem id="placesContext_show:info"
command="placesCmd_show:info"

View File

@ -184,7 +184,7 @@ this.SessionStore = {
SessionStoreInternal.setTabState(aTab, aState);
},
duplicateTab: function ss_duplicateTab(aWindow, aTab, aDelta) {
duplicateTab: function ss_duplicateTab(aWindow, aTab, aDelta = 0) {
return SessionStoreInternal.duplicateTab(aWindow, aTab, aDelta);
},
@ -1456,7 +1456,7 @@ let SessionStoreInternal = {
this.restoreHistoryPrecursor(window, [aTab], [tabState], 0, 0, 0);
},
duplicateTab: function ssi_duplicateTab(aWindow, aTab, aDelta) {
duplicateTab: function ssi_duplicateTab(aWindow, aTab, aDelta = 0) {
if (!aTab.ownerDocument || !aTab.ownerDocument.defaultView.__SSi ||
!aWindow.getBrowser)
throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);

View File

@ -232,9 +232,11 @@ var ContentAreaObserver = {
// Request info about the target form element to see if we
// need to reposition the browser above the keyboard.
Browser.selectedBrowser.messageManager.sendAsyncMessage("Browser:RepositionInfoRequest", {
viewHeight: this.viewableHeight,
});
if (SelectionHelperUI.layerMode === 2 /*kContentLayer*/) {
Browser.selectedBrowser.messageManager.sendAsyncMessage("Browser:RepositionInfoRequest", {
viewHeight: this.viewableHeight,
});
}
},
_onRepositionResponse: function _onRepositionResponse(aJsonMsg) {

View File

@ -11,8 +11,6 @@ const kProgressMarginEnd = 70;
const WebProgress = {
get _identityBox() { return document.getElementById("identity-box"); },
_progressActive: false,
init: function init() {
messageManager.addMessageListener("Content:StateChange", this);
messageManager.addMessageListener("Content:LocationChange", this);
@ -47,19 +45,19 @@ const WebProgress = {
this._networkStop(json, tab);
}
this._progressStep();
this._progressStep(tab);
break;
}
case "Content:LocationChange": {
this._locationChange(json, tab);
this._progressStep();
this._progressStep(tab);
break;
}
case "Content:SecurityChange": {
this._securityChange(json, tab);
this._progressStep();
this._progressStep(tab);
break;
}
}
@ -153,57 +151,60 @@ const WebProgress = {
_progressStart: function _progressStart(aJson, aTab) {
// We will get multiple calls from _windowStart, so
// only process once.
if (this._progressActive)
if (aTab._progressActive)
return;
this._progressActive = true;
// display the track
Elements.progressContainer.removeAttribute("collapsed");
aTab._progressActive = true;
// 'Whoosh' in
this._progressCount = kProgressMarginStart;
Elements.progress.style.width = this._progressCount + "%";
aTab._progressCount = kProgressMarginStart;
this._showProgressBar(aTab);
},
_showProgressBar: function (aTab) {
// display the track
Elements.progressContainer.removeAttribute("collapsed");
Elements.progress.style.width = aTab._progressCount + "%";
Elements.progress.removeAttribute("fade");
// Create a pulse timer to keep things moving even if we don't
// collect any state changes.
setTimeout(function() {
WebProgress._progressStepTimer();
WebProgress._progressStepTimer(aTab);
}, kHeartbeatDuration, this);
},
_stepProgressCount: function _stepProgressCount() {
_stepProgressCount: function _stepProgressCount(aTab) {
// Step toward the end margin in smaller slices as we get closer
let left = kProgressMarginEnd - this._progressCount;
let left = kProgressMarginEnd - aTab._progressCount;
let step = left * .05;
this._progressCount += Math.ceil(step);
aTab._progressCount += Math.ceil(step);
// Don't go past the 'whoosh out' margin.
if (this._progressCount > kProgressMarginEnd) {
this._progressCount = kProgressMarginEnd;
if (aTab._progressCount > kProgressMarginEnd) {
aTab._progressCount = kProgressMarginEnd;
}
},
_progressStep: function _progressStep() {
if (!this._progressActive)
_progressStep: function _progressStep(aTab) {
if (!aTab._progressActive)
return;
this._stepProgressCount();
Elements.progress.style.width = this._progressCount + "%";
this._stepProgressCount(aTab);
Elements.progress.style.width = aTab._progressCount + "%";
},
_progressStepTimer: function _progressStepTimer() {
if (!this._progressActive)
_progressStepTimer: function _progressStepTimer(aTab) {
if (!aTab._progressActive)
return;
this._progressStep();
this._progressStep(aTab);
setTimeout(function() {
WebProgress._progressStepTimer();
WebProgress._progressStepTimer(aTab);
}, kHeartbeatDuration, this);
},
_progressStop: function _progressStop(aJson, aTab) {
this._progressActive = false;
aTab._progressActive = false;
// 'Whoosh out' and fade
Elements.progress.style.width = "100%";
Elements.progress.setAttribute("fade", true);
@ -222,6 +223,12 @@ const WebProgress = {
_onTabSelect: function(aEvent) {
let tab = Browser.getTabFromChrome(aEvent.originalTarget);
this._identityBox.className = tab._identityState || "";
if (tab._progressActive) {
this._showProgressBar(tab);
} else {
Elements.progress.setAttribute("fade", true);
Elements.progressContainer.setAttribute("collapsed", true);
}
},
_onUrlBarInput: function(aEvent) {

View File

@ -9,6 +9,10 @@
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<binding id="circular-progress-indicator">
<resources>
<stylesheet src="chrome://browser/skin/circularprogress.css"/>
</resources>
<content>
<xul:stack>
<xul:toolbarbutton anonid="progressButton" class="circularprogressindicator-progressButton appbar-secondary"/>
@ -80,4 +84,4 @@
</method>
</implementation>
</binding>
</bindings>
</bindings>

View File

@ -1060,7 +1060,7 @@ var BrowserUI = {
this.undoCloseTab();
break;
case "cmd_sanitize":
SanitizeUI.onSanitize();
this.confirmSanitizeDialog();
break;
case "cmd_flyout_back":
FlyoutPanelsUI.onBackButton();
@ -1077,6 +1077,30 @@ var BrowserUI = {
}
},
confirmSanitizeDialog: function () {
let bundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
let title = bundle.GetStringFromName("clearPrivateData.title");
let message = bundle.GetStringFromName("clearPrivateData.message");
let clearbutton = bundle.GetStringFromName("clearPrivateData.clearButton");
let buttonPressed = Services.prompt.confirmEx(
null,
title,
message,
Ci.nsIPrompt.BUTTON_POS_0 * Ci.nsIPrompt.BUTTON_TITLE_IS_STRING +
Ci.nsIPrompt.BUTTON_POS_1 * Ci.nsIPrompt.BUTTON_TITLE_CANCEL,
clearbutton,
null,
null,
null,
{ value: false });
// Clicking 'Clear' will call onSanitize().
if (buttonPressed === 0) {
SanitizeUI.onSanitize();
}
},
crashReportingPrefChanged: function crashReportingPrefChanged(aState) {
CrashReporter.submitReports = aState;
}

View File

@ -677,13 +677,9 @@ var Browser = {
break;
}
case "report-phishing": {
// It's a phishing site, not malware
try {
let reportURL = formatter.formatURLPref("browser.safebrowsing.warning.infoURL");
this.loadURI(reportURL);
} catch (e) {
Cu.reportError("Couldn't get phishing info URL: " + e);
}
// It's a phishing site, just link to the generic information page
let url = Services.urlFormatter.formatURLPref("app.support.baseURL");
this.loadURI(url + "phishing-malware");
break;
}
}
@ -1242,6 +1238,8 @@ function Tab(aURI, aParams, aOwner) {
this._browser = null;
this._notification = null;
this._loading = false;
this._progressActive = false;
this._progressCount = 0;
this._chromeTab = null;
this._eventDeferred = null;
this._updateThumbnailTimeout = null;

View File

@ -322,17 +322,6 @@ var SelectionHandler = {
* whether the browser deck needs repositioning.
*/
_repositionInfoRequest: function _repositionInfoRequest(aJsonMsg) {
if (!this.isActive) {
Util.dumpLn("unexpected: repositionInfoRequest but selection isn't active.");
this.sendAsync("Content:RepositionInfoResponse", { reposition: false });
return;
}
if (!this.targetIsEditable) {
Util.dumpLn("unexpected: repositionInfoRequest but targetIsEditable is false.");
this.sendAsync("Content:RepositionInfoResponse", { reposition: false });
}
let result = this._calcNewContentPosition(aJsonMsg.viewHeight);
// no repositioning needed
@ -422,9 +411,10 @@ var SelectionHandler = {
* distance content should be raised to center the target element.
*/
_calcNewContentPosition: function _calcNewContentPosition(aNewViewHeight) {
// We don't support this on non-editable elements
if (!this._targetIsEditable) {
return 0;
// We have no target element but the keyboard is up
// so lets not cover content
if (!this._cache || !this._cache.element) {
return Services.metro.keyboardHeight;
}
let position = Util.centerElementInView(aNewViewHeight, this._cache.element);

View File

@ -5,14 +5,6 @@
@namespace xul url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
@namespace html url(http://www.w3.org/1999/xhtml);
xul|*:-moz-system-metric(touch-enabled) {
cursor: none !important;
}
html|*:-moz-system-metric(touch-enabled) {
cursor: none !important;
}
/* For touch input, *all* select boxes use the SelectHelper popup. */
select option, select optgroup {
pointer-events: none;

View File

@ -14,6 +14,7 @@ var MetroDownloadsView = {
*/
_downloadCount: 0,
_downloadsInProgress: 0,
_lastDownload: null,
_inited: false,
_progressAlert: null,
_lastSec: Infinity,
@ -54,10 +55,8 @@ var MetroDownloadsView = {
Services.obs.addObserver(this, "dl-done", true);
Services.obs.addObserver(this, "dl-run", true);
Services.obs.addObserver(this, "dl-failed", true);
Services.obs.addObserver(this, "dl-request", true);
this._notificationBox = Browser.getNotificationBox();
this._notificationBox.addEventListener('AlertClose', this.handleEvent, true);
this._progress = new DownloadProgressListener(this);
this.manager.addListener(this._progress);
@ -75,7 +74,6 @@ var MetroDownloadsView = {
Services.obs.removeObserver(this, "dl-done");
Services.obs.removeObserver(this, "dl-run");
Services.obs.removeObserver(this, "dl-failed");
Services.obs.removeObserver(this, "dl-request");
}
},
@ -93,7 +91,7 @@ var MetroDownloadsView = {
}
}
if (this.manager.activeDownloadCount) {
Services.obs.notifyObservers(null, "dl-request", "");
ContextUI.displayNavbar();
}
},
@ -233,7 +231,7 @@ var MetroDownloadsView = {
this._notificationBox.PRIORITY_WARNING_HIGH);
},
_showDownloadCompleteNotification: function (aDownload) {
_showDownloadCompleteNotification: function () {
let message = "";
let showInFilesButtonText = Strings.browser.GetStringFromName("downloadShowInFiles");
@ -242,9 +240,10 @@ var MetroDownloadsView = {
label: showInFilesButtonText,
accessKey: "",
callback: function() {
let fileURI = aDownload.target;
let fileURI = MetroDownloadsView._lastDownload.target;
let file = MetroDownloadsView._getLocalFile(fileURI);
file.reveal();
MetroDownloadsView._resetCompletedDownloads();
}
}
];
@ -257,22 +256,24 @@ var MetroDownloadsView = {
let runButtonText =
Strings.browser.GetStringFromName("downloadRun");
message = Strings.browser.formatStringFromName("alertDownloadsDone2",
[aDownload.displayName], 1);
[this._lastDownload.displayName], 1);
buttons.unshift({
isDefault: true,
label: runButtonText,
accessKey: "",
callback: function() {
MetroDownloadsView.openDownload(aDownload);
MetroDownloadsView.openDownload(MetroDownloadsView._lastDownload);
MetroDownloadsView._resetCompletedDownloads();
}
});
}
this._removeNotification("download-complete");
this.showNotification("download-complete", message, buttons,
this._notificationBox.PRIORITY_WARNING_MEDIUM);
},
_showDownloadCompleteToast: function (aDownload) {
_showDownloadCompleteToast: function () {
let name = "DownloadComplete";
let msg = "";
let title = "";
@ -287,30 +288,24 @@ var MetroDownloadsView = {
observe: function (aSubject, aTopic, aData) {
switch (aTopic) {
case "alertclickcallback":
let fileURI = aDownload.target;
let fileURI = MetroDownloadsView._lastDownload.target;
let file = MetroDownloadsView._getLocalFile(fileURI);
file.reveal();
let downloadCompleteNotification =
MetroDownloadsView._notificationBox.getNotificationWithValue("download-complete");
MetroDownloadsView._notificationBox.removeNotification(downloadCompleteNotification);
MetroDownloadsView._resetCompletedDownloads();
break;
}
}
}
} else {
title = Strings.browser.formatStringFromName("alertDownloadsDone",
[aDownload.displayName], 1);
[this._lastDownload.displayName], 1);
msg = Strings.browser.GetStringFromName("downloadRunNow");
observer = {
observe: function (aSubject, aTopic, aData) {
switch (aTopic) {
case "alertclickcallback":
MetroDownloadsView.openDownload(aDownload);
let downloadCompleteNotification =
MetroDownloadsView._notificationBox.getNotificationWithValue("download-complete");
MetroDownloadsView._notificationBox.removeNotification(downloadCompleteNotification);
MetroDownloadsView.openDownload(MetroDownloadsView._lastDownload);
MetroDownloadsView._resetCompletedDownloads();
break;
}
}
@ -319,6 +314,14 @@ var MetroDownloadsView = {
this.showAlert(name, msg, title, null, observer);
},
_resetCompletedDownloads: function () {
this._progressNotificationInfo.clear();
this._downloadCount = 0;
this._lastDownload = null;
this._downloadProgressIndicator.reset();
this._removeNotification("download-complete");
},
_updateCircularProgressMeter: function dv_updateCircularProgressMeter() {
if (!this._progressNotificationInfo) {
return;
@ -381,16 +384,26 @@ var MetroDownloadsView = {
},
onDownloadButton: function dv_onDownloadButton() {
if (this._progressNotification) {
let progressBar = this._notificationBox.getNotificationWithValue("download-progress");
if (progressBar) {
this._notificationBox.removeNotification(progressBar);
} else {
if (this._downloadsInProgress) {
if (!this._removeNotification("download-progress")) {
this.updateInfobar();
}
} else if (this._downloadCount) {
if (!this._removeNotification("download-complete")) {
this._showDownloadCompleteNotification();
}
}
},
_removeNotification: function (aValue) {
let notification = this._notificationBox.getNotificationWithValue(aValue);
if (!notification) {
return false;
}
this._notificationBox.removeNotification(notification);
return true;
},
updateInfobar: function dv_updateInfobar() {
let message = this._computeDownloadProgressString();
this._updateCircularProgressMeter();
@ -415,6 +428,8 @@ var MetroDownloadsView = {
this._progressNotification =
this.showNotification("download-progress", message, buttons,
this._notificationBox.PRIORITY_WARNING_LOW);
ContextUI.displayNavbar();
} else {
this._progressNotification.label = message;
}
@ -442,17 +457,6 @@ var MetroDownloadsView = {
}
},
handleEvent: function handleEvent(aEvent) {
switch (aEvent.type) {
case "AlertClose":
if (aEvent.notification.value == "download-complete" &&
!MetroDownloadsView._notificationBox.getNotificationWithValue("download-complete")) {
MetroDownloadsView._downloadProgressIndicator.reset();
}
break;
}
},
observe: function (aSubject, aTopic, aData) {
let message = "";
let msgTitle = "";
@ -470,6 +474,7 @@ var MetroDownloadsView = {
case "dl-done":
this._downloadsInProgress--;
download = aSubject.QueryInterface(Ci.nsIDownload);
this._lastDownload = download;
let runAfterDownload = this._runDownloadBooleanMap.get(download.targetFile.path);
if (runAfterDownload) {
this.openDownload(download);
@ -478,11 +483,9 @@ var MetroDownloadsView = {
this._runDownloadBooleanMap.delete(download.targetFile.path);
if (this._downloadsInProgress == 0) {
if (this._downloadCount > 1 || !runAfterDownload) {
this._showDownloadCompleteToast(download);
this._showDownloadCompleteNotification(download);
this._showDownloadCompleteToast();
this._showDownloadCompleteNotification();
}
this._progressNotificationInfo.clear();
this._downloadCount = 0;
this._notificationBox.removeNotification(this._progressNotification);
this._progressNotification = null;
}
@ -491,11 +494,6 @@ var MetroDownloadsView = {
download = aSubject.QueryInterface(Ci.nsIDownload);
this._showDownloadFailedNotification(download);
break;
case "dl-request":
setTimeout(function() {
ContextUI.displayNavbar();
}, 1000);
break;
}
},

View File

@ -4,3 +4,5 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
METRO_CHROME_MANIFESTS += ['tests/mochiperf/metro.ini', 'tests/mochitest/metro.ini']
XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']

View File

@ -1,12 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# For now we're copying the actual Util code.
# We should make this into a jsm module. See bug 848137
XPCSHELL_RESOURCES = \
$(DEPTH)/browser/metro/base/content/Util.js \
$(NULL)
libs:: $(XPCSHELL_RESOURCES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit/

View File

@ -1,17 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
ifndef MOZ_DEBUG
MOCHITEST_METRO_FILES = \
../mochitest/head.js \
perfhelpers.js \
browser_miscgfx_01.js \
browser_tabs_01.js \
browser_deck_01.js \
browser_msgmgr_01.js \
msgmanagerecho.js \
browser_layers_01.js \
browser_firstx.js \
$(NULL)
endif

View File

@ -4,8 +4,6 @@
"use strict";
function test() {
let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
Services.scriptloader.loadSubScript(testDir + "/perfhelpers.js", this);
runTests();
}

View File

@ -4,8 +4,6 @@
"use strict";
function test() {
let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
Services.scriptloader.loadSubScript(testDir + "/perfhelpers.js", this);
runTests();
}

View File

@ -4,8 +4,6 @@
"use strict";
function test() {
let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
Services.scriptloader.loadSubScript(testDir + "/perfhelpers.js", this);
runTests();
}

View File

@ -4,8 +4,6 @@
"use strict";
function test() {
let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
Services.scriptloader.loadSubScript(testDir + "/perfhelpers.js", this);
requestLongerTimeout(2);
runTests();
}

View File

@ -4,8 +4,6 @@
"use strict";
function test() {
let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
Services.scriptloader.loadSubScript(testDir + "/perfhelpers.js", this);
runTests();
}

View File

@ -4,8 +4,6 @@
"use strict";
function test() {
let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
Services.scriptloader.loadSubScript(testDir + "/perfhelpers.js", this);
runTests();
}

View File

@ -3,6 +3,10 @@
"use strict";
// Load common code from ../mochitest/head.js
let mochitestDir = getRootDirectory(gTestPath).replace('/mochiperf', '/mochitest');
Services.scriptloader.loadSubScript(mochitestDir + "head.js", this);
// Misc. constants
const kInfoHeader = "PERF-TEST | ";
const kDeclareId = "DECLARE ";

View File

@ -0,0 +1,19 @@
[DEFAULT]
# Don't run performance tests in debug builds.
skip-if = debug
support-files =
head.js
msgmanagerecho.js
res/ripples.html
res/scroll_test.html
res/tidevideo.html
res/tide.mp4
res/divs_test.html
res/fx.png
[browser_miscgfx_01.js]
[browser_tabs_01.js]
[browser_deck_01.js]
[browser_msgmgr_01.js]
[browser_layers_01.js]
[browser_firstx.js]

View File

@ -1,6 +0,0 @@
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
TEST_DIRS += ['res']

View File

@ -1,14 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
ifndef MOZ_DEBUG
MOCHITEST_METRO_FILES = \
ripples.html \
scroll_test.html \
tidevideo.html \
tide.mp4 \
divs_test.html \
fx.png \
$(NULL)
endif

View File

@ -1,4 +0,0 @@
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

View File

@ -1,63 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MOCHITEST_METRO_FILES = \
head.js \
helpers/BookmarksHelper.js \
helpers/HistoryHelper.js \
helpers/ViewStateHelper.js \
browser_bookmarks.js \
browser_canonizeURL.js \
browser_circular_progress_indicator.js \
browser_crashprompt.js \
browser_context_menu_tests.js \
browser_context_menu_tests_01.html \
browser_context_menu_tests_02.html \
browser_context_menu_tests_03.html \
browser_context_menu_tests_04.html \
browser_context_ui.js \
browser_downloads.js \
browser_findbar.js \
browser_findbar.html \
browser_form_auto_complete.js \
browser_form_auto_complete.html \
browser_history.js \
browser_inputsource.js \
browser_onscreen_keyboard.js \
browser_onscreen_keyboard.html \
browser_prefs_ui.js \
browser_progress_indicator.xul \
browser_remotetabs.js \
browser_snappedState.js \
browser_tabs.js \
browser_test.js \
browser_tiles.js \
browser_tilegrid.xul \
browser_topsites.js \
browser_urlbar.js \
browser_urlbar_highlightURLs.js \
browser_urlbar_trimURLs.js \
$(NULL)
ifndef MOZ_DEBUG
MOCHITEST_METRO_FILES += \
browser_selection_basic.js \
browser_selection_basic.html \
browser_selection_textarea.js \
browser_selection_textarea.html \
browser_selection_frame_content.js \
browser_selection_frame_content.html \
browser_selection_inputs.js \
browser_selection_inputs.html \
browser_selection_frame_textarea.js \
browser_selection_frame_textarea.html \
browser_selection_frame_inputs.js \
browser_selection_frame_inputs.html \
browser_selection_urlbar.js \
browser_selection_contenteditable.js \
browser_selection_contenteditable.html \
browser_selection_caretfocus.js \
browser_selection_caretfocus.html \
$(NULL)
endif

View File

@ -5,6 +5,31 @@
"use strict";
const Ci = Components.interfaces;
const Cm = Components.manager;
const Cc = Components.classes;
const CONTRACT_ID = "@mozilla.org/xre/runtime;1";
function MockAppInfo() {
}
MockAppInfo.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULRuntime]),
}
let newFactory = {
createInstance: function(aOuter, aIID) {
if (aOuter)
throw Components.results.NS_ERROR_NO_AGGREGATION;
return new MockAppInfo().QueryInterface(aIID);
},
lockFactory: function(aLock) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory])
};
var SanitizeHelper = {
_originalSanitizer: null,
@ -19,10 +44,29 @@ var SanitizeHelper = {
setUp: function setUp() {
SanitizeHelper._originalSanitizer = SanitizeUI._sanitizer;
SanitizeUI._sanitizer = SanitizeHelper.MockSanitizer;
let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
this.gAppInfoClassID = registrar.contractIDToCID(CONTRACT_ID);
this.gIncOldFactory = Cm.getClassObject(Cc[CONTRACT_ID], Ci.nsIFactory);
registrar.unregisterFactory(this.gAppInfoClassID, this.gIncOldFactory);
let components = [MockAppInfo];
registrar.registerFactory(this.gAppInfoClassID, "", CONTRACT_ID, newFactory);
this.gIncOldFactory = Cm.getClassObject(Cc[CONTRACT_ID], Ci.nsIFactory);
this.oldPrompt = Services.prompt;
},
tearDown: function tearDown() {
SanitizeUI._sanitizer = SanitizeHelper._originalSanitizer;
if (this.gIncOldFactory) {
var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
registrar.unregisterFactory(this.gAppInfoClassID, newFactory);
registrar.registerFactory(this.gAppInfoClassID, "", CONTRACT_ID, this.gIncOldFactory);
}
this.gIncOldFactory = null;
Services.prompt = this.oldPrompt;
},
};
@ -33,9 +77,18 @@ function getAllSelected() {
}
gTests.push({
setUp: SanitizeHelper.setUp,
tearDown: SanitizeHelper.tearDown,
desc: "Test sanitizer UI",
run: function testSanitizeUI() {
// We want to be able to simulate that a specific button
// of the 'clear private data' prompt was pressed.
Services.prompt = {
confirmEx: function() {
return this.retVal;
}
};
// Show options flyout
let promise = waitForEvent(FlyoutPanelsUI.PrefsFlyoutPanel._topmostElement, "PopupChanged", 2000);
FlyoutPanelsUI.show('PrefsFlyoutPanel');
@ -72,8 +125,16 @@ gTests.push({
}
}
// Simulate clicking "button 1", cancel.
Services.prompt.retVal = 1;
let clearButton = document.getElementById("prefs-clear-data");
clearButton.doCommand();
ok(SanitizeHelper.MockSanitizer.clearCalled.length == 0, "Nothing was cleared");
// We will simulate that "button 0" (which should be the clear button)
// was pressed
Services.prompt.retVal = 0;
clearButton.doCommand();
let clearNotificationDeck = document.getElementById("clear-notification");
let clearNotificationDone = document.getElementById("clear-notification-done");

View File

@ -34,9 +34,9 @@ splitPath.push('mochitest');
const mochitestPath = splitPath.join('/') + '/';
[
"BookmarksHelper.js",
"HistoryHelper.js",
"ViewStateHelper.js"
"helpers/BookmarksHelper.js",
"helpers/HistoryHelper.js",
"helpers/ViewStateHelper.js"
].forEach(function(lib) {
Services.scriptloader.loadSubScript(mochitestPath + lib, this);
}, this);

View File

@ -0,0 +1,74 @@
[DEFAULT]
support-files =
browser_context_menu_tests_01.html
browser_context_menu_tests_02.html
browser_context_menu_tests_03.html
browser_context_menu_tests_04.html
browser_findbar.html
browser_form_auto_complete.html
browser_onscreen_keyboard.html
browser_progress_indicator.xul
browser_selection_basic.html
browser_selection_caretfocus.html
browser_selection_contenteditable.html
browser_selection_frame_content.html
browser_selection_frame_inputs.html
browser_selection_frame_textarea.html
browser_selection_inputs.html
browser_selection_textarea.html
browser_tilegrid.xul
head.js
helpers/BookmarksHelper.js
helpers/HistoryHelper.js
helpers/ViewStateHelper.js
res/image01.png
res/textblock01.html
res/textinput01.html
res/textarea01.html
res/testEngine.xml
res/blankpage1.html
res/blankpage2.html
res/blankpage3.html
[browser_bookmarks.js]
[browser_canonizeURL.js]
[browser_circular_progress_indicator.js]
[browser_crashprompt.js]
[browser_context_menu_tests.js]
[browser_context_ui.js]
[browser_downloads.js]
[browser_findbar.js]
[browser_form_auto_complete.js]
[browser_history.js]
[browser_inputsource.js]
[browser_onscreen_keyboard.js]
[browser_prefs_ui.js]
[browser_remotetabs.js]
[browser_snappedState.js]
[browser_tabs.js]
[browser_test.js]
[browser_tiles.js]
[browser_topsites.js]
[browser_urlbar.js]
[browser_urlbar_highlightURLs.js]
[browser_urlbar_trimURLs.js]
# These tests have known failures in debug builds
[browser_selection_basic.js]
skip-if = debug
[browser_selection_textarea.js]
skip-if = debug
[browser_selection_frame_content.js]
skip-if = debug
[browser_selection_inputs.js]
skip-if = debug
[browser_selection_frame_textarea.js]
skip-if = debug
[browser_selection_frame_inputs.js]
skip-if = debug
[browser_selection_urlbar.js]
skip-if = debug
[browser_selection_contenteditable.js]
skip-if = debug
[browser_selection_caretfocus.js]
skip-if = debug

View File

@ -1,6 +0,0 @@
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
TEST_DIRS += ['res']

View File

@ -1,14 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MOCHITEST_METRO_FILES = \
image01.png \
textblock01.html \
textinput01.html \
textarea01.html \
testEngine.xml \
blankpage1.html \
blankpage2.html \
blankpage3.html \
$(NULL)

View File

@ -1,4 +0,0 @@
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

View File

@ -1,10 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
TEST_DIRS += ['mochitest']
TEST_DIRS += ['mochiperf']
XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']

View File

@ -1,6 +1,7 @@
"use strict";
load("Util.js");
Components.utils.import("resource:///modules/ContentUtil.jsm");
let Util = ContentUtil;
function run_test() {
do_print("Testing Util.extend");

View File

@ -5,10 +5,8 @@
"use strict";
let Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource:///modules/ContentUtil.jsm");
load("Util.js");
Components.utils.import("resource:///modules/ContentUtil.jsm");
let Util = ContentUtil;
function empty_node(node) {
let cnode;
@ -34,8 +32,6 @@ function run_test() {
do_print("Testing Util.populateFragmentFromString");
do_check_true(!!Util.populateFragmentFromString);
do_check_true(!!ContentUtil.populateFragmentFromString);
do_check_eq(ContentUtil.populateFragmentFromString, Util.populateFragmentFromString);
do_print("Loading blank document");
doc = do_parse_document("blank.xhtml", "application/xhtml+xml");
@ -87,4 +83,4 @@ function run_test() {
body.appendChild(frag);
expectedResult = "<span>About the</span> &lt;body&gt; tag. &amp;copy; 2000 - Some Corp™"
do_check_eq(serializeContents(body), expectedResult);
}
}

View File

@ -65,7 +65,6 @@ HelperAppLauncherDialog.prototype = {
},
_showDownloadInfobar: function do_showDownloadInfobar(aLauncher) {
Services.obs.notifyObservers(null, "dl-request", "");
let browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
let runButtonText =

View File

@ -36,6 +36,11 @@ contextAppbar2.restore=Undo delete
# LOCALIZATION NOTE (contextAppbar2.clear): Unselects pages without modification.
contextAppbar2.clear=Clear selection
# Clear private data
clearPrivateData.clearButton=Clear
clearPrivateData.title=Clear Private Data
clearPrivateData.message=Clear your private data?
# Settings Charms
aboutCharm1=About
optionsCharm=Options

View File

@ -15,6 +15,3 @@ DIRS += [
if CONFIG['OS_ARCH'] == 'WINNT':
DIRS += ['shell']
TEST_DIRS += ['base/tests']

View File

@ -613,7 +613,6 @@ pref("browser.safebrowsing.provider.0.reportMalwareURL", "http://{moz:locale}.ma
pref("browser.safebrowsing.provider.0.reportMalwareErrorURL", "http://{moz:locale}.malware-error.mozilla.com/?hl={moz:locale}");
// FAQ URLs
pref("browser.safebrowsing.warning.infoURL", "https://www.mozilla.org/%LOCALE%/firefox/phishing-protection/");
pref("browser.geolocation.warning.infoURL", "https://www.mozilla.org/%LOCALE%/firefox/geolocation/");
// Name of the about: page contributed by safebrowsing to handle display of error

View File

@ -448,28 +448,6 @@ documenttab[selected] .documenttab-selection {
visibility: hidden;
}
.circularprogressindicator-progressRing {
visibility: visible;
margin: 0 @toolbar_horizontal_spacing@;
pointer-events:none;
position: absolute;
}
.circularprogressindicator-progressTrack {
visibility: visible;
margin: 0 @toolbar_horizontal_spacing@;
pointer-events: none;
position: absolute;
width: 40px;
height: 40px;
background-repeat: no-repeat;
background-size: 40px 40px;
background-image: url(chrome://browser/skin/images/progresscircle-bg.png);
}
.circularprogressindicator-progressRing:not([progress]),
.circularprogressindicator-progressTrack:not([progress]) {
visibility: hidden;
}
/* Progress meter ---------------------------------------------------------- */
#progress-container {
@ -765,14 +743,17 @@ documenttab[selected] .documenttab-selection {
visibility: collapse;
}
.circularprogressindicator-progressButton {
margin: 0 @toolbar_horizontal_spacing@;
#download-progress:not([progress]) {
visibility: collapse;
}
#download-progress {
-moz-image-region: rect(0px, 40px, 40px, 0px) !important;
}
.circularprogressindicator-progressButton:hover {
#download-progress:hover {
-moz-image-region: rect(40px, 40px, 80px, 0px) !important;
}
.circularprogressindicator-progressButton:active {
#download-progress:active {
-moz-image-region: rect(80px, 40px, 120px, 0px) !important;
}

View File

@ -0,0 +1,31 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
%filter substitution
%include defines.inc
.circularprogressindicator-progressButton,
.circularprogressindicator-progressRing,
.circularprogressindicator-progressTrack {
margin: 0 @toolbar_horizontal_spacing@;
}
.circularprogressindicator-progressRing,
.circularprogressindicator-progressTrack {
pointer-events:none;
position: absolute;
}
.circularprogressindicator-progressTrack {
width: 40px;
height: 40px;
background-repeat: no-repeat;
background-size: 40px 40px;
background-image: url(chrome://browser/skin/images/progresscircle-bg.png);
}
.circularprogressindicator-progressRing:not([progress]),
.circularprogressindicator-progressTrack:not([progress]) {
visibility: hidden;
}

View File

@ -10,6 +10,7 @@ chrome.jar:
skin/aboutAddons.css (aboutAddons.css)
skin/about.css (about.css)
* skin/flyoutpanel.css (flyoutpanel.css)
* skin/circularprogress.css (circularprogress.css)
* skin/cssthrobber.css (cssthrobber.css)
* skin/browser.css (browser.css)
* skin/content.css (content.css)

View File

@ -1560,6 +1560,11 @@ nsScriptSecurityManager::CheckLoadURIStrWithPrincipal(nsIPrincipal* aPrincipal,
NS_ENSURE_SUCCESS(rv, rv);
rv = CheckLoadURIWithPrincipal(aPrincipal, target, aFlags);
if (rv == NS_ERROR_DOM_BAD_URI) {
// Don't warn because NS_ERROR_DOM_BAD_URI is one of the expected
// return values.
return rv;
}
NS_ENSURE_SUCCESS(rv, rv);
// Now start testing fixup -- since aTargetURIStr is a string, not
@ -1584,6 +1589,11 @@ nsScriptSecurityManager::CheckLoadURIStrWithPrincipal(nsIPrincipal* aPrincipal,
NS_ENSURE_SUCCESS(rv, rv);
rv = CheckLoadURIWithPrincipal(aPrincipal, target, aFlags);
if (rv == NS_ERROR_DOM_BAD_URI) {
// Don't warn because NS_ERROR_DOM_BAD_URI is one of the expected
// return values.
return rv;
}
NS_ENSURE_SUCCESS(rv, rv);
}

View File

@ -9207,14 +9207,11 @@ MOZ_ARG_WITH_STRING(intl-api,
WITH_INTL="--with-intl-api=$withval"
])
if test -z "$WITH_INTL"; then
if test "$NIGHTLY_BUILD" = "1" -a "$MOZ_BUILD_APP" = "browser" -a -z "$DEVELOPER_OPTIONS"; then
# In desktop nightlies the Internationalization API is disabled, but all
# code for it is still built. Bug 853301 will remove this so that it's
# built and the API is enabled.
WITH_INTL="--with-intl-api=build"
if test "$MOZ_BUILD_APP" = "browser"; then
WITH_INTL="--with-intl-api"
else
# Internationalization isn't built or exposed by default in non-desktop and
# non-nightly builds. Bugs to enable:
# Internationalization isn't built or exposed by default in non-desktop
# builds. Bugs to enable:
#
# Android: bug 864843
# B2G: bug 866301

View File

@ -725,9 +725,9 @@ public:
{
}
virtual void GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError);
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
virtual void SetInnerHTML(const nsAString& aInnerHTML, ErrorResult& aError);
void GetOuterHTML(nsAString& aOuterHTML, ErrorResult& aError);
void GetOuterHTML(nsAString& aOuterHTML);
void SetOuterHTML(const nsAString& aOuterHTML, ErrorResult& aError);
void InsertAdjacentHTML(const nsAString& aPosition, const nsAString& aText,
ErrorResult& aError);
@ -1124,7 +1124,7 @@ private:
nsIScrollableFrame* GetScrollFrame(nsIFrame **aStyledFrame = nullptr,
bool aFlushLayout = true);
nsresult GetMarkup(bool aIncludeSelf, nsAString& aMarkup);
void GetMarkup(bool aIncludeSelf, nsAString& aMarkup);
// Data members
nsEventStates mState;

View File

@ -3107,14 +3107,15 @@ Serialize(Element* aRoot, bool aDescendentsOnly, nsAString& aOut)
}
}
nsresult
void
Element::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
{
aMarkup.Truncate();
nsIDocument* doc = OwnerDoc();
if (IsInHTMLDocument()) {
return Serialize(this, !aIncludeSelf, aMarkup) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
Serialize(this, !aIncludeSelf, aMarkup);
return;
}
nsAutoString contentType;
@ -3135,7 +3136,7 @@ Element::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
docEncoder = do_CreateInstance(NS_DOC_ENCODER_CONTRACTID_BASE "application/xml");
}
NS_ENSURE_TRUE(docEncoder, NS_ERROR_FAILURE);
NS_ENSURE_TRUE_VOID(docEncoder);
uint32_t flags = nsIDocumentEncoder::OutputEncodeBasicEntities |
// Output DOM-standard newlines
@ -3153,8 +3154,8 @@ Element::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
}
}
nsresult rv = docEncoder->NativeInit(doc, contentType, flags);
NS_ENSURE_SUCCESS(rv, rv);
DebugOnly<nsresult> rv = docEncoder->NativeInit(doc, contentType, flags);
MOZ_ASSERT(NS_SUCCEEDED(rv));
if (aIncludeSelf) {
docEncoder->SetNativeNode(this);
@ -3162,10 +3163,10 @@ Element::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
docEncoder->SetNativeContainerNode(this);
}
rv = docEncoder->EncodeToString(aMarkup);
MOZ_ASSERT(NS_SUCCEEDED(rv));
if (!aIncludeSelf) {
doc->SetCachedEncoder(docEncoder.forget());
}
return rv;
}
/**
@ -3197,10 +3198,11 @@ FireMutationEventsForDirectParsing(nsIDocument* aDoc, nsIContent* aDest,
}
}
void
Element::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
NS_IMETHODIMP
Element::GetInnerHTML(nsAString& aInnerHTML)
{
aError = GetMarkup(false, aInnerHTML);
GetMarkup(false, aInnerHTML);
return NS_OK;
}
void
@ -3266,9 +3268,9 @@ Element::SetInnerHTML(const nsAString& aInnerHTML, ErrorResult& aError)
}
void
Element::GetOuterHTML(nsAString& aOuterHTML, ErrorResult& aError)
Element::GetOuterHTML(nsAString& aOuterHTML)
{
aError = GetMarkup(true, aOuterHTML);
GetMarkup(true, aOuterHTML);
}
void

View File

@ -641,11 +641,15 @@ nsCopySupport::FireClipboardEvent(int32_t aType, int32_t aClipboardType, nsIPres
if (!nsContentUtils::IsSafeToRunScript())
return false;
int32_t type = -1;
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(piWindow);
bool chromeShell = (docShell && NS_SUCCEEDED(docShell->GetItemType(&type)) &&
type == nsIDocShellTreeItem::typeChrome);
// next, fire the cut, copy or paste event
// XXXndeakin Bug 844941 - why was a preference added here without a running-in-chrome check?
bool doDefault = true;
nsRefPtr<nsDOMDataTransfer> clipboardData;
if (Preferences::GetBool("dom.event.clipboardevents.enabled", true)) {
if (chromeShell || Preferences::GetBool("dom.event.clipboardevents.enabled", true)) {
clipboardData = new nsDOMDataTransfer(aType, aType == NS_PASTE, aClipboardType);
nsEventStatus status = nsEventStatus_eIgnore;

View File

@ -9,6 +9,7 @@
#include "gfxFont.h" // for the gfxTextRun::CompressedGlyph::FLAG_BREAK_TYPE_* values
#include "nsHyphenationManager.h"
#include "nsHyphenator.h"
#include "mozilla/gfx/2D.h"
nsLineBreaker::nsLineBreaker()
: mCurrentWordLanguage(nullptr),

View File

@ -20,6 +20,8 @@
#include "mozilla/dom/CanvasRenderingContext2DBinding.h"
#include "mozilla/dom/CanvasPattern.h"
#include "mozilla/gfx/Rect.h"
#include "mozilla/gfx/2D.h"
#include "gfx2DGlue.h"
class nsXULElement;

View File

@ -1593,7 +1593,7 @@ nsEventStateManager::CreateClickHoldTimer(nsPresContext* inPresContext,
nsIFrame* inDownFrame,
WidgetGUIEvent* inMouseDownEvent)
{
if (!inMouseDownEvent->mFlags.mIsTrusted)
if (!inMouseDownEvent->mFlags.mIsTrusted || IsRemoteTarget(mGestureDownContent))
return;
// just to be anal (er, safe)

View File

@ -16,9 +16,7 @@ public:
HTMLElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~HTMLElement();
using nsGenericHTMLElement::GetInnerHTML;
virtual void GetInnerHTML(nsAString& aInnerHTML,
mozilla::ErrorResult& aError) MOZ_OVERRIDE;
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo* aNodeInfo,
nsINode** aResult) const MOZ_OVERRIDE;
@ -39,8 +37,8 @@ HTMLElement::~HTMLElement()
NS_IMPL_ELEMENT_CLONE(HTMLElement)
void
HTMLElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
NS_IMETHODIMP
HTMLElement::GetInnerHTML(nsAString& aInnerHTML)
{
/**
* nsGenericHTMLElement::GetInnerHTML escapes < and > characters (at least).
@ -52,10 +50,10 @@ HTMLElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
if (mNodeInfo->Equals(nsGkAtoms::xmp) ||
mNodeInfo->Equals(nsGkAtoms::plaintext)) {
nsContentUtils::GetNodeTextContent(this, false, aInnerHTML);
return;
return NS_OK;
}
nsGenericHTMLElement::GetInnerHTML(aInnerHTML, aError);
return nsGenericHTMLElement::GetInnerHTML(aInnerHTML);
}
JSObject*

View File

@ -226,10 +226,11 @@ HTMLScriptElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
aNotify);
}
void
HTMLScriptElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
NS_IMETHODIMP
HTMLScriptElement::GetInnerHTML(nsAString& aInnerHTML)
{
nsContentUtils::GetNodeTextContent(this, false, aInnerHTML);
return NS_OK;
}
void

View File

@ -30,9 +30,7 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
using nsGenericHTMLElement::GetInnerHTML;
virtual void GetInnerHTML(nsAString& aInnerHTML,
mozilla::ErrorResult& aError) MOZ_OVERRIDE;
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) MOZ_OVERRIDE;
using nsGenericHTMLElement::SetInnerHTML;
virtual void SetInnerHTML(const nsAString& aInnerHTML,
mozilla::ErrorResult& aError) MOZ_OVERRIDE;

View File

@ -201,10 +201,11 @@ HTMLStyleElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
return rv;
}
void
HTMLStyleElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
NS_IMETHODIMP
HTMLStyleElement::GetInnerHTML(nsAString& aInnerHTML)
{
nsContentUtils::GetNodeTextContent(this, false, aInnerHTML);
return NS_OK;
}
void

View File

@ -33,9 +33,7 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLStyleElement,
nsGenericHTMLElement)
using nsGenericHTMLElement::GetInnerHTML;
virtual void GetInnerHTML(nsAString& aInnerHTML,
mozilla::ErrorResult& aError) MOZ_OVERRIDE;
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) MOZ_OVERRIDE;
using nsGenericHTMLElement::SetInnerHTML;
virtual void SetInnerHTML(const nsAString& aInnerHTML,
mozilla::ErrorResult& aError) MOZ_OVERRIDE;

View File

@ -464,9 +464,8 @@ public:
return rv.ErrorCode();
}
NS_IMETHOD GetOuterHTML(nsAString& aOuterHTML) MOZ_FINAL {
mozilla::ErrorResult rv;
mozilla::dom::Element::GetOuterHTML(aOuterHTML, rv);
return rv.ErrorCode();
mozilla::dom::Element::GetOuterHTML(aOuterHTML);
return NS_OK;
}
NS_IMETHOD SetOuterHTML(const nsAString& aOuterHTML) MOZ_FINAL {
mozilla::ErrorResult rv;
@ -528,11 +527,8 @@ public:
*aDraggable = Draggable();
return NS_OK;
}
using mozilla::dom::Element::GetInnerHTML;
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) MOZ_FINAL {
mozilla::ErrorResult rv;
GetInnerHTML(aInnerHTML, rv);
return rv.ErrorCode();
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) MOZ_OVERRIDE {
return mozilla::dom::Element::GetInnerHTML(aInnerHTML);
}
using mozilla::dom::Element::SetInnerHTML;
NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) MOZ_FINAL {

View File

@ -17,13 +17,12 @@ namespace mozilla {
/**
* An AudioNodeStream produces a single audio track with ID
* AUDIO_NODE_STREAM_TRACK_ID. This track has rate AudioContext::sIdealAudioRate
* AUDIO_TRACK. This track has rate AudioContext::sIdealAudioRate
* for regular audio contexts, and the rate requested by the web content
* for offline audio contexts.
* Each chunk in the track is a single block of WEBAUDIO_BLOCK_SIZE samples.
* Note: This must be a different value than MEDIA_STREAM_DEST_TRACK_ID
*/
static const int AUDIO_NODE_STREAM_TRACK_ID = 1;
AudioNodeStream::~AudioNodeStream()
{
@ -409,7 +408,7 @@ AudioNodeStream::ProduceOutput(GraphTime aFrom, GraphTime aTo)
FinishOutput();
}
EnsureTrack(AUDIO_NODE_STREAM_TRACK_ID, mSampleRate);
EnsureTrack(AUDIO_TRACK, mSampleRate);
uint16_t outputCount = std::max(uint16_t(1), mEngine->OutputCount());
mLastChunks.SetLength(outputCount);
@ -441,7 +440,7 @@ AudioNodeStream::ProduceOutput(GraphTime aFrom, GraphTime aTo)
}
}
if (mDisabledTrackIDs.Contains(AUDIO_NODE_STREAM_TRACK_ID)) {
if (mDisabledTrackIDs.Contains(static_cast<TrackID>(AUDIO_TRACK))) {
for (uint32_t i = 0; i < mLastChunks.Length(); ++i) {
mLastChunks[i].SetNull(WEBAUDIO_BLOCK_SIZE);
}
@ -453,7 +452,7 @@ AudioNodeStream::ProduceOutput(GraphTime aFrom, GraphTime aTo)
void
AudioNodeStream::AdvanceOutputSegment()
{
StreamBuffer::Track* track = EnsureTrack(AUDIO_NODE_STREAM_TRACK_ID, mSampleRate);
StreamBuffer::Track* track = EnsureTrack(AUDIO_TRACK, mSampleRate);
AudioSegment* segment = track->Get<AudioSegment>();
if (mKind == MediaStreamGraph::EXTERNAL_STREAM) {
@ -467,7 +466,7 @@ AudioNodeStream::AdvanceOutputSegment()
AudioChunk copyChunk = mLastChunks[0];
AudioSegment tmpSegment;
tmpSegment.AppendAndConsumeChunk(&copyChunk);
l->NotifyQueuedTrackChanges(Graph(), AUDIO_NODE_STREAM_TRACK_ID,
l->NotifyQueuedTrackChanges(Graph(), AUDIO_TRACK,
mSampleRate, segment->GetDuration(), 0,
tmpSegment);
}
@ -476,7 +475,7 @@ AudioNodeStream::AdvanceOutputSegment()
TrackTicks
AudioNodeStream::GetCurrentPosition()
{
return EnsureTrack(AUDIO_NODE_STREAM_TRACK_ID, mSampleRate)->Get<AudioSegment>()->GetDuration();
return EnsureTrack(AUDIO_TRACK, mSampleRate)->Get<AudioSegment>()->GetDuration();
}
void
@ -486,14 +485,14 @@ AudioNodeStream::FinishOutput()
return;
}
StreamBuffer::Track* track = EnsureTrack(AUDIO_NODE_STREAM_TRACK_ID, mSampleRate);
StreamBuffer::Track* track = EnsureTrack(AUDIO_TRACK, mSampleRate);
track->SetEnded();
FinishOnGraphThread();
for (uint32_t j = 0; j < mListeners.Length(); ++j) {
MediaStreamListener* l = mListeners[j];
AudioSegment emptySegment;
l->NotifyQueuedTrackChanges(Graph(), AUDIO_NODE_STREAM_TRACK_ID,
l->NotifyQueuedTrackChanges(Graph(), AUDIO_TRACK,
mSampleRate,
track->GetSegment()->GetDuration(),
MediaStreamListener::TRACK_EVENT_ENDED, emptySegment);

View File

@ -117,7 +117,7 @@ AudioBuffer::CopyFromChannel(const Float32Array& aDestination, uint32_t aChannel
CheckedInt<uint32_t> end = aStartInChannel;
end += length;
if (aChannelNumber >= NumberOfChannels() ||
!end.isValid() || end.value() >= mLength) {
!end.isValid() || end.value() > mLength) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return;
}
@ -143,7 +143,7 @@ AudioBuffer::CopyToChannel(JSContext* aJSContext, const Float32Array& aSource,
CheckedInt<uint32_t> end = aStartInChannel;
end += length;
if (aChannelNumber >= NumberOfChannels() ||
!end.isValid() || end.value() >= mLength) {
!end.isValid() || end.value() > mLength) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return;
}

View File

@ -6,10 +6,15 @@
#include "AudioDestinationNode.h"
#include "mozilla/dom/AudioDestinationNodeBinding.h"
#include "mozilla/Preferences.h"
#include "AudioChannelAgent.h"
#include "AudioNodeEngine.h"
#include "AudioNodeStream.h"
#include "MediaStreamGraph.h"
#include "OfflineAudioCompletionEvent.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIDocShell.h"
#include "nsIDocument.h"
namespace mozilla {
namespace dom {
@ -213,7 +218,21 @@ private:
float mVolume;
};
NS_IMPL_ISUPPORTS_INHERITED0(AudioDestinationNode, AudioNode)
static bool UseAudioChannelService()
{
return Preferences::GetBool("media.useAudioChannelService");
}
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(AudioDestinationNode, AudioNode,
mAudioChannelAgent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(AudioDestinationNode)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
NS_INTERFACE_MAP_ENTRY(nsIAudioChannelAgentCallback)
NS_INTERFACE_MAP_END_INHERITING(AudioNode)
NS_IMPL_ADDREF_INHERITED(AudioDestinationNode, AudioNode)
NS_IMPL_RELEASE_INHERITED(AudioDestinationNode, AudioNode)
AudioDestinationNode::AudioDestinationNode(AudioContext* aContext,
bool aIsOffline,
@ -235,11 +254,46 @@ AudioDestinationNode::AudioDestinationNode(AudioContext* aContext,
static_cast<AudioNodeEngine*>(new DestinationNodeEngine(this));
mStream = graph->CreateAudioNodeStream(engine, MediaStreamGraph::EXTERNAL_STREAM);
if (!aIsOffline && UseAudioChannelService()) {
mAudioChannelAgent = new AudioChannelAgent();
mAudioChannelAgent->InitWithWeakCallback(nsIAudioChannelAgent::AUDIO_AGENT_CHANNEL_NORMAL,
this);
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(GetOwner());
if (target) {
target->AddSystemEventListener(NS_LITERAL_STRING("visibilitychange"), this,
/* useCapture = */ true,
/* wantsUntrusted = */ false);
}
nsCOMPtr<nsIDocShell> docshell = do_GetInterface(GetOwner());
if (docshell) {
bool isActive = false;
docshell->GetIsActive(&isActive);
mAudioChannelAgent->SetVisibilityState(isActive);
}
int32_t state = 0;
mAudioChannelAgent->StartPlaying(&state);
SetCanPlay(state == AudioChannelState::AUDIO_CHANNEL_STATE_NORMAL);
}
}
void
AudioDestinationNode::DestroyMediaStream()
{
if (mAudioChannelAgent && !Context()->IsOffline()) {
mAudioChannelAgent->StopPlaying();
mAudioChannelAgent = nullptr;
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(GetOwner());
NS_ENSURE_TRUE_VOID(target);
target->RemoveSystemEventListener(NS_LITERAL_STRING("visibilitychange"), this,
/* useCapture = */ true);
}
if (!mStream)
return;
@ -304,5 +358,38 @@ AudioDestinationNode::StartRendering()
mStream->Graph()->StartNonRealtimeProcessing(mFramesToProduce);
}
void
AudioDestinationNode::SetCanPlay(bool aCanPlay)
{
mStream->SetTrackEnabled(AudioNodeStream::AUDIO_TRACK, aCanPlay);
}
NS_IMETHODIMP
AudioDestinationNode::HandleEvent(nsIDOMEvent* aEvent)
{
nsAutoString type;
aEvent->GetType(type);
if (!type.EqualsLiteral("visibilitychange")) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIDocShell> docshell = do_GetInterface(GetOwner());
NS_ENSURE_TRUE(docshell, NS_ERROR_FAILURE);
bool isActive = false;
docshell->GetIsActive(&isActive);
mAudioChannelAgent->SetVisibilityState(isActive);
return NS_OK;
}
NS_IMETHODIMP
AudioDestinationNode::CanPlayChanged(int32_t aCanPlay)
{
SetCanPlay(aCanPlay == AudioChannelState::AUDIO_CHANNEL_STATE_NORMAL);
return NS_OK;
}
}
}

View File

@ -8,6 +8,8 @@
#define AudioDestinationNode_h_
#include "AudioNode.h"
#include "nsIDOMEventListener.h"
#include "nsIAudioChannelAgent.h"
namespace mozilla {
namespace dom {
@ -15,6 +17,8 @@ namespace dom {
class AudioContext;
class AudioDestinationNode : public AudioNode
, public nsIDOMEventListener
, public nsIAudioChannelAgentCallback
{
public:
// This node type knows what MediaStreamGraph to use based on
@ -28,6 +32,7 @@ public:
virtual void DestroyMediaStream() MOZ_OVERRIDE;
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AudioDestinationNode, AudioNode)
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
@ -48,9 +53,19 @@ public:
void OfflineShutdown();
// nsIDOMEventListener
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
// nsIAudioChannelAgentCallback
NS_IMETHOD CanPlayChanged(int32_t aCanPlay);
private:
void SetCanPlay(bool aCanPlay);
SelfReference<AudioDestinationNode> mOfflineRenderingRef;
uint32_t mFramesToProduce;
nsCOMPtr<nsIAudioChannelAgent> mAudioChannelAgent;
};
}

View File

@ -25,13 +25,14 @@ NS_INTERFACE_MAP_END_INHERITING(AudioNode)
NS_IMPL_ADDREF_INHERITED(BiquadFilterNode, AudioNode)
NS_IMPL_RELEASE_INHERITED(BiquadFilterNode, AudioNode)
void SetParamsOnBiquad(WebCore::Biquad& aBiquad,
float aSampleRate,
BiquadFilterType aType,
double aFrequency,
double aQ,
double aGain,
double aDetune)
static void
SetParamsOnBiquad(WebCore::Biquad& aBiquad,
float aSampleRate,
BiquadFilterType aType,
double aFrequency,
double aQ,
double aGain,
double aDetune)
{
const double nyquist = aSampleRate * 0.5;
double normalizedFrequency = aFrequency / nyquist;
@ -158,10 +159,16 @@ public:
double gain = mGain.GetValueAtTime(pos);
double detune = mDetune.GetValueAtTime(pos);
float inputBuffer[WEBAUDIO_BLOCK_SIZE];
for (uint32_t i = 0; i < numberOfChannels; ++i) {
auto input = static_cast<const float*>(aInput.mChannelData[i]);
if (aInput.mVolume != 1.0) {
AudioBlockCopyChannelWithScale(input, aInput.mVolume, inputBuffer);
input = inputBuffer;
}
SetParamsOnBiquad(mBiquads[i], aStream->SampleRate(), mType, freq, q, gain, detune);
mBiquads[i].process(static_cast<const float*>(aInput.mChannelData[i]),
mBiquads[i].process(input,
static_cast<float*>(const_cast<void*>(aOutput->mChannelData[i])),
aInput.GetDuration());
}

View File

@ -81,12 +81,6 @@ void Biquad::process(const float* sourceP, float* destP, size_t framesToProcess)
m_x2 = DenormalDisabler::flushDenormalFloatToZero(x2);
m_y1 = DenormalDisabler::flushDenormalFloatToZero(y1);
m_y2 = DenormalDisabler::flushDenormalFloatToZero(y2);
m_b0 = b0;
m_b1 = b1;
m_b2 = b2;
m_a1 = a1;
m_a2 = a2;
}
void Biquad::reset()

View File

@ -19,6 +19,7 @@
#include "SVGAnimationElement.h"
#include "SVGAnimatedPreserveAspectRatio.h"
#include "nsContentUtils.h"
#include "mozilla/gfx/2D.h"
using namespace mozilla;
using namespace mozilla::dom;

View File

@ -6,6 +6,7 @@
#include "mozilla/dom/SVGFEFloodElement.h"
#include "mozilla/dom/SVGFEFloodElementBinding.h"
#include "gfxContext.h"
#include "gfxColor.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEFlood)

View File

@ -12,6 +12,7 @@
#include <stdarg.h>
#include "SVGContentUtils.h"
#include "SVGPathSegUtils.h"
#include "gfxContext.h"
#include <algorithm>
using namespace mozilla;

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
function boom()
{
var z = document.createElement("legend");
document.documentElement.appendChild(z);
z.style.display = "table-column-group";
window.find("?");
z.focus();
}
</script>
</head>
<body onload="boom();"></body>
</html>

View File

@ -41,3 +41,4 @@ load 708405-1.html
load 745495.html
load 886213.html
load 898906.html
load 852381.html

View File

@ -2680,10 +2680,8 @@ nsDOMWindowUtils::CheckAndClearPaintedState(nsIDOMElement* aElement, bool* aResu
}
NS_IMETHODIMP
nsDOMWindowUtils::PreventFurtherDialogs()
nsDOMWindowUtils::EnableDialogs()
{
// Permanently disable further dialogs for this window.
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2691,7 +2689,35 @@ nsDOMWindowUtils::PreventFurtherDialogs()
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
static_cast<nsGlobalWindow*>(window.get())->PreventFurtherDialogs(true);
static_cast<nsGlobalWindow*>(window.get())->EnableDialogs();
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::DisableDialogs()
{
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
static_cast<nsGlobalWindow*>(window.get())->DisableDialogs();
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::AreDialogsEnabled(bool* aResult)
{
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
*aResult = static_cast<nsGlobalWindow*>(window.get())->AreDialogsEnabled();
return NS_OK;
}

View File

@ -2544,6 +2544,9 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindow* aWindow,
ignoreTabIndex = false;
if (aNoParentTraversal) {
if (startContent == rootContent)
return NS_OK;
startContent = rootContent;
tabIndex = forward ? 1 : 0;
continue;

View File

@ -1030,8 +1030,7 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
#endif
mCleanedUp(false),
mDialogAbuseCount(0),
mStopAbuseDialogs(false),
mDialogsPermanentlyDisabled(false)
mAreDialogsEnabled(true)
{
nsLayoutStatics::AddRef();
@ -2883,13 +2882,11 @@ nsGlobalWindow::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
}
bool
nsGlobalWindow::DialogsAreBlocked(bool *aBeingAbused)
nsGlobalWindow::ShouldPromptToBlockDialogs()
{
*aBeingAbused = false;
nsGlobalWindow *topWindow = GetScriptableTop();
if (!topWindow) {
NS_ASSERTION(!mDocShell, "DialogsAreBlocked() called without a top window?");
NS_ASSERTION(!mDocShell, "ShouldPromptToBlockDialogs() called without a top window?");
return true;
}
@ -2898,8 +2895,22 @@ nsGlobalWindow::DialogsAreBlocked(bool *aBeingAbused)
return true;
}
if (topWindow->mDialogsPermanentlyDisabled) {
return true;
return topWindow->DialogsAreBeingAbused();
}
bool
nsGlobalWindow::AreDialogsEnabled()
{
nsGlobalWindow *topWindow = GetScriptableTop();
if (!topWindow) {
NS_ERROR("AreDialogsEnabled() called without a top window?");
return false;
}
// TODO: Warn if no top window?
topWindow = topWindow->GetCurrentInnerWindowInternal();
if (!topWindow) {
return false;
}
// Dialogs are blocked if the content viewer is hidden
@ -2910,13 +2921,11 @@ nsGlobalWindow::DialogsAreBlocked(bool *aBeingAbused)
bool isHidden;
cv->GetIsHidden(&isHidden);
if (isHidden) {
return true;
return false;
}
}
*aBeingAbused = topWindow->DialogsAreBeingAbused();
return topWindow->mStopAbuseDialogs && *aBeingAbused;
return topWindow->mAreDialogsEnabled;
}
bool
@ -2973,7 +2982,7 @@ nsGlobalWindow::ConfirmDialogIfNeeded()
"ScriptDialogPreventTitle", title);
promptSvc->Confirm(this, title.get(), label.get(), &disableDialog);
if (disableDialog) {
PreventFurtherDialogs(false);
DisableDialogs();
return false;
}
@ -2981,20 +2990,34 @@ nsGlobalWindow::ConfirmDialogIfNeeded()
}
void
nsGlobalWindow::PreventFurtherDialogs(bool aPermanent)
nsGlobalWindow::DisableDialogs()
{
nsGlobalWindow *topWindow = GetScriptableTop();
if (!topWindow) {
NS_ERROR("PreventFurtherDialogs() called without a top window?");
NS_ERROR("DisableDialogs() called without a top window?");
return;
}
topWindow = topWindow->GetCurrentInnerWindowInternal();
// TODO: Warn if no top window?
if (topWindow) {
topWindow->mStopAbuseDialogs = true;
if (aPermanent) {
topWindow->mDialogsPermanentlyDisabled = true;
}
topWindow->mAreDialogsEnabled = false;
}
}
void
nsGlobalWindow::EnableDialogs()
{
nsGlobalWindow *topWindow = GetScriptableTop();
if (!topWindow) {
NS_ERROR("EnableDialogs() called without a top window?");
return;
}
// TODO: Warn if no top window?
topWindow = topWindow->GetCurrentInnerWindowInternal();
if (topWindow) {
topWindow->mAreDialogsEnabled = true;
}
}
@ -5417,8 +5440,7 @@ nsGlobalWindow::Alert(const nsAString& aString)
{
FORWARD_TO_OUTER(Alert, (aString), NS_ERROR_NOT_INITIALIZED);
bool needToPromptForAbuse;
if (DialogsAreBlocked(&needToPromptForAbuse)) {
if (!AreDialogsEnabled()) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -5460,7 +5482,7 @@ nsGlobalWindow::Alert(const nsAString& aString)
nsAutoSyncOperation sync(GetCurrentInnerWindowInternal() ?
GetCurrentInnerWindowInternal()->mDoc :
nullptr);
if (needToPromptForAbuse) {
if (ShouldPromptToBlockDialogs()) {
bool disallowDialog = false;
nsXPIDLString label;
nsContentUtils::GetLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
@ -5469,7 +5491,7 @@ nsGlobalWindow::Alert(const nsAString& aString)
rv = prompt->AlertCheck(title.get(), final.get(), label.get(),
&disallowDialog);
if (disallowDialog)
PreventFurtherDialogs(false);
DisableDialogs();
} else {
rv = prompt->Alert(title.get(), final.get());
}
@ -5482,8 +5504,7 @@ nsGlobalWindow::Confirm(const nsAString& aString, bool* aReturn)
{
FORWARD_TO_OUTER(Confirm, (aString, aReturn), NS_ERROR_NOT_INITIALIZED);
bool needToPromptForAbuse;
if (DialogsAreBlocked(&needToPromptForAbuse)) {
if (!AreDialogsEnabled()) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -5527,7 +5548,7 @@ nsGlobalWindow::Confirm(const nsAString& aString, bool* aReturn)
nsAutoSyncOperation sync(GetCurrentInnerWindowInternal() ?
GetCurrentInnerWindowInternal()->mDoc :
nullptr);
if (needToPromptForAbuse) {
if (ShouldPromptToBlockDialogs()) {
bool disallowDialog = false;
nsXPIDLString label;
nsContentUtils::GetLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
@ -5536,7 +5557,7 @@ nsGlobalWindow::Confirm(const nsAString& aString, bool* aReturn)
rv = prompt->ConfirmCheck(title.get(), final.get(), label.get(),
&disallowDialog, aReturn);
if (disallowDialog)
PreventFurtherDialogs(false);
DisableDialogs();
} else {
rv = prompt->Confirm(title.get(), final.get(), aReturn);
}
@ -5553,8 +5574,7 @@ nsGlobalWindow::Prompt(const nsAString& aMessage, const nsAString& aInitial,
SetDOMStringToNull(aReturn);
bool needToPromptForAbuse;
if (DialogsAreBlocked(&needToPromptForAbuse)) {
if (!AreDialogsEnabled()) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -5599,7 +5619,7 @@ nsGlobalWindow::Prompt(const nsAString& aMessage, const nsAString& aInitial,
bool disallowDialog = false;
nsXPIDLString label;
if (needToPromptForAbuse) {
if (ShouldPromptToBlockDialogs()) {
nsContentUtils::GetLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
"ScriptDialogLabel", label);
}
@ -5612,7 +5632,7 @@ nsGlobalWindow::Prompt(const nsAString& aMessage, const nsAString& aInitial,
&inoutValue, label.get(), &disallowDialog, &ok);
if (disallowDialog) {
PreventFurtherDialogs(false);
DisableDialogs();
}
NS_ENSURE_SUCCESS(rv, rv);
@ -5862,12 +5882,11 @@ nsGlobalWindow::Print()
if (Preferences::GetBool("dom.disable_window_print", false))
return NS_ERROR_NOT_AVAILABLE;
bool needToPromptForAbuse;
if (DialogsAreBlocked(&needToPromptForAbuse)) {
if (!AreDialogsEnabled()) {
return NS_ERROR_NOT_AVAILABLE;
}
if (needToPromptForAbuse && !ConfirmDialogIfNeeded()) {
if (ShouldPromptToBlockDialogs() && !ConfirmDialogIfNeeded()) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -7847,12 +7866,11 @@ nsGlobalWindow::ShowModalDialog(const nsAString& aURI, nsIVariant *aArgs_,
// pending reflows.
EnsureReflowFlushAndPaint();
bool needToPromptForAbuse;
if (DialogsAreBlocked(&needToPromptForAbuse)) {
if (!AreDialogsEnabled()) {
return NS_ERROR_NOT_AVAILABLE;
}
if (needToPromptForAbuse && !ConfirmDialogIfNeeded()) {
if (ShouldPromptToBlockDialogs() && !ConfirmDialogIfNeeded()) {
return NS_ERROR_NOT_AVAILABLE;
}

View File

@ -503,13 +503,15 @@ public:
already_AddRefed<nsIDOMWindow> GetChildWindow(const nsAString& aName);
// Returns true if dialogs need to be prevented from appearings for this
// window. beingAbused returns whether dialogs are being abused.
bool DialogsAreBlocked(bool *aBeingAbused);
// Returns true if we've reached the state in this top level window where we
// ask the user if further dialogs should be blocked. This method must only
// be called on the scriptable top inner window.
// These return true if we've reached the state in this top level window
// where we ask the user if further dialogs should be blocked.
//
// DialogsAreBeingAbused must be called on the scriptable top inner window.
//
// ShouldPromptToBlockDialogs is implemented in terms of
// DialogsAreBeingAbused, and will get the scriptable top inner window
// automatically.
bool ShouldPromptToBlockDialogs();
bool DialogsAreBeingAbused();
// Ask the user if further dialogs should be blocked, if dialogs are currently
@ -517,8 +519,11 @@ public:
// show, in that case we show a separate dialog to ask this question.
bool ConfirmDialogIfNeeded();
// Prevent further dialogs in this (top level) window
void PreventFurtherDialogs(bool aPermanent);
// These functions are used for controlling and determining whether dialogs
// (alert, prompt, confirm) are currently allowed in this window.
void EnableDialogs();
void DisableDialogs();
bool AreDialogsEnabled();
virtual void SetHasAudioAvailableEventListeners();
@ -1250,15 +1255,9 @@ protected:
// to allow disabling of further dialogs from this window.
TimeStamp mLastDialogQuitTime;
// This is set to true once the user has opted-in to preventing further
// dialogs for this window. Subsequent dialogs may still open if
// mDialogAbuseCount gets reset.
bool mStopAbuseDialogs;
// This flag gets set when dialogs should be permanently disabled for this
// window (e.g. when we are closing the tab and therefore are guaranteed to be
// destroying this window).
bool mDialogsPermanentlyDisabled;
// This flag keeps track of whether dialogs are
// currently enabled on this window.
bool mAreDialogsEnabled;
nsTHashtable<nsPtrHashKey<nsDOMEventTargetHelper> > mEventTargetObjects;

View File

@ -43,7 +43,7 @@ interface nsIDOMEventTarget;
interface nsIRunnable;
interface nsICompositionStringSynthesizer;
[scriptable, uuid(750a47b6-8bdb-4cad-ba2c-b7d3e66d8021)]
[scriptable, uuid(928356ff-26b2-434e-a7ce-c1a660162d81)]
interface nsIDOMWindowUtils : nsISupports {
/**
@ -1303,10 +1303,12 @@ interface nsIDOMWindowUtils : nsISupports {
in float aBottom, in float aLeft);
/**
* Prevent this window (and any child windows) from displaying any further
* dialogs (e.g. window.alert()).
* These are used to control whether dialogs (alert, prompt, confirm) are
* allowed.
*/
void preventFurtherDialogs();
void disableDialogs();
void enableDialogs();
bool areDialogsEnabled();
const unsigned long AGENT_SHEET = 0;
const unsigned long USER_SHEET = 1;

View File

@ -454,15 +454,11 @@ nsGeolocationRequest::Allow()
}
// check to see if we can use a cached value
//
// either:
// a) the user has specified a maximumAge which allows us to return a cached value,
// -or-
// b) the cached position time is some reasonable value to return to the user (<30s)
// if the user has specified a maximumAge, return a cached value.
uint32_t maximumAge = 30 * PR_MSEC_PER_SEC;
uint32_t maximumAge = 0;
if (mOptions) {
if (mOptions->mMaximumAge >= 0) {
if (mOptions->mMaximumAge > 0) {
maximumAge = mOptions->mMaximumAge;
}
}
@ -1125,8 +1121,6 @@ Geolocation::RemoveRequest(nsGeolocationRequest* aRequest)
(mPendingCallbacks.RemoveElement(aRequest) !=
mWatchingCallbacks.RemoveElement(aRequest));
// request must have been in one of the lists
MOZ_ASSERT(requestWasKnown);
unused << requestWasKnown;
}

View File

@ -51,3 +51,4 @@ support-files =
[test_selectAtPoint.html]
[test_subscript_bindings.xul]
[test_xray_event_constructor.xul]
[test_clipboard_events_chrome.html]

View File

@ -0,0 +1,62 @@
<html>
<body onload="runTest()">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script>
// This test checks that the dom.event.clipboardevents.enabled does not apply to chrome shells.
SimpleTest.waitForExplicitFinish();
function runTest()
{
SpecialPowers.setBoolPref("dom.event.clipboardevents.enabled", false);
window.open("data:text/html,<body onload='window.opener.doChecks(this)'><input id='i' value='Sample Text'></body>",
"_blank", "chrome,width=200,height=200");
}
var event_fired = false;
function doChecks(win)
{
var windowFocused = function() {
var textbox = win.document.getElementById("i");
textbox.value = "Sample Text";
textbox.oncut = function() { event_fired = true; };
textbox.oncopy = function() { event_fired = true; };
textbox.onpaste = function() { event_fired = true; };
textbox.select();
textbox.focus();
textbox.setSelectionRange(1, 4);
synthesizeKey("x", {accelKey: 1}, win);
is(textbox.value, "Sle Text", "cut changed text when preference is disabled");
ok(event_fired, "cut event fired when preference is disabled")
event_fired = false;
textbox.setSelectionRange(4, 6);
synthesizeKey("c", {accelKey: 1}, win);
is(textbox.value, "Sle Text", "cut changed text when preference is disabled");
ok(event_fired, "copy event fired when preference is disabled")
event_fired = false;
textbox.setSelectionRange(1, 4);
synthesizeKey("v", {accelKey: 1}, win);
is(textbox.value, "STeText", "paste changed text when preference is disabled");
ok(event_fired, "paste event fired when preference is disabled")
SpecialPowers.clearUserPref("dom.event.clipboardevents.enabled");
SimpleTest.finish();
}
SimpleTest.waitForFocus(windowFocused, win);
}
</script>
<p id="display"></p>
</body></html>

View File

@ -43,6 +43,7 @@ var ecmaGlobals =
"Int32Array",
"Int8Array",
"InternalError",
{name: "Intl", desktop: true},
"Iterator",
"JSON",
"Map",
@ -610,36 +611,38 @@ function createInterfaceMap(isXBLScope) {
var isRelease = !version.contains("a");
var isDesktop = !/Mobile|Tablet/.test(navigator.userAgent);
var isB2G = !isDesktop && !navigator.userAgent.contains("Android");
var interfaceMap = {};
for (var entry of ecmaGlobals) {
if (typeof(entry) === "string") {
// Standard ECMAScript global objects are not defined on the XBL scope.
interfaceMap[entry] = !isXBLScope;
} else if (entry.nightly === isNightly) {
interfaceMap[entry.name] = !isXBLScope;
} else {
interfaceMap[entry.name] = false;
}
}
for (var entry of interfaceNamesInGlobalScope) {
if (typeof(entry) === "string") {
interfaceMap[entry] = true;
} else if (entry.xbl === !isXBLScope ||
entry.desktop === !isDesktop ||
entry.b2g === !isB2G ||
entry.release === !isRelease) {
interfaceMap[entry.name] = false;
} else {
interfaceMap[entry.name] = true;
function addInterfaces(interfaces, shouldExpect)
{
for (var entry of interfaces) {
if (typeof(entry) === "string") {
interfaceMap[entry] = shouldExpect;
} else if ((entry.nightly === !isNightly) ||
(entry.xbl === !isXBLScope) ||
(entry.desktop === !isDesktop) ||
(entry.b2g === !isB2G) ||
(entry.release === !isRelease)) {
interfaceMap[entry.name] = false;
} else {
interfaceMap[entry.name] = shouldExpect;
}
}
}
// Standard ECMAScript global objects are not defined on the XBL scope, but
// everything else exists everywhere.
addInterfaces(ecmaGlobals, !isXBLScope);
addInterfaces(interfaceNamesInGlobalScope, true);
return interfaceMap;
}
function runTest(isXBLScope) {
var interfaceMap = createInterfaceMap(isXBLScope);
for (var name of Object.getOwnPropertyNames(window)) {
// An interfae name should start with an upper case character.
// An interface name should start with an upper case character.
if (!/^(moz)?[A-Z]/.test(name)) {
continue;
}

View File

@ -175,9 +175,9 @@ partial interface Element {
// http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface
partial interface Element {
[Throws,TreatNullAs=EmptyString]
[Pure,SetterThrows,TreatNullAs=EmptyString]
attribute DOMString innerHTML;
[Throws,TreatNullAs=EmptyString]
[Pure,SetterThrows,TreatNullAs=EmptyString]
attribute DOMString outerHTML;
[Throws]
void insertAdjacentHTML(DOMString position, DOMString text);

View File

@ -13,7 +13,7 @@
dictionary PositionOptions {
boolean enableHighAccuracy = false;
long timeout = 0x7fffffff;
long maximumAge = 30000; /* non-conformant, should be 0 */
long maximumAge = 0;
};
[NoInterfaceObject]

Some files were not shown because too many files have changed in this diff Show More