Merge m-c to b-i

This commit is contained in:
Phil Ringnalda 2016-01-09 12:03:17 -08:00
commit 8c48a0d202
287 changed files with 4426 additions and 3504 deletions

View File

@ -597,7 +597,8 @@ static void
MaybeFireNameChange(AtkObject* aAtkObj, const nsString& aNewName)
{
NS_ConvertUTF16toUTF8 newNameUTF8(aNewName);
if (aAtkObj->name && newNameUTF8.Equals(aAtkObj->name))
if (aAtkObj->name &&
!strncmp(aAtkObj->name, newNameUTF8.get(), newNameUTF8.Length()))
return;
// Below we duplicate the functionality of atk_object_set_name(),

View File

@ -91,8 +91,13 @@ void
AccessibleWrap::Shutdown()
{
#ifdef _WIN64
if (mID != kNoID)
static_cast<DocAccessibleWrap*>(mDoc)->RemoveID(mID);
if (mID != kNoID) {
auto doc = static_cast<DocAccessibleWrap*>(mDoc);
MOZ_ASSERT(doc);
if (doc) {
doc->RemoveID(mID);
}
}
#endif
Accessible::Shutdown();

View File

@ -28,10 +28,6 @@
@RESPATH@/chrome/@AB_CD@.manifest
@RESPATH@/@PREF_DIR@/b2g-l10n.js
@RESPATH@/searchplugins/*
@RESPATH@/defaults/profile/bookmarks.html
@RESPATH@/defaults/profile/localstore.rdf
@RESPATH@/defaults/profile/mimeTypes.rdf
@RESPATH@/defaults/profile/chrome/*
#ifdef MOZ_UPDATER
@RESPATH@/update.locale
@RESPATH@/updater.ini
@ -768,7 +764,6 @@
@RESPATH@/@PREF_DIR@/channel-prefs.js
@RESPATH@/greprefs.js
@RESPATH@/defaults/autoconfig/prefcalls.js
@RESPATH@/defaults/profile/prefs.js
; Services (gre) prefs
#ifdef MOZ_SERVICES_SYNC

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1450742506000">
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1452200089000">
<emItems>
<emItem blockID="i58" id="webmaster@buzzzzvideos.info">
<versionRange minVersion="0" maxVersion="*">
@ -3351,6 +3351,18 @@
<match name="filename" exp="(NPSWF32.*\.dll)|(NPSWF64.*\.dll)|(Flash\ Player\.plugin)" /> <versionRange minVersion="19.0.0.226" maxVersion="19.0.0.245" severity="0" vulnerabilitystatus="1"></versionRange>
<infoURL>https://get.adobe.com/flashplayer/</infoURL>
</pluginItem>
<pluginItem blockID="p1074">
<match name="filename" exp="(NPSWF32.*\.dll)|(NPSWF64.*\.dll)|(Flash\ Player\.plugin)" /> <versionRange minVersion="19.0.0.246" maxVersion="20.0.0.235" severity="0" vulnerabilitystatus="1"></versionRange>
<infoURL>https://get.adobe.com/flashplayer/</infoURL>
</pluginItem>
<pluginItem blockID="p1075">
<match name="filename" exp="(NPSWF32.*\.dll)|(NPSWF64.*\.dll)|(Flash\ Player\.plugin)" /> <versionRange minVersion="18.0.0.262" maxVersion="18.0.0.268" severity="0" vulnerabilitystatus="1"></versionRange>
<infoURL>https://get.adobe.com/flashplayer/</infoURL>
</pluginItem>
<pluginItem os="Linux" blockID="p1076">
<match name="filename" exp="libflashplayer\.so" /> <versionRange minVersion="11.2.202.549" maxVersion="11.2.202.554" severity="0" vulnerabilitystatus="1"></versionRange>
<infoURL>https://get.adobe.com/flashplayer/</infoURL>
</pluginItem>
</pluginItems>
<gfxItems>

View File

@ -184,7 +184,6 @@ var TrackingProtection = {
},
showIntroPanel: Task.async(function*() {
let mm = gBrowser.selectedBrowser.messageManager;
let brandBundle = document.getElementById("bundle_brand");
let brandShortName = brandBundle.getString("brandShortName");
@ -219,7 +218,7 @@ var TrackingProtection = {
let panelTarget = yield UITour.getTarget(window, "trackingProtection");
UITour.initForBrowser(gBrowser.selectedBrowser, window);
UITour.showInfo(window, mm, panelTarget,
UITour.showInfo(window, panelTarget,
gNavigatorBundle.getString("trackingProtection.intro.title"),
gNavigatorBundle.getFormattedString("trackingProtection.intro.description",
[brandShortName]),

View File

@ -1759,17 +1759,8 @@ nsContextMenu.prototype = {
selectedText = selectedText.substr(0,truncLength) + this.ellipsis;
}
// Use the current engine if the search bar is visible, the default
// engine otherwise.
var engineName = "";
var ss = Cc["@mozilla.org/browser/search-service;1"].
getService(Ci.nsIBrowserSearchService);
if (isElementVisible(BrowserSearch.searchBar))
engineName = ss.currentEngine.name;
else
engineName = ss.defaultEngine.name;
// format "Search <engine> for <selection>" string to show in menu
let engineName = Services.search.currentEngine.name;
var menuLabel = gNavigatorBundle.getFormattedString("contextMenuSearch",
[engineName,
selectedText]);

View File

@ -261,27 +261,21 @@ extensions.registerSchemaAPI("tabs", null, (extension, context) => {
}).api(),
create: function(createProperties, callback) {
if (!createProperties) {
createProperties = {};
}
let url = createProperties.url || aboutNewTabService.newTabURL;
url = extension.baseURI.resolve(url);
url = context.uri.resolve(url);
function createInWindow(window) {
let tab = window.gBrowser.addTab(url);
let active = true;
if ("active" in createProperties) {
if (createProperties.active !== null) {
active = createProperties.active;
} else if ("selected" in createProperties) {
active = createProperties.selected;
}
if (active) {
window.gBrowser.selectedTab = tab;
}
if ("index" in createProperties) {
if (createProperties.index !== null) {
window.gBrowser.moveTabTo(tab, createProperties.index);
}

View File

@ -24,6 +24,7 @@ support-files =
[browser_ext_tabs_executeScript_bad.js]
[browser_ext_tabs_query.js]
[browser_ext_tabs_getCurrent.js]
[browser_ext_tabs_create.js]
[browser_ext_tabs_update.js]
[browser_ext_tabs_onUpdated.js]
[browser_ext_tabs_sendMessage.js]

View File

@ -0,0 +1,169 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
add_task(function* () {
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:robots");
gBrowser.selectedTab = tab;
// TODO: Multiple windows.
// Using pre-loaded new tab pages interferes with onUpdated events.
// It probably shouldn't.
SpecialPowers.setBoolPref("browser.newtab.preload", false);
registerCleanupFunction(() => {
SpecialPowers.clearUserPref("browser.newtab.preload");
});
let extension = ExtensionTestUtils.loadExtension({
manifest: {
"permissions": ["tabs"],
"background": { "page": "bg/background.html" },
},
files: {
"bg/blank.html": `<html><head><meta charset="utf-8"></head></html>`,
"bg/background.html": `<html><head>
<meta charset="utf-8">
<script src="background.js"></script>
</head></html>`,
"bg/background.js": function() {
// Wrap API methods in promise-based variants.
let promiseTabs = {};
Object.keys(browser.tabs).forEach(method => {
promiseTabs[method] = (...args) => {
return new Promise(resolve => {
browser.tabs[method](...args, resolve);
});
};
});
let activeTab;
let activeWindow;
function runTests() {
const DEFAULTS = {
index: 2,
windowId: activeWindow,
active: true,
pinned: false,
url: "about:newtab",
};
let tests = [
{
create: { url: "http://example.com/" },
result: { url: "http://example.com/" },
},
{
create: { url: "blank.html" },
result: { url: browser.runtime.getURL("bg/blank.html") },
},
{
create: {},
result: { url: "about:newtab" },
},
{
create: { active: false },
result: { active: false },
},
{
create: { active: true },
result: { active: true },
},
{
create: { pinned: true },
result: { pinned: true, index: 0 },
},
{
create: { pinned: true, active: true },
result: { pinned: true, active: true, index: 0 },
},
{
create: { pinned: true, active: false },
result: { pinned: true, active: false, index: 0 },
},
{
create: { index: 1 },
result: { index: 1 },
},
{
create: { index: 1, active: false },
result: { index: 1, active: false },
},
{
create: { windowId: activeWindow },
result: { windowId: activeWindow },
},
];
function nextTest() {
if (!tests.length) {
browser.test.notifyPass("tabs.create");
return;
}
let test = tests.shift();
let expected = Object.assign({}, DEFAULTS, test.result);
browser.test.log(`Testing tabs.create(${JSON.stringify(test.create)}), expecting ${JSON.stringify(test.result)}`);
let tabId;
let updatedPromise = new Promise(resolve => {
let onUpdated = (changedTabId, changed) => {
if (changedTabId === tabId && changed.url) {
browser.tabs.onUpdated.removeListener(onUpdated);
resolve(changed.url);
}
};
browser.tabs.onUpdated.addListener(onUpdated);
});
promiseTabs.create(test.create).then(tab => {
tabId = tab.id;
for (let key of Object.keys(expected)) {
if (key === "url") {
// FIXME: This doesn't get updated until later in the load cycle.
continue;
}
browser.test.assertEq(expected[key], tab[key], `Expected value for tab.${key}`);
}
return updatedPromise;
}).then(url => {
browser.test.assertEq(expected.url, url, `Expected value for tab.url`);
return promiseTabs.remove(tabId);
}).then(() => {
return promiseTabs.update(activeTab, { active: true });
}).then(() => {
nextTest();
});
}
nextTest();
}
browser.tabs.query({ active: true, currentWindow: true }, tabs => {
activeTab = tabs[0].id;
activeWindow = tabs[0].windowId;
runTests();
});
},
},
});
yield extension.startup();
yield extension.awaitFinish("tabs.create");
yield extension.unload();
yield BrowserTestUtils.removeTab(tab);
});

View File

@ -38,7 +38,6 @@ const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
const nsIWindowMediator = Components.interfaces.nsIWindowMediator;
const nsIWindowWatcher = Components.interfaces.nsIWindowWatcher;
const nsIWebNavigationInfo = Components.interfaces.nsIWebNavigationInfo;
const nsIBrowserSearchService = Components.interfaces.nsIBrowserSearchService;
const nsICommandLineValidator = Components.interfaces.nsICommandLineValidator;
const NS_BINDING_ABORTED = Components.results.NS_BINDING_ABORTED;
@ -262,10 +261,7 @@ function logSystemBasedSearch(engine) {
}
function doSearch(searchTerm, cmdLine) {
var ss = Components.classes["@mozilla.org/browser/search-service;1"]
.getService(nsIBrowserSearchService);
var engine = ss.defaultEngine;
var engine = Services.search.defaultEngine;
logSystemBasedSearch(engine);
var submission = engine.getSubmission(searchTerm, null, "system");
@ -796,9 +792,7 @@ nsDefaultCommandLineHandler.prototype = {
}
if (allowedParams.indexOf(formParam) != -1) {
var term = params.get("q");
var ss = Components.classes["@mozilla.org/browser/search-service;1"]
.getService(nsIBrowserSearchService);
var engine = ss.defaultEngine;
var engine = Services.search.defaultEngine;
logSystemBasedSearch(engine);
var submission = engine.getSubmission(term, null, "system");
uri = submission.uri;

View File

@ -446,30 +446,6 @@ BrowserGlue.prototype = {
Preferences.set("browser.search.hiddenOneOffs",
hiddenList.join(","));
}
if (data != "engine-default" && data != "engine-current") {
break;
}
// Enforce that the search service's defaultEngine is always equal to
// its currentEngine. The search service will notify us any time either
// of them are changed (either by directly setting the relevant prefs,
// i.e. if add-ons try to change this directly, or if the
// nsIBrowserSearchService setters are called).
// No need to initialize the search service, since it's guaranteed to be
// initialized already when this notification fires.
let ss = Services.search;
if (ss.currentEngine.name == ss.defaultEngine.name)
return;
if (data == "engine-current")
ss.defaultEngine = ss.currentEngine;
else
ss.currentEngine = ss.defaultEngine;
break;
case "browser-search-service":
if (data != "init-complete")
return;
Services.obs.removeObserver(this, "browser-search-service");
this._syncSearchEngines();
break;
#ifdef NIGHTLY_BUILD
case "nsPref:changed":
@ -568,16 +544,6 @@ BrowserGlue.prototype = {
}
},
_syncSearchEngines: function () {
// Only do this if the search service is already initialized. This function
// gets called in finalUIStartup and from a browser-search-service observer,
// to catch both cases (search service initialization occurring before and
// after final-ui-startup)
if (Services.search.isInitialized) {
Services.search.defaultEngine = Services.search.currentEngine;
}
},
// initialization (called on application startup)
_init: function BG__init() {
let os = Services.obs;
@ -609,7 +575,6 @@ BrowserGlue.prototype = {
os.addObserver(this, "keyword-search", false);
#endif
os.addObserver(this, "browser-search-engine-modified", false);
os.addObserver(this, "browser-search-service", false);
os.addObserver(this, "restart-in-safe-mode", false);
os.addObserver(this, "flash-plugin-hang", false);
os.addObserver(this, "xpi-signature-changed", false);
@ -669,10 +634,6 @@ BrowserGlue.prototype = {
os.removeObserver(this, "keyword-search");
#endif
os.removeObserver(this, "browser-search-engine-modified");
try {
os.removeObserver(this, "browser-search-service");
// may have already been removed by the observer
} catch (ex) {}
#ifdef NIGHTLY_BUILD
Services.prefs.removeObserver(POLARIS_ENABLED, this);
#endif
@ -823,8 +784,6 @@ BrowserGlue.prototype = {
// handle any UI migration
this._migrateUI();
this._syncSearchEngines();
WebappManager.init();
PageThumbs.init();
#ifdef NIGHTLY_BUILD

View File

@ -0,0 +1,35 @@
<?xml version="1.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/. -->
<?xml-stylesheet href="chrome://global/skin/"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<!DOCTYPE prefwindow SYSTEM "chrome://browser/locale/preferences/donottrack.dtd" >
<prefwindow id="DoNotTrackDialog" type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
title="&window.title;"
style="width: &window.width;; height: &window.height;;"
dlgbuttons="accept,cancel">
<prefpane>
<preferences>
<preference id="privacy.donottrackheader.enabled"
name="privacy.donottrackheader.enabled"
type="bool"/>
</preferences>
<hbox align="center" pack="start">
<!-- Work around focus ring not showing properly. -->
<spacer style="width: 1em;"/>
<checkbox label="&doNotTrackCheckbox.label;"
accesskey="&doNotTrackCheckbox.accesskey;"
preference="privacy.donottrackheader.enabled"/>
<label class="text-link doNotTrackLearnMore"
value="&doNotTrackLearnMore.label;"
href="https://www.mozilla.org/dnt"/>
</hbox>
</prefpane>
</prefwindow>

View File

@ -30,7 +30,10 @@ var gPrivacyPane = {
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "tracking-protection";
link.setAttribute("href", url);
this.trackingProtectionReadPrefs();
document.getElementById("trackingprotectionbox").hidden = false;
document.getElementById("trackingprotectionpbmbox").hidden = true;
},
#endif
@ -108,6 +111,10 @@ var gPrivacyPane = {
gPrivacyPane.clearPrivateDataNow(true);
return false;
});
setEventListener("doNotTrackSettings", "click", function () {
gPrivacyPane.showDoNotTrackSettings();
return false;
});
setEventListener("privateBrowsingAutoStart", "command",
gPrivacyPane.updateAutostart);
setEventListener("cookieExceptions", "command",
@ -116,8 +123,54 @@ var gPrivacyPane = {
gPrivacyPane.showCookies);
setEventListener("clearDataSettings", "command",
gPrivacyPane.showClearPrivateDataSettings);
setEventListener("trackingProtectionRadioGroup", "command",
gPrivacyPane.trackingProtectionWritePrefs);
setEventListener("trackingProtectionExceptions", "command",
gPrivacyPane.showTrackingProtectionExceptions);
setEventListener("changeBlockList", "command",
gPrivacyPane.showBlockLists);
setEventListener("changeBlockListPBM", "command",
gPrivacyPane.showBlockLists);
},
// TRACKING PROTECTION MODE
/**
* Selects the right item of the Tracking Protection radiogroup.
*/
trackingProtectionReadPrefs() {
let enabledPref = document.getElementById("privacy.trackingprotection.enabled");
let pbmPref = document.getElementById("privacy.trackingprotection.pbmode.enabled");
let radiogroup = document.getElementById("trackingProtectionRadioGroup");
// Global enable takes precedence over enabled in Private Browsing.
radiogroup.value = enabledPref.value ? "always" :
pbmPref.value ? "private" :
"never";
},
/**
* Sets the pref values based on the selected item of the radiogroup.
*/
trackingProtectionWritePrefs() {
let enabledPref = document.getElementById("privacy.trackingprotection.enabled");
let pbmPref = document.getElementById("privacy.trackingprotection.pbmode.enabled");
let radiogroup = document.getElementById("trackingProtectionRadioGroup");
switch (radiogroup.value) {
case "always":
enabledPref.value = true;
pbmPref.value = true;
break;
case "private":
enabledPref.value = false;
pbmPref.value = true;
break;
case "never":
enabledPref.value = false;
pbmPref.value = false;
break;
}
},
// HISTORY MODE
@ -371,6 +424,21 @@ var gPrivacyPane = {
this._shouldPromptForRestart = true;
},
/**
* Displays fine-grained, per-site preferences for tracking protection.
*/
showTrackingProtectionExceptions() {
let bundlePreferences = document.getElementById("bundlePreferences");
let params = {
permissionType: "trackingprotection",
hideStatusColumn: true,
windowTitle: bundlePreferences.getString("trackingprotectionpermissionstitle"),
introText: bundlePreferences.getString("trackingprotectionpermissionstext"),
};
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
null, params);
},
/**
* Displays the available block lists for tracking protection.
*/
@ -386,6 +454,14 @@ var gPrivacyPane = {
null, params);
},
/**
* Displays the Do Not Track settings dialog.
*/
showDoNotTrackSettings() {
gSubDialog.open("chrome://browser/content/preferences/donottrack.xul",
"resizable=no");
},
// HISTORY
/*

View File

@ -10,9 +10,6 @@
<preferences id="privacyPreferences" hidden="true" data-category="panePrivacy">
<!-- Tracking -->
<preference id="privacy.donottrackheader.enabled"
name="privacy.donottrackheader.enabled"
type="bool"/>
<preference id="privacy.trackingprotection.enabled"
name="privacy.trackingprotection.enabled"
type="bool"/>
@ -30,6 +27,9 @@
<preference id="pref.privacy.disable_button.change_blocklist"
name="pref.privacy.disable_button.change_blocklist"
type="bool"/>
<preference id="pref.privacy.disable_button.tracking_protection_exceptions"
name="pref.privacy.disable_button.tracking_protection_exceptions"
type="bool"/>
<!-- Location Bar -->
<preference id="browser.urlbar.autocomplete.enabled"
@ -87,32 +87,40 @@
<!-- Tracking -->
<groupbox id="trackingGroup" data-category="panePrivacy" hidden="true">
<caption><label>&tracking.label;</label></caption>
<vbox>
<hbox align="center">
<checkbox id="privacyDoNotTrackCheckbox"
label="&dntTrackingNotOkay4.label;"
accesskey="&dntTrackingNotOkay4.accesskey;"
preference="privacy.donottrackheader.enabled"/>
<label id="doNotTrackInfo"
class="text-link"
href="https://www.mozilla.org/dnt">
&doNotTrackInfo.label;
</label>
</hbox>
</vbox>
<vbox id="trackingprotectionbox" hidden="true">
<hbox align="center">
<checkbox id="trackingProtection"
preference="privacy.trackingprotection.enabled"
accesskey="&trackingProtection5.accesskey;"
label="&trackingProtection5.label;" />
<label id="trackingProtectionLearnMore"
class="text-link"
value="&trackingProtectionLearnMore.label;"/>
<hbox align="start">
<vbox>
<caption><label>&trackingProtectionHeader.label;
<label id="trackingProtectionLearnMore" class="text-link"
value="&trackingProtectionLearnMore.label;"/>
</label></caption>
<radiogroup id="trackingProtectionRadioGroup">
<radio value="always"
label="&trackingProtectionAlways.label;"
accesskey="&trackingProtectionAlways.accesskey;"/>
<radio value="private"
label="&trackingProtectionPrivate.label;"
accesskey="&trackingProtectionPrivate.accesskey;"/>
<radio value="never"
label="&trackingProtectionNever.label;"
accesskey="&trackingProtectionNever.accesskey;"/>
</radiogroup>
</vbox>
<spacer flex="1" />
<vbox>
<button id="trackingProtectionExceptions"
label="&trackingProtectionExceptions.label;"
accesskey="&trackingProtectionExceptions.accesskey;"
preference="pref.privacy.disable_button.tracking_protection_exceptions"/>
<button id="changeBlockList"
label="&changeBlockList.label;"
accesskey="&changeBlockList.accesskey;"
preference="pref.privacy.disable_button.change_blocklist"/>
</vbox>
</hbox>
</vbox>
<vbox id="trackingprotectionpbmbox">
<caption><label>&tracking.label;</label></caption>
<hbox align="center">
<checkbox id="trackingProtectionPBM"
preference="privacy.trackingprotection.pbmode.enabled"
@ -122,11 +130,16 @@
class="text-link"
value="&trackingProtectionPBMLearnMore.label;"/>
<spacer flex="1" />
<button id="changeBlockList"
<button id="changeBlockListPBM"
label="&changeBlockList.label;" accesskey="&changeBlockList.accesskey;"
preference="pref.privacy.disable_button.change_blocklist"/>
</hbox>
</vbox>
<vbox>
<description>&doNotTrack.pre.label;<html:a
class="inline-link" id="doNotTrackSettings" href="#"
>&doNotTrack.settings.label;</html:a>&doNotTrack.post.label;</description>
</vbox>
</groupbox>
<!-- History -->

View File

@ -97,7 +97,7 @@ var gSubDialog = {
handleEvent: function(aEvent) {
switch (aEvent.type) {
case "command":
this.close(aEvent);
this._frame.contentWindow.close();
break;
case "dialogclosing":
this._onDialogClosing(aEvent);
@ -127,7 +127,7 @@ var gSubDialog = {
_onUnload: function(aEvent) {
if (aEvent.target.location.href == this._openedURL) {
this.close(this._closingEvent);
this._frame.contentWindow.close();
}
},

View File

@ -32,7 +32,6 @@ skip-if = e10s # Bug ?????? - "leaked until shutdown [nsGlobalWindow #99 about:
[browser_sanitizeOnShutdown_prefLocked.js]
[browser_searchsuggestions.js]
[browser_subdialogs.js]
skip-if = e10s # Bug 1087114
support-files = subdialog.xul
[browser_telemetry.js]
# Skip this test on Android and B2G as FHR and Telemetry are separate systems there.

View File

@ -7,268 +7,265 @@
* Tests for the sub-dialog infrastructure, not for actual sub-dialog functionality.
*/
var gTeardownAfterClose = false;
const gDialogURL = getRootDirectory(gTestPath) + "subdialog.xul";
function test() {
waitForExplicitFinish();
open_preferences((win) => {
Task.spawn(function () {
for (let test of gTests) {
info("STARTING TEST: " + test.desc);
try {
yield test.run();
} finally {
if (test.teardown) {
yield test.teardown();
}
}
function* open_subdialog_and_test_generic_start_state(browser, domcontentloadedFn) {
let domcontentloadedFnStr = domcontentloadedFn ?
"(" + domcontentloadedFn.toString() + ")()" :
"";
return ContentTask.spawn(browser, {gDialogURL, domcontentloadedFnStr}, function*(args) {
let {gDialogURL, domcontentloadedFnStr} = args;
let rv = { acceptCount: 0 };
let win = content.window;
let subdialog = win.gSubDialog;
subdialog.open(gDialogURL, null, rv);
info("waiting for subdialog DOMFrameContentLoaded");
yield ContentTaskUtils.waitForEvent(win, "DOMFrameContentLoaded", true);
let result;
if (domcontentloadedFnStr) {
result = eval(domcontentloadedFnStr);
}
info("waiting for subdialog load");
yield ContentTaskUtils.waitForEvent(subdialog._frame, "load");
info("subdialog window is loaded");
let expectedStyleSheetURLs = subdialog._injectedStyleSheets.slice(0);
for (let styleSheet of subdialog._frame.contentDocument.styleSheets) {
let index = expectedStyleSheetURLs.indexOf(styleSheet.href);
if (index >= 0) {
expectedStyleSheetURLs.splice(index, 1);
}
});
}
ok(!!subdialog._frame.contentWindow, "The dialog should be non-null");
isnot(subdialog._frame.contentWindow.location.toString(), "about:blank",
"Subdialog URL should not be about:blank");
is(win.getComputedStyle(subdialog._overlay, "").visibility, "visible",
"Overlay should be visible");
is(expectedStyleSheetURLs.length, 0,
"No stylesheets that were expected are missing");
return result;
});
}
var gTests = [{
desc: "Check titlebar, focus, return value, title changes, and accepting",
run: function* () {
let rv = { acceptCount: 0 };
let deferredClose = Promise.defer();
let dialogPromise = openAndLoadSubDialog(gDialogURL, null, rv,
(aEvent) => dialogClosingCallback(deferredClose, aEvent));
let dialog = yield dialogPromise;
function* close_subdialog_and_test_generic_end_state(browser, closingFn, closingButton, acceptCount, options) {
let dialogclosingPromise = ContentTask.spawn(browser, {closingButton, acceptCount}, function*(expectations) {
let win = content.window;
let subdialog = win.gSubDialog;
let frame = subdialog._frame;
info("waiting for dialogclosing");
let closingEvent =
yield ContentTaskUtils.waitForEvent(frame.contentWindow, "dialogclosing");
let actualAcceptCount = frame.contentWindow.arguments &&
frame.contentWindow.arguments[0].acceptCount;
// Check focus is in the textbox
is(dialog.document.activeElement.value, "Default text", "Textbox with correct text is focused");
info("waiting for about:blank load");
yield ContentTaskUtils.waitForEvent(frame, "load");
// Titlebar
is(content.document.getElementById("dialogTitle").textContent, "Sample sub-dialog",
"Dialog title should be correct initially");
let receivedEvent = waitForEvent(gBrowser.selectedBrowser, "DOMTitleChanged");
dialog.document.title = "Updated title";
// Wait for the title change listener
yield receivedEvent;
is(content.document.getElementById("dialogTitle").textContent, "Updated title",
"Dialog title should be updated with changes");
isnot(win.getComputedStyle(subdialog._overlay, "").visibility, "visible",
"overlay is not visible");
is(frame.getAttribute("style"), "", "inline styles should be cleared");
is(frame.contentWindow.location.href.toString(), "about:blank",
"sub-dialog should be unloaded");
is(closingEvent.detail.button, expectations.closingButton,
"closing event should indicate button was '" + expectations.closingButton + "'");
is(actualAcceptCount, expectations.acceptCount,
"should be 1 if accepted, 0 if canceled, undefined if closed w/out button");
});
let closingPromise = promiseDialogClosing(dialog);
// Accept the dialog
dialog.document.documentElement.acceptDialog();
let closingEvent = yield closingPromise;
is(closingEvent.detail.button, "accept", "closing event should indicate button was 'accept'");
yield deferredClose.promise;
is(rv.acceptCount, 1, "return value should have been updated");
},
},
{
desc: "Check canceling the dialog",
run: function* () {
let rv = { acceptCount: 0 };
let deferredClose = Promise.defer();
let dialogPromise = openAndLoadSubDialog(gDialogURL, null, rv,
(aEvent) => dialogClosingCallback(deferredClose, aEvent));
let dialog = yield dialogPromise;
let closingPromise = promiseDialogClosing(dialog);
info("cancelling the dialog");
dialog.document.documentElement.cancelDialog();
let closingEvent = yield closingPromise;
is(closingEvent.detail.button, "cancel", "closing event should indicate button was 'cancel'");
yield deferredClose.promise;
is(rv.acceptCount, 0, "return value should NOT have been updated");
},
},
{
desc: "Check window.close on the dialog",
run: function* () {
let rv = { acceptCount: 0 };
let deferredClose = Promise.defer();
let dialogPromise = openAndLoadSubDialog(gDialogURL, null, rv,
(aEvent) => dialogClosingCallback(deferredClose, aEvent));
let dialog = yield dialogPromise;
let closingPromise = promiseDialogClosing(dialog);
info("window.close called on the dialog");
dialog.window.close();
let closingEvent = yield closingPromise;
is(closingEvent.detail.button, null, "closing event should indicate no button was clicked");
yield deferredClose.promise;
is(rv.acceptCount, 0, "return value should NOT have been updated");
},
},
{
desc: "Check clicking the close button on the dialog",
run: function* () {
let rv = { acceptCount: 0 };
let deferredClose = Promise.defer();
let dialogPromise = openAndLoadSubDialog(gDialogURL, null, rv,
(aEvent) => dialogClosingCallback(deferredClose, aEvent));
let dialog = yield dialogPromise;
yield EventUtils.synthesizeMouseAtCenter(content.document.getElementById("dialogClose"), {},
content.window);
yield deferredClose.promise;
is(rv.acceptCount, 0, "return value should NOT have been updated");
},
},
{
desc: "Check that 'back' navigation will close the dialog",
run: function* () {
let rv = { acceptCount: 0 };
let deferredClose = Promise.defer();
let dialogPromise = openAndLoadSubDialog(gDialogURL, null, rv,
(aEvent) => dialogClosingCallback(deferredClose, aEvent));
let dialog = yield dialogPromise;
info("cancelling the dialog");
content.gSubDialog._frame.goBack();
yield deferredClose.promise;
is(rv.acceptCount, 0, "return value should NOT have been updated");
},
},
{
desc: "Hitting escape in the dialog",
run: function* () {
let rv = { acceptCount: 0 };
let deferredClose = Promise.defer();
let dialogPromise = openAndLoadSubDialog(gDialogURL, null, rv,
(aEvent) => dialogClosingCallback(deferredClose, aEvent));
let dialog = yield dialogPromise;
EventUtils.synthesizeKey("VK_ESCAPE", {}, content.window);
yield deferredClose.promise;
is(rv.acceptCount, 0, "return value should NOT have been updated");
},
},
{
desc: "Check that width and height from the sub-dialog are used to size the <browser>",
run: function* () {
let deferredClose = Promise.defer();
let dialogPromise = openAndLoadSubDialog(gDialogURL, null, null,
(aEvent) => dialogClosingCallback(deferredClose, aEvent));
let dialog = yield dialogPromise;
is(content.gSubDialog._frame.style.width, "32em", "Width should be set on the frame from the dialog");
is(content.gSubDialog._frame.style.height, "5em", "Height should be set on the frame from the dialog");
content.gSubDialog.close();
yield deferredClose.promise;
},
},
{
desc: "Check that a set width and content causing wrapping still lead to correct scrollHeight-implied height",
run: function* () {
let deferredClose = Promise.defer();
let dialogPromise = openAndLoadSubDialog(gDialogURL, null, null,
(aEvent) => dialogClosingCallback(deferredClose, aEvent));
let oldHeight;
content.addEventListener("DOMFrameContentLoaded", function frame2Loaded() {
content.removeEventListener("DOMFrameContentLoaded", frame2Loaded);
let doc = content.gSubDialog._frame.contentDocument;
oldHeight = doc.documentElement.scrollHeight;
doc.documentElement.style.removeProperty("height");
doc.getElementById("desc").textContent = `
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque
laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas
sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas
sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas
sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
voluptatem sequi nesciunt.`
doc = null;
});
let dialog = yield dialogPromise;
is(content.gSubDialog._frame.style.width, "32em", "Width should be set on the frame from the dialog");
let docEl = content.gSubDialog._frame.contentDocument.documentElement;
ok(docEl.scrollHeight > oldHeight, "Content height increased (from " + oldHeight + " to " + docEl.scrollHeight + ").");
is(content.gSubDialog._frame.style.height, docEl.scrollHeight + "px", "Height on the frame should be higher now");
content.gSubDialog.close();
yield deferredClose.promise;
},
},
{
desc: "Check that a dialog that is too high gets cut down to size",
run: function* () {
let deferredClose = Promise.defer();
let dialogPromise = openAndLoadSubDialog(gDialogURL, null, null,
(aEvent) => dialogClosingCallback(deferredClose, aEvent));
content.addEventListener("DOMFrameContentLoaded", function frame3Loaded() {
content.removeEventListener("DOMFrameContentLoaded", frame3Loaded);
content.gSubDialog._frame.contentDocument.documentElement.style.height = '100000px';
});
let dialog = yield dialogPromise;
is(content.gSubDialog._frame.style.width, "32em", "Width should be set on the frame from the dialog");
let newHeight = content.gSubDialog._frame.contentDocument.documentElement.scrollHeight;
ok(parseInt(content.gSubDialog._frame.style.height) < window.innerHeight,
"Height on the frame should be smaller than window's innerHeight");
content.gSubDialog.close();
yield deferredClose.promise;
if (options && options.runClosingFnOutsideOfContentTask) {
yield closingFn();
} else {
ContentTask.spawn(browser, null, closingFn);
}
},
{
desc: "Check that scrollWidth and scrollHeight from the sub-dialog are used to size the <browser>",
run: function* () {
let deferredClose = Promise.defer();
let dialogPromise = openAndLoadSubDialog(gDialogURL, null, null,
(aEvent) => dialogClosingCallback(deferredClose, aEvent));
content.addEventListener("DOMFrameContentLoaded", function frameLoaded() {
content.removeEventListener("DOMFrameContentLoaded", frameLoaded);
content.gSubDialog._frame.contentDocument.documentElement.style.removeProperty("height");
content.gSubDialog._frame.contentDocument.documentElement.style.removeProperty("width");
});
let dialog = yield dialogPromise;
ok(content.gSubDialog._frame.style.width.endsWith("px"),
"Width (" + content.gSubDialog._frame.style.width + ") should be set to a px value of the scrollWidth from the dialog");
ok(content.gSubDialog._frame.style.height.endsWith("px"),
"Height (" + content.gSubDialog._frame.style.height + ") should be set to a px value of the scrollHeight from the dialog");
gTeardownAfterClose = true;
content.gSubDialog.close();
yield deferredClose.promise;
},
}];
function promiseDialogClosing(dialog) {
return waitForEvent(dialog, "dialogclosing");
yield dialogclosingPromise;
}
function dialogClosingCallback(aPromise, aEvent) {
// Wait for the close handler to unload the page
waitForEvent(content.gSubDialog._frame, "load", 4000).then((aEvt) => {
info("Load event happened: " + !(aEvt instanceof Error));
is_element_hidden(content.gSubDialog._overlay, "Overlay is not visible");
is(content.gSubDialog._frame.getAttribute("style"), "",
"Check that inline styles were cleared");
is(content.gSubDialog._frame.contentWindow.location.toString(), "about:blank",
"Check the sub-dialog was unloaded");
if (gTeardownAfterClose) {
content.close();
finish();
}
aPromise.resolve();
}, Cu.reportError);
}
let tab;
add_task(function* test_initialize() {
tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences");
});
add_task(function* check_titlebar_focus_returnval_titlechanges_accepting() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
let domtitlechangedPromise = BrowserTestUtils.waitForEvent(tab.linkedBrowser, "DOMTitleChanged");
yield ContentTask.spawn(tab.linkedBrowser, null, function*() {
let dialog = content.window.gSubDialog._frame.contentWindow;
let dialogTitleElement = content.document.getElementById("dialogTitle");
is(dialogTitleElement.textContent, "Sample sub-dialog",
"Title should be correct initially");
is(dialog.document.activeElement.value, "Default text",
"Textbox with correct text is focused");
dialog.document.title = "Updated title";
});
info("waiting for DOMTitleChanged event");
yield domtitlechangedPromise;
ContentTask.spawn(tab.linkedBrowser, null, function*() {
let dialogTitleElement = content.document.getElementById("dialogTitle");
is(dialogTitleElement.textContent, "Updated title", "subdialog should have updated title");
});
// Accept the dialog
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
function() { content.window.gSubDialog._frame.contentDocument.documentElement.acceptDialog(); },
"accept", 1);
});
add_task(function* check_canceling_dialog() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
info("canceling the dialog");
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
function() { content.window.gSubDialog._frame.contentDocument.documentElement.cancelDialog(); },
"cancel", 0);
});
add_task(function* window_close_on_dialog() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
info("canceling the dialog");
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
function() { content.window.gSubDialog._frame.contentWindow.window.close(); },
null, 0);
});
add_task(function* click_close_button_on_dialog() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
info("canceling the dialog");
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
function() { return BrowserTestUtils.synthesizeMouseAtCenter("#dialogClose", {}, tab.linkedBrowser); },
null, 0, {runClosingFnOutsideOfContentTask: true});
});
add_task(function* back_navigation_on_subdialog_should_close_dialog() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
info("canceling the dialog");
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
function() { content.window.gSubDialog._frame.goBack(); },
null, undefined);
});
add_task(function* back_navigation_on_browser_tab_should_close_dialog() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
info("canceling the dialog");
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
function() { tab.linkedBrowser.goBack(); },
null, undefined, {runClosingFnOutsideOfContentTask: true});
});
add_task(function* escape_should_close_dialog() {
todo(false, "BrowserTestUtils.sendChar('VK_ESCAPE') triggers " +
"'can't access dead object' on `navigator` in this test. " +
"See bug 1238065.")
return;
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
info("canceling the dialog");
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
function() { return BrowserTestUtils.sendChar("VK_ESCAPE", tab.linkedBrowser); },
null, undefined, {runClosingFnOutsideOfContentTask: true});
});
add_task(function* correct_width_and_height_should_be_used_for_dialog() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
yield ContentTask.spawn(tab.linkedBrowser, null, function*() {
let frameStyle = content.window.gSubDialog._frame.style;
is(frameStyle.width, "32em", "Width should be set on the frame from the dialog");
is(frameStyle.height, "5em", "Height should be set on the frame from the dialog");
});
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
function() { content.window.gSubDialog._frame.contentWindow.window.close(); },
null, 0);
});
add_task(function* wrapped_text_in_dialog_should_have_expected_scrollHeight() {
let oldHeight = yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser, function domcontentloadedFn() {
let frame = content.window.gSubDialog._frame;
let doc = frame.contentDocument;
let oldHeight = doc.documentElement.scrollHeight;
doc.documentElement.style.removeProperty("height");
doc.getElementById("desc").textContent = `
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque
laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas
sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas
sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas
sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
voluptatem sequi nesciunt.`
return oldHeight;
});
yield ContentTask.spawn(tab.linkedBrowser, oldHeight, function*(oldHeight) {
let frame = content.window.gSubDialog._frame;
let docEl = frame.contentDocument.documentElement;
is(frame.style.width, "32em",
"Width should be set on the frame from the dialog");
ok(docEl.scrollHeight > oldHeight,
"Content height increased (from " + oldHeight + " to " + docEl.scrollHeight + ").");
is(frame.style.height, docEl.scrollHeight + "px",
"Height on the frame should be higher now");
});
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
function() { content.window.gSubDialog._frame.contentWindow.window.close(); },
null, 0);
});
add_task(function* dialog_too_tall_should_get_reduced_in_height() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser, function domcontentloadedFn() {
let frame = content.window.gSubDialog._frame;
frame.contentDocument.documentElement.style.height = '100000px';
});
yield ContentTask.spawn(tab.linkedBrowser, null, function*() {
let frame = content.window.gSubDialog._frame;
is(frame.style.width, "32em", "Width should be set on the frame from the dialog");
ok(parseInt(frame.style.height) < content.window.innerHeight,
"Height on the frame should be smaller than window's innerHeight");
});
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
function() { content.window.gSubDialog._frame.contentWindow.window.close(); },
null, 0);
});
add_task(function* scrollWidth_and_scrollHeight_from_subdialog_should_size_the_browser() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser, function domcontentloadedFn() {
let frame = content.window.gSubDialog._frame;
frame.contentDocument.documentElement.style.removeProperty("height");
frame.contentDocument.documentElement.style.removeProperty("width");
});
yield ContentTask.spawn(tab.linkedBrowser, null, function*() {
let frame = content.window.gSubDialog._frame;
ok(frame.style.width.endsWith("px"),
"Width (" + frame.style.width + ") should be set to a px value of the scrollWidth from the dialog");
ok(frame.style.height.endsWith("px"),
"Height (" + frame.style.height + ") should be set to a px value of the scrollHeight from the dialog");
});
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
function() { content.window.gSubDialog._frame.contentWindow.window.close(); },
null, 0);
});
add_task(function* test_shutdown() {
gBrowser.removeTab(tab);
});

View File

@ -12,6 +12,7 @@ browser.jar:
* content/browser/preferences/cookies.js
* content/browser/preferences/connection.xul
content/browser/preferences/connection.js
content/browser/preferences/donottrack.xul
* content/browser/preferences/fonts.xul
content/browser/preferences/fonts.js
content/browser/preferences/handlers.xml

View File

@ -249,6 +249,10 @@ var gPermissionManager = {
var urlLabel = document.getElementById("urlLabel");
urlLabel.hidden = !urlFieldVisible;
if (aParams.hideStatusColumn) {
document.getElementById("statusCol").hidden = true;
}
let treecols = document.getElementsByTagName("treecols")[0];
treecols.addEventListener("click", event => {
if (event.target.nodeName != "treecol" || event.button != 0) {

View File

@ -130,8 +130,7 @@
<property name="currentEngine">
<setter><![CDATA[
let ss = Services.search;
ss.defaultEngine = ss.currentEngine = val;
Services.search.currentEngine = val;
return val;
]]></setter>
<getter><![CDATA[

View File

@ -530,13 +530,18 @@ this.UITour = {
}
let infoOptions = {};
if (typeof data.closeButtonCallbackID == "string") {
infoOptions.closeButtonCallback = () => {
this.sendPageCallback(messageManager, data.closeButtonCallbackID);
};
}
if (typeof data.targetCallbackID == "string") {
infoOptions.targetCallback = details => {
this.sendPageCallback(messageManager, data.targetCallbackID, details);
};
}
if (typeof data.closeButtonCallbackID == "string")
infoOptions.closeButtonCallbackID = data.closeButtonCallbackID;
if (typeof data.targetCallbackID == "string")
infoOptions.targetCallbackID = data.targetCallbackID;
this.showInfo(window, messageManager, target, data.title, data.text, iconURL, buttons, infoOptions);
this.showInfo(window, target, data.title, data.text, iconURL, buttons, infoOptions);
}).catch(log.error);
break;
}
@ -1395,17 +1400,17 @@ this.UITour = {
* Show an info panel.
*
* @param {ChromeWindow} aChromeWindow
* @param {nsIMessageSender} aMessageManager
* @param {Node} aAnchor
* @param {String} [aTitle=""]
* @param {String} [aDescription=""]
* @param {String} [aIconURL=""]
* @param {Object[]} [aButtons=[]]
* @param {Object} [aOptions={}]
* @param {String} [aOptions.closeButtonCallbackID]
* @param {String} [aOptions.closeButtonCallback]
* @param {String} [aOptions.targetCallback]
*/
showInfo: function(aChromeWindow, aMessageManager, aAnchor, aTitle = "", aDescription = "", aIconURL = "",
aButtons = [], aOptions = {}) {
showInfo(aChromeWindow, aAnchor, aTitle = "", aDescription = "",
aIconURL = "", aButtons = [], aOptions = {}) {
function showInfoPanel(aAnchorEl) {
aAnchorEl.focus();
@ -1461,8 +1466,9 @@ this.UITour = {
let tooltipClose = document.getElementById("UITourTooltipClose");
let closeButtonCallback = (event) => {
this.hideInfo(document.defaultView);
if (aOptions && aOptions.closeButtonCallbackID)
this.sendPageCallback(aMessageManager, aOptions.closeButtonCallbackID);
if (aOptions && aOptions.closeButtonCallback) {
aOptions.closeButtonCallback();
}
};
tooltipClose.addEventListener("command", closeButtonCallback);
@ -1471,16 +1477,16 @@ this.UITour = {
target: aAnchor.targetName,
type: event.type,
};
this.sendPageCallback(aMessageManager, aOptions.targetCallbackID, details);
aOptions.targetCallback(details);
};
if (aOptions.targetCallbackID && aAnchor.addTargetListener) {
if (aOptions.targetCallback && aAnchor.addTargetListener) {
aAnchor.addTargetListener(document, targetCallback);
}
tooltip.addEventListener("popuphiding", function tooltipHiding(event) {
tooltip.removeEventListener("popuphiding", tooltipHiding);
tooltipClose.removeEventListener("command", closeButtonCallback);
if (aOptions.targetCallbackID && aAnchor.removeTargetListener) {
if (aOptions.targetCallback && aAnchor.removeTargetListener) {
aAnchor.removeTargetListener(document, targetCallback);
}
});

View File

@ -25,6 +25,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "Pocket",
XPCOMUtils.defineLazyGetter(this, "gPocketBundle", function() {
return Services.strings.createBundle("chrome://pocket/locale/pocket.properties");
});
XPCOMUtils.defineLazyGetter(this, "gPocketStyleURI", function() {
return Services.io.newURI("chrome://pocket/skin/pocket.css", null, null);
});
const PREF_BRANCH = "extensions.pocket.";
@ -286,10 +289,12 @@ function pktUIGetter(prop, window) {
var PocketOverlay = {
startup: function(reason) {
let styleSheetService = Cc["@mozilla.org/content/style-sheet-service;1"]
.getService(Ci.nsIStyleSheetService);
this._sheetType = styleSheetService.AUTHOR_SHEET;
this._cachedSheet = styleSheetService.preloadSheet(gPocketStyleURI,
this._sheetType);
CreatePocketWidget(reason);
Services.obs.addObserver(this,
"browser-delayed-startup-finished",
false);
CustomizableUI.addListener(this);
PocketContextMenu.init();
PocketReader.startup();
@ -322,9 +327,7 @@ var PocketOverlay = {
PocketContextMenu.shutdown();
PocketReader.shutdown();
},
observe: function(aSubject, aTopic, aData) {
// new browser window, initialize the "overlay"
let window = aSubject;
onWindowOpened: function(window) {
this.setWindowScripts(window);
this.addStyles(window);
this.updateWindow(window);
@ -435,21 +438,13 @@ var PocketOverlay = {
},
addStyles: function(win) {
let xmlPI = win.document.createProcessingInstruction("xml-stylesheet",
"type=\"text/css\" href=\"chrome://pocket/skin/pocket.css\"");
win.document.insertBefore(xmlPI, win.document.documentElement);
let utils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
utils.addSheet(this._cachedSheet, this._sheetType);
},
removeStyles: function(win) {
let el = win.document.documentElement.previousSibling;
while (el) {
if (el.nodeType == el.PROCESSING_INSTRUCTION_NODE &&
el.sheet && el.sheet.href == "chrome://pocket/skin/pocket.css") {
el.remove();
break;
}
el = el.previousSibling;
}
let utils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
utils.removeSheet(gPocketStyleURI, this._sheetType);
}
}

View File

@ -46,9 +46,6 @@
@RESPATH@/browser/chrome/@AB_CD@.manifest
@RESPATH@/chrome/@AB_CD@@JAREXT@
@RESPATH@/chrome/@AB_CD@.manifest
@RESPATH@/browser/defaults/profile/chrome/*
@RESPATH@/browser/defaults/profile/localstore.rdf
@RESPATH@/browser/defaults/profile/mimeTypes.rdf
@RESPATH@/dictionaries/*
@RESPATH@/hyphenation/*
@RESPATH@/browser/@PREF_DIR@/firefox-l10n.js
@ -704,7 +701,6 @@
@RESPATH@/browser/@PREF_DIR@/firefox-branding.js
@RESPATH@/greprefs.js
@RESPATH@/defaults/autoconfig/prefcalls.js
@RESPATH@/browser/defaults/profile/prefs.js
@RESPATH@/browser/defaults/permissions
; Warning: changing the path to channel-prefs.js can cause bugs (Bug 756325)

View File

@ -94,21 +94,8 @@ $(STAGEDIST): $(DIST)/branding
$(DIST)/branding:
$(NSINSTALL) -D $@
PROFILE_FILES = \
localstore.rdf \
mimeTypes.rdf \
$(NULL)
PROFILE_CHROME = userChrome-example.css userContent-example.css
DEFINES += -DBOOKMARKS_INCLUDE_DIR=$(dir $(call MERGE_FILE,profile/bookmarks.inc))
libs:: $(addprefix generic/profile/,$(PROFILE_FILES))
$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/defaults/profile
libs:: $(call MERGE_FILES,$(addprefix profile/chrome/,$(PROFILE_CHROME)))
$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/defaults/profile/chrome
libs-%:
$(NSINSTALL) -D $(DIST)/install
@$(MAKE) -C ../../toolkit/locales libs-$* XPI_ROOT_APPID='$(XPI_ROOT_APPID)'

View File

@ -0,0 +1,12 @@
<!-- 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/. -->
<!ENTITY window.title "Do Not Track">
<!ENTITY window.width "40em">
<!ENTITY window.height "8em">
<!ENTITY doNotTrackCheckbox.label "Use Do Not Track">
<!ENTITY doNotTrackCheckbox.accesskey "U">
<!ENTITY doNotTrackLearnMore.label "Learn More">

View File

@ -19,6 +19,8 @@ acceptVeryLargeMinimumFont=Keep my changes anyway
#### Permissions Manager
trackingprotectionpermissionstext=You have disabled Tracking Protection on these sites.
trackingprotectionpermissionstitle=Exceptions - Tracking Protection
cookiepermissionstext=You can specify which websites are always or never allowed to use cookies. Type the exact address of the site you want to manage and then click Block, Allow for Session, or Allow.
cookiepermissionstitle=Exceptions - Cookies
addonspermissionstext=You can specify which websites are allowed to install add-ons. Type the exact address of the site you want to allow and then click Allow.

View File

@ -2,20 +2,30 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!ENTITY tracking.label "Tracking">
<!ENTITY trackingProtectionHeader.label "Use Tracking Protection">
<!ENTITY trackingProtectionAlways.label "Always">
<!ENTITY trackingProtectionAlways.accesskey "y">
<!ENTITY trackingProtectionPrivate.label "Only in private windows">
<!ENTITY trackingProtectionPrivate.accesskey "l">
<!ENTITY trackingProtectionNever.label "Never">
<!ENTITY trackingProtectionNever.accesskey "n">
<!ENTITY trackingProtectionLearnMore.label "Learn more">
<!ENTITY trackingProtectionExceptions.label "Exceptions…">
<!ENTITY trackingProtectionExceptions.accesskey "x">
<!ENTITY dntTrackingNotOkay4.label "Request that sites not track you">
<!ENTITY dntTrackingNotOkay4.accesskey "n">
<!ENTITY doNotTrackInfo.label "Learn More">
<!ENTITY trackingProtection5.label "Use Tracking Protection">
<!ENTITY trackingProtection5.accesskey "i">
<!ENTITY trackingProtectionLearnMore.label "Learn more">
<!ENTITY tracking.label "Tracking">
<!ENTITY trackingProtectionPBM5.label "Use Tracking Protection in Private Windows">
<!ENTITY trackingProtectionPBM5.accesskey "v">
<!ENTITY trackingProtectionPBMLearnMore.label "Learn more">
<!ENTITY changeBlockList.label "Change Block List">
<!ENTITY changeBlockList.accesskey "C">
<!-- LOCALIZATION NOTE (doNotTrack.pre.label): include a trailing space as needed -->
<!-- LOCALIZATION NOTE (doNotTrack.post.label): include a starting space as needed -->
<!ENTITY doNotTrack.pre.label "You can also ">
<!ENTITY doNotTrack.settings.label "manage your Do Not Track settings">
<!ENTITY doNotTrack.post.label ".">
<!ENTITY history.label "History">
<!ENTITY locationBar.label "Location Bar">

View File

@ -1,50 +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/. */
/*
* Edit this file and copy it as userChrome.css into your
* profile-directory/chrome/
*/
/*
* This file can be used to customize the look of Mozilla's user interface
* You should consider using !important on rules which you want to
* override default settings.
*/
/*
* Do not remove the @namespace line -- it's required for correct functioning
*/
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
/*
* Some possible accessibility enhancements:
*/
/*
* Make all the default font sizes 20 pt:
*
* * {
* font-size: 20pt !important
* }
*/
/*
* Make menu items in particular 15 pt instead of the default size:
*
* menupopup > * {
* font-size: 15pt !important
* }
*/
/*
* Give the Location (URL) Bar a fixed-width font
*
* #urlbar {
* font-family: monospace !important;
* }
*/
/*
* For more examples see http://www.mozilla.org/unix/customizing.html
*/

View File

@ -1,32 +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/. */
/*
* Edit this file and copy it as userContent.css into your
* profile-directory/chrome/
*/
/*
* This file can be used to apply a style to all web pages you view
* Rules without !important are overruled by author rules if the
* author sets any. Rules with !important overrule author rules.
*/
/*
* example: give all tables a 2px border
*
* table { border: 2px solid; }
*/
/*
* example: turn off "marquee" element
*
* marquee { -moz-binding: none; }
*
*/
/*
* For more examples see http://www.mozilla.org/unix/customizing.html
*/

View File

@ -1,9 +0,0 @@
<?xml version="1.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/. -->
<RDF:RDF
xmlns:NC="http://home.netscape.com/NC-rdf#"
xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
</RDF:RDF>

View File

@ -1,17 +0,0 @@
<?xml version="1.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/. -->
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:NC="http://home.netscape.com/NC-rdf#"
xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Description about="urn:mimetypes">
<NC:MIME-types>
<Seq about="urn:mimetypes:root">
</Seq>
</NC:MIME-types>
</Description>
</RDF>

View File

@ -70,6 +70,7 @@
locale/browser/preferences/cookies.dtd (%chrome/browser/preferences/cookies.dtd)
locale/browser/preferences/content.dtd (%chrome/browser/preferences/content.dtd)
locale/browser/preferences/connection.dtd (%chrome/browser/preferences/connection.dtd)
locale/browser/preferences/donottrack.dtd (%chrome/browser/preferences/donottrack.dtd)
locale/browser/preferences/applications.dtd (%chrome/browser/preferences/applications.dtd)
locale/browser/preferences/fonts.dtd (%chrome/browser/preferences/fonts.dtd)
locale/browser/preferences/main.dtd (%chrome/browser/preferences/main.dtd)

View File

@ -189,7 +189,7 @@ var ReaderParent = {
} else {
icon += "reader-tour.png";
}
UITour.showInfo(win, browser.messageManager, target,
UITour.showInfo(win, target,
browserBundle.GetStringFromName("readingList.promo.firstUse.readerView.title"),
browserBundle.GetStringFromName("readingList.promo.firstUse.readerView.body"),
icon);

View File

@ -16,10 +16,11 @@
%define forwardTransitionLength 150ms
%define conditionalForwardWithUrlbar window:not([chromehidden~="toolbar"]) #urlbar-wrapper
%define conditionalForwardWithUrlbarWidth 31
:root {
--backbutton-urlbar-overlap: 6px;
/* icon width + border + horizontal padding (includes the overlap from backbutton-urlbar-overlap) */
--forwardbutton-width: 31px;
--toolbarbutton-hover-background: rgba(255,255,255,.5) linear-gradient(rgba(255,255,255,.5), transparent);
--toolbarbutton-hover-bordercolor: rgba(0,0,0,.25);
@ -743,7 +744,7 @@ menuitem:not([type]):not(.menuitem-tooltip):not(.menuitem-iconic-tooltip) {
padding-right: 3px;
border-left-style: none;
border-radius: 0;
max-width: @conditionalForwardWithUrlbarWidth@px;
max-width: var(--forwardbutton-width);
}
@conditionalForwardWithUrlbar@:not([switchingtabs]) > #forward-button {
@ -751,7 +752,7 @@ menuitem:not([type]):not(.menuitem-tooltip):not(.menuitem-iconic-tooltip) {
}
@conditionalForwardWithUrlbar@ > #forward-button[disabled] {
margin-left: -@conditionalForwardWithUrlbarWidth@px;
margin-left: calc(0px - var(--forwardbutton-width));
}
@conditionalForwardWithUrlbar@:hover:not([switchingtabs]) > #forward-button[disabled] {
@ -761,7 +762,7 @@ menuitem:not([type]):not(.menuitem-tooltip):not(.menuitem-iconic-tooltip) {
@conditionalForwardWithUrlbar@:not(:hover) > #forward-button[disabled] {
/* when not hovered anymore, trigger a new transition to hide the forward button immediately */
margin-left: -@conditionalForwardWithUrlbarWidth@.01px;
margin-left: calc(-0.01px - var(--forwardbutton-width));
}
/* undo close tab menu item */

View File

@ -4,6 +4,10 @@
%include ../shared/devedition.inc.css
:root {
--forwardbutton-width: 29px;
}
:root[devtoolstheme="dark"] .findbar-closebutton:not(:hover),
:root[devtoolstheme="dark"] #sidebar-header > .close-icon:not(:hover),
.tab-close-button[visuallyselected]:not(:hover) {

View File

@ -8,7 +8,6 @@
%filter substitution
%define forwardTransitionLength 150ms
%define conditionalForwardWithUrlbar window:not([chromehidden~="toolbar"]) #urlbar-wrapper
%define conditionalForwardWithUrlbarWidth 32
%define toolbarButtonPressed :hover:active:not([disabled="true"]):not([cui-areatype="menu-panel"])
%define windowButtonMarginTop 11px
@ -21,6 +20,8 @@
--tabs-toolbar-color: #333;
--backbutton-urlbar-overlap: 6px;
/* icon width + border + horizontal padding (includes the overlap from backbutton-urlbar-overlap) */
--forwardbutton-width: 32px;
--toolbarbutton-hover-background: hsla(0,0%,100%,.1) linear-gradient(hsla(0,0%,100%,.3), hsla(0,0%,100%,.1)) padding-box;
--toolbarbutton-hover-bordercolor: hsla(0,0%,0%,.2);
@ -1371,7 +1372,7 @@ toolbar .toolbarbutton-1 > .toolbarbutton-menubutton-button {
}
@conditionalForwardWithUrlbar@ > #forward-button[disabled] {
margin-left: -@conditionalForwardWithUrlbarWidth@px;
margin-left: calc(0px - var(--forwardbutton-width));
}
@conditionalForwardWithUrlbar@:hover:not([switchingtabs]) > #forward-button[disabled] {
@ -1381,7 +1382,7 @@ toolbar .toolbarbutton-1 > .toolbarbutton-menubutton-button {
@conditionalForwardWithUrlbar@:not(:hover) > #forward-button[disabled] {
/* when not hovered anymore, trigger a new transition to hide the forward button immediately */
margin-left: -@conditionalForwardWithUrlbarWidth@.01px;
margin-left: calc(-0.01px - var(--forwardbutton-width));
}
.unified-nav-back[_moz-menuactive]:-moz-locale-dir(ltr),

View File

@ -41,6 +41,18 @@
#forward-button {
-moz-border-start: none !important;
/* browser.css and friends set up the width of the button to be 32px.
* They then set margin-left to -2px to ensure the button is not too wide
* compared to the back button, and set padding-left to center the icon
* correctly.
* In our theme, the back and forward buttons are the same width, with the
* back button being 32px with 1px border on both sides. To ensure the
* forward button's content box looks like it is the same size with width
* set to 32px and a 1px border on only 1 side, we overlap by 1px, so both
* buttons end up with a content box that looks like it's 30px.
*/
margin-left: -1px;
padding-left: 1px;
}
#forward-button > .toolbarbutton-icon {

View File

@ -222,11 +222,12 @@ treecol {
/* Privacy pane */
#doNotTrackInfo,
.doNotTrackLearnMore,
#trackingProtectionPBMLearnMore,
#trackingProtectionLearnMore {
-moz-margin-start: 1.5em !important;
margin-top: 0;
font-weight: normal;
}
/* Collapse the non-active vboxes in decks to use only the height the

View File

@ -20,6 +20,9 @@
--backbutton-urlbar-overlap: 6px;
/* icon width + border + horizontal padding (includes the overlap from backbutton-urlbar-overlap) */
--forwardbutton-width: 31px;
--toolbarbutton-vertical-inner-padding: 2px;
--toolbarbutton-vertical-outer-padding: 8px;
@ -939,9 +942,7 @@ toolbar[brighttext] .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
border-radius: 0 !important;
padding-left: calc(var(--backbutton-urlbar-overlap) + 3px) !important;
padding-right: 3px !important;
% icon width + border + horizontal padding without --backbutton-urlbar-overlap
%define forwardButtonWidth 25
max-width: calc(@forwardButtonWidth@px + var(--backbutton-urlbar-overlap)) !important;
max-width: var(--forwardbutton-width) !important;
}
@conditionalForwardWithUrlbar@:not([switchingtabs]) > #forward-button {
@ -949,7 +950,7 @@ toolbar[brighttext] .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
}
@conditionalForwardWithUrlbar@ > #forward-button[disabled] {
margin-left: calc(-@forwardButtonWidth@px - var(--backbutton-urlbar-overlap));
margin-left: calc(0px - var(--forwardbutton-width));
}
@conditionalForwardWithUrlbar@:hover:not([switchingtabs]) > #forward-button[disabled] {
@ -959,7 +960,7 @@ toolbar[brighttext] .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
@conditionalForwardWithUrlbar@:not(:hover) > #forward-button[disabled] {
/* when not hovered anymore, trigger a new transition to hide the forward button immediately */
margin-left: calc(-@forwardButtonWidth@.01px - var(--backbutton-urlbar-overlap));
margin-left: calc(-0.01px - var(--forwardbutton-width));
}
#back-button {

View File

@ -4,6 +4,10 @@
%include ../shared/devedition.inc.css
:root {
--forwardbutton-width: 29px;
}
:root[devtoolstheme="dark"],
:root[devtoolstheme="light"] {
/* Matches the #browser-border-start, #browser-border-end color */

View File

@ -1200,7 +1200,11 @@ void DiagnosticsMatcher::TrivialCtorDtorChecker::run(
"class %0 must have trivial constructors and destructors");
const CXXRecordDecl *node = Result.Nodes.getNodeAs<CXXRecordDecl>("node");
bool badCtor = !node->hasTrivialDefaultConstructor();
// We need to accept non-constexpr trivial constructors as well. This occurs
// when a struct contains pod members, which will not be initialized. As
// constexpr values are initialized, the constructor is non-constexpr.
bool badCtor = !(node->hasConstexprDefaultConstructor() ||
node->hasTrivialDefaultConstructor());
bool badDtor = !node->hasTrivialDestructor();
if (badCtor || badDtor)
Diag.Report(node->getLocStart(), errorID) << node;

View File

@ -5,6 +5,15 @@ struct MOZ_TRIVIAL_CTOR_DTOR EmptyClass{};
template <class T>
struct MOZ_TRIVIAL_CTOR_DTOR TemplateEmptyClass{};
struct MOZ_TRIVIAL_CTOR_DTOR NonEmptyClass {
void *m;
};
template <class T>
struct MOZ_TRIVIAL_CTOR_DTOR TemplateNonEmptyClass {
T* m;
};
struct MOZ_TRIVIAL_CTOR_DTOR BadUserDefinedCtor { // expected-error {{class 'BadUserDefinedCtor' must have trivial constructors and destructors}}
BadUserDefinedCtor() {}
};
@ -17,7 +26,7 @@ struct MOZ_TRIVIAL_CTOR_DTOR BadVirtualDtor { // expected-error {{class 'BadVirt
virtual ~BadVirtualDtor() {}
};
struct MOZ_TRIVIAL_CTOR_DTOR BadVirtualMember { // expected-error {{class 'BadVirtualMember' must have trivial constructors and destructors}}
struct MOZ_TRIVIAL_CTOR_DTOR OkVirtualMember {
virtual void f();
};
@ -53,6 +62,22 @@ struct MOZ_TRIVIAL_CTOR_DTOR BadNonTrivialDtorInMember { // expected-error {{cla
NonTrivialDtor m;
};
struct MOZ_TRIVIAL_CTOR_DTOR BadVirtualMemberInMember { // expected-error {{class 'BadVirtualMemberInMember' must have trivial constructors and destructors}}
struct MOZ_TRIVIAL_CTOR_DTOR OkVirtualMemberInMember {
VirtualMember m;
};
struct MOZ_TRIVIAL_CTOR_DTOR OkConstExprConstructor {
constexpr OkConstExprConstructor() {}
};
struct MOZ_TRIVIAL_CTOR_DTOR OkConstExprConstructorInMember {
OkConstExprConstructor m;
};
// XXX: This error is unfortunate, but is unlikely to come up in real code.
// In this situation, it should be possible to define a constexpr constructor
// which explicitly initializes the members.
struct MOZ_TRIVIAL_CTOR_DTOR BadUnfortunateError { // expected-error {{class 'BadUnfortunateError' must have trivial constructors and destructors}}
OkConstExprConstructor m;
void *n;
};

View File

@ -5725,6 +5725,7 @@ MOZ_DIRECTX_SDK_PATH=
MOZ_D3DCOMPILER_XP_DLL=
MOZ_D3DCOMPILER_XP_CAB=
if test "$COMPILE_ENVIRONMENT" ; then
case "$target_os" in
*mingw*)
MOZ_ANGLE_RENDERER=1
@ -5887,7 +5888,9 @@ if test -n "$MOZ_ANGLE_RENDERER"; then
AC_MSG_ERROR([ Install Windows SDK 8.0+, as well as DirectX SDK (June 2010 version or newer), or reconfigure without this flag.])
fi
fi
fi
fi # MOZ_ANGLE_RENDERER
fi # COMPILE_ENVIRONMENT
dnl ========================================================
@ -6280,41 +6283,49 @@ dnl minimum minor version of Unicode NSIS isn't in the path
dnl (unless in case of cross compiling, for which Unicode
dnl is not yet sufficient).
if test "$OS_ARCH" = "WINNT"; then
MIN_NSIS_MAJOR_VER=2
MIN_NSIS_MINOR_VER=46
MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensis-3.0b1.exe makensisu-3.0a2.exe makensisu-2.46.exe makensis)
MIN_NSIS_MAJOR_VER=3
MIN_NSIS_MINOR_VER=0
MIN_NSIS_PRERELEASE_TYPE=b
MIN_NSIS_PRERELEASE_VER=1
MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensis-3.0b3.exe makensis-3.0b1.exe makensis)
if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
AC_MSG_RESULT([yes])
MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null`
changequote(,)
MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'`
changequote([,])
if test "$MAKENSISU_PARSED_VER" = ""; then
changequote(,)
MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'`
changequote([,])
fi
MAKENSISU_MAJOR_VER=0
MAKENSISU_MINOR_VER=0
MAKENSISU_PRERELEASE_TYPE=$MIN_NSIS_PRERELEASE_TYPE
MAKENSISU_PRERELEASE_VER=$MIN_NSIS_PRERELEASE_VER
if test ! "$MAKENSISU_PARSED_VER" = ""; then
MAKENSISU_MAJOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $1 }'`
MAKENSISU_MINOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $2 }'`
changequote(,)
MAKENSISU_PARSED_PRERELEASE=`echo "$MAKENSISU_VER" | sed -e 's/^v[0-9]\+\.[0-9]\+\([^0-9]\+\)\([0-9]\+\).*$/\1.\2/g'`
changequote([,])
if test ! "$MAKENSISU_PARSED_PRERELEASE" = "$MAKENSISU_VER"; then
MAKENSISU_PRERELEASE_TYPE=`echo $MAKENSISU_PARSED_PRERELEASE | $AWK -F\. '{ print $1 }'`
MAKENSISU_PRERELEASE_VER=`echo $MAKENSISU_PARSED_PRERELEASE | $AWK -F\. '{ print $2 }'`
fi
fi
AC_MSG_CHECKING([for Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater])
AC_MSG_CHECKING([for NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER$MIN_NSIS_PRERELEASE_TYPE$MIN_NSIS_PRERELEASE_VER or greater])
if test "$MAKENSISU_MAJOR_VER" -eq $MIN_NSIS_MAJOR_VER -a \
"$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER ||
test "$MAKENSISU_MAJOR_VER" -gt $MIN_NSIS_MAJOR_VER; then
"$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER -a \
"$MAKENSISU_PRERELEASE_TYPE" = "$MIN_NSIS_PRERELEASE_TYPE" -a \
"$MAKENSISU_PRERELEASE_VER" -ge $MIN_NSIS_PRERELEASE_VER; then
AC_MSG_RESULT([yes])
AC_MSG_RESULT([Found NSIS Version: $MAKENSISU_VER])
else
AC_MSG_RESULT([no])
if test -z "$CROSS_COMPILE"; then
AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater in your path.])
AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER$MIN_NSIS_PRERELEASE_TYPE$MIN_NSIS_PRERELEASE_VER or greater in your path.])
else
MAKENSISU=
fi
fi
elif test -z "$CROSS_COMPILE"; then
AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater in your path.])
AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER$MIN_NSIS_PRERELEASE_TYPE$MIN_NSIS_PRERELEASE_VER or greater in your path.])
else
MAKENSISU=
fi
@ -8146,11 +8157,14 @@ if test "$MOZ_TREE_CAIRO"; then
MOZ_ENABLE_D2D_SURFACE=1
MOZ_ENABLE_DWRITE_FONT=1
MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
if test "$COMPILE_ENVIRONMENT"; then
dnl D3D10 Layers depend on D2D Surfaces.
if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
dnl D3D10 Layers depend on D2D Surfaces.
if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
fi
fi
;;
esac

View File

@ -1,6 +1,7 @@
content devtools client/
skin devtools classic/1.0 client/themes/
resource devtools .
locale devtools en-US client/locales/en-US/
content webide client/webide/content/
skin webide classic/1.0 client/webide/themes/

View File

@ -126,6 +126,67 @@ function* spawnTest() {
exec: {
output: 'Test Plug-in 1.0.0.0 enabled.'
}
},
{
setup: 'addon ctp Test_Plug-in_1.0.0.0',
check: {
input: 'addon ctp Test_Plug-in_1.0.0.0',
hints: '',
markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
status: 'VALID',
args: {
command: { name: 'addon ctp' },
addon: {
value: function(addon) {
is(addon.name, 'Test Plug-in', 'test plugin name');
},
status: 'VALID'
}
}
},
exec: {
output: 'Test Plug-in 1.0.0.0 set to click-to-play.'
}
},
{
setup: 'addon ctp OpenH264_Video_Codec_provided_by_Cisco_Systems,_Inc._null',
check: {
input: 'addon ctp OpenH264_Video_Codec_provided_by_Cisco_Systems,_Inc._null',
hints: '',
status: 'VALID',
args: {
command: { name: 'addon ctp' },
addon: {
value: function(addon) {
is(addon.name, 'OpenH264 Video Codec provided by Cisco Systems, Inc.', 'openh264');
},
status: 'VALID'
}
}
},
exec: {
output: 'OpenH264 Video Codec provided by Cisco Systems, Inc. null cannot be set to click-to-play.'
}
},
{
setup: 'addon ctp Mochitest_1.0',
check: {
input: 'addon ctp Mochitest_1.0',
hints: '',
status: 'VALID',
args: {
command: { name: 'addon ctp' },
addon: {
value: function(addon) {
is(addon.name, 'Mochitest', 'mochitest');
},
status: 'VALID'
}
}
},
exec: {
output: 'Mochitest 1.0 cannot be set to click-to-play because it is not a plugin.'
}
}
]);

View File

@ -1,54 +0,0 @@
"use strict";
var SOURCE_URL = getFileUrl("setBreakpoint-on-line-with-no-offests-in-gcd-script.js");
function run_test() {
return Task.spawn(function* () {
do_test_pending();
let global = testGlobal("test");
loadSubScript(SOURCE_URL, global);
Cu.forceGC();
DebuggerServer.registerModule("xpcshell-test/testactors");
DebuggerServer.init(() => true);
DebuggerServer.addTestGlobal(global);
let client = new DebuggerClient(DebuggerServer.connectPipe());
yield connect(client);
let tab = yield findTab(client, "test");
let [, tabClient] = yield attachTab(client, tab);
let [, threadClient] = yield attachThread(tabClient);
yield resume(threadClient);
let source = yield findSource(threadClient, SOURCE_URL);
let sourceClient = threadClient.source(source);
let location = { line: 7 };
let [packet, breakpointClient] = yield setBreakpoint(sourceClient, location);
do_check_true(packet.isPending);
executeSoon(function () {
reload(tabClient).then(function () {
loadSubScript(SOURCE_URL, global);
});
});
packet = yield waitForPaused(threadClient);
do_check_eq(packet.type, "paused");
let why = packet.why;
do_check_eq(why.type, "breakpoint");
do_check_eq(why.actors.length, 1);
do_check_eq(why.actors[0], breakpointClient.actor);
let frame = packet.frame;
let where = frame.where;
do_check_eq(where.source.actor, source.actor);
do_check_eq(where.line, location.line + 1);
let variables = frame.environment.bindings.variables;
do_check_eq(variables.a.value, 1);
do_check_eq(variables.c.value.type, "undefined");
yield resume(threadClient);
yield close(client);
do_test_finished();
});
}

View File

@ -189,10 +189,17 @@ exports.executeSoon = function executeSoon(aFn) {
if (isWorker) {
setImmediate(aFn);
} else {
let stack = components.stack;
let executor = () => {
Cu.callFunctionWithAsyncStack(aFn, stack, "DevToolsUtils.executeSoon");
};
let executor;
// Only enable async stack reporting when DEBUG_JS_MODULES is set
// (customized local builds) to avoid a performance penalty.
if (AppConstants.DEBUG_JS_MODULES || exports.testing) {
let stack = components.stack;
executor = () => {
Cu.callFunctionWithAsyncStack(aFn, stack, "DevToolsUtils.executeSoon");
};
} else {
executor = aFn;
}
Services.tm.mainThread.dispatch({
run: exports.makeInfallible(executor)
}, Ci.nsIThread.DISPATCH_NORMAL);

View File

@ -279,6 +279,41 @@ var items = [
return l10n.lookupFormat("addonAlreadyDisabled", [ name ]);
}
},
{
item: "command",
runAt: "client",
name: "addon ctp",
description: l10n.lookup("addonCtpDesc"),
params: [
{
name: "addon",
type: "addon",
description: l10n.lookup("addonNameDesc")
}
],
exec: function(args, context) {
let name = (args.addon.name + " " + args.addon.version).trim();
if (args.addon.type !== "plugin") {
return l10n.lookupFormat("addonCantCtp", [ name ]);
}
if (!args.addon.userDisabled ||
args.addon.userDisabled === true) {
args.addon.userDisabled = AddonManager.STATE_ASK_TO_ACTIVATE;
if (args.addon.userDisabled !== AddonManager.STATE_ASK_TO_ACTIVATE) {
// Some plugins (e.g. OpenH264 shipped with Firefox) cannot be set to
// click-to-play. Handle this.
return l10n.lookupFormat("addonNoCtp", [ name ]);
}
return l10n.lookupFormat("addonCtp", [ name ]);
}
return l10n.lookupFormat("addonAlreadyCtp", [ name ]);
}
}
];

View File

@ -836,6 +836,30 @@ addonAlreadyDisabled=%S is already disabled.
# command when an add-on is disabled.
addonDisabled=%S disabled.
# LOCALIZATION NOTE (addonCtpDesc) A very short description of the
# 'addon ctp <type>' command. This string is designed to be shown in a menu
# alongside the command name, which is why it should be as short as possible.
addonCtpDesc=Set the specified plugin to click-to-play.
# LOCALIZATION NOTE (addonCtp) Used in the output of the 'addon ctp'
# command when a plugin is set to click-to-play.
addonCtp=%S set to click-to-play.
# LOCALIZATION NOTE (addonAlreadyCtp) Used in the output of the
# 'addon ctp' command when an attempt is made to set a plugin to
# click-to-play that is already set to click-to-play.
addonAlreadyCtp=%S is already set to click-to-play.
# LOCALIZATION NOTE (addonCantCtp) Used in the output of the 'addon
# ctp' command when an attempt is made to set an addon to click-to-play,
# but the addon is not a plugin.
addonCantCtp=%S cannot be set to click-to-play because it is not a plugin.
# LOCALIZATION NOTE (addonNoCtp) Used in the output of the 'addon
# ctp' command when an attempt is made to set an addon to click-to-play,
# but the plugin cannot be set to click-to-play for some reason.
addonNoCtp=%S cannot be set to click-to-play.
# LOCALIZATION NOTE (exportDesc) A very short description of the 'export'
# command. This string is designed to be shown in a menu alongside the command
# name, which is why it should be as short as possible.

View File

@ -7,6 +7,11 @@ var Cr = Components.results;
var {require} = Cu.import("resource://devtools/shared/Loader.jsm");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
DevToolsUtils.testing = true;
do_register_cleanup(() => {
DevToolsUtils.testing = false;
});
// Register a console listener, so console messages don't just disappear
// into the ether.

View File

@ -1271,6 +1271,13 @@ public:
return JS::AsmJSCache_Success;
}
void Cleanup()
{
#ifdef DEBUG
NoteActorDestroyed();
#endif
}
private:
~ChildRunnable()
{
@ -1329,7 +1336,7 @@ private:
ActorDestroy(ActorDestroyReason why) override
{
MOZ_ASSERT(NS_IsMainThread());
mActorDestroyed = true;
NoteActorDestroyed();
}
void
@ -1368,6 +1375,11 @@ private:
mCondVar.Notify();
}
void NoteActorDestroyed()
{
mActorDestroyed = true;
}
nsIPrincipal* const mPrincipal;
nsAutoPtr<PrincipalInfo> mPrincipalInfo;
WriteParams mWriteParams;
@ -1553,6 +1565,7 @@ OpenFile(nsIPrincipal* aPrincipal,
JS::AsmJSCacheResult openResult =
childRunnable->BlockUntilOpen(aChildRunnable);
if (openResult != JS::AsmJSCache_Success) {
childRunnable->Cleanup();
return openResult;
}

View File

@ -957,6 +957,32 @@ BlobImplFile::LookupAndCacheIsDirectory()
mDirState = isDir ? BlobDirState::eIsDir : BlobDirState::eIsNotDir;
}
////////////////////////////////////////////////////////////////////////////
// BlobImplEmptyFile implementation
NS_IMPL_ISUPPORTS_INHERITED0(BlobImplEmptyFile, BlobImpl)
already_AddRefed<BlobImpl>
BlobImplEmptyFile::CreateSlice(uint64_t aStart, uint64_t aLength,
const nsAString& aContentType,
ErrorResult& aRv)
{
MOZ_ASSERT(!aStart && !aLength);
RefPtr<BlobImpl> impl = new BlobImplEmptyFile(aContentType);
return impl.forget();
}
void
BlobImplEmptyFile::GetInternalStream(nsIInputStream** aStream,
ErrorResult& aRv)
{
nsresult rv = NS_NewCStringInputStream(aStream, EmptyCString());
if (NS_WARN_IF(NS_FAILED(rv))) {
aRv.Throw(rv);
return;
}
}
////////////////////////////////////////////////////////////////////////////
// BlobImplMemory implementation

View File

@ -833,6 +833,31 @@ private:
bool mIsTemporary;
};
class BlobImplEmptyFile final : public BlobImplBase
{
public:
NS_DECL_ISUPPORTS_INHERITED
explicit BlobImplEmptyFile(const nsAString& aContentType)
: BlobImplBase(EmptyString(), aContentType, 0 /* aLength */)
{}
virtual void GetInternalStream(nsIInputStream** aStream,
ErrorResult& aRv) override;
virtual already_AddRefed<BlobImpl>
CreateSlice(uint64_t aStart, uint64_t aLength,
const nsAString& aContentType, ErrorResult& aRv) override;
virtual bool IsMemoryFile() const override
{
return true;
}
private:
~BlobImplEmptyFile() {}
};
} // namespace dom
} // namespace mozilla

View File

@ -179,6 +179,8 @@ FormData::Has(const nsAString& aName)
nsresult
FormData::AddNameFilePair(const nsAString& aName, File* aFile)
{
MOZ_ASSERT(aFile);
FormDataTuple* data = mFormData.AppendElement();
SetNameFilePair(data, aName, aFile);
return NS_OK;
@ -272,12 +274,10 @@ FormData::SetNameFilePair(FormDataTuple* aData,
File* aFile)
{
MOZ_ASSERT(aData);
MOZ_ASSERT(aFile);
aData->name = aName;
if (aFile) {
aData->value.SetAsFile() = aFile;
} else {
aData->value.SetAsUSVString() = EmptyString();
}
aData->value.SetAsFile() = aFile;
}
// -------------------------------------------------------------------------
@ -364,7 +364,7 @@ FormData::GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength,
fs.AddNameValuePair(mFormData[i].name,
mFormData[i].value.GetAsUSVString());
} else {
fs.AddNameFilePair(mFormData[i].name, nullptr);
MOZ_CRASH("This should no be possible.");
}
}

View File

@ -7659,7 +7659,7 @@ nsContentUtils::ToWidgetPoint(const CSSPoint& aPoint,
{
return LayoutDeviceIntPoint::FromAppUnitsRounded(
(CSSPoint::ToAppUnits(aPoint) +
aOffset).ApplyResolution(aPresContext->PresShell()->GetCumulativeNonRootScaleResolution()),
aOffset).ApplyResolution(nsLayoutUtils::GetCurrentAPZResolutionScale(aPresContext->PresShell())),
aPresContext->AppUnitsPerDevPixel());
}

View File

@ -3755,8 +3755,8 @@ nsIDocument::ShouldThrottleFrameRequests()
return false;
}
if (!mIsShowing) {
// We're not showing (probably in a background tab or the bf cache).
if (Hidden()) {
// We're not visible (probably in a background tab or the bf cache).
return true;
}

View File

@ -258,7 +258,7 @@ protected:
void TraceWrapper(JSTracer* aTrc, const char* name)
{
if (mWrapper) {
JS_CallUnbarrieredObjectTracer(aTrc, &mWrapper, name);
js::UnsafeTraceManuallyBarrieredEdge(aTrc, &mWrapper, name);
}
}

View File

@ -14,7 +14,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=789315
<form id="a"><input name="b" type="file"/></form>
<script type="text/javascript">
is(new FormData(document.getElementById('a')).get('b'), "", "This should return an empty string.");
var obj = new FormData(document.getElementById('a')).get('b');
ok(obj instanceof File, "This should return an empty File");
is(obj.size, 0, "Size should be 0");
is(obj.name, "", "Name should be an empty string");
is(obj.type, "application/octet-stream", "Type should be application/octet-stream");
var o = obj.slice(10, 100, "foo/bar");
is(o.size, 0, "The new blob has size 0");
is(o.type, "foo/bar", "The new blob has type foo/bar");
</script>
</body>

View File

@ -2095,7 +2095,7 @@ class SequenceTracer<JSObject*, false, false, false>
public:
static void TraceSequence(JSTracer* trc, JSObject** objp, JSObject** end) {
for (; objp != end; ++objp) {
JS_CallUnbarrieredObjectTracer(trc, objp, "sequence<object>");
JS::UnsafeTraceRoot(trc, objp, "sequence<object>");
}
}
};
@ -2109,7 +2109,7 @@ class SequenceTracer<JS::Value, false, false, false>
public:
static void TraceSequence(JSTracer* trc, JS::Value* valp, JS::Value* end) {
for (; valp != end; ++valp) {
JS_CallUnbarrieredValueTracer(trc, valp, "sequence<any>");
JS::UnsafeTraceRoot(trc, valp, "sequence<any>");
}
}
};

View File

@ -9620,7 +9620,7 @@ class CGUnionStruct(CGThing):
if t.isObject():
traceCases.append(
CGCase("e" + vars["name"],
CGGeneric('JS_CallUnbarrieredObjectTracer(trc, %s, "%s");\n' %
CGGeneric('JS::UnsafeTraceRoot(trc, %s, "%s");\n' %
("&mValue.m" + vars["name"] + ".Value()",
"mValue.m" + vars["name"]))))
elif t.isDictionary():
@ -12603,12 +12603,12 @@ class CGDictionary(CGThing):
memberLoc)
if type.isObject():
trace = CGGeneric('JS_CallUnbarrieredObjectTracer(trc, %s, "%s");\n' %
trace = CGGeneric('JS::UnsafeTraceRoot(trc, %s, "%s");\n' %
("&"+memberData, memberName))
if type.nullable():
trace = CGIfWrapper(trace, memberData)
elif type.isAny():
trace = CGGeneric('JS_CallUnbarrieredValueTracer(trc, %s, "%s");\n' %
trace = CGGeneric('JS::UnsafeTraceRoot(trc, %s, "%s");\n' %
("&"+memberData, memberName))
elif (type.isSequence() or type.isDictionary() or
type.isSpiderMonkeyInterface() or type.isUnion()):

View File

@ -45,10 +45,10 @@ public:
inline void TraceSelf(JSTracer* trc)
{
if (mTypedObj) {
JS_CallUnbarrieredObjectTracer(trc, &mTypedObj, "TypedArray.mTypedObj");
JS::UnsafeTraceRoot(trc, &mTypedObj, "TypedArray.mTypedObj");
}
if (mWrappedObj) {
JS_CallUnbarrieredObjectTracer(trc, &mTypedObj, "TypedArray.mWrappedObj");
JS::UnsafeTraceRoot(trc, &mTypedObj, "TypedArray.mWrappedObj");
}
}

View File

@ -287,6 +287,20 @@ WebGL2Context::GetQuery(GLenum target, GLenum pname)
return tmp.forget();
}
static bool
ValidateQueryEnum(WebGLContext* webgl, GLenum pname, const char* info)
{
switch (pname) {
case LOCAL_GL_QUERY_RESULT_AVAILABLE:
case LOCAL_GL_QUERY_RESULT:
return true;
default:
webgl->ErrorInvalidEnum("%s: invalid pname: %s", info, webgl->EnumName(pname));
return false;
}
}
void
WebGL2Context::GetQueryParameter(JSContext*, WebGLQuery* query, GLenum pname,
JS::MutableHandleValue retval)
@ -296,6 +310,9 @@ WebGL2Context::GetQueryParameter(JSContext*, WebGLQuery* query, GLenum pname,
if (IsContextLost())
return;
if (!ValidateQueryEnum(this, pname, "getQueryParameter"))
return;
if (!query) {
/* OpenGL ES 3.0 spec 6.1.7 (spec getQueryObject 1):
* If id is not the name of a query object, or if the query object
@ -330,6 +347,9 @@ WebGL2Context::GetQueryParameter(JSContext*, WebGLQuery* query, GLenum pname,
// We must wait for an event loop before the query can be available
if (!query->mCanBeAvailable && !gfxPrefs::WebGLImmediateQueries()) {
if (pname == LOCAL_GL_QUERY_RESULT_AVAILABLE) {
retval.set(JS::BooleanValue(false));
}
return;
}

View File

@ -125,7 +125,7 @@ WebGL2Context::GetSyncParameter(JSContext*, WebGLSync* sync, GLenum pname, JS::M
MakeContextCurrent();
gl->fGetSynciv(sync->mGLName, pname, 1, nullptr, &result);
retval.set(JS::Int32Value(result));
break;
return;
}
ErrorInvalidEnum("getSyncParameter: Invalid pname 0x%04x", pname);

View File

@ -933,7 +933,7 @@ Event::GetScreenCoords(nsPresContext* aPresContext,
LayoutDevicePixel::ToAppUnits(aPoint, aPresContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom());
if (aPresContext->PresShell()) {
pt = pt.RemoveResolution(aPresContext->PresShell()->GetCumulativeNonRootScaleResolution());
pt = pt.RemoveResolution(nsLayoutUtils::GetCurrentAPZResolutionScale(aPresContext->PresShell()));
}
pt += LayoutDevicePixel::ToAppUnits(guiEvent->widget->WidgetToScreenOffset(),

View File

@ -5593,9 +5593,10 @@ HTMLInputElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
}
if (files.IsEmpty()) {
// If no file was selected, pretend we had an empty file with an
// empty filename.
aFormSubmission->AddNameFilePair(name, nullptr);
RefPtr<BlobImpl> blobImpl =
new BlobImplEmptyFile(NS_LITERAL_STRING("application/octet-stream"));
RefPtr<File> file = File::Create(OwnerDoc()->GetInnerWindow(), blobImpl);
aFormSubmission->AddNameFilePair(name, file);
}
return NS_OK;

View File

@ -167,15 +167,15 @@ nsresult
nsFSURLEncoded::AddNameFilePair(const nsAString& aName,
File* aFile)
{
MOZ_ASSERT(aFile);
if (!mWarnedFileControl) {
SendJSWarning(mDocument, "ForgotFileEnctypeWarning", nullptr, 0);
mWarnedFileControl = true;
}
nsAutoString filename;
if (aFile) {
aFile->GetName(filename);
}
aFile->GetName(filename);
return AddNameValuePair(aName, filename);
}
@ -441,61 +441,60 @@ nsresult
nsFSMultipartFormData::AddNameFilePair(const nsAString& aName,
File* aFile)
{
MOZ_ASSERT(aFile);
// Encode the control name
nsAutoCString nameStr;
nsresult rv = EncodeVal(aName, nameStr, true);
NS_ENSURE_SUCCESS(rv, rv);
nsCString filename, contentType;
nsAutoString filename16;
aFile->GetName(filename16);
ErrorResult error;
nsAutoString filepath16;
aFile->GetPath(filepath16, error);
if (NS_WARN_IF(error.Failed())) {
return error.StealNSResult();
}
if (!filepath16.IsEmpty()) {
// File.path includes trailing "/"
filename16 = filepath16 + filename16;
}
nsAutoCString filename;
rv = EncodeVal(filename16, filename, true);
NS_ENSURE_SUCCESS(rv, rv);
// Get content type
nsAutoString contentType16;
aFile->GetType(contentType16);
if (contentType16.IsEmpty()) {
contentType16.AssignLiteral("application/octet-stream");
}
nsAutoCString contentType;
contentType.Adopt(nsLinebreakConverter::
ConvertLineBreaks(NS_ConvertUTF16toUTF8(contentType16).get(),
nsLinebreakConverter::eLinebreakAny,
nsLinebreakConverter::eLinebreakSpace));
// Get input stream
nsCOMPtr<nsIInputStream> fileStream;
if (aFile) {
nsAutoString filename16;
aFile->GetName(filename16);
aFile->GetInternalStream(getter_AddRefs(fileStream), error);
if (NS_WARN_IF(error.Failed())) {
return error.StealNSResult();
}
ErrorResult error;
nsAutoString filepath16;
aFile->GetPath(filepath16, error);
if (NS_WARN_IF(error.Failed())) {
return error.StealNSResult();
}
if (!filepath16.IsEmpty()) {
// File.path includes trailing "/"
filename16 = filepath16 + filename16;
}
rv = EncodeVal(filename16, filename, true);
if (fileStream) {
// Create buffered stream (for efficiency)
nsCOMPtr<nsIInputStream> bufferedStream;
rv = NS_NewBufferedInputStream(getter_AddRefs(bufferedStream),
fileStream, 8192);
NS_ENSURE_SUCCESS(rv, rv);
// Get content type
nsAutoString contentType16;
aFile->GetType(contentType16);
if (contentType16.IsEmpty()) {
contentType16.AssignLiteral("application/octet-stream");
}
contentType.Adopt(nsLinebreakConverter::
ConvertLineBreaks(NS_ConvertUTF16toUTF8(contentType16).get(),
nsLinebreakConverter::eLinebreakAny,
nsLinebreakConverter::eLinebreakSpace));
// Get input stream
aFile->GetInternalStream(getter_AddRefs(fileStream), error);
if (NS_WARN_IF(error.Failed())) {
return error.StealNSResult();
}
if (fileStream) {
// Create buffered stream (for efficiency)
nsCOMPtr<nsIInputStream> bufferedStream;
rv = NS_NewBufferedInputStream(getter_AddRefs(bufferedStream),
fileStream, 8192);
NS_ENSURE_SUCCESS(rv, rv);
fileStream = bufferedStream;
}
}
else {
contentType.AssignLiteral("application/octet-stream");
fileStream = bufferedStream;
}
//
@ -619,9 +618,7 @@ nsFSTextPlain::AddNameFilePair(const nsAString& aName,
File* aFile)
{
nsAutoString filename;
if (aFile) {
aFile->GetName(filename);
}
aFile->GetName(filename);
AddNameValuePair(aName, filename);
return NS_OK;

View File

@ -258,7 +258,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=523771
<p>
File input:
<input type=file name="file_1" class="setfile">
<input type=file name="file_2" class="setfile empty">
<input type=file name="file_2">
<input type=file name="" class="setfile">
<input type=file name="">
<input type=file class="setfile">
@ -268,7 +268,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=523771
Multifile input:
<input multiple type=file name="file_3" class="setfile">
<input multiple type=file name="file_4" class="setfile multi">
<input multiple type=file name="file_5" class="setfile empty">
<input multiple type=file name="file_5">
<input multiple type=file name="" class="setfile">
<input multiple type=file name="" class="setfile multi">
<input multiple type=file name="">
@ -426,7 +426,6 @@ function onFilesOpened(files) {
let singleFile = textFile;
let multiFile = [textFile, imageFile];
emptyFile = new File([], "", { type: "application/octet-stream" });
var addList = document.getElementsByClassName("setfile");
let i = 0;
@ -434,8 +433,6 @@ function onFilesOpened(files) {
while (input = addList[i++]) {
if (input.classList.contains("multi")) {
SpecialPowers.wrap(input).mozSetFileArray(multiFile);
} else if (input.classList.contains("empty")) {
SpecialPowers.wrap(input).mozSetFileArray([emptyFile]);
} else {
SpecialPowers.wrap(input).mozSetFileArray([singleFile]);
}
@ -449,6 +446,7 @@ function onFilesOpened(files) {
myFile2 = input.files[1];
is(myFile1.size, 20, "File1 size");
is(myFile2.size, 2711, "File2 size");
emptyFile = { name: "", type: "application/octet-stream" };
// Now, actually run the tests; see below.
onFilesSet();

View File

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set sw=4 ts=8 et tw=80 : */
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
@ -618,7 +618,26 @@ ContentChild::Init(MessageLoop* aIOLoop,
IPC::Channel* aChannel)
{
#ifdef MOZ_WIDGET_GTK
gtk_init(nullptr, nullptr);
// We need to pass a display down to gtk_init because it's not going to
// use the one from the environment on its own when deciding which backend
// to use, and when starting under XWayland, it may choose to start with
// the wayland backend instead of the x11 backend.
// The DISPLAY environment variable is normally set by the parent process.
char* display_name = PR_GetEnv("DISPLAY");
if (display_name) {
int argc = 3;
char option_name[] = "--display";
char* argv[] = {
nullptr,
option_name,
display_name,
nullptr
};
char** argvp = argv;
gtk_init(&argc, &argvp);
} else {
gtk_init(nullptr, nullptr);
}
#endif
#ifdef MOZ_WIDGET_QT
@ -1572,7 +1591,7 @@ ContentChild::AllocPBlobChild(const BlobConstructorParams& aParams)
mozilla::PRemoteSpellcheckEngineChild *
ContentChild::AllocPRemoteSpellcheckEngineChild()
{
NS_NOTREACHED("Default Constructor for PRemoteSpellcheckEngineChild should never be called");
MOZ_CRASH("Default Constructor for PRemoteSpellcheckEngineChild should never be called");
return nullptr;
}
@ -1599,7 +1618,7 @@ ContentChild::SendPBlobConstructor(PBlobChild* aActor,
PPresentationChild*
ContentChild::AllocPPresentationChild()
{
NS_NOTREACHED("We should never be manually allocating PPresentationChild actors");
MOZ_CRASH("We should never be manually allocating PPresentationChild actors");
return nullptr;
}
@ -1704,7 +1723,7 @@ ContentChild::SendPIccConstructor(PIccChild* aActor,
PIccChild*
ContentChild::AllocPIccChild(const uint32_t& aServiceId)
{
NS_NOTREACHED("No one should be allocating PIccChild actors");
MOZ_CRASH("No one should be allocating PIccChild actors");
return nullptr;
}
@ -1760,7 +1779,7 @@ ContentChild::DeallocPDeviceStorageRequestChild(PDeviceStorageRequestChild* aDev
PFileSystemRequestChild*
ContentChild::AllocPFileSystemRequestChild(const FileSystemParams& aParams)
{
NS_NOTREACHED("Should never get here!");
MOZ_CRASH("Should never get here!");
return nullptr;
}
@ -1793,7 +1812,7 @@ PMobileConnectionChild*
ContentChild::AllocPMobileConnectionChild(const uint32_t& aClientId)
{
#ifdef MOZ_B2G_RIL
NS_NOTREACHED("No one should be allocating PMobileConnectionChild actors");
MOZ_CRASH("No one should be allocating PMobileConnectionChild actors");
return nullptr;
#else
MOZ_CRASH("No support for mobileconnection on this platform!");;
@ -1832,7 +1851,7 @@ ContentChild::AllocPPrintingChild()
// which implements PPrintingChild. Instead, the nsPrintingProxy service is
// requested and instantiated via XPCOM, and the constructor of
// nsPrintingProxy sets up the IPC connection.
NS_NOTREACHED("Should never get here!");
MOZ_CRASH("Should never get here!");
return nullptr;
}
@ -1851,7 +1870,7 @@ ContentChild::AllocPScreenManagerChild(uint32_t* aNumberOfScreens,
// nsScreenManagerProxy. Instead, the nsScreenManagerProxy
// service is requested and instantiated via XPCOM, and the
// constructor of nsScreenManagerProxy sets up the IPC connection.
NS_NOTREACHED("Should never get here!");
MOZ_CRASH("Should never get here!");
return nullptr;
}
@ -2007,7 +2026,7 @@ ContentChild::DeallocPMediaChild(media::PMediaChild *aActor)
PStorageChild*
ContentChild::AllocPStorageChild()
{
NS_NOTREACHED("We should never be manually allocating PStorageChild actors");
MOZ_CRASH("We should never be manually allocating PStorageChild actors");
return nullptr;
}
@ -3023,7 +3042,7 @@ ContentChild::RecvUpdateWindow(const uintptr_t& aChildId)
}
return true;
#else
NS_NOTREACHED("ContentChild::RecvUpdateWindow calls unexpected on this platform.");
MOZ_ASSERT(false, "ContentChild::RecvUpdateWindow calls unexpected on this platform.");
return false;
#endif
}

View File

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set sw=4 ts=8 et tw=80 : */
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */

16
dom/ipc/ContentParent.cpp Executable file → Normal file
View File

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set sw=4 ts=8 et tw=80 : */
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
@ -5433,10 +5433,14 @@ ContentParent::RecvCreateWindow(PBrowserParent* aThisTab,
// The content process should never be in charge of computing whether or
// not a window should be private or remote - the parent will do that.
MOZ_ASSERT(!(aChromeFlags & nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW));
MOZ_ASSERT(!(aChromeFlags & nsIWebBrowserChrome::CHROME_NON_PRIVATE_WINDOW));
MOZ_ASSERT(!(aChromeFlags & nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME));
MOZ_ASSERT(!(aChromeFlags & nsIWebBrowserChrome::CHROME_REMOTE_WINDOW));
const uint32_t badFlags =
nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW
| nsIWebBrowserChrome::CHROME_NON_PRIVATE_WINDOW
| nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME
| nsIWebBrowserChrome::CHROME_REMOTE_WINDOW;
if (!!(aChromeFlags & badFlags)) {
return false;
}
TabParent* thisTabParent = nullptr;
if (aThisTab) {

View File

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set sw=4 ts=8 et tw=80 : */
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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,6 +1,6 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set sw=4 ts=8 et tw=80 :
* This Source Code Form is subject to the terms of the Mozilla Public
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#include "CrashReporterParent.h"

View File

@ -867,7 +867,7 @@ TabChild::SetStatus(uint32_t aStatusType, const char16_t* aStatus)
NS_IMETHODIMP
TabChild::GetWebBrowser(nsIWebBrowser** aWebBrowser)
{
NS_NOTREACHED("TabChild::GetWebBrowser not supported in TabChild");
NS_WARNING("TabChild::GetWebBrowser not supported in TabChild");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -875,7 +875,7 @@ TabChild::GetWebBrowser(nsIWebBrowser** aWebBrowser)
NS_IMETHODIMP
TabChild::SetWebBrowser(nsIWebBrowser* aWebBrowser)
{
NS_NOTREACHED("TabChild::SetWebBrowser not supported in TabChild");
NS_WARNING("TabChild::SetWebBrowser not supported in TabChild");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -890,7 +890,7 @@ TabChild::GetChromeFlags(uint32_t* aChromeFlags)
NS_IMETHODIMP
TabChild::SetChromeFlags(uint32_t aChromeFlags)
{
NS_NOTREACHED("trying to SetChromeFlags from content process?");
NS_WARNING("trying to SetChromeFlags from content process?");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -898,7 +898,7 @@ TabChild::SetChromeFlags(uint32_t aChromeFlags)
NS_IMETHODIMP
TabChild::DestroyBrowserWindow()
{
NS_NOTREACHED("TabChild::DestroyBrowserWindow not supported in TabChild");
NS_WARNING("TabChild::DestroyBrowserWindow not supported in TabChild");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -906,7 +906,7 @@ TabChild::DestroyBrowserWindow()
NS_IMETHODIMP
TabChild::SizeBrowserTo(int32_t aCX, int32_t aCY)
{
NS_NOTREACHED("TabChild::SizeBrowserTo not supported in TabChild");
NS_WARNING("TabChild::SizeBrowserTo not supported in TabChild");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -914,7 +914,7 @@ TabChild::SizeBrowserTo(int32_t aCX, int32_t aCY)
NS_IMETHODIMP
TabChild::ShowAsModal()
{
NS_NOTREACHED("TabChild::ShowAsModal not supported in TabChild");
NS_WARNING("TabChild::ShowAsModal not supported in TabChild");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -929,7 +929,7 @@ TabChild::IsWindowModal(bool* aRetVal)
NS_IMETHODIMP
TabChild::ExitModalEventLoop(nsresult aStatus)
{
NS_NOTREACHED("TabChild::ExitModalEventLoop not supported in TabChild");
NS_WARNING("TabChild::ExitModalEventLoop not supported in TabChild");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -1001,7 +1001,7 @@ TabChild::SetVisibility(bool aVisibility)
NS_IMETHODIMP
TabChild::GetTitle(char16_t** aTitle)
{
NS_NOTREACHED("TabChild::GetTitle not supported in TabChild");
NS_WARNING("TabChild::GetTitle not supported in TabChild");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -1017,7 +1017,7 @@ TabChild::SetTitle(const char16_t* aTitle)
NS_IMETHODIMP
TabChild::GetSiteWindow(void** aSiteWindow)
{
NS_NOTREACHED("TabChild::GetSiteWindow not supported in TabChild");
NS_WARNING("TabChild::GetSiteWindow not supported in TabChild");
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set sw=4 ts=8 et tw=80 : */
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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

@ -205,7 +205,7 @@ MP3TrackDemuxer::FastSeek(const TimeUnit& aTime) {
if (!aTime.ToMicroseconds()) {
// Quick seek to the beginning of the stream.
mFrameIndex = 0;
} else if (vbr.IsTOCPresent()) {
} else if (vbr.IsTOCPresent() && Duration().ToMicroseconds() > 0) {
// Use TOC for more precise seeking.
const float durationFrac = static_cast<float>(aTime.ToMicroseconds()) /
Duration().ToMicroseconds();
@ -358,7 +358,9 @@ MP3TrackDemuxer::Duration() const {
// Unknown length, we can't estimate duration.
return TimeUnit::FromMicroseconds(-1);
}
numFrames = (streamLen - mFirstFrameOffset) / AverageFrameLength();
if (AverageFrameLength() > 0) {
numFrames = (streamLen - mFirstFrameOffset) / AverageFrameLength();
}
}
return Duration(numFrames);
}
@ -534,7 +536,7 @@ MP3TrackDemuxer::OffsetFromFrameIndex(int64_t aFrameIndex) const {
int64_t offset = 0;
const auto& vbr = mParser.VBRInfo();
if (vbr.NumBytes() && vbr.NumAudioFrames()) {
if (vbr.IsValid()) {
offset = mFirstFrameOffset + aFrameIndex * vbr.NumBytes().value() /
vbr.NumAudioFrames().value();
} else if (AverageFrameLength() > 0) {
@ -550,7 +552,7 @@ MP3TrackDemuxer::FrameIndexFromOffset(int64_t aOffset) const {
int64_t frameIndex = 0;
const auto& vbr = mParser.VBRInfo();
if (vbr.NumBytes() && vbr.NumAudioFrames()) {
if (vbr.IsValid()) {
frameIndex = static_cast<float>(aOffset - mFirstFrameOffset) /
vbr.NumBytes().value() * vbr.NumAudioFrames().value();
frameIndex = std::min<int64_t>(vbr.NumAudioFrames().value(), frameIndex);
@ -626,7 +628,7 @@ MP3TrackDemuxer::AverageFrameLength() const {
return static_cast<double>(mTotalFrameLen) / mNumParsedFrames;
}
const auto& vbr = mParser.VBRInfo();
if (vbr.NumBytes() && vbr.NumAudioFrames()) {
if (vbr.IsValid() && vbr.NumAudioFrames().value() + 1) {
return static_cast<double>(vbr.NumBytes().value()) /
(vbr.NumAudioFrames().value() + 1);
}
@ -962,6 +964,16 @@ FrameParser::VBRHeader::IsTOCPresent() const {
return mTOC.size() == vbr_header::TOC_SIZE;
}
bool
FrameParser::VBRHeader::IsValid() const {
return mType != NONE &&
mNumAudioFrames.valueOr(0) > 0 &&
mNumBytes.valueOr(0) > 0 &&
// We don't care about the scale for any computations here.
// mScale < 101 &&
true;
}
int64_t
FrameParser::VBRHeader::Offset(float aDurationFac) const {
if (!IsTOCPresent()) {

View File

@ -232,6 +232,9 @@ public:
// Returns true iff Xing/Info TOC (table of contents) is present.
bool IsTOCPresent() const;
// Returns whether the header is valid (containing reasonable field values).
bool IsValid() const;
// Returns the byte offset for the given duration percentage as a factor
// (0: begin, 1.0: end).
int64_t Offset(float aDurationFac) const;

View File

@ -48,13 +48,12 @@ function ontimeupdate(e) {
delta_wallclock = (t.timestamp - t.startTimestamp - t.bufferingTime) / 1000;
t.mozPreservesPitch = false;
is(t.mozPreservesPitch, false, "If we disable the pitch preservation, it should appear as such.");
is(t.mozPreservesPitch, false, t.name + ": If we disable the pitch preservation, it should appear as such.");
t.bufferingTime = 0;
is(t.playbackRate, SLOW_RATE,
"The playback rate shoud be "+SLOW_RATE+"." + t.token);
ok(checkPlaybackRate(delta_wallclock, delta, SLOW_RATE, 0.25), "We are effectively slowing down playback. (" + delta_wallclock + ", " + delta + ") for " + t.token);
is(t.playbackRate, SLOW_RATE, t.name + ": The playback rate shoud be "+SLOW_RATE+".");
ok(checkPlaybackRate(delta_wallclock, delta, SLOW_RATE, 0.25), t.name + ": We are effectively slowing down playback. (" + delta_wallclock + ", " + delta + ")");
t.removeEventListener("timeupdate", ontimeupdate);
t.addEventListener("pause", onpaused);
t.playbackRate = NULL_RATE;
@ -80,14 +79,14 @@ function afterNullPlaybackRate(e) {
t.testedForNull = true;
ok(t.currentTime == t.oldCurrentTime, "Current time should not change when playbackRate is null (" + t.currentTime + " " + t.oldCurrentTime + ").");
ok(!t.paused, "The element should not be in paused state.");
ok(t.currentTime == t.oldCurrentTime, t.name + ": Current time should not change when playbackRate is null (" + t.currentTime + " " + t.oldCurrentTime + ").");
ok(!t.paused, t.name + ": The element should not be in paused state.");
t.removeEventListener("paused", onpaused);
is(t.pausedReceived, undefined, "Paused event should not have been received.");
is(t.pausedReceived, undefined, t.name + ": Paused event should not have been received.");
t.timestamp = Date.now();
t.oldCurrentTime = t.currentTime;
t.playbackRate = VERY_FAST_RATE;
is(t.playbackRate, FAST_RATE, "Playback rate should be clamped to " + FAST_RATE + ".");
is(t.playbackRate, FAST_RATE, t.name + ": Playback rate should be clamped to " + FAST_RATE + ".");
}
function onended(e) {
@ -97,9 +96,9 @@ function onended(e) {
t.bufferingTime = 0;
// If we got "ended" too early, skip these tests.
if (t.testedForSlowdown && t.testedForNull) {
is(t.playbackRate, FAST_RATE, "The playback rate should still be "+FAST_RATE+".");
ok(!t.muted, "The audio should be muted when playing at high speed, but should not appear as such.");
is(t.currentTime, t.duration, "Current time should be equal to the duration (not change by playback rate).");
is(t.playbackRate, FAST_RATE, t.name + ": The playback rate should still be "+FAST_RATE+".");
ok(!t.muted, t.name + ": The audio should be muted when playing at high speed, but should not appear as such.");
is(t.currentTime, t.duration, t.name + ": Current time should be equal to the duration (not change by playback rate).");
}
finish_test(t);
}
@ -134,13 +133,14 @@ function onwaiting(e) {
}
function onvolumechange(e) {
ok(false, "We should not receive a volumechange event when changing the playback rate.");
ok(false, e.target.name + ": We should not receive a volumechange event when changing the playback rate.");
}
function startTest(test, token) {
let elemType = /^audio/.test(test.type) ? "audio" : "video";
let element = document.createElement(elemType);
element.src = test.name;
element.name = test.name;
element.preload = "metadata";
element.token = token;
element.controls = true;
@ -154,12 +154,12 @@ function startTest(test, token) {
element.addEventListener("volumechange", onvolumechange);
manager.started(token);
element.startTimestamp = Date.now();
is(element.mozPreservesPitch, true, "Pitch preservation should be enabled by default.");
is(element.mozPreservesPitch, true, test.name + ": Pitch preservation should be enabled by default.");
element.addEventListener("loadedmetadata", function() {
is(element.playbackRate, 1.0, "playbackRate should be initially 1.0");
is(element.defaultPlaybackRate, 1.0, "defaultPlaybackRate should be initially 1.0");
is(element.playbackRate, 1.0, test.name + ": playbackRate should be initially 1.0");
is(element.defaultPlaybackRate, 1.0, test.name + ": defaultPlaybackRate should be initially 1.0");
element.playbackRate = VERY_SLOW_RATE;
is(element.playbackRate, SLOW_RATE, "PlaybackRate should be clamped to " + SLOW_RATE + ".");
is(element.playbackRate, SLOW_RATE, test.name + ": PlaybackRate should be clamped to " + SLOW_RATE + ".");
element.play();
element.playbackRate = SLOW_RATE;
});

View File

@ -286,7 +286,7 @@ TraceJSObjWrappers(JSTracer *trc, void *data)
// any of them moved.
for (JSObjWrapperTable::Enum e(sJSObjWrappers); !e.empty(); e.popFront()) {
nsJSObjWrapperKey key = e.front().key();
JS_CallUnbarrieredObjectTracer(trc, &key.mJSObj, "sJSObjWrappers key object");
JS::UnsafeTraceRoot(trc, &key.mJSObj, "sJSObjWrappers key object");
nsJSObjWrapper *wrapper = e.front().value();
JS::TraceNullableEdge(trc, &wrapper->mJSObj, "sJSObjWrappers wrapper object");
if (key != e.front().key()) {
@ -1101,7 +1101,7 @@ JSObjWrapperKeyMarkCallback(JSTracer *trc, JSObject *obj, void *data) {
if (!p)
return;
JS_CallUnbarrieredObjectTracer(trc, &obj, "sJSObjWrappers key object");
js::UnsafeTraceManuallyBarrieredEdge(trc, &obj, "sJSObjWrappers key object");
nsJSObjWrapperKey newKey(obj, npp);
sJSObjWrappers.rekeyIfMoved(oldKey, newKey);
}

View File

@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=642338
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=642338">Mozilla Bug 642338</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
@ -42,7 +42,7 @@ function testWindow(w)
function checkFeature(feature, prefname) {
if (prefname === undefined)
prefname = feature;
if (SpecialPowers.getBoolPref('dom.disable_window_open_feature.' + prefname)) {
is(w[feature].visible, true, feature + ' should always be true.');
}
@ -81,7 +81,7 @@ var allBarsWindow =
'personalbar=yes,status=yes,scrollbars=yes',
true);
var noBarsWindow =
var noBarsWindow =
window.open('file_window_bar.html?false', 'no-bars',
'menubar=no,toolbar=no,location=no,' +
'personalbar=no,status=no,scrollbars=no',

View File

@ -25,7 +25,7 @@ support-files =
[test_MessageEvent.html]
[test_postMessage_basehref.html]
[test_postMessage_closed.html]
skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s #bug 894914 - wrong data - got FAIL, expected message # b2g(bug 894914 - wrong data - got FAIL, expected message) b2g-debug(bug 894914 - wrong data - got FAIL, expected message) b2g-desktop(Bug 931116, b2g desktop specific, initial triage)
skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 894914 - wrong data - got FAIL, expected message # b2g(bug 894914 - wrong data - got FAIL, expected message) b2g-debug(bug 894914 - wrong data - got FAIL, expected message) b2g-desktop(Bug 931116, b2g desktop specific, initial triage)
[test_postMessage_hash.html]
[test_postMessage.html]
[test_postMessage_idn.xhtml]

View File

@ -46,7 +46,12 @@ ServiceWorkerClientInfo::ServiceWorkerClientInfo(nsIDocument* aDoc)
mWindowId = innerWindow->WindowID();
}
aDoc->GetURL(mUrl);
nsCOMPtr<nsIURI> originalURI = aDoc->GetOriginalURI();
if (originalURI) {
nsAutoCString spec;
originalURI->GetSpec(spec);
CopyUTF8toUTF16(spec, mUrl);
}
mVisibilityState = aDoc->VisibilityState();
ErrorResult result;

View File

@ -2920,8 +2920,10 @@ ServiceWorkerManager::LoadRegistration(
registration = CreateNewRegistration(aRegistration.scope(), principal);
} else {
RefPtr<ServiceWorkerInfo> newest = registration->Newest();
// If the script spec matches and our active worker state matches our
// expectations for a "current worker", then we are done.
if (newest && newest->ScriptSpec() == aRegistration.scriptSpec() &&
!!registration->mActiveWorker == aRegistration.currentWorkerURL().IsEmpty()) {
!registration->mActiveWorker == aRegistration.currentWorkerURL().IsEmpty()) {
// No needs for updates.
return;
}
@ -3599,7 +3601,8 @@ ServiceWorkerManager::DispatchFetchEvent(const PrincipalOriginAttributes& aOrigi
internalChannel->GetLoadGroup(getter_AddRefs(loadGroup));
documentId = aDocumentIdForTopLevelNavigation;
// TODO: Use aDocumentIdForTopLevelNavigation for potentialClientId, pending
// the spec change.
nsCOMPtr<nsIURI> uri;
aRv = aChannel->GetSecureUpgradedChannelURI(getter_AddRefs(uri));

View File

@ -1243,7 +1243,9 @@ private:
init.mRequest.Value() = request;
init.mBubbles = false;
init.mCancelable = true;
init.mClientId = mClientId;
if (!mClientId.IsEmpty()) {
init.mClientId = mClientId;
}
init.mIsReload = mIsReload;
RefPtr<FetchEvent> event =
FetchEvent::Constructor(globalObj, NS_LITERAL_STRING("fetch"), init, result);

View File

@ -1139,8 +1139,7 @@ DefaultTooltipTextProvider::GetNodeText(nsIDOMNode* aNode, char16_t** aText,
nsCOMPtr<nsIURI> uri(linkContent->GetURIExternal());
if (uri) {
currElement->GetAttributeNS(
NS_LITERAL_STRING("http://www.w3.org/1999/xlink"),
NS_LITERAL_STRING("title"), outText);
xlinkNS, NS_LITERAL_STRING("title"), outText);
if (outText.Length()) {
found = true;
}
@ -1150,7 +1149,7 @@ DefaultTooltipTextProvider::GetNodeText(nsIDOMNode* aNode, char16_t** aText,
lookingForSVGTitle = UseSVGTitle(currElement);
}
if (lookingForSVGTitle) {
nsINodeList* childNodes = node->ChildNodes();
nsINodeList* childNodes = content->ChildNodes();
uint32_t childNodeCount = childNodes->Length();
for (uint32_t i = 0; i < childNodeCount; i++) {
nsIContent* child = childNodes->Item(i);

View File

@ -31,8 +31,8 @@ interface nsIWebBrowserChrome : nsISupports
/**
* The currently loaded WebBrowser. The browser chrome may be
* told to set the WebBrowser object to a new object by setting this
* attribute. In this case the implementer is responsible for taking the
* new WebBrowser object and doing any necessary initialization or setup
* attribute. In this case the implementer is responsible for taking the
* new WebBrowser object and doing any necessary initialization or setup
* as if it had created the WebBrowser itself. This includes positioning
* setting up listeners etc.
*/
@ -53,7 +53,7 @@ interface nsIWebBrowserChrome : nsISupports
const unsigned long CHROME_SCROLLBARS = 0x00000200;
const unsigned long CHROME_TITLEBAR = 0x00000400;
const unsigned long CHROME_EXTRA = 0x00000800;
// createBrowserWindow specific flags
const unsigned long CHROME_WITH_SIZE = 0x00001000;
const unsigned long CHROME_WITH_POSITION = 0x00002000;
@ -98,12 +98,12 @@ interface nsIWebBrowserChrome : nsISupports
// Note: The modal style bit just affects the way the window looks and does
// mean it's actually modal.
const unsigned long CHROME_MODAL = 0x20000000;
const unsigned long CHROME_MODAL = 0x20000000;
const unsigned long CHROME_OPENAS_DIALOG = 0x40000000;
const unsigned long CHROME_OPENAS_CHROME = 0x80000000;
const unsigned long CHROME_ALL = 0x00000ffe;
/**
* The chrome flags for this browser chrome. The implementation should
* reflect the value of this attribute by hiding or showing its chrome
@ -118,20 +118,20 @@ interface nsIWebBrowserChrome : nsISupports
void destroyBrowserWindow();
/**
* Tells the chrome to size itself such that the browser will be the
* Tells the chrome to size itself such that the browser will be the
* specified size.
* @param aCX new width of the browser
* @param aCY new height of the browser
*/
void sizeBrowserTo(in long aCX, in long aCY);
/**
* Shows the window as a modal window.
* @return (the function error code) the status value specified by
* in exitModalEventLoop.
*/
void showAsModal();
/**
* Is the window modal (that is, currently executing a modal loop)?
* @return true if it's a modal window
@ -145,4 +145,3 @@ interface nsIWebBrowserChrome : nsISupports
*/
void exitModalEventLoop(in nsresult aStatus);
};

View File

@ -808,7 +808,7 @@ CreateCGPattern(const Pattern &aPattern, CGAffineTransform aUserSpace)
yStep = static_cast<CGFloat>(1 << 22);
break;
case ExtendMode::REFLECT:
assert(0);
MOZ_FALLTHROUGH_ASSERT("ExtendMode::REFLECT");
case ExtendMode::REPEAT:
xStep = static_cast<CGFloat>(CGImageGetWidth(image));
yStep = static_cast<CGFloat>(CGImageGetHeight(image));

View File

@ -644,8 +644,7 @@ DrawTargetCairo::GetType() const
case CAIRO_SURFACE_TYPE_SKIA:
case CAIRO_SURFACE_TYPE_QT:
MOZ_ASSERT(false, "Can't determine actual DrawTargetType for DrawTargetCairo - assuming SOFTWARE_RASTER");
// fallthrough
MOZ_FALLTHROUGH_ASSERT("Can't determine actual DrawTargetType for DrawTargetCairo - assuming SOFTWARE_RASTER");
case CAIRO_SURFACE_TYPE_IMAGE:
case CAIRO_SURFACE_TYPE_XLIB:
case CAIRO_SURFACE_TYPE_XCB:

View File

@ -91,6 +91,7 @@ bool
GLBlitHelper::InitTexQuadProgram(BlitType target)
{
const char kTexBlit_VertShaderSource[] = "\
#version 100 \n\
#ifdef GL_ES \n\
precision mediump float; \n\
#endif \n\
@ -109,6 +110,7 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
";
const char kTex2DBlit_FragShaderSource[] = "\
#version 100 \n\
#ifdef GL_ES \n\
#ifdef GL_FRAGMENT_PRECISION_HIGH \n\
precision highp float; \n\
@ -127,6 +129,7 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
";
const char kTex2DRectBlit_FragShaderSource[] = "\
#version 100 \n\
#ifdef GL_FRAGMENT_PRECISION_HIGH \n\
precision highp float; \n\
#else \n\
@ -146,6 +149,7 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
";
#ifdef ANDROID /* MOZ_WIDGET_ANDROID || MOZ_WIDGET_GONK */
const char kTexExternalBlit_FragShaderSource[] = "\
#version 100 \n\
#extension GL_OES_EGL_image_external : require \n\
#ifdef GL_FRAGMENT_PRECISION_HIGH \n\
precision highp float; \n\
@ -174,6 +178,7 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
[B] [1.16438, 2.01723, 0.00000] [Cr - 0.50196]
*/
const char kTexYUVPlanarBlit_FragShaderSource[] = "\
#version 100 \n\
#ifdef GL_ES \n\
precision mediump float; \n\
#endif \n\
@ -200,6 +205,7 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
#ifdef XP_MACOSX
const char kTexNV12PlanarBlit_FragShaderSource[] = "\
#version 100 \n\
#extension GL_ARB_texture_rectangle : require \n\
#ifdef GL_ES \n\
precision mediump float \n\
@ -383,18 +389,16 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
// Cache and set attribute and uniform
mGL->fUseProgram(program);
switch (target) {
#ifdef ANDROID
case ConvertSurfaceTexture:
case ConvertGralloc:
#endif
case BlitTex2D:
case BlitTexRect:
case ConvertEGLImage:
case ConvertSurfaceTexture:
case ConvertGralloc: {
#ifdef ANDROID
case ConvertEGLImage: {
GLint texUnitLoc = mGL->fGetUniformLocation(program, "uTexUnit");
MOZ_ASSERT(texUnitLoc != -1, "uniform uTexUnit not found");
mGL->fUniform1i(texUnitLoc, 0);
#else
MOZ_ASSERT_UNREACHABLE("gralloc not support on non-android");
#endif
break;
}
case ConvertPlanarYCbCr: {
@ -434,6 +438,8 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
#endif
break;
}
default:
return false;
}
MOZ_ASSERT(mGL->fGetAttribLocation(program, "aPosition") == 0);
mYFlipLoc = mGL->fGetUniformLocation(program, "uYflip");

View File

@ -7,6 +7,7 @@
#define GFX_LAYERMETRICSWRAPPER_H
#include "Layers.h"
#include "UnitTransforms.h"
namespace mozilla {
namespace layers {
@ -299,6 +300,11 @@ public:
return gfx::Matrix4x4();
}
CSSTransformMatrix GetTransformTyped() const
{
return ViewAs<CSSTransformMatrix>(GetTransform());
}
bool TransformIsPerspective() const
{
MOZ_ASSERT(IsValid());

View File

@ -895,6 +895,12 @@ Layer::GetTransform() const
return transform;
}
const CSSTransformMatrix
Layer::GetTransformTyped() const
{
return ViewAs<CSSTransformMatrix>(GetTransform());
}
const Matrix4x4
Layer::GetLocalTransform()
{
@ -912,6 +918,12 @@ Layer::GetLocalTransform()
return transform;
}
const LayerToParentLayerMatrix4x4
Layer::GetLocalTransformTyped()
{
return ViewAs<LayerToParentLayerMatrix4x4>(GetLocalTransform());
}
bool
Layer::HasTransformAnimation() const
{

View File

@ -1276,6 +1276,9 @@ public:
virtual Layer* GetFirstChild() const { return nullptr; }
virtual Layer* GetLastChild() const { return nullptr; }
const gfx::Matrix4x4 GetTransform() const;
// Same as GetTransform(), but returns the transform as a strongly-typed
// matrix. Eventually this will replace GetTransform().
const CSSTransformMatrix GetTransformTyped() const;
const gfx::Matrix4x4& GetBaseTransform() const { return mTransform; }
// Note: these are virtual because ContainerLayerComposite overrides them.
virtual float GetPostXScale() const { return mPostXScale; }
@ -1346,10 +1349,17 @@ public:
/**
* Returns the local transform for this layer: either mTransform or,
* for shadow layers, GetShadowTransform()
* for shadow layers, GetShadowTransform(), in either case with the
* pre- and post-scales applied.
*/
const gfx::Matrix4x4 GetLocalTransform();
/**
* Same as GetLocalTransform(), but returns a strongly-typed matrix.
* Eventually, this will replace GetLocalTransform().
*/
const LayerToParentLayerMatrix4x4 GetLocalTransformTyped();
/**
* Returns the local opacity for this layer: either mOpacity or,
* for shadow layers, GetShadowOpacity()

View File

@ -13,6 +13,7 @@
#include "mozilla/layers/GonkNativeHandle.h"
#endif
#include "Units.h"
#include "mozilla/gfx/Point.h" // for IntPoint
#include "mozilla/TypedEnumBits.h"
#include "nsRegion.h"
@ -284,6 +285,22 @@ enum TextureDumpMode {
DoNotCompress // dump texture uncompressed
};
// Some specialized typedefs of Matrix4x4Typed.
typedef gfx::Matrix4x4Typed<LayerPixel, CSSTransformedLayerPixel> CSSTransformMatrix;
// Several different async transforms can contribute to a layer's transform
// (specifically, an async animation can contribute a transform, and each APZC
// that scrolls a layer can contribute async scroll/zoom and overscroll
// transforms).
// To try to model this with typed units, we represent individual async
// transforms as ParentLayer -> ParentLayer transforms (aliased as
// AsyncTransformComponentMatrix), and we represent the product of all of them
// as a CSSTransformLayer -> ParentLayer transform (aliased as
// AsyncTransformMatrix). To create an AsyncTransformMatrix from component
// matrices, a ViewAs operation is needed. A MultipleAsyncTransforms
// PixelCastJustification is provided for this purpose.
typedef gfx::Matrix4x4Typed<ParentLayerPixel, ParentLayerPixel> AsyncTransformComponentMatrix;
typedef gfx::Matrix4x4Typed<CSSTransformedLayerPixel, ParentLayerPixel> AsyncTransformMatrix;
} // namespace layers
} // namespace mozilla

View File

@ -358,7 +358,9 @@ APZCTreeManager::PrepareNodeForLayer(const LayerMetricsWrapper& aLayer,
if (!needsApzc) {
node = RecycleOrCreateNode(aState, nullptr, aLayersId);
AttachNodeToTree(node, aParent, aNextSibling);
node->SetHitTestData(GetEventRegions(aLayer), aLayer.GetTransform(),
node->SetHitTestData(
GetEventRegions(aLayer),
aLayer.GetTransformTyped(),
aLayer.GetClipRect() ? Some(ParentLayerIntRegion(*aLayer.GetClipRect())) : Nothing(),
GetEventRegionsOverride(aParent, aLayer));
node->SetScrollbarData(aLayer.GetScrollbarTargetContainerId(),
@ -462,7 +464,10 @@ APZCTreeManager::PrepareNodeForLayer(const LayerMetricsWrapper& aLayer,
MOZ_ASSERT(node->IsPrimaryHolder() && node->GetApzc() && node->GetApzc()->Matches(guid));
ParentLayerIntRegion clipRegion = ComputeClipRegion(state->mController, aLayer);
node->SetHitTestData(GetEventRegions(aLayer), aLayer.GetTransform(), Some(clipRegion),
node->SetHitTestData(
GetEventRegions(aLayer),
aLayer.GetTransformTyped(),
Some(clipRegion),
GetEventRegionsOverride(aParent, aLayer));
apzc->SetAncestorTransform(aAncestorTransform);
@ -526,7 +531,10 @@ APZCTreeManager::PrepareNodeForLayer(const LayerMetricsWrapper& aLayer,
MOZ_ASSERT(aAncestorTransform.FuzzyEqualsMultiplicative(apzc->GetAncestorTransform()));
ParentLayerIntRegion clipRegion = ComputeClipRegion(state->mController, aLayer);
node->SetHitTestData(GetEventRegions(aLayer), aLayer.GetTransform(), Some(clipRegion),
node->SetHitTestData(
GetEventRegions(aLayer),
aLayer.GetTransformTyped(),
Some(clipRegion),
GetEventRegionsOverride(aParent, aLayer));
}
@ -1848,7 +1856,7 @@ APZCTreeManager::GetScreenToApzcTransform(const AsyncPanZoomController *aApzc) c
// ancestorUntransform is updated to RC.Inverse() * QC.Inverse() when parent == P
ancestorUntransform = parent->GetAncestorTransform().Inverse();
// asyncUntransform is updated to PA.Inverse() when parent == P
Matrix4x4 asyncUntransform = parent->GetCurrentAsyncTransformWithOverscroll().Inverse();
Matrix4x4 asyncUntransform = parent->GetCurrentAsyncTransformWithOverscroll().Inverse().ToUnknownMatrix();
// untransformSinceLastApzc is RC.Inverse() * QC.Inverse() * PA.Inverse()
Matrix4x4 untransformSinceLastApzc = ancestorUntransform * asyncUntransform;
@ -1880,7 +1888,7 @@ APZCTreeManager::GetApzcToGeckoTransform(const AsyncPanZoomController *aApzc) co
// leftmost matrix in a multiplication is applied first.
// asyncUntransform is LA.Inverse()
Matrix4x4 asyncUntransform = aApzc->GetCurrentAsyncTransformWithOverscroll().Inverse();
Matrix4x4 asyncUntransform = aApzc->GetCurrentAsyncTransformWithOverscroll().Inverse().ToUnknownMatrix();
// aTransformToGeckoOut is initialized to LA.Inverse() * LD * MC * NC * OC * PC
result = asyncUntransform * aApzc->GetTransformToLastDispatchedPaint() * aApzc->GetAncestorTransform();

View File

@ -8,6 +8,8 @@
#define mozilla_layers_APZUtils_h
#include <stdint.h> // for uint32_t
#include "LayersTypes.h"
#include "UnitTransforms.h"
#include "mozilla/gfx/Point.h"
#include "mozilla/FloatingPoint.h"
@ -61,6 +63,16 @@ static bool IsZero(const gfx::PointTyped<Units>& aPoint)
&& FuzzyEqualsAdditive(aPoint.y, 0.0f, COORDINATE_EPSILON);
}
// Deem an AsyncTransformComponentMatrix (obtained by multiplying together
// one or more AsyncTransformComponentMatrix objects) as constituting a
// complete async transform.
inline AsyncTransformMatrix
CompleteAsyncTransform(const AsyncTransformComponentMatrix& aMatrix)
{
return ViewAs<AsyncTransformMatrix>(aMatrix,
PixelCastJustification::MultipleAsyncTransforms);
}
} // namespace layers
} // namespace mozilla

View File

@ -2899,10 +2899,10 @@ bool AsyncPanZoomController::UpdateAnimation(const TimeStamp& aSampleTime,
return false;
}
Matrix4x4 AsyncPanZoomController::GetOverscrollTransform() const {
AsyncTransformComponentMatrix AsyncPanZoomController::GetOverscrollTransform() const {
ReentrantMonitorAutoEnter lock(mMonitor);
if (!IsOverscrolled()) {
return Matrix4x4();
return AsyncTransformComponentMatrix();
}
// The overscroll effect is a uniform stretch along the overscrolled axis,
@ -2939,7 +2939,7 @@ Matrix4x4 AsyncPanZoomController::GetOverscrollTransform() const {
}
// Combine the transformations into a matrix.
return Matrix4x4::Scaling(scaleX, scaleY, 1)
return AsyncTransformComponentMatrix::Scaling(scaleX, scaleY, 1)
.PostTranslate(translation.x, translation.y, 0);
}
@ -2987,7 +2987,7 @@ bool AsyncPanZoomController::AdvanceAnimations(const TimeStamp& aSampleTime)
return requestAnimationFrame;
}
void AsyncPanZoomController::SampleContentTransformForFrame(ViewTransform* aOutTransform,
void AsyncPanZoomController::SampleContentTransformForFrame(AsyncTransform* aOutTransform,
ParentLayerPoint& aScrollOffset)
{
ReentrantMonitorAutoEnter lock(mMonitor);
@ -2996,7 +2996,7 @@ void AsyncPanZoomController::SampleContentTransformForFrame(ViewTransform* aOutT
*aOutTransform = GetCurrentAsyncTransform();
}
ViewTransform AsyncPanZoomController::GetCurrentAsyncTransform() const {
AsyncTransform AsyncPanZoomController::GetCurrentAsyncTransform() const {
ReentrantMonitorAutoEnter lock(mMonitor);
CSSPoint lastPaintScrollOffset;
@ -3028,13 +3028,14 @@ ViewTransform AsyncPanZoomController::GetCurrentAsyncTransform() const {
ParentLayerPoint translation = (currentScrollOffset - lastPaintScrollOffset)
* mFrameMetrics.GetZoom() * mTestAsyncZoom.scale;
return ViewTransform(
return AsyncTransform(
LayerToParentLayerScale(mFrameMetrics.GetAsyncZoom().scale * mTestAsyncZoom.scale),
-translation);
}
Matrix4x4 AsyncPanZoomController::GetCurrentAsyncTransformWithOverscroll() const {
return Matrix4x4(GetCurrentAsyncTransform()) * GetOverscrollTransform();
AsyncTransformComponentMatrix AsyncPanZoomController::GetCurrentAsyncTransformWithOverscroll() const {
return AsyncTransformComponentMatrix(GetCurrentAsyncTransform())
* GetOverscrollTransform();
}
Matrix4x4 AsyncPanZoomController::GetTransformToLastDispatchedPaint() const {

View File

@ -44,7 +44,7 @@ struct ScrollableLayerGuid;
class CompositorParent;
class GestureEventListener;
class PCompositorParent;
struct ViewTransform;
struct AsyncTransform;
class AsyncPanZoomAnimation;
class FlingAnimation;
class InputBlockState;
@ -166,14 +166,14 @@ public:
* This function returns the async transform via the |aOutTransform|
* out parameter.
*/
void SampleContentTransformForFrame(ViewTransform* aOutTransform,
void SampleContentTransformForFrame(AsyncTransform* aOutTransform,
ParentLayerPoint& aScrollOffset);
/**
* Return a visual effect that reflects this apzc's
* overscrolled state, if any.
*/
Matrix4x4 GetOverscrollTransform() const;
AsyncTransformComponentMatrix GetOverscrollTransform() const;
/**
* A shadow layer update has arrived. |aLayerMetrics| is the new FrameMetrics
@ -218,13 +218,13 @@ public:
* existing transform, it will make the layer appear with the desired pan/zoom
* amount.
*/
ViewTransform GetCurrentAsyncTransform() const;
AsyncTransform GetCurrentAsyncTransform() const;
/**
* Returns the same transform as GetCurrentAsyncTransform(), but includes
* any transform due to axis over-scroll.
*/
Matrix4x4 GetCurrentAsyncTransformWithOverscroll() const;
AsyncTransformComponentMatrix GetCurrentAsyncTransformWithOverscroll() const;
/**
* Returns the transform to take something from the coordinate space of the

View File

@ -10,6 +10,7 @@
#include "LayersLogging.h" // for Stringify
#include "mozilla/gfx/Point.h" // for Point4D
#include "mozilla/layers/APZThreadUtils.h" // for AssertOnCompositorThread
#include "mozilla/layers/APZUtils.h" // for CompleteAsyncTransform
#include "mozilla/layers/AsyncCompositionManager.h" // for ViewTransform::operator Matrix4x4()
#include "nsPrintfCString.h" // for nsPrintfCString
#include "UnitTransforms.h" // for ViewAs
@ -206,7 +207,7 @@ HitTestingTreeNode::GetLayersId() const
void
HitTestingTreeNode::SetHitTestData(const EventRegions& aRegions,
const gfx::Matrix4x4& aTransform,
const CSSTransformMatrix& aTransform,
const Maybe<ParentLayerIntRegion>& aClipRegion,
const EventRegionsOverride& aOverride)
{
@ -227,12 +228,12 @@ Maybe<LayerPoint>
HitTestingTreeNode::Untransform(const ParentLayerPoint& aPoint) const
{
// convert into Layer coordinate space
gfx::Matrix4x4 localTransform = mTransform;
if (mApzc) {
localTransform = localTransform * mApzc->GetCurrentAsyncTransformWithOverscroll();
}
return UntransformBy(
ViewAs<LayerToParentLayerMatrix4x4>(localTransform).Inverse(), aPoint);
LayerToParentLayerMatrix4x4 transform = mTransform *
CompleteAsyncTransform(
mApzc
? mApzc->GetCurrentAsyncTransformWithOverscroll()
: AsyncTransformComponentMatrix());
return UntransformBy(transform.Inverse(), aPoint);
}
HitTestResult

View File

@ -85,7 +85,7 @@ public:
/* Hit test related methods */
void SetHitTestData(const EventRegions& aRegions,
const gfx::Matrix4x4& aTransform,
const CSSTransformMatrix& aTransform,
const Maybe<ParentLayerIntRegion>& aClipRegion,
const EventRegionsOverride& aOverride);
bool IsOutsideClip(const ParentLayerPoint& aPoint) const;
@ -135,7 +135,7 @@ private:
/* This is the transform from layer L. This does NOT include any async
* transforms. */
gfx::Matrix4x4 mTransform;
CSSTransformMatrix mTransform;
/* This is clip rect for L that we wish to use for hit-testing purposes. Note
* that this may not be exactly the same as the clip rect on layer L because

View File

@ -233,7 +233,7 @@ public:
}
}
bool SampleContentTransformForFrame(ViewTransform* aOutTransform,
bool SampleContentTransformForFrame(AsyncTransform* aOutTransform,
ParentLayerPoint& aScrollOffset,
const TimeDuration& aIncrement = TimeDuration::FromMilliseconds(0)) {
mcc->AdvanceBy(aIncrement);
@ -340,7 +340,7 @@ protected:
{
const TimeDuration increment = TimeDuration::FromMilliseconds(1);
ParentLayerPoint pointOut;
ViewTransform viewTransformOut;
AsyncTransform viewTransformOut;
mcc->AdvanceBy(increment);
apzc->SampleContentTransformForFrame(&viewTransformOut, pointOut);
}
@ -355,7 +355,7 @@ protected:
const TimeDuration increment = TimeDuration::FromMilliseconds(1);
bool recoveredFromOverscroll = false;
ParentLayerPoint pointOut;
ViewTransform viewTransformOut;
AsyncTransform viewTransformOut;
while (apzc->SampleContentTransformForFrame(&viewTransformOut, pointOut)) {
// The reported scroll offset should be the same throughout.
EXPECT_EQ(aExpectedScrollOffset, pointOut);
@ -1112,11 +1112,11 @@ TEST_F(APZCBasicTester, Overzoom) {
TEST_F(APZCBasicTester, SimpleTransform) {
ParentLayerPoint pointOut;
ViewTransform viewTransformOut;
AsyncTransform viewTransformOut;
apzc->SampleContentTransformForFrame(&viewTransformOut, pointOut);
EXPECT_EQ(ParentLayerPoint(), pointOut);
EXPECT_EQ(ViewTransform(), viewTransformOut);
EXPECT_EQ(AsyncTransform(), viewTransformOut);
}
@ -1174,7 +1174,7 @@ TEST_F(APZCBasicTester, ComplexTransform) {
layers[1]->SetFrameMetrics(childMetrics);
ParentLayerPoint pointOut;
ViewTransform viewTransformOut;
AsyncTransform viewTransformOut;
// Both the parent and child layer should behave exactly the same here, because
// the CSS transform on the child layer does not affect the SampleContentTransformForFrame code
@ -1183,39 +1183,39 @@ TEST_F(APZCBasicTester, ComplexTransform) {
apzc->SetFrameMetrics(metrics);
apzc->NotifyLayersUpdated(metrics, true);
apzc->SampleContentTransformForFrame(&viewTransformOut, pointOut);
EXPECT_EQ(ViewTransform(LayerToParentLayerScale(1), ParentLayerPoint()), viewTransformOut);
EXPECT_EQ(AsyncTransform(LayerToParentLayerScale(1), ParentLayerPoint()), viewTransformOut);
EXPECT_EQ(ParentLayerPoint(60, 60), pointOut);
childApzc->SetFrameMetrics(childMetrics);
childApzc->NotifyLayersUpdated(childMetrics, true);
childApzc->SampleContentTransformForFrame(&viewTransformOut, pointOut);
EXPECT_EQ(ViewTransform(LayerToParentLayerScale(1), ParentLayerPoint()), viewTransformOut);
EXPECT_EQ(AsyncTransform(LayerToParentLayerScale(1), ParentLayerPoint()), viewTransformOut);
EXPECT_EQ(ParentLayerPoint(60, 60), pointOut);
// do an async scroll by 5 pixels and check the transform
metrics.ScrollBy(CSSPoint(5, 0));
apzc->SetFrameMetrics(metrics);
apzc->SampleContentTransformForFrame(&viewTransformOut, pointOut);
EXPECT_EQ(ViewTransform(LayerToParentLayerScale(1), ParentLayerPoint(-30, 0)), viewTransformOut);
EXPECT_EQ(AsyncTransform(LayerToParentLayerScale(1), ParentLayerPoint(-30, 0)), viewTransformOut);
EXPECT_EQ(ParentLayerPoint(90, 60), pointOut);
childMetrics.ScrollBy(CSSPoint(5, 0));
childApzc->SetFrameMetrics(childMetrics);
childApzc->SampleContentTransformForFrame(&viewTransformOut, pointOut);
EXPECT_EQ(ViewTransform(LayerToParentLayerScale(1), ParentLayerPoint(-30, 0)), viewTransformOut);
EXPECT_EQ(AsyncTransform(LayerToParentLayerScale(1), ParentLayerPoint(-30, 0)), viewTransformOut);
EXPECT_EQ(ParentLayerPoint(90, 60), pointOut);
// do an async zoom of 1.5x and check the transform
metrics.ZoomBy(1.5f);
apzc->SetFrameMetrics(metrics);
apzc->SampleContentTransformForFrame(&viewTransformOut, pointOut);
EXPECT_EQ(ViewTransform(LayerToParentLayerScale(1.5), ParentLayerPoint(-45, 0)), viewTransformOut);
EXPECT_EQ(AsyncTransform(LayerToParentLayerScale(1.5), ParentLayerPoint(-45, 0)), viewTransformOut);
EXPECT_EQ(ParentLayerPoint(135, 90), pointOut);
childMetrics.ZoomBy(1.5f);
childApzc->SetFrameMetrics(childMetrics);
childApzc->SampleContentTransformForFrame(&viewTransformOut, pointOut);
EXPECT_EQ(ViewTransform(LayerToParentLayerScale(1.5), ParentLayerPoint(-45, 0)), viewTransformOut);
EXPECT_EQ(AsyncTransform(LayerToParentLayerScale(1.5), ParentLayerPoint(-45, 0)), viewTransformOut);
EXPECT_EQ(ParentLayerPoint(135, 90), pointOut);
childApzc->Destroy();
@ -1253,7 +1253,7 @@ protected:
int touchStart = 50;
int touchEnd = 10;
ParentLayerPoint pointOut;
ViewTransform viewTransformOut;
AsyncTransform viewTransformOut;
nsTArray<uint32_t> allowedTouchBehaviors;
allowedTouchBehaviors.AppendElement(aBehavior);
@ -1264,10 +1264,10 @@ protected:
if (aShouldTriggerScroll) {
EXPECT_EQ(ParentLayerPoint(0, -(touchEnd-touchStart)), pointOut);
EXPECT_NE(ViewTransform(), viewTransformOut);
EXPECT_NE(AsyncTransform(), viewTransformOut);
} else {
EXPECT_EQ(ParentLayerPoint(), pointOut);
EXPECT_EQ(ViewTransform(), viewTransformOut);
EXPECT_EQ(AsyncTransform(), viewTransformOut);
}
// Clear the fling from the previous pan, or stopping it will
@ -1279,7 +1279,7 @@ protected:
apzc->SampleContentTransformForFrame(&viewTransformOut, pointOut);
EXPECT_EQ(ParentLayerPoint(), pointOut);
EXPECT_EQ(ViewTransform(), viewTransformOut);
EXPECT_EQ(AsyncTransform(), viewTransformOut);
}
void DoPanWithPreventDefaultTest()
@ -1289,7 +1289,7 @@ protected:
int touchStart = 50;
int touchEnd = 10;
ParentLayerPoint pointOut;
ViewTransform viewTransformOut;
AsyncTransform viewTransformOut;
uint64_t blockId = 0;
// Pan down
@ -1303,7 +1303,7 @@ protected:
apzc->SampleContentTransformForFrame(&viewTransformOut, pointOut);
EXPECT_EQ(ParentLayerPoint(), pointOut);
EXPECT_EQ(ViewTransform(), viewTransformOut);
EXPECT_EQ(AsyncTransform(), viewTransformOut);
apzc->AssertStateIsReset();
}
@ -1357,7 +1357,7 @@ TEST_F(APZCBasicTester, Fling) {
int touchStart = 50;
int touchEnd = 10;
ParentLayerPoint pointOut;
ViewTransform viewTransformOut;
AsyncTransform viewTransformOut;
// Fling down. Each step scroll further down
Pan(apzc, mcc, touchStart, touchEnd);
@ -1525,7 +1525,7 @@ TEST_F(APZCBasicTester, OverScrollAbort) {
EXPECT_TRUE(apzc->IsOverscrolled());
ParentLayerPoint pointOut;
ViewTransform viewTransformOut;
AsyncTransform viewTransformOut;
// This sample call will run to the end of the fling animation
// and will schedule the overscroll animation.
@ -1582,7 +1582,7 @@ protected:
// Advance the fling animation by timeDelta milliseconds.
ParentLayerPoint pointOut;
ViewTransform viewTransformOut;
AsyncTransform viewTransformOut;
apzc->SampleContentTransformForFrame(&viewTransformOut, pointOut, TimeDuration::FromMilliseconds(timeDelta));
// Deliver a tap to abort the fling. Ensure that we get a HandleSingleTap
@ -1619,7 +1619,7 @@ protected:
// Sample the fling a couple of times to ensure it's going.
ParentLayerPoint point, finalPoint;
ViewTransform viewTransform;
AsyncTransform viewTransform;
apzc->SampleContentTransformForFrame(&viewTransform, point, TimeDuration::FromMilliseconds(10));
apzc->SampleContentTransformForFrame(&viewTransform, finalPoint, TimeDuration::FromMilliseconds(10));
EXPECT_GT(finalPoint.y, point.y);
@ -1818,11 +1818,11 @@ protected:
EXPECT_EQ(nsEventStatus_eConsumeDoDefault, status);
ParentLayerPoint pointOut;
ViewTransform viewTransformOut;
AsyncTransform viewTransformOut;
apzc->SampleContentTransformForFrame(&viewTransformOut, pointOut);
EXPECT_EQ(ParentLayerPoint(), pointOut);
EXPECT_EQ(ViewTransform(), viewTransformOut);
EXPECT_EQ(AsyncTransform(), viewTransformOut);
apzc->AssertStateIsReset();
}
@ -2049,7 +2049,7 @@ protected:
void SampleAnimationsOnce() {
const TimeDuration increment = TimeDuration::FromMilliseconds(1);
ParentLayerPoint pointOut;
ViewTransform viewTransformOut;
AsyncTransform viewTransformOut;
mcc->AdvanceBy(increment);
for (const RefPtr<Layer>& layer : layers) {
@ -2710,7 +2710,7 @@ TEST_F(APZHitTestingTester, TestRepaintFlushOnWheelEvents) {
EXPECT_EQ(nsEventStatus_eConsumeDoDefault, manager->ReceiveInputEvent(swi, nullptr, nullptr));
EXPECT_EQ(origin, swi.mOrigin);
ViewTransform viewTransform;
AsyncTransform viewTransform;
ParentLayerPoint point;
apzcroot->SampleContentTransformForFrame(&viewTransform, point);
EXPECT_EQ(0, point.x);

View File

@ -146,7 +146,7 @@ FuzzyEquals(float a, float b) {
return (fabsf(a - b) < 1e-6);
}
static ViewTransform
static AsyncTransform
ComputeViewTransform(const FrameMetrics& aContentMetrics, const FrameMetrics& aCompositorMetrics)
{
// This is basically the same code as AsyncPanZoomController::GetCurrentAsyncTransform
@ -155,7 +155,7 @@ ComputeViewTransform(const FrameMetrics& aContentMetrics, const FrameMetrics& aC
ParentLayerPoint translation = (aCompositorMetrics.GetScrollOffset() - aContentMetrics.GetScrollOffset())
* aCompositorMetrics.GetZoom();
return ViewTransform(aCompositorMetrics.GetAsyncZoom(), -translation);
return AsyncTransform(aCompositorMetrics.GetAsyncZoom(), -translation);
}
bool
@ -163,7 +163,7 @@ SharedFrameMetricsHelper::UpdateFromCompositorFrameMetrics(
const LayerMetricsWrapper& aLayer,
bool aHasPendingNewThebesContent,
bool aLowPrecision,
ViewTransform& aViewTransform)
AsyncTransform& aViewTransform)
{
MOZ_ASSERT(aLayer);
@ -1399,11 +1399,11 @@ ClientMultiTiledLayerBuffer::ValidateTile(TileClient& aTile,
static Maybe<LayerRect>
GetCompositorSideCompositionBounds(const LayerMetricsWrapper& aScrollAncestor,
const LayerToParentLayerMatrix4x4& aTransformToCompBounds,
const ViewTransform& aAPZTransform,
const AsyncTransform& aAPZTransform,
const LayerRect& aClip)
{
LayerToParentLayerMatrix4x4 transform = aTransformToCompBounds *
ViewAs<ParentLayerToParentLayerMatrix4x4>(aAPZTransform);
AsyncTransformComponentMatrix(aAPZTransform);
return UntransformBy(transform.Inverse(),
aScrollAncestor.Metrics().GetCompositionBounds(), aClip);
@ -1443,7 +1443,7 @@ ClientMultiTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& a
// Find out the current view transform to determine which tiles to draw
// first, and see if we should just abort this paint. Aborting is usually
// caused by there being an incoming, more relevant paint.
ViewTransform viewTransform;
AsyncTransform viewTransform;
#if defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_ANDROID_APZ)
FrameMetrics contentMetrics = scrollAncestor.Metrics();
bool abortPaint = false;

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