This commit is contained in:
Ryan VanderMeulen 2013-04-10 11:01:28 -04:00
Родитель 2c8dec2f1f 839048be74
Коммит f9bee15085
675 изменённых файлов: 30257 добавлений и 15833 удалений

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

@ -17,4 +17,4 @@
#
# Modifying this file will now automatically clobber the buildbot machines \o/
#
Bug 856349 broke Windows b2g builds.
Bug 859894: Hopefully the final WebIDL clobber.

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

@ -102,7 +102,6 @@ pref("dom.disable_open_during_load", true);
pref("privacy.popups.showBrowserMessage", true);
pref("keyword.enabled", true);
pref("keyword.URL", "https://www.google.com/m?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=");
pref("accessibility.typeaheadfind", false);
pref("accessibility.typeaheadfind.timeout", 5000);

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

@ -66,10 +66,6 @@ ifdef MOZ_LINKER
LIBS += $(MOZ_ZLIB_LIBS)
endif
ifdef HAVE_CLOCK_MONOTONIC
LIBS += $(REALTIME_LIBS)
endif
ifndef MOZ_WINCONSOLE
ifdef MOZ_DEBUG
MOZ_WINCONSOLE = 1

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

@ -13,13 +13,12 @@
#include <io.h>
#include <fcntl.h>
#elif defined(XP_UNIX)
#include <sys/time.h>
#include <sys/resource.h>
#include <time.h>
#include <unistd.h>
#endif
#ifdef XP_MACOSX
#include <mach/mach_time.h>
#include "MacQuirks.h"
#endif
@ -389,80 +388,25 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory)
return 255;
}
#ifdef XP_WIN
/**
* Used only when GetTickCount64 is not available on the platform.
* Last result of GetTickCount call. Kept in [ms].
*/
static DWORD sLastGTCResult = 0;
/**
* Higher part of the 64-bit value of MozGetTickCount64,
* incremented atomically.
*/
static DWORD sLastGTCRollover = 0;
/**
* Function protecting GetTickCount result from rolling over. The original
* code comes from the Windows implementation of the TimeStamp class minus the
* locking harness which isn't needed here.
*
* @returns The current time in milliseconds
*/
static ULONGLONG WINAPI
MozGetTickCount64()
/* Local implementation of PR_Now, since the executable can't depend on NSPR */
static PRTime _PR_Now()
{
DWORD GTC = ::GetTickCount();
/* Pull the rollover counter forward only if new value of GTC goes way
* down under the last saved result */
if ((sLastGTCResult > GTC) && ((sLastGTCResult - GTC) > (1UL << 30)))
++sLastGTCRollover;
sLastGTCResult = GTC;
return (ULONGLONG)sLastGTCRollover << 32 | sLastGTCResult;
}
typedef ULONGLONG (WINAPI* GetTickCount64_t)();
static GetTickCount64_t sGetTickCount64 = nullptr;
#ifdef XP_WIN
MOZ_STATIC_ASSERT(sizeof(PRTime) == sizeof(FILETIME), "PRTime must have the same size as FILETIME");
FILETIME ft;
GetSystemTimeAsFileTime(&ft);
PRTime now;
CopyMemory(&now, &ft, sizeof(PRTime));
#ifdef __GNUC__
return (now - 116444736000000000LL) / 10LL;
#else
return (now - 116444736000000000i64) / 10i64;
#endif
/**
* Local TimeStamp::Now()-compatible implementation used to record timestamps
* which will be passed to XRE_StartupTimelineRecord().
*/
static uint64_t
TimeStamp_Now()
{
#ifdef XP_WIN
LARGE_INTEGER freq;
::QueryPerformanceFrequency(&freq);
HMODULE kernelDLL = GetModuleHandleW(L"kernel32.dll");
sGetTickCount64 = reinterpret_cast<GetTickCount64_t>
(GetProcAddress(kernelDLL, "GetTickCount64"));
if (!sGetTickCount64) {
/* If the platform does not support the GetTickCount64 (Windows XP doesn't),
* then use our fallback implementation based on GetTickCount. */
sGetTickCount64 = MozGetTickCount64;
}
return sGetTickCount64() * freq.QuadPart;
#elif defined(XP_MACOSX)
return mach_absolute_time();
#elif defined(HAVE_CLOCK_MONOTONIC)
struct timespec ts;
int rv = clock_gettime(CLOCK_MONOTONIC, &ts);
if (rv != 0) {
return 0;
}
uint64_t baseNs = (uint64_t)ts.tv_sec * 1000000000;
return baseNs + (uint64_t)ts.tv_nsec;
#else
struct timeval tm;
gettimeofday(&tm, 0);
return (((PRTime)tm.tv_sec * 1000000LL) + (PRTime)tm.tv_usec);
#endif
}
@ -584,7 +528,7 @@ int main(int argc, char* argv[])
#ifdef DEBUG_delay_start_metro
Sleep(5000);
#endif
uint64_t start = TimeStamp_Now();
PRTime start = _PR_Now();
#ifdef XP_MACOSX
TriggerQuirks();

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

@ -210,9 +210,6 @@ pref("xpinstall.whitelist.add.180", "marketplace.firefox.com");
pref("lightweightThemes.update.enabled", true);
pref("keyword.enabled", true);
// Override the default keyword.URL. Empty value means
// "use the search service's default engine"
pref("keyword.URL", "");
pref("general.useragent.locale", "@AB_CD@");
pref("general.skins.selectedSkin", "classic/1.0");
@ -540,6 +537,8 @@ pref("browser.gesture.twist.left", "cmd_gestureRotateLeft");
pref("browser.gesture.twist.end", "cmd_gestureRotateEnd");
pref("browser.gesture.tap", "cmd_fullZoomReset");
pref("browser.snapshots.limit", 0);
// 0: Nothing happens
// 1: Scrolling contents
// 2: Go back or go forward, in your history

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

@ -256,19 +256,6 @@ function onSearchSubmit(aEvent)
function setupSearchEngine()
{
let searchEngineName = document.documentElement.getAttribute("searchEngineName");
let searchEngineInfo = SEARCH_ENGINES[searchEngineName];
if (!searchEngineInfo) {
return;
}
// Add search engine logo.
if (searchEngineInfo.image) {
let logoElt = document.getElementById("searchEngineLogo");
logoElt.src = searchEngineInfo.image;
logoElt.alt = searchEngineName;
}
// The "autofocus" attribute doesn't focus the form element
// immediately when the element is first drawn, so the
// attribute is also used for styling when the page first loads.
@ -277,6 +264,26 @@ function setupSearchEngine()
searchText.removeEventListener("blur", searchText_onBlur);
searchText.removeAttribute("autofocus");
});
let searchEngineName = document.documentElement.getAttribute("searchEngineName");
let searchEngineInfo = SEARCH_ENGINES[searchEngineName];
let logoElt = document.getElementById("searchEngineLogo");
// Add search engine logo.
if (searchEngineInfo && searchEngineInfo.image) {
logoElt.parentNode.hidden = false;
logoElt.src = searchEngineInfo.image;
#ifdef XP_MACOSX
if (searchEngineInfo.imageHD && !window.matchMedia("(max-resolution: 1dppx)").matches)
logoElt.src = searchEngineInfo.imageHD;
#endif
logoElt.alt = searchEngineName;
searchText.placeholder = "";
}
else {
logoElt.parentNode.hidden = true;
searchText.placeholder = searchEngineName;
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -358,6 +358,30 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m
}
%endif
/* History Swipe Animation */
#historySwipeAnimationContainer {
overflow: hidden;
}
#historySwipeAnimationPreviousPage,
#historySwipeAnimationCurrentPage,
#historySwipeAnimationNextPage {
background: none top left no-repeat white;
}
#historySwipeAnimationPreviousPage {
background-image: -moz-element(#historySwipeAnimationPreviousPageSnapshot);
}
#historySwipeAnimationCurrentPage {
background-image: -moz-element(#historySwipeAnimationCurrentPageSnapshot);
}
#historySwipeAnimationNextPage {
background-image: -moz-element(#historySwipeAnimationNextPageSnapshot);
}
/* Identity UI */
#identity-popup-content-box.unknownIdentity > #identity-popup-connectedToLabel ,
#identity-popup-content-box.unknownIdentity > #identity-popup-runByLabel ,

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

@ -157,6 +157,7 @@ let gInitialPages = [
#include browser-tabview.js
#include browser-thumbnails.js
#include browser-webrtcUI.js
#include browser-gestureSupport.js
#ifdef MOZ_DATA_REPORTING
#include browser-data-submission-info-bar.js
@ -724,396 +725,6 @@ const gFormSubmitObserver = {
}
};
// Simple gestures support
//
// As per bug #412486, web content must not be allowed to receive any
// simple gesture events. Multi-touch gesture APIs are in their
// infancy and we do NOT want to be forced into supporting an API that
// will probably have to change in the future. (The current Mac OS X
// API is undocumented and was reverse-engineered.) Until support is
// implemented in the event dispatcher to keep these events as
// chrome-only, we must listen for the simple gesture events during
// the capturing phase and call stopPropagation on every event.
let gGestureSupport = {
_currentRotation: 0,
_lastRotateDelta: 0,
_rotateMomentumThreshold: .75,
/**
* Add or remove mouse gesture event listeners
*
* @param aAddListener
* True to add/init listeners and false to remove/uninit
*/
init: function GS_init(aAddListener) {
const gestureEvents = ["SwipeGesture",
"MagnifyGestureStart", "MagnifyGestureUpdate", "MagnifyGesture",
"RotateGestureStart", "RotateGestureUpdate", "RotateGesture",
"TapGesture", "PressTapGesture"];
let addRemove = aAddListener ? window.addEventListener :
window.removeEventListener;
gestureEvents.forEach(function (event) addRemove("Moz" + event, this, true),
this);
},
/**
* Dispatch events based on the type of mouse gesture event. For now, make
* sure to stop propagation of every gesture event so that web content cannot
* receive gesture events.
*
* @param aEvent
* The gesture event to handle
*/
handleEvent: function GS_handleEvent(aEvent) {
if (!Services.prefs.getBoolPref(
"dom.debug.propagate_gesture_events_through_content")) {
aEvent.stopPropagation();
}
// Create a preference object with some defaults
let def = function(aThreshold, aLatched)
({ threshold: aThreshold, latched: !!aLatched });
switch (aEvent.type) {
case "MozSwipeGesture":
aEvent.preventDefault();
this.onSwipe(aEvent);
break;
case "MozMagnifyGestureStart":
aEvent.preventDefault();
#ifdef XP_WIN
this._setupGesture(aEvent, "pinch", def(25, 0), "out", "in");
#else
this._setupGesture(aEvent, "pinch", def(150, 1), "out", "in");
#endif
break;
case "MozRotateGestureStart":
aEvent.preventDefault();
this._setupGesture(aEvent, "twist", def(25, 0), "right", "left");
break;
case "MozMagnifyGestureUpdate":
case "MozRotateGestureUpdate":
aEvent.preventDefault();
this._doUpdate(aEvent);
break;
case "MozTapGesture":
aEvent.preventDefault();
this._doAction(aEvent, ["tap"]);
break;
case "MozRotateGesture":
aEvent.preventDefault();
this._doAction(aEvent, ["twist", "end"]);
break;
/* case "MozPressTapGesture":
break; */
}
},
/**
* Called at the start of "pinch" and "twist" gestures to setup all of the
* information needed to process the gesture
*
* @param aEvent
* The continual motion start event to handle
* @param aGesture
* Name of the gesture to handle
* @param aPref
* Preference object with the names of preferences and defaults
* @param aInc
* Command to trigger for increasing motion (without gesture name)
* @param aDec
* Command to trigger for decreasing motion (without gesture name)
*/
_setupGesture: function GS__setupGesture(aEvent, aGesture, aPref, aInc, aDec) {
// Try to load user-set values from preferences
for (let [pref, def] in Iterator(aPref))
aPref[pref] = this._getPref(aGesture + "." + pref, def);
// Keep track of the total deltas and latching behavior
let offset = 0;
let latchDir = aEvent.delta > 0 ? 1 : -1;
let isLatched = false;
// Create the update function here to capture closure state
this._doUpdate = function GS__doUpdate(aEvent) {
// Update the offset with new event data
offset += aEvent.delta;
// Check if the cumulative deltas exceed the threshold
if (Math.abs(offset) > aPref["threshold"]) {
// Trigger the action if we don't care about latching; otherwise, make
// sure either we're not latched and going the same direction of the
// initial motion; or we're latched and going the opposite way
let sameDir = (latchDir ^ offset) >= 0;
if (!aPref["latched"] || (isLatched ^ sameDir)) {
this._doAction(aEvent, [aGesture, offset > 0 ? aInc : aDec]);
// We must be getting latched or leaving it, so just toggle
isLatched = !isLatched;
}
// Reset motion counter to prepare for more of the same gesture
offset = 0;
}
};
// The start event also contains deltas, so handle an update right away
this._doUpdate(aEvent);
},
/**
* Generator producing the powerset of the input array where the first result
* is the complete set and the last result (before StopIteration) is empty.
*
* @param aArray
* Source array containing any number of elements
* @yield Array that is a subset of the input array from full set to empty
*/
_power: function GS__power(aArray) {
// Create a bitmask based on the length of the array
let num = 1 << aArray.length;
while (--num >= 0) {
// Only select array elements where the current bit is set
yield aArray.reduce(function (aPrev, aCurr, aIndex) {
if (num & 1 << aIndex)
aPrev.push(aCurr);
return aPrev;
}, []);
}
},
/**
* Determine what action to do for the gesture based on which keys are
* pressed and which commands are set
*
* @param aEvent
* The original gesture event to convert into a fake click event
* @param aGesture
* Array of gesture name parts (to be joined by periods)
*/
_doAction: function GS__doAction(aEvent, aGesture) {
// Create an array of pressed keys in a fixed order so that a command for
// "meta" is preferred over "ctrl" when both buttons are pressed (and a
// command for both don't exist)
let keyCombos = [];
["shift", "alt", "ctrl", "meta"].forEach(function (key) {
if (aEvent[key + "Key"])
keyCombos.push(key);
});
// Try each combination of key presses in decreasing order for commands
for (let subCombo of this._power(keyCombos)) {
// Convert a gesture and pressed keys into the corresponding command
// action where the preference has the gesture before "shift" before
// "alt" before "ctrl" before "meta" all separated by periods
let command;
try {
command = this._getPref(aGesture.concat(subCombo).join("."));
} catch (e) {}
if (!command)
continue;
let node = document.getElementById(command);
if (node) {
if (node.getAttribute("disabled") != "true") {
let cmdEvent = document.createEvent("xulcommandevent");
cmdEvent.initCommandEvent("command", true, true, window, 0,
aEvent.ctrlKey, aEvent.altKey, aEvent.shiftKey,
aEvent.metaKey, aEvent);
node.dispatchEvent(cmdEvent);
}
} else {
goDoCommand(command);
}
break;
}
},
/**
* Convert continual motion events into an action if it exceeds a threshold
* in a given direction. This function will be set by _setupGesture to
* capture state that needs to be shared across multiple gesture updates.
*
* @param aEvent
* The continual motion update event to handle
*/
_doUpdate: function(aEvent) {},
/**
* Convert the swipe gesture into a browser action based on the direction
*
* @param aEvent
* The swipe event to handle
*/
onSwipe: function GS_onSwipe(aEvent) {
// Figure out which one (and only one) direction was triggered
for (let dir of ["UP", "RIGHT", "DOWN", "LEFT"]) {
if (aEvent.direction == aEvent["DIRECTION_" + dir]) {
this._doAction(aEvent, ["swipe", dir.toLowerCase()]);
break;
}
}
},
/**
* Get a gesture preference or use a default if it doesn't exist
*
* @param aPref
* Name of the preference to load under the gesture branch
* @param aDef
* Default value if the preference doesn't exist
*/
_getPref: function GS__getPref(aPref, aDef) {
// Preferences branch under which all gestures preferences are stored
const branch = "browser.gesture.";
try {
// Determine what type of data to load based on default value's type
let type = typeof aDef;
let getFunc = "get" + (type == "boolean" ? "Bool" :
type == "number" ? "Int" : "Char") + "Pref";
return gPrefService[getFunc](branch + aPref);
}
catch (e) {
return aDef;
}
},
/**
* Perform rotation for ImageDocuments
*
* @param aEvent
* The MozRotateGestureUpdate event triggering this call
*/
rotate: function(aEvent) {
if (!(content.document instanceof ImageDocument))
return;
let contentElement = content.document.body.firstElementChild;
if (!contentElement)
return;
// If we're currently snapping, cancel that snap
if (contentElement.classList.contains("completeRotation"))
this._clearCompleteRotation();
this.rotation = Math.round(this.rotation + aEvent.delta);
contentElement.style.transform = "rotate(" + this.rotation + "deg)";
this._lastRotateDelta = aEvent.delta;
},
/**
* Perform a rotation end for ImageDocuments
*/
rotateEnd: function() {
if (!(content.document instanceof ImageDocument))
return;
let contentElement = content.document.body.firstElementChild;
if (!contentElement)
return;
let transitionRotation = 0;
// The reason that 360 is allowed here is because when rotating between
// 315 and 360, setting rotate(0deg) will cause it to rotate the wrong
// direction around--spinning wildly.
if (this.rotation <= 45)
transitionRotation = 0;
else if (this.rotation > 45 && this.rotation <= 135)
transitionRotation = 90;
else if (this.rotation > 135 && this.rotation <= 225)
transitionRotation = 180;
else if (this.rotation > 225 && this.rotation <= 315)
transitionRotation = 270;
else
transitionRotation = 360;
// If we're going fast enough, and we didn't already snap ahead of rotation,
// then snap ahead of rotation to simulate momentum
if (this._lastRotateDelta > this._rotateMomentumThreshold &&
this.rotation > transitionRotation)
transitionRotation += 90;
else if (this._lastRotateDelta < -1 * this._rotateMomentumThreshold &&
this.rotation < transitionRotation)
transitionRotation -= 90;
// Only add the completeRotation class if it is is necessary
if (transitionRotation != this.rotation) {
contentElement.classList.add("completeRotation");
contentElement.addEventListener("transitionend", this._clearCompleteRotation);
}
contentElement.style.transform = "rotate(" + transitionRotation + "deg)";
this.rotation = transitionRotation;
},
/**
* Gets the current rotation for the ImageDocument
*/
get rotation() {
return this._currentRotation;
},
/**
* Sets the current rotation for the ImageDocument
*
* @param aVal
* The new value to take. Can be any value, but it will be bounded to
* 0 inclusive to 360 exclusive.
*/
set rotation(aVal) {
this._currentRotation = aVal % 360;
if (this._currentRotation < 0)
this._currentRotation += 360;
return this._currentRotation;
},
/**
* When the location/tab changes, need to reload the current rotation for the
* image
*/
restoreRotationState: function() {
if (!(content.document instanceof ImageDocument))
return;
let contentElement = content.document.body.firstElementChild;
let transformValue = content.window.getComputedStyle(contentElement, null)
.transform;
if (transformValue == "none") {
this.rotation = 0;
return;
}
// transformValue is a rotation matrix--split it and do mathemagic to
// obtain the real rotation value
transformValue = transformValue.split("(")[1]
.split(")")[0]
.split(",");
this.rotation = Math.round(Math.atan2(transformValue[1], transformValue[0]) *
(180 / Math.PI));
},
/**
* Removes the transition rule by removing the completeRotation class
*/
_clearCompleteRotation: function() {
let contentElement = content.document &&
content.document instanceof ImageDocument &&
content.document.body &&
content.document.body.firstElementChild;
if (!contentElement)
return;
contentElement.classList.remove("completeRotation");
contentElement.removeEventListener("transitionend", this._clearCompleteRotation);
},
};
var gBrowserInit = {
onLoad: function() {
// window.arguments[0]: URI to load (string), or an nsISupportsArray of
@ -1212,6 +823,9 @@ var gBrowserInit = {
// setup simple gestures support
gGestureSupport.init(true);
// setup history swipe animation
gHistorySwipeAnimation.init();
if (window.opener && !window.opener.closed) {
let openerSidebarBox = window.opener.document.getElementById("sidebar-box");
// If the opener had a sidebar, open the same sidebar in our window.
@ -1689,6 +1303,8 @@ var gBrowserInit = {
gGestureSupport.init(false);
gHistorySwipeAnimation.uninit();
FullScreen.cleanup();
Services.obs.removeObserver(gPluginHandler.pluginCrashed, "plugin-crashed");
@ -1815,6 +1431,10 @@ var gBrowserInit = {
SocialUI.nonBrowserWindowInit();
if (PrivateBrowsingUtils.permanentPrivateBrowsing) {
document.getElementById("macDockMenuNewWindow").hidden = true;
}
this._delayedStartupTimeoutId = setTimeout(this.nonBrowserWindowDelayedStartup.bind(this), 0);
},
@ -1904,7 +1524,6 @@ var nonBrowserWindowDelayedStartup = gBrowserInit.nonBrowserWindowDelayedStartup
var nonBrowserWindowShutdown = gBrowserInit.nonBrowserWindowShutdown.bind(gBrowserInit);
#endif
function HandleAppCommandEvent(evt) {
switch (evt.command) {
case "Back":
@ -2770,7 +2389,7 @@ let BrowserOnClick = {
// we can fetch a site-specific report, for phishing, we redirect
// to the generic page describing phishing protection.
// We log even if malware/phishing info URL couldn't be found:
// We log even if malware/phishing info URL couldn't be found:
// the measurement is for how many users clicked the WHY BLOCKED button
secHistogram.add(nsISecTel[bucketName + "WHY_BLOCKED"]);
@ -3253,7 +2872,7 @@ const DOMLinkHandler = {
aLink, aLink.type, null)
!= Ci.nsIContentPolicy.ACCEPT)
return null;
try {
uri.userPass = "";
} catch(e) {
@ -3910,7 +3529,7 @@ function updateCharacterEncodingMenuState()
let appDevCharsetMenu =
document.getElementById("appmenu_developer_charsetMenu");
// gBrowser is null on Mac when the menubar shows in the context of
// non-browser windows. The above elements may be null depending on
// non-browser windows. The above elements may be null depending on
// what parts of the menubar are present. E.g. no app menu on Mac.
if (gBrowser &&
gBrowser.docShell &&

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

@ -191,8 +191,8 @@
<hbox pack="start" align="center" class="popup-notification-button-container">
<label id="social-undoactivation-button"
class="text-link"
value="&social.activated.undobutton.label;"
accesskey="&social.activated.undobutton.accesskey;"
value="&social.activated.undo.label;"
accesskey="&social.activated.undo.accesskey;"
onclick="SocialUI.undoActivation(this);"/>
<spacer flex="1"/>
<button id="social-activation-button"

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

@ -55,7 +55,8 @@
<menupopup id="menu_mac_dockmenu">
<!-- The command cannot be cmd_newNavigator because we need to activate
the application. -->
<menuitem label="&newNavigatorCmd.label;" oncommand="OpenBrowserWindowFromDockMenu();" />
<menuitem label="&newNavigatorCmd.label;" oncommand="OpenBrowserWindowFromDockMenu();"
id="macDockMenuNewWindow" />
<menuitem label="&newPrivateWindow.label;" oncommand="OpenBrowserWindowFromDockMenu({private: true});" />
</menupopup>
</popupset>

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

@ -145,6 +145,9 @@ _BROWSER_FILES = \
browser_bug647886.js \
browser_bug655584.js \
browser_bug664672.js \
browser_bug678392.js \
browser_bug678392-1.html \
browser_bug678392-2.html \
browser_bug710878.js \
browser_bug719271.js \
browser_bug724239.js \

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

@ -0,0 +1,12 @@
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>bug678392 - 1</title>
</head>
<body>
bug 678392 test page 1
</body>
</html>

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

@ -0,0 +1,12 @@
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>bug678392 - 2</title>
</head>
<body>
bug 678392 test page 2
</body>
</html>

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

@ -0,0 +1,192 @@
/* 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/. */
let HTTPROOT = "http://example.com/browser/browser/base/content/test/";
function maxSnapshotOverride() {
return 5;
}
function test() {
waitForExplicitFinish();
BrowserOpenTab();
let tab = gBrowser.selectedTab;
registerCleanupFunction(function () { gBrowser.removeTab(tab); });
ok(gHistorySwipeAnimation, "gHistorySwipeAnimation exists.");
if (!gHistorySwipeAnimation._isSupported()) {
is(gHistorySwipeAnimation.active, false, "History swipe animation is not " +
"active when not supported by the platform.");
finish();
return;
}
gHistorySwipeAnimation._getMaxSnapshots = maxSnapshotOverride;
gHistorySwipeAnimation.init();
is(gHistorySwipeAnimation.active, true, "History swipe animation support " +
"was successfully initialized when supported.");
cleanupArray();
load(gBrowser.selectedTab, HTTPROOT + "browser_bug678392-2.html", test0);
}
function load(aTab, aUrl, aCallback) {
aTab.linkedBrowser.addEventListener("pageshow", function onpageshow(aEvent) {
aEvent.currentTarget.removeEventListener("pageshow", onpageshow, false);
waitForFocus(aCallback, content);
}, false);
aTab.linkedBrowser.loadURI(aUrl);
}
function cleanupArray() {
let arr = gHistorySwipeAnimation._trackedSnapshots;
while (arr.length > 0) {
delete arr[0].browser.snapshots[arr[0].index]; // delete actual snapshot
arr.splice(0, 1);
}
}
function testArrayCleanup() {
// Test cleanup of array of tracked snapshots.
let arr = gHistorySwipeAnimation._trackedSnapshots;
is(arr.length, 0, "Snapshots were removed correctly from the array of " +
"tracked snapshots.");
}
function test0() {
// Test growing of array of tracked snapshots.
let tab = gBrowser.selectedTab;
load(tab, HTTPROOT + "browser_bug678392-1.html", function() {
ok(gHistorySwipeAnimation._trackedSnapshots, "Array for snapshot " +
"tracking is initialized.");
is(gHistorySwipeAnimation._trackedSnapshots.length, 1, "Snapshot array " +
"has correct length of 1 after loading one page.");
load(tab, HTTPROOT + "browser_bug678392-2.html", function() {
is(gHistorySwipeAnimation._trackedSnapshots.length, 2, "Snapshot array " +
" has correct length of 2 after loading two pages.");
load(tab, HTTPROOT + "browser_bug678392-1.html", function() {
is(gHistorySwipeAnimation._trackedSnapshots.length, 3, "Snapshot " +
"array has correct length of 3 after loading three pages.");
load(tab, HTTPROOT + "browser_bug678392-2.html", function() {
is(gHistorySwipeAnimation._trackedSnapshots.length, 4, "Snapshot " +
"array has correct length of 4 after loading four pages.");
cleanupArray();
testArrayCleanup();
test1();
});
});
});
});
}
function verifyRefRemoved(aIndex, aBrowser) {
let wasFound = false;
let arr = gHistorySwipeAnimation._trackedSnapshots;
for (let i = 0; i < arr.length; i++) {
if (arr[i].index == aIndex && arr[i].browser == aBrowser)
wasFound = true;
}
is(wasFound, false, "The reference that was previously removed was " +
"still found in the array of tracked snapshots.");
}
function test1() {
// Test presence of snpashots in per-tab array of snapshots and removal of
// individual snapshots (and corresponding references in the array of
// tracked snapshots).
let tab = gBrowser.selectedTab;
load(tab, HTTPROOT + "browser_bug678392-1.html", function() {
var historyIndex = gBrowser.webNavigation.sessionHistory.index - 1;
load(tab, HTTPROOT + "browser_bug678392-2.html", function() {
load(tab, HTTPROOT + "browser_bug678392-1.html", function() {
load(tab, HTTPROOT + "browser_bug678392-2.html", function() {
let browser = gBrowser.selectedBrowser;
ok(browser.snapshots, "Array of snapshots exists in browser.");
ok(browser.snapshots[historyIndex], "First page exists in snapshot " +
"array.");
ok(browser.snapshots[historyIndex + 1], "Second page exists in " +
"snapshot array.");
ok(browser.snapshots[historyIndex + 2], "Third page exists in " +
"snapshot array.");
ok(browser.snapshots[historyIndex + 3], "Fourth page exists in " +
"snapshot array.");
is(gHistorySwipeAnimation._trackedSnapshots.length, 4, "Length of " +
"array of tracked snapshots is equal to 4 after loading four " +
"pages.");
// Test removal of reference in the middle of the array.
gHistorySwipeAnimation._removeTrackedSnapshot(historyIndex + 1,
browser);
verifyRefRemoved(historyIndex + 1, browser);
is(gHistorySwipeAnimation._trackedSnapshots.length, 3, "Length of " +
"array of tracked snapshots is equal to 3 after removing one" +
"reference from the array with length 4.");
// Test removal of reference at end of array.
gHistorySwipeAnimation._removeTrackedSnapshot(historyIndex + 3,
browser);
verifyRefRemoved(historyIndex + 3, browser);
is(gHistorySwipeAnimation._trackedSnapshots.length, 2, "Length of " +
"array of tracked snapshots is equal to 2 after removing two" +
"references from the array with length 4.");
// Test removal of reference at head of array.
gHistorySwipeAnimation._removeTrackedSnapshot(historyIndex,
browser);
verifyRefRemoved(historyIndex, browser);
is(gHistorySwipeAnimation._trackedSnapshots.length, 1, "Length of " +
"array of tracked snapshots is equal to 1 after removing three" +
"references from the array with length 4.");
cleanupArray();
test2();
});
});
});
});
}
function test2() {
// Test growing of snapshot array across tabs.
let tab = gBrowser.selectedTab;
load(tab, HTTPROOT + "browser_bug678392-1.html", function() {
var historyIndex = gBrowser.webNavigation.sessionHistory.index - 1;
load(tab, HTTPROOT + "browser_bug678392-2.html", function() {
is(gHistorySwipeAnimation._trackedSnapshots.length, 2, "Length of " +
"snapshot array is equal to 2 after loading two pages");
let prevTab = tab;
tab = gBrowser.addTab("about:newtab");
gBrowser.selectedTab = tab;
load(tab, HTTPROOT + "browser_bug678392-2.html" /* initial page */,
function() {
load(tab, HTTPROOT + "browser_bug678392-1.html", function() {
load(tab, HTTPROOT + "browser_bug678392-2.html", function() {
is(gHistorySwipeAnimation._trackedSnapshots.length, 4, "Length " +
"of snapshot array is equal to 4 after loading two pages in " +
"two tabs each.");
gBrowser.removeCurrentTab();
gBrowser.selectedTab = prevTab;
cleanupArray();
test3();
});
});
});
});
});
}
function test3() {
// Test uninit of gHistorySwipeAnimation.
// This test MUST be the last one to execute.
gHistorySwipeAnimation.uninit();
is(gHistorySwipeAnimation.active, false, "History swipe animation support " +
"was successfully uninitialized");
finish();
}

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

@ -17,7 +17,7 @@ var pairs = [
["1.1.1.1", "http://1.1.1.1/"],
["ftp://example", "ftp://example/"],
["ftp.example.bar", "ftp://ftp.example.bar/"],
["ex ample", Services.search.originalDefaultEngine.getSubmission("ex ample", null, "keyword").uri.spec],
["ex ample", Services.search.defaultEngine.getSubmission("ex ample", null, "keyword").uri.spec],
];
function testNext() {

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

@ -122,6 +122,14 @@ function test_TestEventListeners()
{
let e = test_helper1; // easier to type this name
// Swipe gesture animation events
e("MozSwipeGestureStart", 0, -0.7, 0);
e("MozSwipeGestureUpdate", 0, -0.4, 0);
e("MozSwipeGestureEnd", 0, 0, 0);
e("MozSwipeGestureStart", 0, 0.6, 0);
e("MozSwipeGestureUpdate", 0, 0.3, 0);
e("MozSwipeGestureEnd", 0, 1, 0);
// Swipe gesture event
e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_LEFT, 0.0, 0);
e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0.0, 0);
@ -199,7 +207,7 @@ function test_helper2(type, direction, delta, altKey, ctrlKey, shiftKey, metaKey
10, 10, 10, 10,
ctrlKey, altKey, shiftKey, metaKey,
1, window,
direction, delta, 0);
0, direction, delta, 0);
successful = true;
}
catch (ex) {

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

@ -7,30 +7,12 @@ var gTests = [
{
name: "normal search (search service)",
testText: "test search",
searchURL: Services.search.originalDefaultEngine.getSubmission("test search", null, "keyword").uri.spec
searchURL: Services.search.defaultEngine.getSubmission("test search", null, "keyword").uri.spec
},
{
name: "?-prefixed search (search service)",
testText: "? foo ",
searchURL: Services.search.originalDefaultEngine.getSubmission("foo", null, "keyword").uri.spec
},
{
name: "normal search (keyword.url)",
testText: "test search",
keywordURLPref: "http://example.com/?q=",
searchURL: "http://example.com/?q=test+search"
},
{
name: "?-prefixed search (keyword.url)",
testText: "? foo ",
keywordURLPref: "http://example.com/?q=",
searchURL: "http://example.com/?q=foo"
},
{
name: "encoding test (keyword.url)",
testText: "test encoded+%/",
keywordURLPref: "http://example.com/?q=",
searchURL: "http://example.com/?q=test+encoded%2B%25%2F"
searchURL: Services.search.defaultEngine.getSubmission("foo", null, "keyword").uri.spec
}
];

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

@ -1,3 +1,5 @@
/* 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/. */
@ -17,11 +19,11 @@ pref("app.update.promptWaitTime", 86400);
pref("app.update.url.manual", "http://www.mozilla.com/firefox/channel/");
// A default value for the "More information about this update" link
// supplied in the "An update is available" page of the update wizard.
pref("app.update.url.details", "http://www.mozilla.org/projects/%APP%/");
pref("app.update.url.details", "http://www.mozilla.org/projects/firefox/");
// Release notes and vendor URLs
pref("app.releaseNotesURL", "http://www.mozilla.org/projects/%APP%/%VERSION%/releasenotes/");
pref("app.vendorURL", "http://www.mozilla.org/projects/%APP%/");
pref("app.releaseNotesURL", "http://www.mozilla.org/projects/firefox/%VERSION%/releasenotes/");
pref("app.vendorURL", "http://www.mozilla.org/projects/firefox/");
// Search codes belong only in builds with official branding
pref("browser.search.param.yahoo-fr", "");

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

@ -2,8 +2,8 @@
* 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/. */
pref("startup.homepage_override_url","http://www.mozilla.org/projects/%APP%/%VERSION%/whatsnew/?oldversion=%OLD_VERSION%");
pref("startup.homepage_welcome_url","http://www.mozilla.org/projects/%APP%/%VERSION%/firstrun/");
pref("startup.homepage_override_url","http://www.mozilla.org/projects/firefox/%VERSION%/whatsnew/?oldversion=%OLD_VERSION%");
pref("startup.homepage_welcome_url","http://www.mozilla.org/projects/firefox/%VERSION%/firstrun/");
// The time interval between checks for a new version (in seconds)
pref("app.update.interval", 7200); // 2 hours
// The time interval between the downloading of mar file chunks in the
@ -16,11 +16,11 @@ pref("app.update.promptWaitTime", 43200);
pref("app.update.url.manual", "http://nightly.mozilla.org/");
// A default value for the "More information about this update" link
// supplied in the "An update is available" page of the update wizard.
pref("app.update.url.details", "http://www.mozilla.org/projects/%APP%/");
pref("app.update.url.details", "http://www.mozilla.org/projects/firefox/");
// Release notes and vendor URLs
pref("app.releaseNotesURL", "http://www.mozilla.org/projects/%APP%/%VERSION%/releasenotes/");
pref("app.vendorURL", "http://www.mozilla.org/projects/%APP%/");
pref("app.releaseNotesURL", "http://www.mozilla.org/projects/firefox/%VERSION%/releasenotes/");
pref("app.vendorURL", "http://www.mozilla.org/projects/firefox/");
// Search codes belong only in builds with official branding
pref("browser.search.param.yahoo-fr", "");

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

@ -2,8 +2,8 @@
* 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/. */
pref("startup.homepage_override_url","http://www.mozilla.com/%LOCALE%/%APP%/%VERSION%/whatsnew/?oldversion=%OLD_VERSION%");
pref("startup.homepage_welcome_url","http://www.mozilla.com/%LOCALE%/%APP%/%VERSION%/firstrun/");
pref("startup.homepage_override_url","http://www.mozilla.com/%LOCALE%/firefox/%VERSION%/whatsnew/?oldversion=%OLD_VERSION%");
pref("startup.homepage_welcome_url","http://www.mozilla.com/%LOCALE%/firefox/%VERSION%/firstrun/");
// Interval: Time between checks for a new version (in seconds)
pref("app.update.interval", 43200); // 12 hours
// The time interval between the downloading of mar file chunks in the
@ -16,11 +16,11 @@ pref("app.update.promptWaitTime", 86400);
pref("app.update.url.manual", "http://www.firefox.com");
// A default value for the "More information about this update" link
// supplied in the "An update is available" page of the update wizard.
pref("app.update.url.details", "http://www.mozilla.com/%LOCALE%/%APP%/releases/");
pref("app.update.url.details", "http://www.mozilla.com/%LOCALE%/firefox/releases/");
// Release notes and vendor URLs
pref("app.releaseNotesURL", "http://www.mozilla.com/%LOCALE%/%APP%/%VERSION%/releasenotes/");
pref("app.vendorURL", "http://www.mozilla.com/%LOCALE%/%APP%/");
pref("app.releaseNotesURL", "http://www.mozilla.com/%LOCALE%/firefox/%VERSION%/releasenotes/");
pref("app.vendorURL", "http://www.mozilla.com/%LOCALE%/firefox/");
pref("browser.search.param.ms-pc", "MOZI");
pref("browser.search.param.yahoo-fr", "moz35");

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

@ -2,8 +2,8 @@
* 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/. */
pref("startup.homepage_override_url","http://www.mozilla.org/projects/%APP%/%VERSION%/whatsnew/");
pref("startup.homepage_welcome_url","http://www.mozilla.org/projects/%APP%/%VERSION%/firstrun/");
pref("startup.homepage_override_url","http://www.mozilla.org/projects/firefox/%VERSION%/whatsnew/");
pref("startup.homepage_welcome_url","http://www.mozilla.org/projects/firefox/%VERSION%/firstrun/");
// The time interval between checks for a new version (in seconds)
pref("app.update.interval", 86400); // 24 hours
// The time interval between the downloading of mar file chunks in the
@ -13,14 +13,14 @@ pref("app.update.download.backgroundInterval", 60);
pref("app.update.promptWaitTime", 86400);
// URL user can browse to manually if for some reason all update installation
// attempts fail.
pref("app.update.url.manual", "http://www.mozilla.org/products/%APP%/");
pref("app.update.url.manual", "http://www.mozilla.org/products/firefox/");
// A default value for the "More information about this update" link
// supplied in the "An update is available" page of the update wizard.
pref("app.update.url.details", "http://www.mozilla.org/projects/%APP%/");
pref("app.update.url.details", "http://www.mozilla.org/projects/firefox/");
// Release notes and vendor URLs
pref("app.releaseNotesURL", "http://www.mozilla.org/projects/%APP%/%VERSION%/releasenotes/");
pref("app.vendorURL", "http://www.mozilla.org/projects/%APP%/");
pref("app.releaseNotesURL", "http://www.mozilla.org/projects/firefox/%VERSION%/releasenotes/");
pref("app.vendorURL", "http://www.mozilla.org/projects/firefox/");
// Search codes belong only in builds with official branding
pref("browser.search.param.yahoo-fr", "");

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

@ -53,9 +53,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "webrtcUI",
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "KeywordURLResetPrompter",
"resource:///modules/KeywordURLResetPrompter.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
"resource:///modules/RecentWindow.jsm");
@ -264,13 +261,6 @@ BrowserGlue.prototype = {
this._initPlaces(false);
}
break;
case "defaultURIFixup-using-keyword-pref":
if (KeywordURLResetPrompter.shouldPrompt) {
let keywordURI = subject.QueryInterface(Ci.nsIURI);
KeywordURLResetPrompter.prompt(this.getMostRecentBrowserWindow(),
keywordURI);
}
break;
case "initial-migration-will-import-default-bookmarks":
this._migrationImportsDefaultBookmarks = true;
break;
@ -344,7 +334,6 @@ BrowserGlue.prototype = {
os.addObserver(this, "distribution-customization-complete", false);
os.addObserver(this, "places-shutdown", false);
this._isPlacesShutdownObserver = true;
os.addObserver(this, "defaultURIFixup-using-keyword-pref", false);
os.addObserver(this, "handle-xul-text-link", false);
os.addObserver(this, "profile-before-change", false);
#ifdef MOZ_SERVICES_HEALTHREPORT
@ -378,7 +367,6 @@ BrowserGlue.prototype = {
os.removeObserver(this, "places-database-locked");
if (this._isPlacesShutdownObserver)
os.removeObserver(this, "places-shutdown");
os.removeObserver(this, "defaultURIFixup-using-keyword-pref");
os.removeObserver(this, "handle-xul-text-link");
os.removeObserver(this, "profile-before-change");
#ifdef MOZ_SERVICES_HEALTHREPORT
@ -564,9 +552,6 @@ BrowserGlue.prototype = {
});
}
let keywordURLUserSet = Services.prefs.prefHasUserValue("keyword.URL");
Services.telemetry.getHistogramById("FX_KEYWORD_URL_USERSET").add(keywordURLUserSet);
// Perform default browser checking.
var shell;
try {
@ -1223,7 +1208,7 @@ BrowserGlue.prototype = {
},
_migrateUI: function BG__migrateUI() {
const UI_VERSION = 9;
const UI_VERSION = 11;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul#";
let currentUIVersion = 0;
try {
@ -1366,6 +1351,29 @@ BrowserGlue.prototype = {
Services.prefs.clearUserPref("browser.library.useNewDownloadsView");
}
#ifdef XP_WIN
if (currentUIVersion < 10) {
// For Windows systems with display set to > 96dpi (i.e. systemDefaultScale
// will return a value > 1.0), we want to discard any saved full-zoom settings,
// as we'll now be scaling the content according to the system resolution
// scale factor (Windows "logical DPI" setting)
let sm = Cc["@mozilla.org/gfx/screenmanager;1"].getService(Ci.nsIScreenManager);
if (sm.systemDefaultScale > 1.0) {
let cps2 = Cc["@mozilla.org/content-pref/service;1"].
getService(Ci.nsIContentPrefService2);
cps2.removeByName("browser.content.full-zoom", null);
}
}
#endif
if (currentUIVersion < 11) {
Services.prefs.clearUserPref("dom.disable_window_move_resize");
Services.prefs.clearUserPref("dom.disable_window_flip");
Services.prefs.clearUserPref("dom.event.contextmenu.enabled");
Services.prefs.clearUserPref("javascript.enabled");
Services.prefs.clearUserPref("permissions.default.image");
}
if (this._dirty)
this._dataSource.QueryInterface(Ci.nsIRDFRemoteDataSource).Flush();

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

@ -1,46 +0,0 @@
<?xml version="1.0"?>
<!-- -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -->
<!-- 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/. -->
<!DOCTYPE prefwindow SYSTEM "chrome://browser/locale/preferences/advanced-scripts.dtd">
<?xml-stylesheet href="chrome://global/skin/"?>
<prefwindow id="AdvancedJSDialog" type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&advancedJSDialog.title;"
dlgbuttons="accept,cancel,help"
ondialoghelp="openPrefsHelp()">
<script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
<prefpane id="AdvancedJSDialogPane"
helpTopic="prefs-advanced-javascript">
<preferences>
<preference id="dom.event.contextmenu.enabled" name="dom.event.contextmenu.enabled" type="bool"/>
<preference id="dom.disable_window_move_resize" name="dom.disable_window_move_resize" type="bool" inverted="true"/>
<preference id="dom.disable_window_flip" name="dom.disable_window_flip" type="bool" inverted="true"/>
</preferences>
<script type="application/javascript" src="chrome://browser/content/preferences/advanced-scripts.js"/>
<stringbundle id="preferencesBundle" src="chrome://browser/locale/preferences/preferences.properties"/>
<description value="&allowScripts.label;"/>
<checkbox id="moveResizePopupWindows" label="&moveResizePopupWindows.label;"
accesskey="&moveResizePopupWindows.accesskey;"
preference="dom.disable_window_move_resize"/>
<checkbox id="raiseLowerWindows" label="&raiseLowerWindows.label;"
accesskey="&raiseLowerWindows.accesskey;"
preference="dom.disable_window_flip"/>
<checkbox id="disableContextMenus" label="&disableContextMenus.label;"
accesskey="&disableContextMenus.accesskey;"
preference="dom.event.contextmenu.enabled"/>
</prefpane>
</prefwindow>

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

@ -36,8 +36,7 @@ var gContentPane = {
* The exceptions types which may be passed to this._showExceptions().
*/
_exceptionsParams: {
popup: { blockVisible: false, sessionVisible: false, allowVisible: true, prefilledHost: "", permissionType: "popup" },
image: { blockVisible: true, sessionVisible: false, allowVisible: true, prefilledHost: "", permissionType: "image" }
popup: { blockVisible: false, sessionVisible: false, allowVisible: true, prefilledHost: "", permissionType: "popup" }
},
/**
@ -62,15 +61,6 @@ var gContentPane = {
*
* dom.disable_open_during_load
* - true if popups are blocked by default, false otherwise
* permissions.default.image
* - an integer:
* 1 all images should be loaded,
* 2 no images should be loaded,
* 3 load only images from the site on which the current page resides
* (i.e., if viewing foo.example.com, foo.example.com/foo.jpg and
* bar.foo.example.com/bar.jpg load but example.com/quux.jpg does not)
* javascript.enabled
* - true if JavaScript is enabled, false otherwise
*/
// POP-UPS
@ -84,48 +74,6 @@ var gContentPane = {
this._showExceptions("popup");
},
// IMAGES
/**
* Converts the value of the permissions.default.image preference into a
* Boolean value for use in determining the state of the "load images"
* checkbox, returning true if images should be loaded and false otherwise.
*/
readLoadImages: function ()
{
var pref = document.getElementById("permissions.default.image");
return (pref.value == 1 || pref.value == 3);
},
/**
* Returns the "load images" preference value which maps to the state of the
* preferences UI.
*/
writeLoadImages: function ()
{
return (document.getElementById("loadImages").checked) ? 1 : 2;
},
/**
* Displays image exception preferences for which websites can and cannot
* load images.
*/
showImageExceptions: function ()
{
this._showExceptions("image");
},
// JAVASCRIPT
/**
* Displays the advanced JavaScript preferences for enabling or disabling
* various annoying behaviors.
*/
showAdvancedJS: function ()
{
document.documentElement.openSubDialog("chrome://browser/content/preferences/advanced-scripts.xul",
"", null);
},
// FONTS

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

@ -22,17 +22,8 @@
<preferences id="contentPreferences">
<!--XXX buttons prefs -->
<!-- POPUPS, IMAGES, JAVASCRIPT -->
<!-- POPUPS -->
<preference id="dom.disable_open_during_load" name="dom.disable_open_during_load" type="bool"/>
<preference id="permissions.default.image" name="permissions.default.image" type="int"/>
<preference id="javascript.enabled" name="javascript.enabled" type="bool"/>
<preference id="pref.advanced.images.disable_button.view_image"
name="pref.advanced.images.disable_button.view_image"
type="bool"/>
<preference id="pref.advanced.javascript.disable_button.advanced"
name="pref.advanced.javascript.disable_button.advanced"
type="bool"/>
<!-- FONTS -->
<preference id="font.language.group"
@ -65,36 +56,6 @@
oncommand="gContentPane.showPopupExceptions();"
accesskey="&popupExceptions.accesskey;"/>
</row>
<row id="enableImagesRow">
<vbox align="start">
<checkbox id="loadImages"
label="&loadImages.label;"
accesskey="&loadImages.accesskey;"
preference="permissions.default.image"
onsyncfrompreference="return gContentPane.readLoadImages();"
onsynctopreference="return gContentPane.writeLoadImages();"/>
</vbox>
<vbox>
<button label="&exceptions.label;"
accesskey="&exceptions.accesskey;"
oncommand="gContentPane.showImageExceptions();"
preference="pref.advanced.images.disable_button.view_image"/>
</vbox>
</row>
<row id="enableJavaScriptRow">
<vbox align="start">
<checkbox id="enableJavaScript" preference="javascript.enabled"
label="&enableJavaScript.label;" accesskey="&enableJavaScript.accesskey;"
onsyncfrompreference="return gContentPane.updateButtons('advancedJSButton',
'javascript.enabled');"/>
</vbox>
<vbox>
<button id="advancedJSButton" label="&advancedJS.label;"
accesskey="&advancedJS.accesskey;"
oncommand="gContentPane.showAdvancedJS();"
preference="pref.advanced.javascript.disable_button.advanced"/>
</vbox>
</row>
</rows>
</grid>
</groupbox>

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

@ -36,9 +36,7 @@ var gContentPane = {
*/
_exceptionsParams: {
popup: { blockVisible: false, sessionVisible: false, allowVisible: true,
prefilledHost: "", permissionType: "popup" },
image: { blockVisible: true, sessionVisible: false, allowVisible: true,
prefilledHost: "", permissionType: "image" }
prefilledHost: "", permissionType: "popup" }
},
/**
@ -63,15 +61,6 @@ var gContentPane = {
*
* dom.disable_open_during_load
* - true if popups are blocked by default, false otherwise
* permissions.default.image
* - an integer:
* 1 all images should be loaded,
* 2 no images should be loaded,
* 3 load only images from the site on which the current page resides
* (i.e., if viewing foo.example.com, foo.example.com/foo.jpg and
* bar.foo.example.com/bar.jpg load but example.com/quux.jpg does not)
* javascript.enabled
* - true if JavaScript is enabled, false otherwise
*/
// POP-UPS
@ -85,49 +74,6 @@ var gContentPane = {
this._showExceptions("popup");
},
// IMAGES
/**
* Converts the value of the permissions.default.image preference into a
* Boolean value for use in determining the state of the "load images"
* checkbox, returning true if images should be loaded and false otherwise.
*/
readLoadImages: function ()
{
var pref = document.getElementById("permissions.default.image");
return (pref.value == 1 || pref.value == 3);
},
/**
* Returns the "load images" preference value which maps to the state of the
* preferences UI.
*/
writeLoadImages: function ()
{
return (document.getElementById("loadImages").checked) ? 1 : 2;
},
/**
* Displays image exception preferences for which websites can and cannot
* load images.
*/
showImageExceptions: function ()
{
this._showExceptions("image");
},
// JAVASCRIPT
/**
* Displays the advanced JavaScript preferences for enabling or disabling
* various annoying behaviors.
*/
showAdvancedJS: function ()
{
openDialog("chrome://browser/content/preferences/advanced-scripts.xul",
"Browser:AdvancedScripts", null);
},
// FONTS
/**

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

@ -4,22 +4,10 @@
<preferences id="contentPreferences">
<!-- Popups, images, and JavaScript -->
<!-- Popups -->
<preference id="dom.disable_open_during_load"
name="dom.disable_open_during_load"
type="bool"/>
<preference id="permissions.default.image"
name="permissions.default.image"
type="int"/>
<preference id="javascript.enabled"
name="javascript.enabled"
type="bool"/>
<preference id="pref.advanced.images.disable_button.view_image"
name="pref.advanced.images.disable_button.view_image"
type="bool"/>
<preference id="pref.advanced.javascript.disable_button.advanced"
name="pref.advanced.javascript.disable_button.advanced"
type="bool"/>
<!-- Fonts -->
<preference id="font.language.group"
@ -56,36 +44,6 @@
oncommand="gContentPane.showPopupExceptions();"
accesskey="&popupExceptions.accesskey;"/>
</row>
<row id="enableImagesRow">
<vbox align="start">
<checkbox id="loadImages"
label="&loadImages.label;"
accesskey="&loadImages.accesskey;"
preference="permissions.default.image"
onsyncfrompreference="return gContentPane.readLoadImages();"
onsynctopreference="return gContentPane.writeLoadImages();"/>
</vbox>
<vbox>
<button label="&exceptions.label;"
accesskey="&exceptions.accesskey;"
oncommand="gContentPane.showImageExceptions();"
preference="pref.advanced.images.disable_button.view_image"/>
</vbox>
</row>
<row id="enableJavaScriptRow">
<vbox align="start">
<checkbox id="enableJavaScript" preference="javascript.enabled"
label="&enableJavaScript.label;" accesskey="&enableJavaScript.accesskey;"
onsyncfrompreference="return gContentPane.updateButtons('advancedJSButton',
'javascript.enabled');"/>
</vbox>
<vbox>
<button id="advancedJSButton" label="&advancedJS.label;"
accesskey="&advancedJS.accesskey;"
oncommand="gContentPane.showAdvancedJS();"
preference="pref.advanced.javascript.disable_button.advanced"/>
</vbox>
</row>
</rows>
</grid>
</groupbox>
@ -162,4 +120,4 @@
accesskey="&chooseButton.accesskey;"
oncommand="gContentPane.showLanguages();"/>
</hbox>
</groupbox>
</groupbox>

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

@ -146,13 +146,14 @@ var gPrivacyPane = {
*/
getTrackingPrefs: function PPP_getTrackingPrefs()
{
let dntValuePref = document.getElementById("privacy.donottrackheader.value"),
dntEnabledPref = document.getElementById("privacy.donottrackheader.enabled");
// XXX avoid using bindings that might not be attached, see bug 859982
let dntValue = Services.prefs.getBoolPref("privacy.donottrackheader.value"),
dntEnabled = Services.prefs.getBoolPref("privacy.donottrackheader.enabled");
// if DNT is enbaled, select the value from the selected radio
// button, otherwise choose the "no preference" radio button
if (dntEnabledPref.value)
return dntValuePref.value;
if (dntEnabled)
return dntValue;
return document.getElementById("dntnopref").value;
},

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

@ -9,7 +9,6 @@ browser.jar:
content/browser/preferences/aboutPermissions.xml
* content/browser/preferences/advanced.xul
* content/browser/preferences/advanced.js
content/browser/preferences/advanced-scripts.xul
content/browser/preferences/applications.xul
* content/browser/preferences/applications.js
content/browser/preferences/applicationManager.xul

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

@ -45,6 +45,7 @@ var gEngineManagerDialog = {
break;
case "engine-removed":
case "engine-current":
case "engine-default":
// Not relevant
break;
}

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

@ -121,8 +121,12 @@
<field name="searchButton">document.getAnonymousElementByAttribute(this,
"anonid", "searchbar-engine-button");</field>
<property name="currentEngine"
onset="this.searchService.currentEngine = val; return val;">
<property name="currentEngine">
<setter><![CDATA[
let ss = this.searchService;
ss.defaultEngine = ss.currentEngine = val;
return val;
]]></setter>
<getter><![CDATA[
var currentEngine = this.searchService.currentEngine;
// Return a dummy engine if there is no currentEngine
@ -422,8 +426,9 @@
var newIndex = this.engines.indexOf(this.currentEngine);
newIndex += isNextEngine ? 1 : -1;
if (newIndex >= 0 && newIndex < this.engines.length)
if (newIndex >= 0 && newIndex < this.engines.length) {
this.currentEngine = this.engines[newIndex];
}
aEvent.preventDefault();
aEvent.stopPropagation();

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

@ -57,7 +57,7 @@ function test() {
let engine = Services.search.getEngineByName("Google");
ok(engine, "Google");
is(Services.search.originalDefaultEngine, engine, "Check that Google is the default search engine");
is(Services.search.defaultEngine, engine, "Check that Google is the default search engine");
let distributionID;
try {

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

@ -774,6 +774,8 @@ bin/libfreebl_32int64_3.so
@BINPATH@/metro/chrome.manifest
@BINPATH@/metro/searchplugins
@BINPATH@/metro/metroapp.ini
@BINPATH@/metro/chrome/browser@JAREXT@
@BINPATH@/metro/chrome/browser.manifest
@BINPATH@/metro/chrome/chrome@JAREXT@
@BINPATH@/metro/chrome/chrome.manifest
@BINPATH@/metro/chrome/@AB_CD@@JAREXT@

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

@ -633,9 +633,9 @@ just addresses the organization to follow, e.g. "This site is run by " -->
<!ENTITY social.toggleNotifications.accesskey "n">
<!ENTITY social.activated.description "Services from <label/> have been enabled. You can change your settings for services in the <label class='text-link'>Add-on Manager</label>.">
<!ENTITY social.activated.undobutton.label "Oops, undo this!">
<!ENTITY social.activated.undobutton.accesskey "U">
<!ENTITY social.learnMore.label "Learn more...">
<!ENTITY social.activated.undo.label "Oops, undo this!">
<!ENTITY social.activated.undo.accesskey "U">
<!ENTITY social.learnMore.label "Learn more">
<!ENTITY social.learnMore.accesskey "l">
<!ENTITY social.closeNotificationItem.label "Not Now">

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

@ -361,21 +361,6 @@ dataReportingNotification.message = %1$S automatically sends some data to
dataReportingNotification.button.label = Choose What I Share
dataReportingNotification.button.accessKey = C
# Keyword.URL reset prompt
# LOCALIZATION NOTE (keywordPrompt.message):
# - %1$S is brandShortName
# - %2$S is a host name (e.g. "somewebsearch.com") from the current value of keyword.URL
# - %3$S is the name of the default search engine (e.g. "Google")
keywordPrompt.message = %1$S is using '%2$S' for searches from the location bar. Would you like to restore the default search (%3$S)?
# LOCALIZATION NOTE (keywordPrompt.yesButton): %1$S is the name of the default search engine
keywordPrompt.yesButton = Yes, use %1$S
keywordPrompt.yesButton.accessKey = Y
# LOCALIZATION NOTE (keywordPrompt.noButton): %1$S is a host name (e.g. "somewebsearch.com") from the current value of keyword.URL
keywordPrompt.noButton = No, continue using '%1$S'
keywordPrompt.noButton.accessKey = N
# Webapps notification popup
webapps.install = Install
webapps.install.accesskey = I
@ -388,11 +373,11 @@ fullscreen.entered=%S is now fullscreen.
# LOCALIZATION NOTE (fullscreen.rememberDecision): displayed when we enter HTML5 fullscreen mode, %S is the domain name of the focused website (e.g. mozilla.com).
fullscreen.rememberDecision=Remember decision for %S
# LOCALIZATION NOTE (social.activated.description): %1$S is the name of the social provider, %2$S is brandShortName (e.g. Firefox)
# LOCALIZATION NOTE (social.install.description): %1$S is the hostname of the social provider, %2$S is brandShortName (e.g. Firefox)
service.install.description=Would you like to enable services from %1$S to display in your %2$S toolbar and sidebar?
service.install.ok.label=Enable Services
service.install.ok.accesskey=E
service.install.learnmore=Learn More...
service.install.learnmore=Learn More
# LOCALIZATION NOTE (social.turnOff.label): %S is the name of the social provider
social.turnOff.label=Turn off %S

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

@ -1,15 +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/. -->
<!ENTITY advancedJSDialog.title "Advanced JavaScript Settings">
<!ENTITY window.width "37em">
<!ENTITY allowScripts.label "Allow scripts to:">
<!ENTITY moveResizePopupWindows.label "Move or resize popup windows">
<!ENTITY moveResizePopupWindows.accesskey "M">
<!ENTITY raiseLowerWindows.label "Raise or lower windows">
<!ENTITY raiseLowerWindows.accesskey "R">
<!ENTITY disableContextMenus.label "Disable or replace context menus">
<!ENTITY disableContextMenus.accesskey "D">

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

@ -7,20 +7,6 @@
<!ENTITY popupExceptions.label "Exceptions…">
<!ENTITY popupExceptions.accesskey "E">
<!ENTITY loadImages.label "Load images automatically">
<!ENTITY loadImages.accesskey "I">
<!ENTITY exceptions.label "Exceptions…">
<!ENTITY exceptions.accesskey "x">
<!ENTITY enableJavaScript.label "Enable JavaScript">
<!ENTITY enableJavaScript.accesskey "J">
<!ENTITY advancedJS.label "Advanced…">
<!ENTITY advancedJS.accesskey "v">
<!ENTITY enableJava.label "Enable Java">
<!ENTITY enableJava.accesskey "n">
<!ENTITY fontsAndColors.label "Fonts &amp; Colors">
<!ENTITY defaultFont.label "Default font:">

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

@ -21,8 +21,6 @@ addonspermissionstext=You can specify which websites are allowed to install add-
addons_permissions_title=Allowed Sites - Add-ons Installation
popuppermissionstext=You can specify which websites are allowed to open pop-up windows. Type the exact address of the site you want to allow and then click Allow.
popuppermissionstitle=Allowed Sites - Pop-ups
imagepermissionstext=You can specify which websites are allowed to load images. Type the exact address of the site you want to manage and then click Block or Allow.
imagepermissionstitle=Exceptions - Images
invalidURI=Please enter a valid hostname
invalidURITitle=Invalid Hostname Entered

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

@ -89,7 +89,6 @@
locale/browser/preferences/aboutPermissions.dtd (%chrome/browser/preferences/aboutPermissions.dtd)
locale/browser/preferences/aboutPermissions.properties (%chrome/browser/preferences/aboutPermissions.properties)
locale/browser/preferences/advanced.dtd (%chrome/browser/preferences/advanced.dtd)
locale/browser/preferences/advanced-scripts.dtd (%chrome/browser/preferences/advanced-scripts.dtd)
locale/browser/preferences/applicationManager.dtd (%chrome/browser/preferences/applicationManager.dtd)
locale/browser/preferences/applicationManager.properties (%chrome/browser/preferences/applicationManager.properties)
locale/browser/preferences/colors.dtd (%chrome/browser/preferences/colors.dtd)

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

@ -136,13 +136,8 @@ function TopSitesView(aGrid, aMaxSites, aUseThumbnails) {
this._set.controller = this;
this._topSitesMax = aMaxSites;
this._useThumbs = aUseThumbnails;
// handle selectionchange DOM events from the grid/tile group
this._set.addEventListener("context-action", this, false);
// clean up state when the appbar closes
window.addEventListener('MozAppbarDismissing', this, false);
let history = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
history.addObserver(this, false);
@ -230,13 +225,8 @@ TopSitesView.prototype = {
},0);
}
},
handleEvent: function(aEvent) {
switch (aEvent.type){
case "context-action":
this.doActionOnSelectedTiles(aEvent.action, aEvent);
aEvent.stopPropagation(); // event is handled, no need to let it bubble further
break;
case "MozAppbarDismissing":
// clean up when the context appbar is dismissed - we don't remember selections
this._lastSelectedSites = null;

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

@ -134,10 +134,37 @@ let Util = {
aElement.style.border = "2px solid red";
},
transitionElementVisibility: function(aNodes, aVisible) {
// accept single node or a collection of nodes
aNodes = aNodes.length ? aNodes : [aNodes];
let defd = Promise.defer();
let pending = 0;
Array.forEach(aNodes, function(aNode) {
if (aVisible) {
aNode.hidden = false;
aNode.removeAttribute("fade"); // trigger transition to full opacity
} else {
aNode.setAttribute("fade", true); // trigger transition to 0 opacity
}
aNode.addEventListener("transitionend", function onTransitionEnd(aEvent){
aNode.removeEventListener("transitionend", onTransitionEnd);
if (!aVisible) {
aNode.hidden = true;
}
pending--;
if (!pending){
defd.resolve(true);
}
}, false);
pending++;
});
return defd.promise;
},
getHrefForElement: function getHrefForElement(target) {
let link = null;
while (target) {
if (target instanceof Ci.nsIDOMHTMLAnchorElement ||
if (target instanceof Ci.nsIDOMHTMLAnchorElement ||
target instanceof Ci.nsIDOMHTMLAreaElement ||
target instanceof Ci.nsIDOMHTMLLinkElement) {
if (target.hasAttribute("href"))
@ -441,7 +468,7 @@ Util.Timeout.prototype = {
return this;
},
// Return true if we are waiting for a callback.
// Return true if we are waiting for a callback.
isPending: function isPending() {
return this._type !== null;
}

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

@ -159,42 +159,39 @@ var Appbar = {
}
}
},
showContextualActions: function(aVerbs){
let doc = document;
// button element id to action verb lookup
let buttonsMap = new Map();
for (let verb of aVerbs) {
let id = verb + "-selected-button";
let buttonNode = doc.getElementById(id);
if (buttonNode) {
buttonsMap.set(id, verb);
} else {
Util.dumpLn("Appbar.showContextualActions: no button for " + verb);
if (!doc.getElementById(id)) {
throw new Error("Appbar.showContextualActions: no button for " + verb);
}
buttonsMap.set(id, verb);
}
// hide/show buttons as appropriate
let buttons = doc.querySelectorAll("#contextualactions-tray > toolbarbutton");
for (let btnNode of buttons) {
if (buttonsMap.has(btnNode.id)){
btnNode.hidden = false;
} else {
btnNode.hidden = true;
// sort buttons into 2 buckets - needing showing and needing hiding
let toHide = [],
toShow = [];
for (let btnNode of this.appbar.querySelectorAll("#contextualactions-tray > toolbarbutton")) {
// correct the hidden state for each button;
// .. buttons present in the map should be visible, otherwise not
if (buttonsMap.has(btnNode.id)) {
if (btnNode.hidden) toShow.push(btnNode);
} else if (!btnNode.hidden) {
toHide.push(btnNode);
}
};
if (buttonsMap.size) {
// there are buttons to show
// TODO: show the contextual actions tray?
} else {
// 0 actions to show;
// TODO: hide the contextual actions tray entirely?
}
return Task.spawn(function() {
if (toHide.length) {
yield Util.transitionElementVisibility(toHide, false);
}
if (toShow.length) {
yield Util.transitionElementVisibility(toShow, true);
}
});
},
_onTileSelectionChanged: function _onTileSelectionChanged(aEvent){
let activeTileset = aEvent.target;

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

@ -114,21 +114,11 @@
return new Set();
}
function cloneSet(aSet) {
let clone = new Set();
if (aSet) {
for (let item of aSet) {
clone.add(item);
}
}
return clone;
}
// given one or more sets of values,
// return a set with only those values present in each
let initialItem = tileNodes[0];
let verbSet = cloneSet(initialItem.contextActions);
let verbSet = new Set(initialItem.contextActions);
for (let i=1; i<tileNodes.length; i++){
let set = tileNodes[i].contextActions;
for (let item of verbSet) {
@ -137,6 +127,10 @@
}
}
}
// add the clear-selection button if more than one tiles are selected
if (tileNodes.length > 1) {
verbSet.add('clear');
}
// returns Set
return verbSet;
]]>
@ -475,10 +469,25 @@
]]>
</body>
</method>
</implementation>
<handlers>
<handler event="context-action">
<![CDATA[
// context-action is an event fired by the appbar typically
// which directs us to do something to the selected tiles
switch (event.action) {
case "clear":
this.clearSelection();
break;
default:
if (this.controller && this.controller.doActionOnSelectedTiles) {
this.controller.doActionOnSelectedTiles(event.action, event);
}
}
]]>
</handler>
</handlers>
</binding>
<binding id="richgrid-item">
<content>
<xul:vbox anonid="anon-richgrid-item" class="richgrid-item-content" xbl:inherits="customImage">

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

@ -314,11 +314,12 @@
<!-- Windows 8 Appbar -->
<appbar id="appbar" mousethrough="never" observes="bcast_windowState">
<!-- contextual actions temporarily hidden, pending #800996 -->
<hbox id="contextualactions-tray" flex="1" hidden="true">
<toolbarbutton id="delete-selected-button" hidden="true" oncommand="Appbar.dispatchContextualAction('delete')"/>
<toolbarbutton id="restore-selected-button" hidden="true" oncommand="Appbar.dispatchContextualAction('restore')"/>
<toolbarbutton id="pin-selected-button" hidden="true" oncommand="Appbar.dispatchContextualAction('pin')"/>
<toolbarbutton id="unpin-selected-button" hidden="true" oncommand="Appbar.dispatchContextualAction('unpin')"/>
<hbox id="contextualactions-tray" flex="1">
<toolbarbutton id="delete-selected-button" hidden="true" fade="true" oncommand="Appbar.dispatchContextualAction('delete')"/>
<toolbarbutton id="restore-selected-button" hidden="true" fade="true" oncommand="Appbar.dispatchContextualAction('restore')"/>
<toolbarbutton id="pin-selected-button" hidden="true" fade="true" oncommand="Appbar.dispatchContextualAction('pin')"/>
<toolbarbutton id="unpin-selected-button" hidden="true" fade="true" oncommand="Appbar.dispatchContextualAction('unpin')"/>
<toolbarbutton id="clear-selected-button" hidden="true" fade="true" oncommand="Appbar.dispatchContextualAction('clear')"/>
</hbox>
<hbox flex="1">
<toolbarbutton id="download-button" oncommand="Appbar.onDownloadButton()"/>
@ -676,6 +677,11 @@
</hbox>
</stack>
<html:div id="overlay-back" class="overlay-button"
observes="cmd_back" onclick="CommandUpdater.doCommand('cmd_back');"></html:div>
<html:div id="overlay-plus" class="overlay-button"
observes="cmd_back" onclick="CommandUpdater.doCommand('cmd_newTab');"></html:div>
<svg:svg height="0">
<svg:clipPath id="forward-button-clip-path" clipPathUnits="objectBoundingBox">
<svg:path d="M 0,0 C 0.15,0.12 0.25,0.3 0.25,0.5 0.25,0.7 0.15,0.88 0,1 L 1,1 1,0 0,0 z"/>

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

@ -3,7 +3,6 @@
# 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/.
chrome.jar:
% content browser %content/
@ -69,7 +68,6 @@ chrome.jar:
content/shell.html (content/jsshell/shell.html)
content/browser.css (content/browser.css)
content/cursor.css (content/cursor.css)
% content branding %content/branding/
content/sanitize.js (content/sanitize.js)
content/sanitizeUI.js (content/sanitizeUI.js)
content/input.js (content/input.js)

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

@ -3,13 +3,13 @@
[{"type":"text/x-moz-place-container","title":"@bookmarks_title@","annos":[{"name":"metro/bookmarksRoot","expires":4,"type":1,"value":1}],
"children":
[
{"index":1,"title":"@firefox_about@", "type":"text/x-moz-place", "uri":"http://www.mozilla.com/@AB_CD@/about/",
{"index":1,"title":"@firefox_about@", "type":"text/x-moz-place", "uri":"http://www.mozilla.org/@AB_CD@/about/",
"iconUri":"chrome://branding/content/favicon32.png"
},
{"index":2,"title":"@getting_started@", "type":"text/x-moz-place", "uri":"http://www.mozilla.com/@AB_CD@/firefox/central/",
{"index":2,"title":"@getting_started@", "type":"text/x-moz-place", "uri":"http://www.mozilla.org/@AB_CD@/firefox/central/",
"iconUri":"chrome://branding/content/favicon32.png"
},
{"index":3,"title":"@firefox_community@", "type":"text/x-moz-place", "uri":"http://www.mozilla.com/@AB_CD@/firefox/community/",
{"index":3,"title":"@firefox_community@", "type":"text/x-moz-place", "uri":"http://www.mozilla.org/@AB_CD@/firefox/community/",
"iconUri":"chrome://branding/content/favicon32.png"
},
]

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

@ -198,7 +198,6 @@ pref("privacy.popups.showBrowserMessage", true);
pref("dom.disable_window_open_dialog_feature", true);
pref("keyword.enabled", true);
pref("keyword.URL", "http://www.bing.com/search?q=");
pref("accessibility.typeaheadfind", false);
pref("accessibility.typeaheadfind.timeout", 5000);
@ -381,17 +380,12 @@ pref("dom.ipc.content.nice", 1);
// product URLs
// The breakpad report server to link to in about:crashes
pref("breakpad.reportURL", "https://crash-stats.mozilla.com/report/index/");
pref("app.releaseNotesURL", "http://www.mozilla.com/%LOCALE%/mobile/%VERSION%/releasenotes/");
// TODO: This is not the correct article for metro!!!
pref("app.sync.tutorialURL", "https://support.mozilla.org/kb/sync-firefox-between-desktop-and-mobile");
pref("app.support.baseURL", "http://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/");
pref("app.privacyURL", "http://www.mozilla.com/legal/privacy/");
pref("app.creditsURL", "http://www.mozilla.org/credits/");
pref("app.channelURL", "http://www.mozilla.org/%LOCALE%/firefox/channel/");
#if MOZ_UPDATE_CHANNEL == beta
pref("app.faqURL", "http://www.mozilla.com/%LOCALE%/mobile/beta/faq/");
#else
pref("app.faqURL", "http://www.mozilla.com/%LOCALE%/mobile/faq/");
#endif
// Name of alternate about: page for certificate errors (when undefined, defaults to about:neterror)
pref("security.alternate_certificate_error_page", "certerror");
@ -400,12 +394,6 @@ pref("security.warn_viewing_mixed", false); // Warning is disabled. See Bug 616
// Override some named colors to avoid inverse OS themes
#ifdef MOZ_OFFICIAL_BRANDING
pref("browser.search.param.yahoo-fr", "moz35");
pref("browser.search.param.yahoo-fr-cjkt", "moz35");
pref("browser.search.param.yahoo-fr-ja", "mozff");
#endif
/* app update prefs */
pref("app.update.timer", 60000); // milliseconds (1 min)
@ -418,23 +406,9 @@ pref("app.update.channel", "@MOZ_UPDATE_CHANNEL@");
pref("app.update.mode", 1);
pref("app.update.silent", false);
pref("app.update.url", "https://aus2.mozilla.org/update/4/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%-xul/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/%PLATFORM_VERSION%/update.xml");
pref("app.update.promptWaitTime", 43200);
pref("app.update.idletime", 60);
pref("app.update.showInstalledUI", false);
pref("app.update.incompatible.mode", 0);
pref("app.update.download.backgroundInterval", 0);
// %APP% resolves to metrofirefox, which won't work until bug 845983 is fixed
#ifdef MOZ_OFFICIAL_BRANDING
pref("app.update.interval", 86400);
pref("app.update.url.manual", "https://www.mozilla.org/%LOCALE%/firefox/update/");
pref("app.update.url.details", "https://www.mozilla.org/%LOCALE%/firefox/releases/");
#else
pref("app.update.interval", 28800);
pref("app.update.url.manual", "https://www.mozilla.org/%LOCALE%/firefox/");
pref("app.update.url.details", "https://www.mozilla.org/%LOCALE%/firefox/");
#endif
#endif
// replace newlines with spaces on paste into single-line text boxes
pref("editor.singleLine.pasteNewlines", 2);
@ -554,7 +528,7 @@ pref("browser.dom.window.dump.enabled", true);
pref("device.camera.enabled", true);
pref("media.realtime_decoder.enabled", true);
// Mobile manages state by autodetection
// Metro manages state by autodetection
pref("network.manage-offline-status", true);
// Enable HTML fullscreen API in content.

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

@ -643,7 +643,21 @@ appbar toolbarbutton[disabled] {
#star-button[checked] {
-moz-image-region: rect(80px, 360px, 120px, 320px) !important;
}
/* Tile-selection-Specific */
#contextualactions-tray > toolbarbutton {
opacity: 1;
}
#contextualactions-tray > toolbarbutton[fade] {
opacity: 0;
}
#contextualactions-tray > toolbarbutton:not([immediate]) {
transition-property: opacity;
transition-duration: .3s;
transition-timing-function: ease-in;
transition-delay: 80ms;
}
#pin-selected-button {
-moz-image-region: rect(0px, 240px, 40px, 200px) !important;
}
@ -653,17 +667,15 @@ appbar toolbarbutton[disabled] {
#pin-selected-button:active {
-moz-image-region: rect(80px, 240px, 120px, 200px) !important;
}
#unpin-selected-button {
-moz-image-region: rect(80px, 240px, 120px, 200px) !important;
-moz-image-region: rect(0px, 280px, 40px, 240px) !important;
}
#unpin-selected-button:hover {
-moz-image-region: rect(40px, 240px, 80px, 200px) !important;
-moz-image-region: rect(40px, 280px, 80px, 240px) !important;
}
#unpin-selected-button:active {
-moz-image-region: rect(0px, 240px, 40px, 200px) !important;
-moz-image-region: rect(80px, 280px, 120px, 240px) !important;
}
#delete-selected-button {
-moz-image-region: rect(0px, 480px, 40px, 440px) !important;
}
@ -673,6 +685,25 @@ appbar toolbarbutton[disabled] {
#delete-selected-button:active {
-moz-image-region: rect(80px, 480px, 120px, 440px) !important;
}
#clear-selected-button {
-moz-image-region: rect(0px, 520px, 40px, 480px) !important;
}
#clear-selected-button:hover {
-moz-image-region: rect(40px, 520px, 80px, 480px) !important;
}
#clear-selected-button:active {
-moz-image-region: rect(80px, 520px, 120px, 480px) !important;
}
#restore-selected-button {
-moz-image-region: rect(0px, 560px, 40px, 520px) !important;
}
#restore-selected-button:hover {
-moz-image-region: rect(40px, 560px, 80px, 520px) !important;
}
#restore-selected-button:active {
-moz-image-region: rect(80px, 560px, 120px, 520px) !important;
}
/* Flyouts ---------------------------------------------------------------- */
/* don't add a margin to the very top settings entry in flyouts */
@ -945,6 +976,67 @@ setting[type="directory"] > .preferences-alignment {
-moz-margin-end: @margin_large@;
}
/* overlay buttons */
.overlay-button {
position: fixed;
top: 50%;
margin-top: -66px;
width: 120px;
height: 120px;
background-color: hsla(210,30%,10%,.2);
background-size: 60px;
background-repeat: no-repeat;
background-origin: padding-box;
background-clip: padding-box;
border: 6px solid hsla(0,0%,100%,.7);
border-radius: 50%;
box-shadow: 0 0 0 1px hsla(0,0%,0%,.04),
0 0 9px 0 hsla(0,0%,0%,.1);
transition-duration: 550ms;
transition-timing-function: cubic-bezier(0.1, 0.9, 0.2, 1);
}
#overlay-back {
left: -72px;
background-image: url(chrome://browser/skin/images/overlay-back.png);
background-position: right 6px center;
}
#overlay-plus {
right: -72px;
background-image: url(chrome://browser/skin/images/overlay-plus.png);
background-position: left 6px center;
}
.overlay-button[disabled] {
box-shadow: none;
}
#overlay-back[disabled] {
transform: translateX(-60px);
}
#overlay-plus[disabled] {
transform: translateX(60px);
}
.overlay-button:not([disabled]):hover {
background-color: hsla(210,30%,10%,.4);
background-size: 78px;
border-color: hsla(0,0%,100%,.9);
}
#overlay-back:not([disabled]):hover {
background-position: right 12px center;
transform: translateX(40px) scale(1.2);
}
#overlay-plus:not([disabled]):hover {
background-position: left 12px center;
transform: translateX(-40px) scale(1.2);
}
/* helperapp (save-as) popup ----------------------------------------------- */
#helperapp-target {
font-size: @font_small@ !important;

Двоичные данные
browser/metro/theme/images/appbar-icons.png

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

До

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

После

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

Двоичные данные
browser/metro/theme/images/overlay-back.png Normal file

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

После

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

Двоичные данные
browser/metro/theme/images/overlay-plus.png Normal file

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

После

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

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

@ -82,3 +82,5 @@ chrome.jar:
skin/images/scrubber-hdpi.png (images/scrubber-hdpi.png)
skin/images/selection-monocle.png (images/selection-monocle.png)
skin/images/appbar-icons.png (images/appbar-icons.png)
skin/images/overlay-back.png (images/overlay-back.png)
skin/images/overlay-plus.png (images/overlay-plus.png)

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

@ -16,25 +16,25 @@ const SNIPPETS_URL_PREF = "browser.aboutHomeSnippets.updateUrl";
const STARTPAGE_VERSION = 4;
this.AboutHomeUtils = {
get snippetsVersion() STARTPAGE_VERSION
};
get snippetsVersion() STARTPAGE_VERSION,
/**
* Returns an object containing the name and searchURL of the original default
* search engine.
*/
XPCOMUtils.defineLazyGetter(AboutHomeUtils, "defaultSearchEngine", function() {
let defaultEngine = Services.search.originalDefaultEngine;
let submission = defaultEngine.getSubmission("_searchTerms_", null, "homepage");
if (submission.postData) {
throw new Error("Home page does not support POST search engines.");
/**
* Returns an object containing the name and searchURL of the original default
* search engine.
*/
get defaultSearchEngine() {
let defaultEngine = Services.search.defaultEngine;
let submission = defaultEngine.getSubmission("_searchTerms_", null, "homepage");
if (submission.postData) {
throw new Error("Home page does not support POST search engines.");
}
return Object.freeze({
name: defaultEngine.name,
searchURL: submission.uri.spec
});
}
return Object.freeze({
name: defaultEngine.name,
searchURL: submission.uri.spec
});
});
};
/**
* Returns the URL to fetch snippets from, in the urlFormatter service format.

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

@ -1,105 +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/. */
let EXPORTED_SYMBOLS = [ "KeywordURLResetPrompter" ];
const Ci = Components.interfaces;
const Cc = Components.classes;
const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
const KEYWORD_PROMPT_REV = 1;
let KeywordURLResetPrompter = {
get shouldPrompt() {
let keywordURLUserSet = Services.prefs.prefHasUserValue("keyword.URL");
let declinedRev;
try {
declinedRev = Services.prefs.getIntPref("browser.keywordURLPromptDeclined");
} catch (ex) {}
return keywordURLUserSet && declinedRev != KEYWORD_PROMPT_REV;
},
prompt: function KeywordURLResetPrompter_prompt(win, keywordURI) {
let tabbrowser = win.gBrowser;
let notifyBox = tabbrowser.getNotificationBox();
let existingNotification = notifyBox.getNotificationWithValue("keywordURL-reset");
if (existingNotification)
return;
// Find the name/URI of this build's original default engine.
// XXX: Can't use originalDefaultEngine getter here, because that doesn't
// use the default pref branch.
let defaultURI;
let defaultEngine;
try {
let defaultPB = Services.prefs.getDefaultBranch(null);
const nsIPLS = Ci.nsIPrefLocalizedString;
let defaultName = defaultPB.getComplexValue("browser.search.defaultenginename", nsIPLS).data;
defaultEngine = Services.search.getEngineByName(defaultName);
defaultURI = defaultEngine.getSubmission("foo").uri;
} catch (ex) {
// Something went horribly wrong! bail out
return;
}
// If the user-set value has the same base domain as the default, don't
// prompt.
let keywordBaseDomain;
try {
keywordBaseDomain = Services.eTLD.getBaseDomain(keywordURI);
if (keywordBaseDomain == Services.eTLD.getBaseDomain(defaultURI))
return;
} catch (ex) {}
if (!keywordBaseDomain)
return;
let brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
let brandShortName = brandBundle.GetStringFromName("brandShortName");
let browserBundle = win.gNavigatorBundle;
let msg = browserBundle.getFormattedString("keywordPrompt.message",
[brandShortName, keywordBaseDomain,
defaultEngine.name]);
let buttons = [
{
label: browserBundle.getFormattedString("keywordPrompt.yesButton",
[defaultEngine.name]),
accessKey: browserBundle.getString("keywordPrompt.yesButton.accessKey"),
popup: null,
callback: function(aNotificationBar, aButton) {
Services.prefs.clearUserPref("keyword.URL");
try {
// If the currently loaded URI still has the same base domain as the
// keyword URI (this is used as a rough approximation of whether the
// user is still seeing search results as opposed to having clicked
// on a result link), load the default engine's searchForm URL so
// that they can re-do their search.
let currentBaseDomain = Services.eTLD.getBaseDomain(tabbrowser.currentURI);
if (currentBaseDomain == keywordBaseDomain)
tabbrowser.loadURI(defaultEngine.searchForm);
} catch (ex) {}
}
},
{
label: browserBundle.getFormattedString("keywordPrompt.noButton",
[keywordBaseDomain]),
accessKey: browserBundle.getString("keywordPrompt.noButton.accessKey"),
popup: null,
callback: function(aNotificationBar, aButton) {
Services.prefs.setIntPref("browser.keywordURLPromptDeclined", KEYWORD_PROMPT_REV);
}
}
];
let notification = notifyBox.appendNotification(msg, "keywordURL-reset", null, notifyBox.PRIORITY_WARNING_HIGH, buttons);
notification.setAttribute("hideclose", true);
// stick around for a few page loads in case there are redirects involved
notification.persistence = 3;
}
}

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

@ -20,7 +20,6 @@ EXTRA_JS_MODULES = \
SignInToWebsite.jsm \
webappsUI.jsm \
webrtcUI.jsm \
KeywordURLResetPrompter.jsm \
Social.jsm \
SharedFrame.jsm \
$(NULL)

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

@ -2056,6 +2056,17 @@ window[tabsontop="false"] richlistitem[type~="action"][actiontype="switchtab"][s
}
}
/* History Swipe Animation */
#historySwipeAnimationCurrentPage,
#historySwipeAnimationNextPage {
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6);
}
#historySwipeAnimationContainer {
background: url("chrome://browser/skin/linen-pattern.png") #B3B9C1;
}
/* ----- SIDEBAR ELEMENTS ----- */
#sidebar,

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

@ -39,6 +39,7 @@ browser.jar:
skin/classic/browser/Info.png
skin/classic/browser/keyhole-circle.png
skin/classic/browser/KUI-background.png
skin/classic/browser/linen-pattern.png
skin/classic/browser/menu-back.png
skin/classic/browser/menu-forward.png
skin/classic/browser/notification-16.png

Двоичные данные
browser/themes/osx/linen-pattern.png Normal file

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

После

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

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

@ -57,6 +57,7 @@ def InvokeClWithDependencyGeneration(cmdline):
f = open(depstarget, "w")
for dep in sorted(deps):
print >>f, "%s: %s" % (target, dep)
print >>f, "%s:" % dep
if __name__ == "__main__":
InvokeClWithDependencyGeneration(sys.argv[1:])

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

@ -1692,6 +1692,7 @@ class Makefile(object):
def hastarget(self, target):
return target in self._targets
_globcheck = re.compile('[[*?]')
def gettarget(self, target):
assert isinstance(target, str_type)
@ -1699,8 +1700,7 @@ class Makefile(object):
assert target != '', "empty target?"
if target.find('*') != -1 or target.find('?') != -1 or target.find('[') != -1:
raise DataError("wildcards should have been expanded by the parser: '%s'" % (target,))
assert not self._globcheck.match(target)
t = self._targets.get(target, None)
if t is None:
@ -1757,7 +1757,10 @@ class Makefile(object):
self.included.append((path, required))
fspath = util.normaljoin(self.workdir, path)
if os.path.exists(fspath):
stmts = parser.parsefile(fspath)
if weak:
stmts = parser.parsedepfile(fspath)
else:
stmts = parser.parsefile(fspath)
self.variables.append('MAKEFILE_LIST', Variables.SOURCE_AUTOMATIC, path, None, self)
stmts.execute(self, weak=weak)
self.gettarget(path).explicit = True

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

@ -372,6 +372,33 @@ def parsefile(pathname):
pathname = os.path.realpath(pathname)
return _parsecache.get(pathname)
def parsedepfile(pathname):
"""
Parse a filename listing only depencencies into a parserdata.StatementList.
"""
def continuation_iter(lines):
current_line = []
for line in lines:
line = line.rstrip()
if line.endswith("\\"):
current_line.append(line.rstrip("\\"))
continue
if not len(line):
continue
current_line.append(line)
yield ''.join(current_line)
current_line = []
if current_line:
yield ''.join(current_line)
pathname = os.path.realpath(pathname)
stmts = parserdata.StatementList()
for line in continuation_iter(open(pathname).readlines()):
target, deps = line.split(":", 1)
stmts.append(parserdata.Rule(data.StringExpansion(target, None),
data.StringExpansion(deps, None), False))
return stmts
def parsestring(s, filename):
"""
Parse a string containing makefile data into a parserdata.StatementList.

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

@ -156,6 +156,28 @@ class Rule(Statement):
self.doublecolon = doublecolon
def execute(self, makefile, context):
if context.weak:
self._executeweak(makefile, context)
else:
self._execute(makefile, context)
def _executeweak(self, makefile, context):
"""
If the context is weak (we're just handling dependencies) we can make a number of assumptions here.
This lets us go really fast and is generally good.
"""
assert context.weak
assert len(self.targetexp.resolvesplit(makefile, makefile.variables)) == 1
target = self.targetexp.resolvesplit(makefile, makefile.variables)[0]
deps = self.depexp.resolvesplit(makefile, makefile.variables)
rule = data.Rule(deps, self.doublecolon, loc=self.targetexp.loc, weakdeps=True)
makefile.gettarget(target).addrule(rule)
makefile.foundtarget(target)
context.currule = rule
def _execute(self, makefile, context):
assert not context.weak
atargets = data.stripdotslashes(self.targetexp.resolvesplit(makefile, makefile.variables))
targets = [data.Pattern(p) for p in _expandwildcards(makefile, atargets)]
@ -168,15 +190,12 @@ class Rule(Statement):
raise data.DataError("Mixed implicit and normal rule", self.targetexp.loc)
ispattern, = ispatterns
if ispattern and context.weak:
raise data.DataError("Pattern rules not allowed in includedeps", self.targetexp.loc)
deps = [p for p in _expandwildcards(makefile, data.stripdotslashes(self.depexp.resolvesplit(makefile, makefile.variables)))]
deps = list(_expandwildcards(makefile, data.stripdotslashes(self.depexp.resolvesplit(makefile, makefile.variables))))
if ispattern:
rule = data.PatternRule(targets, map(data.Pattern, deps), self.doublecolon, loc=self.targetexp.loc)
makefile.appendimplicitrule(rule)
else:
rule = data.Rule(deps, self.doublecolon, loc=self.targetexp.loc, weakdeps=context.weak)
rule = data.Rule(deps, self.doublecolon, loc=self.targetexp.loc, weakdeps=False)
for t in targets:
makefile.gettarget(t.gettarget()).addrule(rule)

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

@ -329,6 +329,9 @@ def main():
with open(options.depend, 'w') as depfile:
depfile.write("%s : %s\n" % (options.target, ' '.join(dep for dep in deps if os.path.isfile(dep) and dep != options.target)))
for dep in deps:
if os.path.isfile(dep) and dep != options.target:
depfile.write("%s :\n" % dep)
if __name__ == '__main__':
main()

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

@ -44,4 +44,7 @@ if __name__ == '__main__':
if options.depend:
ensureParentDir(options.depend)
with open(options.depend, 'w') as depfile:
depfile.write("%s : %s\n" % (options.output, ' '.join(ExpandLibsDeps(args))))
deps = ExpandLibsDeps(args)
depfile.write("%s : %s\n" % (options.output, ' '.join(deps)))
for dep in deps:
depfile.write("%s :\n" % dep)

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

@ -987,17 +987,19 @@ define MAKE_DEPS_AUTO_CC
if test -d $(@D); then \
echo "Building deps for $< using Sun Studio cc"; \
$(CC) $(COMPILE_CFLAGS) -xM $< >$(_MDDEPFILE) ; \
$(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \
fi
endef
define MAKE_DEPS_AUTO_CXX
if test -d $(@D); then \
echo "Building deps for $< using Sun Studio CC"; \
$(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \
$(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \
fi
endef
endif # Sun Studio on Solaris
$(OBJS) $(HOST_OBJS): $(GLOBAL_DEPS)
$(OBJS) $(HOST_OBJS) $(PROGOBJS) $(HOST_PROGOBJS): $(GLOBAL_DEPS)
# Rules for building native targets must come first because of the host_ prefix
$(HOST_COBJS): host_%.$(OBJ_SUFFIX): %.c
@ -1614,14 +1616,11 @@ ifneq (,$(filter-out all chrome default export realchrome tools clean clobber cl
MDDEPEND_FILES := $(strip $(wildcard $(foreach file,$(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS) $(TARGETS) $(XPIDLSRCS:.idl=.h) $(XPIDLSRCS:.idl=.xpt),$(MDDEPDIR)/$(notdir $(file)).pp) $(addprefix $(MDDEPDIR)/,$(EXTRA_MDDEPEND_FILES))))
ifneq (,$(MDDEPEND_FILES))
# The script mddepend.pl checks the dependencies and writes to stdout
# one rule to force out-of-date objects. For example,
# foo.o boo.o: FORCE
# The script has an advantage over including the *.pp files directly
# because it handles the case when header files are removed from the build.
# 'make' would complain that there is no way to build missing headers.
ALL_PP_RESULTS = $(shell $(PERL) $(BUILD_TOOLS)/mddepend.pl - $(MDDEPEND_FILES))
$(eval $(ALL_PP_RESULTS))
ifdef .PYMAKE
includedeps $(MDDEPEND_FILES)
else
include $(MDDEPEND_FILES)
endif
endif
endif

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

@ -7992,7 +7992,7 @@ dnl ========================================================
MOZ_ARG_HEADER(Build dependencies)
if test "$GNU_CC" -a "$GNU_CXX"; then
_DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
_DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
elif test "$SOLARIS_SUNPRO_CC"; then
_DEPEND_CFLAGS=
@ -8078,7 +8078,7 @@ dnl ========================================================
dnl Graphics checks.
dnl ========================================================
if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
if test "${OS_TARGET}" = "WINNT" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
MOZ_ENABLE_SKIA=1
else
MOZ_ENABLE_SKIA=

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

@ -41,7 +41,7 @@
#include "nsINodeList.h"
#include "mozilla/ErrorResult.h"
#include "nsIScrollableFrame.h"
#include "nsIDOMAttr.h"
#include "mozilla/dom/Attr.h"
#include "nsISMILAttr.h"
#include "nsClientRect.h"
#include "nsEvent.h"
@ -644,16 +644,16 @@ public:
{
OwnerDoc()->RequestPointerLock(this);
}
nsIDOMAttr* GetAttributeNode(const nsAString& aName);
already_AddRefed<nsIDOMAttr> SetAttributeNode(nsIDOMAttr* aNewAttr,
ErrorResult& aError);
already_AddRefed<nsIDOMAttr> RemoveAttributeNode(nsIDOMAttr* aOldAttr,
ErrorResult& aError);
nsIDOMAttr* GetAttributeNodeNS(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
ErrorResult& aError);
already_AddRefed<nsIDOMAttr> SetAttributeNodeNS(nsIDOMAttr* aNewAttr,
ErrorResult& aError);
Attr* GetAttributeNode(const nsAString& aName);
already_AddRefed<Attr> SetAttributeNode(Attr& aNewAttr,
ErrorResult& aError);
already_AddRefed<Attr> RemoveAttributeNode(Attr& aOldAttr,
ErrorResult& aError);
Attr* GetAttributeNodeNS(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
ErrorResult& aError);
already_AddRefed<Attr> SetAttributeNodeNS(Attr& aNewAttr,
ErrorResult& aError);
already_AddRefed<nsClientRectList> GetClientRects();
already_AddRefed<nsClientRect> GetBoundingClientRect();
@ -1064,9 +1064,9 @@ protected:
return this;
}
nsIDOMAttr* GetAttributeNodeNSInternal(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
ErrorResult& aError);
Attr* GetAttributeNodeNSInternal(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
ErrorResult& aError);
void RegisterFreezableElement() {
OwnerDoc()->RegisterFreezableElement(this);
@ -1394,7 +1394,8 @@ NS_IMETHOD SetAttributeNode(nsIDOMAttr* newAttr, \
return NS_ERROR_INVALID_POINTER; \
} \
mozilla::ErrorResult rv; \
*_retval = Element::SetAttributeNode(newAttr, rv).get(); \
mozilla::dom::Attr* attr = static_cast<mozilla::dom::Attr*>(newAttr); \
*_retval = Element::SetAttributeNode(*attr, rv).get(); \
return rv.ErrorCode(); \
} \
NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* oldAttr, \
@ -1404,7 +1405,8 @@ NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* oldAttr, \
return NS_ERROR_INVALID_POINTER; \
} \
mozilla::ErrorResult rv; \
*_retval = Element::RemoveAttributeNode(oldAttr, rv).get(); \
mozilla::dom::Attr* attr = static_cast<mozilla::dom::Attr*>(oldAttr); \
*_retval = Element::RemoveAttributeNode(*attr, rv).get(); \
return rv.ErrorCode(); \
} \
NS_IMETHOD GetAttributeNodeNS(const nsAString& namespaceURI, \
@ -1421,7 +1423,8 @@ NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* newAttr, \
nsIDOMAttr** _retval) MOZ_FINAL \
{ \
mozilla::ErrorResult rv; \
*_retval = Element::SetAttributeNodeNS(newAttr, rv).get(); \
mozilla::dom::Attr* attr = static_cast<mozilla::dom::Attr*>(newAttr); \
*_retval = Element::SetAttributeNodeNS(*attr, rv).get(); \
return rv.ErrorCode(); \
} \
NS_IMETHOD GetElementsByTagName(const nsAString& name, \

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

@ -87,6 +87,7 @@ class ImageLoader;
} // namespace css
namespace dom {
class Attr;
class CDATASection;
class Comment;
class DocumentFragment;
@ -1983,9 +1984,9 @@ public:
// Deprecated WebIDL bits
already_AddRefed<mozilla::dom::CDATASection>
CreateCDATASection(const nsAString& aData, mozilla::ErrorResult& rv);
already_AddRefed<nsIDOMAttr>
already_AddRefed<mozilla::dom::Attr>
CreateAttribute(const nsAString& aName, mozilla::ErrorResult& rv);
already_AddRefed<nsIDOMAttr>
already_AddRefed<mozilla::dom::Attr>
CreateAttributeNS(const nsAString& aNamespaceURI,
const nsAString& aQualifiedName,
mozilla::ErrorResult& rv);

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

@ -7,7 +7,8 @@
* Implementation of DOM Core's nsIDOMAttr node.
*/
#include "nsDOMAttribute.h"
#include "mozilla/dom/Attr.h"
#include "mozilla/dom/AttrBinding.h"
#include "mozilla/dom/Element.h"
#include "nsContentCreatorFunctions.h"
#include "nsINameSpaceManager.h"
@ -28,15 +29,17 @@
#include "nsAsyncDOMEvent.h"
#include "nsWrapperCacheInlines.h"
using namespace mozilla;
using namespace mozilla::dom;
DOMCI_NODE_DATA(Attr, mozilla::dom::Attr)
namespace mozilla {
namespace dom {
//----------------------------------------------------------------------
bool nsDOMAttribute::sInitialized;
bool Attr::sInitialized;
nsDOMAttribute::nsDOMAttribute(nsDOMAttributeMap *aAttrMap,
already_AddRefed<nsINodeInfo> aNodeInfo,
const nsAString &aValue, bool aNsAware)
Attr::Attr(nsDOMAttributeMap *aAttrMap,
already_AddRefed<nsINodeInfo> aNodeInfo,
const nsAString &aValue, bool aNsAware)
: nsIAttribute(aAttrMap, aNodeInfo, aNsAware), mValue(aValue)
{
NS_ABORT_IF_FALSE(mNodeInfo, "We must get a nodeinfo here!");
@ -45,9 +48,11 @@ nsDOMAttribute::nsDOMAttribute(nsDOMAttributeMap *aAttrMap,
// We don't add a reference to our content. It will tell us
// to drop our reference when it goes away.
SetIsDOMBinding();
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMAttribute)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Attr)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
if (!nsINode::Traverse(tmp, cb)) {
@ -55,22 +60,20 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMAttribute)
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDOMAttribute)
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(Attr)
nsINode::Trace(tmp, aCallback, aClosure);
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMAttribute)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Attr)
nsINode::Unlink(tmp);
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
DOMCI_NODE_DATA(Attr, nsDOMAttribute)
// QueryInterface implementation for nsDOMAttribute
NS_INTERFACE_TABLE_HEAD(nsDOMAttribute)
// QueryInterface implementation for Attr
NS_INTERFACE_TABLE_HEAD(Attr)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_NODE_INTERFACE_TABLE5(nsDOMAttribute, nsIDOMAttr, nsIAttribute, nsIDOMNode,
NS_NODE_INTERFACE_TABLE5(Attr, nsIDOMAttr, nsIAttribute, nsIDOMNode,
nsIDOMEventTarget, EventTarget)
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsDOMAttribute)
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(Attr)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
new nsNodeSupportsWeakRefTearoff(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMXPathNSResolver,
@ -78,12 +81,12 @@ NS_INTERFACE_TABLE_HEAD(nsDOMAttribute)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Attr)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMAttribute)
NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(nsDOMAttribute,
NS_IMPL_CYCLE_COLLECTING_ADDREF(Attr)
NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(Attr,
nsNodeUtils::LastRelease(this))
void
nsDOMAttribute::SetMap(nsDOMAttributeMap *aMap)
Attr::SetMap(nsDOMAttributeMap *aMap)
{
if (mAttrMap && !aMap && sInitialized) {
// We're breaking a relationship with content and not getting a new one,
@ -95,18 +98,18 @@ nsDOMAttribute::SetMap(nsDOMAttributeMap *aMap)
}
nsIContent*
nsDOMAttribute::GetContent() const
Attr::GetContent() const
{
return GetContentInternal();
}
nsresult
nsDOMAttribute::SetOwnerDocument(nsIDocument* aDocument)
Attr::SetOwnerDocument(nsIDocument* aDocument)
{
NS_ASSERTION(aDocument, "Missing document");
nsIDocument *doc = OwnerDoc();
NS_ASSERTION(doc != aDocument, "bad call to nsDOMAttribute::SetOwnerDocument");
NS_ASSERTION(doc != aDocument, "bad call to Attr::SetOwnerDocument");
doc->DeleteAllPropertiesFor(this);
nsCOMPtr<nsINodeInfo> newNodeInfo;
@ -122,14 +125,14 @@ nsDOMAttribute::SetOwnerDocument(nsIDocument* aDocument)
}
NS_IMETHODIMP
nsDOMAttribute::GetName(nsAString& aName)
Attr::GetName(nsAString& aName)
{
aName = NodeName();
return NS_OK;
}
already_AddRefed<nsIAtom>
nsDOMAttribute::GetNameAtom(nsIContent* aContent)
Attr::GetNameAtom(nsIContent* aContent)
{
nsIAtom* result = nullptr;
if (!mNsAware &&
@ -150,7 +153,7 @@ nsDOMAttribute::GetNameAtom(nsIContent* aContent)
}
NS_IMETHODIMP
nsDOMAttribute::GetValue(nsAString& aValue)
Attr::GetValue(nsAString& aValue)
{
nsIContent* content = GetContentInternal();
if (content) {
@ -164,36 +167,55 @@ nsDOMAttribute::GetValue(nsAString& aValue)
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::SetValue(const nsAString& aValue)
void
Attr::SetValue(const nsAString& aValue, ErrorResult& aRv)
{
nsIContent* content = GetContentInternal();
if (!content) {
mValue = aValue;
return NS_OK;
return;
}
nsCOMPtr<nsIAtom> nameAtom = GetNameAtom(content);
return content->SetAttr(mNodeInfo->NamespaceID(),
nameAtom,
mNodeInfo->GetPrefixAtom(),
aValue,
true);
aRv = content->SetAttr(mNodeInfo->NamespaceID(),
nameAtom,
mNodeInfo->GetPrefixAtom(),
aValue,
true);
}
NS_IMETHODIMP
Attr::SetValue(const nsAString& aValue)
{
ErrorResult rv;
SetValue(aValue, rv);
return rv.ErrorCode();
}
bool
Attr::Specified() const
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eSpecified);
return true;
}
NS_IMETHODIMP
nsDOMAttribute::GetSpecified(bool* aSpecified)
Attr::GetSpecified(bool* aSpecified)
{
NS_ENSURE_ARG_POINTER(aSpecified);
OwnerDoc()->WarnOnceAbout(nsIDocument::eSpecified);
*aSpecified = true;
*aSpecified = Specified();
return NS_OK;
}
Element*
Attr::GetOwnerElement(ErrorResult& aRv)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eOwnerElement);
return GetContentInternal();
}
NS_IMETHODIMP
nsDOMAttribute::GetOwnerElement(nsIDOMElement** aOwnerElement)
Attr::GetOwnerElement(nsIDOMElement** aOwnerElement)
{
NS_ENSURE_ARG_POINTER(aOwnerElement);
OwnerDoc()->WarnOnceAbout(nsIDocument::eOwnerElement);
@ -209,7 +231,7 @@ nsDOMAttribute::GetOwnerElement(nsIDOMElement** aOwnerElement)
}
void
nsDOMAttribute::GetNodeValueInternal(nsAString& aNodeValue)
Attr::GetNodeValueInternal(nsAString& aNodeValue)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeValue);
@ -217,7 +239,7 @@ nsDOMAttribute::GetNodeValueInternal(nsAString& aNodeValue)
}
void
nsDOMAttribute::SetNodeValueInternal(const nsAString& aNodeValue, ErrorResult& aError)
Attr::SetNodeValueInternal(const nsAString& aNodeValue, ErrorResult& aError)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeValue);
@ -225,13 +247,13 @@ nsDOMAttribute::SetNodeValueInternal(const nsAString& aNodeValue, ErrorResult& a
}
nsresult
nsDOMAttribute::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
Attr::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
{
nsAutoString value;
const_cast<nsDOMAttribute*>(this)->GetValue(value);
const_cast<Attr*>(this)->GetValue(value);
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
*aResult = new nsDOMAttribute(nullptr, ni.forget(), value, mNsAware);
*aResult = new Attr(nullptr, ni.forget(), value, mNsAware);
if (!*aResult) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -242,7 +264,7 @@ nsDOMAttribute::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
}
already_AddRefed<nsIURI>
nsDOMAttribute::GetBaseURI() const
Attr::GetBaseURI() const
{
nsINode *parent = GetContentInternal();
@ -250,7 +272,7 @@ nsDOMAttribute::GetBaseURI() const
}
void
nsDOMAttribute::GetTextContentInternal(nsAString& aTextContent)
Attr::GetTextContentInternal(nsAString& aTextContent)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eTextContent);
@ -258,8 +280,8 @@ nsDOMAttribute::GetTextContentInternal(nsAString& aTextContent)
}
void
nsDOMAttribute::SetTextContentInternal(const nsAString& aTextContent,
ErrorResult& aError)
Attr::SetTextContentInternal(const nsAString& aTextContent,
ErrorResult& aError)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eTextContent);
@ -267,7 +289,7 @@ nsDOMAttribute::SetTextContentInternal(const nsAString& aTextContent,
}
NS_IMETHODIMP
nsDOMAttribute::GetIsId(bool* aReturn)
Attr::GetIsId(bool* aReturn)
{
nsIContent* content = GetContentInternal();
if (!content)
@ -288,69 +310,78 @@ nsDOMAttribute::GetIsId(bool* aReturn)
}
bool
nsDOMAttribute::IsNodeOfType(uint32_t aFlags) const
Attr::IsNodeOfType(uint32_t aFlags) const
{
return !(aFlags & ~eATTRIBUTE);
}
uint32_t
nsDOMAttribute::GetChildCount() const
Attr::GetChildCount() const
{
return 0;
}
nsIContent *
nsDOMAttribute::GetChildAt(uint32_t aIndex) const
Attr::GetChildAt(uint32_t aIndex) const
{
return nullptr;
}
nsIContent * const *
nsDOMAttribute::GetChildArray(uint32_t* aChildCount) const
Attr::GetChildArray(uint32_t* aChildCount) const
{
*aChildCount = 0;
return nullptr;
}
int32_t
nsDOMAttribute::IndexOf(const nsINode* aPossibleChild) const
Attr::IndexOf(const nsINode* aPossibleChild) const
{
return -1;
}
nsresult
nsDOMAttribute::InsertChildAt(nsIContent* aKid, uint32_t aIndex,
Attr::InsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsDOMAttribute::AppendChildTo(nsIContent* aKid, bool aNotify)
Attr::AppendChildTo(nsIContent* aKid, bool aNotify)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void
nsDOMAttribute::RemoveChildAt(uint32_t aIndex, bool aNotify)
Attr::RemoveChildAt(uint32_t aIndex, bool aNotify)
{
}
nsresult
nsDOMAttribute::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
Attr::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
{
aVisitor.mCanHandle = true;
return NS_OK;
}
void
nsDOMAttribute::Initialize()
Attr::Initialize()
{
sInitialized = true;
}
void
nsDOMAttribute::Shutdown()
Attr::Shutdown()
{
sInitialized = false;
}
JSObject*
Attr::WrapObject(JSContext* aCx, JSObject* aScope)
{
return AttrBinding::Wrap(aCx, aScope, this);
}
} // namespace dom
} // namespace mozilla

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

@ -7,8 +7,8 @@
* Implementation of DOM Core's nsIDOMAttr node.
*/
#ifndef nsDOMAttribute_h___
#define nsDOMAttribute_h___
#ifndef mozilla_dom_Attr_h
#define mozilla_dom_Attr_h
#include "nsIAttribute.h"
#include "nsIDOMAttr.h"
@ -21,17 +21,20 @@
#include "nsCycleCollectionParticipant.h"
#include "nsStubMutationObserver.h"
namespace mozilla {
namespace dom {
// Attribute helper class used to wrap up an attribute with a dom
// object that implements nsIDOMAttr and nsIDOMNode
class nsDOMAttribute : public nsIAttribute,
public nsIDOMAttr
class Attr : public nsIAttribute,
public nsIDOMAttr
{
public:
nsDOMAttribute(nsDOMAttributeMap* aAttrMap,
already_AddRefed<nsINodeInfo> aNodeInfo,
const nsAString& aValue,
bool aNsAware);
virtual ~nsDOMAttribute() {}
Attr(nsDOMAttributeMap* aAttrMap,
already_AddRefed<nsINodeInfo> aNodeInfo,
const nsAString& aValue,
bool aNsAware);
virtual ~Attr() {}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -70,12 +73,29 @@ public:
static void Initialize();
static void Shutdown();
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDOMAttribute,
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Attr,
nsIAttribute)
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
// WebIDL
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
// XPCOM GetName() is OK
// XPCOM GetValue() is OK
void SetValue(const nsAString& aValue, ErrorResult& aRv);
bool Specified() const;
// XPCOM GetNamespaceURI() is OK
// XPCOM GetPrefix() is OK
// XPCOM GetLocalName() is OK
Element* GetOwnerElement(ErrorResult& aRv);
protected:
virtual mozilla::dom::Element* GetNameSpaceElement()
{
@ -94,5 +114,7 @@ private:
nsString mValue;
};
} // namespace dom
} // namespace mozilla
#endif /* nsDOMAttribute_h___ */
#endif /* mozilla_dom_Attr_h */

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

@ -14,7 +14,7 @@
#include "mozilla/dom/Element.h"
#include "nsDOMAttribute.h"
#include "mozilla/dom/Attr.h"
#include "nsDOMAttributeMap.h"
#include "nsIAtom.h"
#include "nsINodeInfo.h"
@ -769,46 +769,48 @@ Element::RemoveAttribute(const nsAString& aName, ErrorResult& aError)
aError = UnsetAttr(name->NamespaceID(), name->LocalName(), true);
}
nsIDOMAttr*
Attr*
Element::GetAttributeNode(const nsAString& aName)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eGetAttributeNode);
return Attributes()->GetNamedItem(aName);
}
already_AddRefed<nsIDOMAttr>
Element::SetAttributeNode(nsIDOMAttr* aNewAttr, ErrorResult& aError)
already_AddRefed<Attr>
Element::SetAttributeNode(Attr& aNewAttr, ErrorResult& aError)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eSetAttributeNode);
nsCOMPtr<nsIDOMAttr> returnAttr;
aError = Attributes()->SetNamedItem(aNewAttr, getter_AddRefs(returnAttr));
nsCOMPtr<nsIDOMAttr> attr;
aError = Attributes()->SetNamedItem(&aNewAttr, getter_AddRefs(attr));
if (aError.Failed()) {
return nullptr;
}
nsRefPtr<Attr> returnAttr = static_cast<Attr*>(attr.get());
return returnAttr.forget();
}
already_AddRefed<nsIDOMAttr>
Element::RemoveAttributeNode(nsIDOMAttr* aAttribute,
already_AddRefed<Attr>
Element::RemoveAttributeNode(Attr& aAttribute,
ErrorResult& aError)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eRemoveAttributeNode);
nsAutoString name;
aError = aAttribute->GetName(name);
aError = aAttribute.GetName(name);
if (aError.Failed()) {
return nullptr;
}
nsCOMPtr<nsIDOMAttr> returnAttr;
aError = Attributes()->RemoveNamedItem(name, getter_AddRefs(returnAttr));
nsCOMPtr<nsIDOMAttr> attr;
aError = Attributes()->RemoveNamedItem(name, getter_AddRefs(attr));
if (aError.Failed()) {
return nullptr;
}
nsRefPtr<Attr> returnAttr = static_cast<Attr*>(attr.get());
return returnAttr.forget();
}
@ -872,7 +874,7 @@ Element::RemoveAttributeNS(const nsAString& aNamespaceURI,
aError = UnsetAttr(nsid, name, true);
}
nsIDOMAttr*
Attr*
Element::GetAttributeNodeNS(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
ErrorResult& aError)
@ -882,7 +884,7 @@ Element::GetAttributeNodeNS(const nsAString& aNamespaceURI,
return GetAttributeNodeNSInternal(aNamespaceURI, aLocalName, aError);
}
nsIDOMAttr*
Attr*
Element::GetAttributeNodeNSInternal(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
ErrorResult& aError)
@ -890,12 +892,12 @@ Element::GetAttributeNodeNSInternal(const nsAString& aNamespaceURI,
return Attributes()->GetNamedItemNS(aNamespaceURI, aLocalName, aError);
}
already_AddRefed<nsIDOMAttr>
Element::SetAttributeNodeNS(nsIDOMAttr* aNewAttr,
already_AddRefed<Attr>
Element::SetAttributeNodeNS(Attr& aNewAttr,
ErrorResult& aError)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eSetAttributeNodeNS);
return Attributes()->SetNamedItemNS(aNewAttr, aError);
return Attributes()->SetNamedItemNS(&aNewAttr, aError);
}
already_AddRefed<nsIHTMLCollection>
@ -1863,7 +1865,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
nsAutoString ns;
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNamespaceID, ns);
ErrorResult rv;
nsIDOMAttr* attrNode =
Attr* attrNode =
GetAttributeNodeNSInternal(ns, nsDependentAtomString(aName), rv);
mutation.mRelatedNode = attrNode;
@ -1989,7 +1991,7 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
this);
// Grab the attr node if needed before we remove it from the attr map
nsCOMPtr<nsIDOMAttr> attrNode;
nsRefPtr<Attr> attrNode;
if (hasMutationListeners) {
nsAutoString ns;
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNameSpaceID, ns);

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

@ -15,7 +15,7 @@
#include "mozilla/dom/FragmentOrElement.h"
#include "nsDOMAttribute.h"
#include "mozilla/dom/Attr.h"
#include "nsDOMAttributeMap.h"
#include "nsIAtom.h"
#include "nsINodeInfo.h"

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

@ -39,12 +39,13 @@ EXPORTS = \
nsDOMAttributeMap.h \
nsMappedAttributeElement.h \
nsStyledElement.h \
nsSandboxFlags.h \
nsSandboxFlags.h \
$(NULL)
EXPORTS_NAMESPACES = mozilla/dom
EXPORTS_mozilla/dom = \
Attr.h \
Comment.h \
DocumentFragment.h \
DocumentType.h \
@ -79,7 +80,7 @@ CPPSRCS = \
nsCrossSiteListenerProxy.cpp \
nsCSPService.cpp \
nsDataDocumentContentPolicy.cpp \
nsDOMAttribute.cpp \
Attr.cpp \
nsDOMAttributeMap.cpp \
nsDOMBlobBuilder.cpp \
nsDOMCaretPosition.cpp \

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

@ -8,7 +8,7 @@
*/
#include "nsDOMAttributeMap.h"
#include "nsDOMAttribute.h"
#include "mozilla/dom/Attr.h"
#include "nsIDOMDocument.h"
#include "mozilla/dom/Element.h"
#include "nsIDocument.h"
@ -20,6 +20,7 @@
#include "nsUnicharUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
//----------------------------------------------------------------------
@ -35,7 +36,7 @@ nsDOMAttributeMap::nsDOMAttributeMap(Element* aContent)
* Clear map pointer for attributes.
*/
PLDHashOperator
RemoveMapRef(nsAttrHashKey::KeyType aKey, nsRefPtr<nsDOMAttribute>& aData,
RemoveMapRef(nsAttrHashKey::KeyType aKey, nsRefPtr<Attr>& aData,
void* aUserArg)
{
aData->SetMap(nullptr);
@ -61,7 +62,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
PLDHashOperator
TraverseMapEntry(nsAttrHashKey::KeyType aKey, nsRefPtr<nsDOMAttribute>& aData,
TraverseMapEntry(nsAttrHashKey::KeyType aKey, nsRefPtr<Attr>& aData,
void* aUserArg)
{
nsCycleCollectionTraversalCallback *cb =
@ -93,7 +94,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMAttributeMap)
PLDHashOperator
SetOwnerDocumentFunc(nsAttrHashKey::KeyType aKey,
nsRefPtr<nsDOMAttribute>& aData,
nsRefPtr<Attr>& aData,
void* aUserArg)
{
nsresult rv = aData->SetOwnerDocument(static_cast<nsIDocument*>(aUserArg));
@ -114,7 +115,7 @@ void
nsDOMAttributeMap::DropAttribute(int32_t aNamespaceID, nsIAtom* aLocalName)
{
nsAttrKey attr(aNamespaceID, aLocalName);
nsDOMAttribute *node = mAttributeCache.GetWeak(attr);
Attr *node = mAttributeCache.GetWeak(attr);
if (node) {
// Break link to map
node->SetMap(nullptr);
@ -124,21 +125,21 @@ nsDOMAttributeMap::DropAttribute(int32_t aNamespaceID, nsIAtom* aLocalName)
}
}
already_AddRefed<nsDOMAttribute>
already_AddRefed<Attr>
nsDOMAttributeMap::RemoveAttribute(nsINodeInfo* aNodeInfo)
{
NS_ASSERTION(aNodeInfo, "RemoveAttribute() called with aNodeInfo == nullptr!");
nsAttrKey attr(aNodeInfo->NamespaceID(), aNodeInfo->NameAtom());
nsRefPtr<nsDOMAttribute> node;
nsRefPtr<Attr> node;
if (!mAttributeCache.Get(attr, getter_AddRefs(node))) {
nsAutoString value;
// As we are removing the attribute we need to set the current value in
// the attribute node.
mContent->GetAttr(aNodeInfo->NamespaceID(), aNodeInfo->NameAtom(), value);
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
node = new nsDOMAttribute(nullptr, ni.forget(), value, true);
node = new Attr(nullptr, ni.forget(), value, true);
}
else {
// Break link to map
@ -151,18 +152,18 @@ nsDOMAttributeMap::RemoveAttribute(nsINodeInfo* aNodeInfo)
return node.forget();
}
nsDOMAttribute*
Attr*
nsDOMAttributeMap::GetAttribute(nsINodeInfo* aNodeInfo, bool aNsAware)
{
NS_ASSERTION(aNodeInfo, "GetAttribute() called with aNodeInfo == nullptr!");
nsAttrKey attr(aNodeInfo->NamespaceID(), aNodeInfo->NameAtom());
nsDOMAttribute* node = mAttributeCache.GetWeak(attr);
Attr* node = mAttributeCache.GetWeak(attr);
if (!node) {
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
nsRefPtr<nsDOMAttribute> newAttr =
new nsDOMAttribute(this, ni.forget(), EmptyString(), aNsAware);
nsRefPtr<Attr> newAttr =
new Attr(this, ni.forget(), EmptyString(), aNsAware);
mAttributeCache.Put(attr, newAttr);
node = newAttr;
}
@ -170,7 +171,7 @@ nsDOMAttributeMap::GetAttribute(nsINodeInfo* aNodeInfo, bool aNsAware)
return node;
}
nsDOMAttribute*
Attr*
nsDOMAttributeMap::GetNamedItem(const nsAString& aAttrName)
{
if (mContent) {
@ -211,7 +212,7 @@ nsDOMAttributeMap::SetNamedItemNS(nsIDOMAttr* aAttr, nsIDOMAttr** aReturn)
return rv.ErrorCode();
}
already_AddRefed<nsDOMAttribute>
already_AddRefed<Attr>
nsDOMAttributeMap::SetNamedItemInternal(nsIDOMAttr* aAttr,
bool aWithNS,
ErrorResult& aError)
@ -226,7 +227,7 @@ nsDOMAttributeMap::SetNamedItemInternal(nsIDOMAttr* aAttr,
return nullptr;
}
nsDOMAttribute *attribute = static_cast<nsDOMAttribute*>(iAttribute.get());
Attr *attribute = static_cast<Attr*>(iAttribute.get());
// Check that attribute is not owned by somebody else
nsDOMAttributeMap* owner = iAttribute->GetMap();
@ -265,7 +266,7 @@ nsDOMAttributeMap::SetNamedItemInternal(nsIDOMAttr* aAttr,
nsAutoString name;
nsCOMPtr<nsINodeInfo> ni;
nsRefPtr<nsDOMAttribute> attr;
nsRefPtr<Attr> attr;
// SetNamedItemNS()
if (aWithNS) {
// Return existing attribute, if present
@ -347,12 +348,12 @@ nsDOMAttributeMap::RemoveNamedItem(const nsAString& aName,
}
nsDOMAttribute*
Attr*
nsDOMAttributeMap::GetItemAt(uint32_t aIndex, nsresult *aResult)
{
*aResult = NS_OK;
nsDOMAttribute* node = nullptr;
Attr* node = nullptr;
const nsAttrName* name;
if (mContent && (name = mContent->GetAttrNameAt(aIndex))) {
@ -406,7 +407,7 @@ nsDOMAttributeMap::GetNamedItemNS(const nsAString& aNamespaceURI,
return rv.ErrorCode();
}
nsDOMAttribute*
Attr*
nsDOMAttributeMap::GetNamedItemNS(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
ErrorResult& aError)
@ -480,7 +481,7 @@ nsDOMAttributeMap::RemoveNamedItemNS(const nsAString& aNamespaceURI,
return NS_ERROR_DOM_NOT_FOUND_ERR;
}
nsRefPtr<nsDOMAttribute> attr = RemoveAttribute(ni);
nsRefPtr<Attr> attr = RemoveAttribute(ni);
nsINodeInfo *attrNi = attr->NodeInfo();
mContent->UnsetAttr(attrNi->NamespaceID(), attrNi->NameAtom(), true);
@ -503,7 +504,7 @@ nsDOMAttributeMap::Enumerate(AttrCache::EnumReadFunction aFunc,
size_t
AttrCacheSizeEnumerator(const nsAttrKey& aKey,
const nsRefPtr<nsDOMAttribute>& aValue,
const nsRefPtr<Attr>& aValue,
nsMallocSizeOfFun aMallocSizeOf,
void* aUserArg)
{

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

@ -18,18 +18,18 @@
#include "mozilla/ErrorResult.h"
class nsIAtom;
class nsDOMAttribute;
class nsINodeInfo;
class nsIDocument;
namespace mozilla {
namespace dom {
class Attr;
class Element;
} // namespace dom
} // namespace mozilla
/**
* Structure used as a key for caching nsDOMAttributes in nsDOMAttributeMap's mAttributeCache.
* Structure used as a key for caching Attrs in nsDOMAttributeMap's mAttributeCache.
*/
class nsAttrKey
{
@ -128,7 +128,7 @@ public:
*/
uint32_t Count() const;
typedef nsRefPtrHashtable<nsAttrHashKey, nsDOMAttribute> AttrCache;
typedef nsRefPtrHashtable<nsAttrHashKey, mozilla::dom::Attr> AttrCache;
/**
* Enumerates over the attribute nodess in the map and calls aFunc for each
@ -138,8 +138,8 @@ public:
*/
uint32_t Enumerate(AttrCache::EnumReadFunction aFunc, void *aUserArg) const;
nsDOMAttribute* GetItemAt(uint32_t aIndex, nsresult *rv);
nsDOMAttribute* GetNamedItem(const nsAString& aAttrName);
mozilla::dom::Attr* GetItemAt(uint32_t aIndex, nsresult *rv);
mozilla::dom::Attr* GetNamedItem(const nsAString& aAttrName);
static nsDOMAttributeMap* FromSupports(nsISupports* aSupports)
{
@ -160,11 +160,11 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMAttributeMap)
nsDOMAttribute* GetNamedItemNS(const nsAString& aNamespaceURI,
mozilla::dom::Attr* GetNamedItemNS(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
mozilla::ErrorResult& aError);
already_AddRefed<nsDOMAttribute> SetNamedItemNS(nsIDOMAttr *aNode,
already_AddRefed<mozilla::dom::Attr> SetNamedItemNS(nsIDOMAttr *aNode,
mozilla::ErrorResult& aError)
{
return SetNamedItemInternal(aNode, true, aError);
@ -176,7 +176,7 @@ private:
Element *mContent; // Weak reference
/**
* Cache of nsDOMAttributes.
* Cache of Attrs.
*/
AttrCache mAttributeCache;
@ -184,7 +184,7 @@ private:
* SetNamedItem() (aWithNS = false) and SetNamedItemNS() (aWithNS =
* true) implementation.
*/
already_AddRefed<nsDOMAttribute>
already_AddRefed<mozilla::dom::Attr>
SetNamedItemInternal(nsIDOMAttr *aNode,
bool aWithNS,
mozilla::ErrorResult& aError);
@ -194,12 +194,12 @@ private:
const nsAString& aLocalName,
mozilla::ErrorResult& aError);
nsDOMAttribute* GetAttribute(nsINodeInfo* aNodeInfo, bool aNsAware);
mozilla::dom::Attr* GetAttribute(nsINodeInfo* aNodeInfo, bool aNsAware);
/**
* Remove an attribute, returns the removed node.
*/
already_AddRefed<nsDOMAttribute> RemoveAttribute(nsINodeInfo* aNodeInfo);
already_AddRefed<mozilla::dom::Attr> RemoveAttribute(nsINodeInfo* aNodeInfo);
};

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

@ -41,7 +41,7 @@
#include "nsIDOMNodeFilter.h"
#include "nsIDOMStyleSheet.h"
#include "nsDOMAttribute.h"
#include "mozilla/dom/Attr.h"
#include "nsIDOMDOMStringList.h"
#include "nsIDOMDOMImplementation.h"
#include "nsIDOMDocumentXBL.h"
@ -4930,7 +4930,7 @@ nsDocument::CreateAttribute(const nsAString& aName,
return rv.ErrorCode();
}
already_AddRefed<nsIDOMAttr>
already_AddRefed<Attr>
nsIDocument::CreateAttribute(const nsAString& aName, ErrorResult& rv)
{
WarnOnceAbout(eCreateAttribute);
@ -4955,8 +4955,8 @@ nsIDocument::CreateAttribute(const nsAString& aName, ErrorResult& rv)
return nullptr;
}
nsCOMPtr<nsIDOMAttr> attribute =
new nsDOMAttribute(nullptr, nodeInfo.forget(), EmptyString(), false);
nsRefPtr<Attr> attribute = new Attr(nullptr, nodeInfo.forget(),
EmptyString(), false);
return attribute.forget();
}
@ -4971,7 +4971,7 @@ nsDocument::CreateAttributeNS(const nsAString & aNamespaceURI,
return rv.ErrorCode();
}
already_AddRefed<nsIDOMAttr>
already_AddRefed<Attr>
nsIDocument::CreateAttributeNS(const nsAString& aNamespaceURI,
const nsAString& aQualifiedName,
ErrorResult& rv)
@ -4988,8 +4988,8 @@ nsIDocument::CreateAttributeNS(const nsAString& aNamespaceURI,
return nullptr;
}
nsCOMPtr<nsIDOMAttr> attribute =
new nsDOMAttribute(nullptr, nodeInfo.forget(), EmptyString(), true);
nsRefPtr<Attr> attribute = new Attr(nullptr, nodeInfo.forget(),
EmptyString(), true);
return attribute.forget();
}
@ -6454,7 +6454,7 @@ nsIDocument::GetCompatMode(nsString& aCompatMode) const
static void BlastSubtreeToPieces(nsINode *aNode);
PLDHashOperator
BlastFunc(nsAttrHashKey::KeyType aKey, nsDOMAttribute *aData, void* aUserArg)
BlastFunc(nsAttrHashKey::KeyType aKey, Attr *aData, void* aUserArg)
{
nsCOMPtr<nsIAttribute> *attr =
static_cast<nsCOMPtr<nsIAttribute>*>(aUserArg);

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

@ -1723,6 +1723,9 @@ GK_ATOM(seconds, "seconds")
GK_ATOM(secondsFromDateTime, "seconds-from-dateTime")
// Simple gestures support
GK_ATOM(onMozSwipeGestureStart, "onMozSwipeGestureStart")
GK_ATOM(onMozSwipeGestureUpdate, "onMozSwipeGestureUpdate")
GK_ATOM(onMozSwipeGestureEnd, "onMozSwipeGestureEnd")
GK_ATOM(onMozSwipeGesture, "onMozSwipeGesture")
GK_ATOM(onMozMagnifyGestureStart, "onMozMagnifyGestureStart")
GK_ATOM(onMozMagnifyGestureUpdate, "onMozMagnifyGestureUpdate")
@ -1984,6 +1987,7 @@ GK_ATOM(windows_glass, "windows-glass")
GK_ATOM(touch_enabled, "touch-enabled")
GK_ATOM(maemo_classic, "maemo-classic")
GK_ATOM(menubar_drag, "menubar-drag")
GK_ATOM(swipe_animation_enabled, "swipe-animation-enabled")
// windows theme selector metrics
GK_ATOM(windows_classic, "windows-classic")
@ -2016,6 +2020,7 @@ GK_ATOM(_moz_menubar_drag, "-moz-menubar-drag")
GK_ATOM(_moz_device_pixel_ratio, "-moz-device-pixel-ratio")
GK_ATOM(_moz_device_orientation, "-moz-device-orientation")
GK_ATOM(_moz_is_resource_document, "-moz-is-resource-document")
GK_ATOM(_moz_swipe_animation_enabled, "-moz-swipe-animation-enabled")
// application commands
GK_ATOM(Back, "Back")

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

@ -28,7 +28,7 @@
#include "nsCycleCollectionParticipant.h"
#include "nsCycleCollector.h"
#include "nsDocument.h"
#include "nsDOMAttribute.h"
#include "mozilla/dom/Attr.h"
#include "nsDOMAttributeMap.h"
#include "nsDOMCID.h"
#include "nsDOMCSSAttrDeclaration.h"

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

@ -99,8 +99,9 @@ void
nsImageLoadingContent::DestroyImageLoadingContent()
{
// Cancel our requests so they won't hold stale refs to us
ClearCurrentRequest(NS_BINDING_ABORTED);
ClearPendingRequest(NS_BINDING_ABORTED);
// NB: Don't ask to discard the images here.
ClearCurrentRequest(NS_BINDING_ABORTED, 0);
ClearPendingRequest(NS_BINDING_ABORTED, 0);
}
nsImageLoadingContent::~nsImageLoadingContent()
@ -944,8 +945,8 @@ void
nsImageLoadingContent::CancelImageRequests(bool aNotify)
{
AutoStateChanger changer(this, aNotify);
ClearPendingRequest(NS_BINDING_ABORTED);
ClearCurrentRequest(NS_BINDING_ABORTED);
ClearPendingRequest(NS_BINDING_ABORTED, REQUEST_DISCARD);
ClearCurrentRequest(NS_BINDING_ABORTED, REQUEST_DISCARD);
}
nsresult
@ -956,8 +957,8 @@ nsImageLoadingContent::UseAsPrimaryRequest(imgRequestProxy* aRequest,
AutoStateChanger changer(this, aNotify);
// Get rid if our existing images
ClearPendingRequest(NS_BINDING_ABORTED);
ClearCurrentRequest(NS_BINDING_ABORTED);
ClearPendingRequest(NS_BINDING_ABORTED, REQUEST_DISCARD);
ClearCurrentRequest(NS_BINDING_ABORTED, REQUEST_DISCARD);
// Clone the request we were given.
nsRefPtr<imgRequestProxy>& req = PrepareNextRequest();
@ -1074,14 +1075,14 @@ nsImageLoadingContent::SetBlockedRequest(nsIURI* aURI, int16_t aContentDecision)
// reason "image source changed". However, apparently there's some abuse
// over in nsImageFrame where the displaying of the "broken" icon for the
// next image depends on the cancel reason of the previous image. ugh.
ClearPendingRequest(NS_ERROR_IMAGE_BLOCKED);
ClearPendingRequest(NS_ERROR_IMAGE_BLOCKED, REQUEST_DISCARD);
// For the blocked case, we only want to cancel the existing current request
// if size is not available. bz says the web depends on this behavior.
if (!HaveSize(mCurrentRequest)) {
mImageBlockingStatus = aContentDecision;
ClearCurrentRequest(NS_ERROR_IMAGE_BLOCKED);
ClearCurrentRequest(NS_ERROR_IMAGE_BLOCKED, REQUEST_DISCARD);
// We still want to remember what URI we were despite not having an actual
// request.
@ -1097,7 +1098,7 @@ nsImageLoadingContent::PrepareCurrentRequest()
mImageBlockingStatus = nsIContentPolicy::ACCEPT;
// Get rid of anything that was there previously.
ClearCurrentRequest(NS_ERROR_IMAGE_SRC_CHANGED);
ClearCurrentRequest(NS_ERROR_IMAGE_SRC_CHANGED, REQUEST_DISCARD);
if (mNewRequestsWillNeedAnimationReset) {
mCurrentRequestFlags |= REQUEST_NEEDS_ANIMATION_RESET;
@ -1111,7 +1112,7 @@ nsRefPtr<imgRequestProxy>&
nsImageLoadingContent::PreparePendingRequest()
{
// Get rid of anything that was there previously.
ClearPendingRequest(NS_ERROR_IMAGE_SRC_CHANGED);
ClearPendingRequest(NS_ERROR_IMAGE_SRC_CHANGED, REQUEST_DISCARD);
if (mNewRequestsWillNeedAnimationReset) {
mPendingRequestFlags |= REQUEST_NEEDS_ANIMATION_RESET;
@ -1167,7 +1168,8 @@ nsImageLoadingContent::MakePendingRequestCurrent()
}
void
nsImageLoadingContent::ClearCurrentRequest(nsresult aReason)
nsImageLoadingContent::ClearCurrentRequest(nsresult aReason,
uint32_t aFlags)
{
if (!mCurrentRequest) {
// Even if we didn't have a current request, we might have been keeping
@ -1184,14 +1186,15 @@ nsImageLoadingContent::ClearCurrentRequest(nsresult aReason)
&mCurrentRequestRegistered);
// Clean up the request.
UntrackImage(mCurrentRequest, REQUEST_DISCARD);
UntrackImage(mCurrentRequest, aFlags);
mCurrentRequest->CancelAndForgetObserver(aReason);
mCurrentRequest = nullptr;
mCurrentRequestFlags = 0;
}
void
nsImageLoadingContent::ClearPendingRequest(nsresult aReason)
nsImageLoadingContent::ClearPendingRequest(nsresult aReason,
uint32_t aFlags)
{
if (!mPendingRequest)
return;
@ -1207,7 +1210,7 @@ nsImageLoadingContent::ClearPendingRequest(nsresult aReason)
nsLayoutUtils::DeregisterImageRequest(GetFramePresContext(), mPendingRequest,
&mPendingRequestRegistered);
UntrackImage(mPendingRequest, REQUEST_DISCARD);
UntrackImage(mPendingRequest, aFlags);
mPendingRequest->CancelAndForgetObserver(aReason);
mPendingRequest = nullptr;
mPendingRequestFlags = 0;
@ -1326,21 +1329,32 @@ nsImageLoadingContent::UntrackImage(imgIRequest* aImage, uint32_t aFlags /* = 0
MOZ_ASSERT(aImage == mCurrentRequest || aImage == mPendingRequest,
"Why haven't we heard of this request?");
// If GetOurDocument() returns null here, we've outlived our document.
// That's fine, because the document empties out the tracker and unlocks
// all locked images on destruction.
// We may not be in the document. If we outlived our document that's fine,
// because the document empties out the tracker and unlocks all locked images
// on destruction. But if we were never in the document we may need to force
// discarding the image here, since this is the only chance we have.
nsIDocument* doc = GetOurCurrentDoc();
if (doc) {
if (aImage == mCurrentRequest && (mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
if (aImage == mCurrentRequest) {
if (doc && (mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
mCurrentRequestFlags &= ~REQUEST_IS_TRACKED;
doc->RemoveImage(mCurrentRequest,
(aFlags & REQUEST_DISCARD) ? nsIDocument::REQUEST_DISCARD : 0);
}
if (aImage == mPendingRequest && (mPendingRequestFlags & REQUEST_IS_TRACKED)) {
else if (aFlags & REQUEST_DISCARD) {
// If we're not in the document we may still need to be discarded.
aImage->RequestDiscard();
}
}
if (aImage == mPendingRequest) {
if (doc && (mPendingRequestFlags & REQUEST_IS_TRACKED)) {
mPendingRequestFlags &= ~REQUEST_IS_TRACKED;
doc->RemoveImage(mPendingRequest,
(aFlags & REQUEST_DISCARD) ? nsIDocument::REQUEST_DISCARD : 0);
}
else if (aFlags & REQUEST_DISCARD) {
// If we're not in the document we may still need to be discarded.
aImage->RequestDiscard();
}
}
return NS_OK;
}

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

@ -298,8 +298,8 @@ protected:
/**
* Cancels and nulls-out the "current" and "pending" requests if they exist.
*/
void ClearCurrentRequest(nsresult aReason);
void ClearPendingRequest(nsresult aReason);
void ClearCurrentRequest(nsresult aReason, uint32_t aFlags);
void ClearPendingRequest(nsresult aReason, uint32_t aFlags);
/**
* Retrieve a pointer to the 'registered with the refresh driver' flag for

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

@ -1490,7 +1490,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLContext)
NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextInternal)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
// If the exact way we cast to nsISupports here ever changes, fix our
// PreCreate hook!
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports,
nsICanvasRenderingContextInternal)
// ToSupports() method.
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMWebGLRenderingContext)
NS_INTERFACE_MAP_END

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

@ -1173,7 +1173,7 @@ public:
inline nsISupports*
ToSupports(WebGLContext* context)
{
return static_cast<nsICanvasRenderingContextInternal*>(context);
return static_cast<nsIDOMWebGLRenderingContext*>(context);
}
class WebGLActiveInfo MOZ_FINAL

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

@ -778,6 +778,18 @@ NON_IDL_EVENT(gamepaddisconnected,
#endif
// Simple gesture events
NON_IDL_EVENT(MozSwipeGestureStart,
NS_SIMPLE_GESTURE_SWIPE_START,
EventNameType_None,
NS_SIMPLE_GESTURE_EVENT)
NON_IDL_EVENT(MozSwipeGestureUpdate,
NS_SIMPLE_GESTURE_SWIPE_UPDATE,
EventNameType_None,
NS_SIMPLE_GESTURE_EVENT)
NON_IDL_EVENT(MozSwipeGestureEnd,
NS_SIMPLE_GESTURE_SWIPE_END,
EventNameType_None,
NS_SIMPLE_GESTURE_EVENT)
NON_IDL_EVENT(MozSwipeGesture,
NS_SIMPLE_GESTURE_SWIPE,
EventNameType_None,

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

@ -43,6 +43,24 @@ NS_INTERFACE_MAP_BEGIN(nsDOMSimpleGestureEvent)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SimpleGestureEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
/* attribute unsigned long allowedDirections; */
NS_IMETHODIMP
nsDOMSimpleGestureEvent::GetAllowedDirections(PRUint32 *aAllowedDirections)
{
NS_ENSURE_ARG_POINTER(aAllowedDirections);
*aAllowedDirections =
static_cast<nsSimpleGestureEvent*>(mEvent)->allowedDirections;
return NS_OK;
}
NS_IMETHODIMP
nsDOMSimpleGestureEvent::SetAllowedDirections(PRUint32 aAllowedDirections)
{
static_cast<nsSimpleGestureEvent*>(mEvent)->allowedDirections =
aAllowedDirections;
return NS_OK;
}
/* readonly attribute unsigned long direction; */
NS_IMETHODIMP
nsDOMSimpleGestureEvent::GetDirection(uint32_t *aDirection)
@ -86,6 +104,7 @@ nsDOMSimpleGestureEvent::InitSimpleGestureEvent(const nsAString& aTypeArg,
bool aMetaKeyArg,
uint16_t aButton,
nsIDOMEventTarget* aRelatedTarget,
uint32_t aAllowedDirectionsArg,
uint32_t aDirectionArg,
double aDeltaArg,
uint32_t aClickCountArg)
@ -108,6 +127,7 @@ nsDOMSimpleGestureEvent::InitSimpleGestureEvent(const nsAString& aTypeArg,
NS_ENSURE_SUCCESS(rv, rv);
nsSimpleGestureEvent* simpleGestureEvent = static_cast<nsSimpleGestureEvent*>(mEvent);
simpleGestureEvent->allowedDirections = aAllowedDirectionsArg;
simpleGestureEvent->direction = aDirectionArg;
simpleGestureEvent->delta = aDeltaArg;
simpleGestureEvent->clickCount = aClickCountArg;

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

@ -31,6 +31,11 @@ public:
return mozilla::dom::SimpleGestureEventBinding::Wrap(aCx, aScope, this);
}
uint32_t AllowedDirections()
{
return static_cast<nsSimpleGestureEvent*>(mEvent)->allowedDirections;
}
uint32_t Direction()
{
return static_cast<nsSimpleGestureEvent*>(mEvent)->direction;
@ -61,6 +66,7 @@ public:
bool aMetaKey,
uint16_t aButton,
mozilla::dom::EventTarget* aRelatedTarget,
uint32_t aAllowedDirections,
uint32_t aDirection,
double aDelta,
uint32_t aClickCount,
@ -70,8 +76,8 @@ public:
aView, aDetail, aScreenX, aScreenY,
aClientX, aClientY, aCtrlKey, aAltKey,
aShiftKey, aMetaKey, aButton,
aRelatedTarget, aDirection,
aDelta, aClickCount);
aRelatedTarget, aAllowedDirections,
aDirection, aDelta, aClickCount);
}
};

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

@ -100,8 +100,9 @@ AnalyserNode::WrapObject(JSContext* aCx, JSObject* aScope)
void
AnalyserNode::SetFftSize(uint32_t aValue, ErrorResult& aRv)
{
// Disallow values that are either less than 2 or not a power of 2
if (aValue < 2 ||
// Disallow values that are not a power of 2 and outside the [32,2048] range
if (aValue < 32 ||
aValue > 2048 ||
(aValue & (aValue - 1)) != 0) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return;

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

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "AudioBuffer.h"
#include <speex/speex_resampler.h>
#include "mozilla/dom/AudioBufferBinding.h"
#include "nsContentUtils.h"
#include "AudioContext.h"
@ -105,7 +104,6 @@ AudioBuffer::RestoreJSChannelData(JSContext* aJSContext)
}
mSharedChannels = nullptr;
mResampledChannels = nullptr;
}
}
@ -160,74 +158,18 @@ StealJSArrayDataIntoThreadSharedFloatArrayBufferList(JSContext* aJSContext,
}
ThreadSharedFloatArrayBufferList*
AudioBuffer::GetThreadSharedChannelsForRate(JSContext* aJSContext, uint32_t aRate,
AudioBuffer::GetThreadSharedChannelsForRate(JSContext* aJSContext, uint32_t* aRate,
uint32_t* aLength)
{
if (mResampledChannels && mResampledChannelsRate == aRate) {
// return cached data
*aLength = mResampledChannelsLength;
return mResampledChannels;
}
if (!mSharedChannels) {
// Steal JS data
mSharedChannels =
StealJSArrayDataIntoThreadSharedFloatArrayBufferList(aJSContext, mJSChannels);
}
if (mSampleRate == aRate) {
*aLength = mLength;
return mSharedChannels;
}
mResampledChannels = new ThreadSharedFloatArrayBufferList(NumberOfChannels());
double newLengthD = ceil(Duration()*aRate);
uint32_t newLength = uint32_t(newLengthD);
*aLength = newLength;
double size = sizeof(float)*NumberOfChannels()*newLengthD;
if (size != uint32_t(size)) {
return mResampledChannels;
}
float* outputData = static_cast<float*>(malloc(uint32_t(size)));
if (!outputData) {
nsCOMPtr<nsPIDOMWindow> pWindow = do_QueryInterface(mContext->GetParentObject());
nsIDocument* doc = nullptr;
if (pWindow) {
doc = pWindow->GetExtantDoc();
}
nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
"Media",
doc,
nsContentUtils::eDOM_PROPERTIES,
"MediaBufferSourceNodeResampleOutOfMemory");
return mResampledChannels;
}
SpeexResamplerState* resampler = speex_resampler_init(NumberOfChannels(),
mSampleRate,
aRate,
SPEEX_RESAMPLER_QUALITY_DEFAULT,
nullptr);
for (uint32_t i = 0; i < NumberOfChannels(); ++i) {
const float* inputData = mSharedChannels->GetData(i);
uint32_t inSamples = mLength;
uint32_t outSamples = newLength;
speex_resampler_process_float(resampler, i,
inputData, &inSamples,
outputData, &outSamples);
mResampledChannels->SetData(i, i == 0 ? outputData : nullptr, outputData);
outputData += newLength;
}
speex_resampler_destroy(resampler);
mResampledChannelsRate = aRate;
mResampledChannelsLength = newLength;
return mResampledChannels;
*aLength = mLength;
*aRate = mSampleRate;
return mSharedChannels;
}
}

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

@ -93,7 +93,7 @@ public:
* at aRate. Sets *aLength to the number of samples per channel.
*/
ThreadSharedFloatArrayBufferList* GetThreadSharedChannelsForRate(JSContext* aContext,
uint32_t aRate,
uint32_t* aRate,
uint32_t* aLength);
// aContents should either come from JS_AllocateArrayBufferContents or
@ -114,12 +114,6 @@ protected:
// if and only if the mJSChannels are neutered.
nsRefPtr<ThreadSharedFloatArrayBufferList> mSharedChannels;
// One-element cache of resampled data. Can be non-null only if mSharedChannels
// is non-null.
nsRefPtr<ThreadSharedFloatArrayBufferList> mResampledChannels;
uint32_t mResampledChannelsRate;
uint32_t mResampledChannelsLength;
uint32_t mLength;
float mSampleRate;
};

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

@ -9,11 +9,14 @@
#include "nsMathUtils.h"
#include "AudioNodeEngine.h"
#include "AudioNodeStream.h"
#include "AudioDestinationNode.h"
#include "speex/speex_resampler.h"
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(AudioBufferSourceNode, AudioNode, mBuffer)
NS_IMPL_CYCLE_COLLECTION_INHERITED_2(AudioBufferSourceNode, AudioNode,
mBuffer, mPlaybackRate)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(AudioBufferSourceNode)
NS_INTERFACE_MAP_END_INHERITING(AudioNode)
@ -24,24 +27,57 @@ NS_IMPL_RELEASE_INHERITED(AudioBufferSourceNode, AudioNode)
class AudioBufferSourceNodeEngine : public AudioNodeEngine
{
public:
AudioBufferSourceNodeEngine() :
explicit AudioBufferSourceNodeEngine(AudioDestinationNode* aDestination) :
mStart(0), mStop(TRACK_TICKS_MAX),
mResampler(nullptr),
mOffset(0), mDuration(0),
mLoop(false), mLoopStart(0), mLoopEnd(0)
mLoopStart(0), mLoopEnd(0),
mSampleRate(0), mPosition(0), mChannels(0), mPlaybackRate(1.0f),
mDestination(static_cast<AudioNodeStream*>(aDestination->Stream())),
mPlaybackRateTimeline(1.0f), mLoop(false)
{}
~AudioBufferSourceNodeEngine()
{
if (mResampler) {
speex_resampler_destroy(mResampler);
}
}
// START, OFFSET and DURATION are always set by start() (along with setting
// mBuffer to something non-null).
// STOP is set by stop().
enum Parameters {
SAMPLE_RATE,
START,
STOP,
OFFSET,
DURATION,
LOOP,
LOOPSTART,
LOOPEND
LOOPEND,
PLAYBACKRATE
};
virtual void SetTimelineParameter(uint32_t aIndex, const dom::AudioParamTimeline& aValue)
{
switch (aIndex) {
case PLAYBACKRATE:
mPlaybackRateTimeline = aValue;
// If we have a simple value that is 1.0 (i.e. intrinsic speed), and our
// input buffer is already at the ideal audio rate, and we have a
// resampler, we can release it.
if (mResampler && mPlaybackRateTimeline.HasSimpleValue() &&
mPlaybackRateTimeline.GetValue() == 1.0 &&
mSampleRate == IdealAudioRate()) {
speex_resampler_destroy(mResampler);
mResampler = nullptr;
}
WebAudioUtils::ConvertAudioParamToTicks(mPlaybackRateTimeline, nullptr, mDestination);
break;
default:
NS_ERROR("Bad GainNodeEngine TimelineParameter");
}
}
virtual void SetStreamTimeParameter(uint32_t aIndex, TrackTicks aParam)
{
switch (aIndex) {
@ -54,6 +90,7 @@ public:
virtual void SetInt32Parameter(uint32_t aIndex, int32_t aParam)
{
switch (aIndex) {
case SAMPLE_RATE: mSampleRate = aParam; break;
case OFFSET: mOffset = aParam; break;
case DURATION: mDuration = aParam; break;
case LOOP: mLoop = !!aParam; break;
@ -68,6 +105,23 @@ public:
mBuffer = aBuffer;
}
SpeexResamplerState* Resampler(uint32_t aChannels)
{
if (aChannels != mChannels && mResampler) {
speex_resampler_destroy(mResampler);
mResampler = nullptr;
}
if (!mResampler) {
mChannels = aChannels;
mResampler = speex_resampler_init(mChannels, mSampleRate,
IdealAudioRate(),
SPEEX_RESAMPLER_QUALITY_DEFAULT,
nullptr);
}
return mResampler;
}
// Borrow a full buffer of size WEBAUDIO_BLOCK_SIZE from the source buffer
// at offset aSourceOffset. This avoids copying memory.
void BorrowFromInputBuffer(AudioChunk* aOutput,
@ -99,6 +153,53 @@ public:
}
}
// Resamples input data to an output buffer, according to |mSampleRate| and
// the playbackRate.
// The number of frames consumed/produced depends on the amount of space
// remaining in both the input and output buffer, and the playback rate (that
// is, the ratio between the output samplerate and the input samplerate).
void CopyFromInputBufferWithResampling(AudioChunk* aOutput,
uint32_t aChannels,
uintptr_t aSourceOffset,
uintptr_t aBufferOffset,
uint32_t aAvailableInInputBuffer,
uint32_t& aFramesRead,
uint32_t& aFramesWritten) {
// Compute the sample rate we want to resample to.
double finalSampleRate = mSampleRate / mPlaybackRate;
double finalPlaybackRate = finalSampleRate / IdealAudioRate();
uint32_t availableInOuputBuffer = WEBAUDIO_BLOCK_SIZE - aBufferOffset;
uint32_t inputSamples, outputSamples;
// Check if we are short on input or output buffer.
if (aAvailableInInputBuffer < availableInOuputBuffer * finalPlaybackRate) {
outputSamples = ceil(aAvailableInInputBuffer / finalPlaybackRate);
inputSamples = aAvailableInInputBuffer;
} else {
inputSamples = ceil(availableInOuputBuffer * finalPlaybackRate);
outputSamples = availableInOuputBuffer;
}
SpeexResamplerState* resampler = Resampler(aChannels);
for (uint32_t i = 0; i < aChannels; ++i) {
uint32_t inSamples = inputSamples;
uint32_t outSamples = outputSamples;
const float* inputData = mBuffer->GetData(i) + aSourceOffset;
float* outputData =
static_cast<float*>(const_cast<void*>(aOutput->mChannelData[i])) +
aBufferOffset;
speex_resampler_process_float(resampler, i,
inputData, &inSamples,
outputData, &outSamples);
aFramesRead = inSamples;
aFramesWritten = outSamples;
}
}
/**
* Fill aOutput with as many zero frames as we can, and advance
* aOffsetWithinBlock and aCurrentPosition based on how many frames we write.
@ -146,16 +247,42 @@ public:
uint32_t numFrames = std::min(std::min(WEBAUDIO_BLOCK_SIZE - *aOffsetWithinBlock,
aBufferMax - aBufferOffset),
uint32_t(mStop - *aCurrentPosition));
if (numFrames == WEBAUDIO_BLOCK_SIZE) {
if (numFrames == WEBAUDIO_BLOCK_SIZE &&
mSampleRate == IdealAudioRate() &&
mPlaybackRate == 1.0f) {
BorrowFromInputBuffer(aOutput, aChannels, aBufferOffset);
*aOffsetWithinBlock += numFrames;
*aCurrentPosition += numFrames;
mPosition += numFrames;
} else {
if (aOutput->IsNull()) {
MOZ_ASSERT(*aOffsetWithinBlock == 0);
AllocateAudioBlock(aChannels, aOutput);
}
CopyFromInputBuffer(aOutput, aChannels, aBufferOffset, *aOffsetWithinBlock, numFrames);
if (mSampleRate == IdealAudioRate() && mPlaybackRate == 1.0f) {
CopyFromInputBuffer(aOutput, aChannels, aBufferOffset, *aOffsetWithinBlock, numFrames);
*aOffsetWithinBlock += numFrames;
*aCurrentPosition += numFrames;
mPosition += numFrames;
} else {
uint32_t framesRead, framesWritten, availableInInputBuffer;
availableInInputBuffer = aBufferMax - aBufferOffset;
CopyFromInputBufferWithResampling(aOutput, aChannels, aBufferOffset, *aOffsetWithinBlock, availableInInputBuffer, framesRead, framesWritten);
*aOffsetWithinBlock += framesWritten;
*aCurrentPosition += framesRead;
mPosition += framesRead;
}
}
*aOffsetWithinBlock += numFrames;
*aCurrentPosition += numFrames;
}
TrackTicks GetPosition(AudioNodeStream* aStream)
{
if (aStream->GetCurrentPosition() < mStart) {
return aStream->GetCurrentPosition();
}
return mStart + mPosition;
}
virtual void ProduceAudioBlock(AudioNodeStream* aStream,
@ -172,8 +299,22 @@ public:
return;
}
// WebKit treats the playbackRate as a k-rate parameter in their code,
// despite the spec saying that it should be an a-rate parameter. We treat
// it as k-rate. Spec bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=21592
float newPlaybackRate;
if (mPlaybackRateTimeline.HasSimpleValue()) {
newPlaybackRate = mPlaybackRateTimeline.GetValue();
} else {
newPlaybackRate = mPlaybackRateTimeline.GetValueAtTime<TrackTicks>(aStream->GetCurrentPosition());
}
if (newPlaybackRate != mPlaybackRate) {
mPlaybackRate = newPlaybackRate;
speex_resampler_set_rate(Resampler(mChannels), mSampleRate, mSampleRate / mPlaybackRate);
}
uint32_t written = 0;
TrackTicks currentPosition = aStream->GetCurrentPosition();
TrackTicks currentPosition = GetPosition(aStream);
while (written < WEBAUDIO_BLOCK_SIZE) {
if (mStop != TRACK_TICKS_MAX &&
currentPosition >= mStop) {
@ -212,11 +353,18 @@ public:
TrackTicks mStart;
TrackTicks mStop;
nsRefPtr<ThreadSharedFloatArrayBufferList> mBuffer;
SpeexResamplerState* mResampler;
int32_t mOffset;
int32_t mDuration;
bool mLoop;
int32_t mLoopStart;
int32_t mLoopEnd;
int32_t mSampleRate;
uint32_t mPosition;
uint32_t mChannels;
float mPlaybackRate;
AudioNodeStream* mDestination;
AudioParamTimeline mPlaybackRateTimeline;
bool mLoop;
};
AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* aContext)
@ -225,10 +373,12 @@ AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* aContext)
, mLoopEnd(0.0)
, mLoop(false)
, mStartCalled(false)
, mPlaybackRate(new AudioParam(this, SendPlaybackRateToStream, 1.0f))
{
SetProduceOwnOutput(true);
mStream = aContext->Graph()->CreateAudioNodeStream(new AudioBufferSourceNodeEngine(),
MediaStreamGraph::INTERNAL_STREAM);
mStream = aContext->Graph()->CreateAudioNodeStream(
new AudioBufferSourceNodeEngine(aContext->Destination()),
MediaStreamGraph::INTERNAL_STREAM);
mStream->AddMainThreadListener(this);
}
@ -259,14 +409,15 @@ AudioBufferSourceNode::Start(JSContext* aCx, double aWhen, double aOffset,
return;
}
uint32_t rate = Context()->GetRate();
uint32_t rate;
uint32_t lengthSamples;
nsRefPtr<ThreadSharedFloatArrayBufferList> data =
mBuffer->GetThreadSharedChannelsForRate(aCx, rate, &lengthSamples);
double length = double(lengthSamples)/rate;
mBuffer->GetThreadSharedChannelsForRate(aCx, &rate, &lengthSamples);
double length = double(lengthSamples) / rate;
double offset = std::max(0.0, aOffset);
double endOffset = aDuration.WasPassed() ?
std::min(aOffset + aDuration.Value(), length) : length;
if (offset >= endOffset) {
return;
}
@ -304,6 +455,7 @@ AudioBufferSourceNode::Start(JSContext* aCx, double aWhen, double aOffset,
}
ns->SetInt32Parameter(AudioBufferSourceNodeEngine::DURATION,
NS_lround(endOffset*rate) - offsetTicks);
ns->SetInt32Parameter(AudioBufferSourceNodeEngine::SAMPLE_RATE, rate);
}
void
@ -333,5 +485,12 @@ AudioBufferSourceNode::NotifyMainThreadStateChanged()
}
}
void
AudioBufferSourceNode::SendPlaybackRateToStream(AudioNode* aNode)
{
AudioBufferSourceNode* This = static_cast<AudioBufferSourceNode*>(aNode);
SendTimelineParameterToStream(This, AudioBufferSourceNodeEngine::PLAYBACKRATE, *This->mPlaybackRate);
}
}
}

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

@ -64,7 +64,10 @@ public:
{
mBuffer = aBuffer;
}
AudioParam* PlaybackRate() const
{
return mPlaybackRate;
}
bool Loop() const
{
return mLoop;
@ -93,11 +96,13 @@ public:
virtual void NotifyMainThreadStateChanged() MOZ_OVERRIDE;
private:
static void SendPlaybackRateToStream(AudioNode* aNode);
nsRefPtr<AudioBuffer> mBuffer;
double mLoopStart;
double mLoopEnd;
bool mLoop;
bool mStartCalled;
nsRefPtr<AudioParam> mPlaybackRate;
};
}

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

@ -19,12 +19,17 @@ struct ConvertTimeToTickHelper
static int64_t Convert(double aTime, void* aClosure)
{
TrackRate sampleRate = IdealAudioRate();
StreamTime streamTime;
ConvertTimeToTickHelper* This = static_cast<ConvertTimeToTickHelper*> (aClosure);
TrackTicks tick = This->mDestinationStream->GetCurrentPosition();
StreamTime destinationStreamTime = TicksToTimeRoundDown(sampleRate, tick);
GraphTime graphTime = This->mDestinationStream->StreamTimeToGraphTime(destinationStreamTime);
StreamTime streamTime = This->mSourceStream->GraphTimeToStreamTime(graphTime);
if (This->mSourceStream) {
TrackTicks tick = This->mDestinationStream->GetCurrentPosition();
StreamTime destinationStreamTime = TicksToTimeRoundDown(sampleRate, tick);
GraphTime graphTime = This->mDestinationStream->StreamTimeToGraphTime(destinationStreamTime);
streamTime = This->mSourceStream->GraphTimeToStreamTime(graphTime);
} else {
streamTime = This->mDestinationStream->GetCurrentPosition();
}
return TimeToTicksRoundDown(sampleRate, streamTime + SecondsToMediaTime(aTime));
}
};

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

@ -39,9 +39,18 @@ addLoadEvent(function() {
expectException(function() {
analyser.fftSize = 1;
}, DOMException.INDEX_SIZE_ERR);
expectException(function() {
analyser.fftSize = 8;
}, DOMException.INDEX_SIZE_ERR);
expectException(function() {
analyser.fftSize = 100; // non-power of two
}, DOMException.INDEX_SIZE_ERR);
expectException(function() {
analyser.fftSize = 2049;
}, DOMException.INDEX_SIZE_ERR);
expectException(function() {
analyser.fftSize = 4096;
}, DOMException.INDEX_SIZE_ERR);
analyser.fftSize = 1024;
is(analyser.frequencyBinCount, 512, "Correct new value for frequencyBinCount");

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

@ -291,6 +291,6 @@ private:
inline nsISupports*
ToSupports(dom::SpeechRecognition* aRec)
{
return static_cast<nsIObserver*>(aRec);
return ToSupports(static_cast<nsDOMEventTargetHelper*>(aRec));
}
} // namespace mozilla

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

@ -17,8 +17,6 @@ var errorCodes = {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
Components.utils.import("resource://gre/modules/Services.jsm");
SpecialPowers.setBoolPref("media.webspeech.recognition.enable", true);
SpecialPowers.setBoolPref("media.webspeech.test.enable", true);
function EventManager(sr) {
var self = this;
@ -123,11 +121,6 @@ function EventManager(sr) {
}
}
function resetPrefs() {
SpecialPowers.setBoolPref("media.webspeech.test.fake_fsm_events", false);
SpecialPowers.setBoolPref("media.webspeech.test.fake_recognition_service", false);
}
function buildResultCallback(transcript) {
return (function(evt) {
is(evt.results[0][0].transcript, transcript, "expect correct transcript");
@ -140,28 +133,35 @@ function buildErrorCallback(errcode) {
});
}
function performTest(eventsToRequest, expectedEvents, doneFunc, audioSampleFile) {
var sr = new SpeechRecognition();
var em = new EventManager(sr);
function performTest(options) {
var prefs = options.prefs;
for (var eventName in expectedEvents) {
var cb = expectedEvents[eventName];
em.expect(eventName, cb);
}
prefs.unshift(
["media.webspeech.recognition.enable", true],
["media.webspeech.test.enable", true]
);
em.done = function() {
em.requestTestEnd();
resetPrefs();
doneFunc();
}
SpecialPowers.pushPrefEnv({set: prefs}, function() {
var sr = new SpeechRecognition();
var em = new EventManager(sr);
if (!audioSampleFile) {
audioSampleFile = DEFAULT_AUDIO_SAMPLE_FILE;
}
for (var eventName in options.expectedEvents) {
var cb = options.expectedEvents[eventName];
em.expect(eventName, cb);
}
em.audioSampleFile = audioSampleFile;
em.done = function() {
em.requestTestEnd();
options.doneFunc();
}
for (var i = 0; i < eventsToRequest.length; i++) {
em.requestFSMEvent(eventsToRequest[i]);
}
em.audioSampleFile = DEFAULT_AUDIO_SAMPLE_FILE;
if (options.audioSampleFile) {
em.audioSampleFile = options.audioSampleFile;
}
for (var i = 0; i < options.eventsToRequest.length; i++) {
em.requestFSMEvent(options.eventsToRequest[i]);
}
});
}

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

@ -33,9 +33,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650295
];
function doNextTest() {
SpecialPowers.setBoolPref("media.webspeech.test.fake_fsm_events", true);
SpecialPowers.setBoolPref("media.webspeech.test.fake_recognition_service", true);
var nextEvent = eventsToAbortOn[nextEventIdx];
var expectedEvents = {
"start": null,
@ -59,12 +56,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650295
nextEventIdx++;
performTest([
"EVENT_START",
"EVENT_AUDIO_DATA"
],
expectedEvents,
(nextEventIdx < eventsToAbortOn.length) ? doNextTest : SimpleTest.finish);
performTest({
eventsToRequest: ["EVENT_START", "EVENT_AUDIO_DATA"],
expectedEvents: expectedEvents,
doneFunc: (nextEventIdx < eventsToAbortOn.length) ? doNextTest : SimpleTest.finish,
prefs: [["media.webspeech.test.fake_fsm_events", true], ["media.webspeech.test.fake_recognition_service", true]]
});
}
doNextTest();

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

@ -20,15 +20,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650295
<script type="text/javascript">
SimpleTest.waitForExplicitFinish();
SpecialPowers.setBoolPref("media.webspeech.test.fake_fsm_events", true);
performTest([
'EVENT_START',
'EVENT_AUDIO_ERROR'
], {
'error': buildErrorCallback(errorCodes.AUDIO_CAPTURE),
'end': null
}, SimpleTest.finish);
performTest({
eventsToRequest: ['EVENT_START', 'EVENT_AUDIO_ERROR'],
expectedEvents: {
'error': buildErrorCallback(errorCodes.AUDIO_CAPTURE),
'end': null
},
doneFunc: SimpleTest.finish,
prefs: [["media.webspeech.test.fake_fsm_events", true]]
});
</script>
</pre>
</body>

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

@ -20,9 +20,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650295
<script type="text/javascript">
SimpleTest.waitForExplicitFinish();
SpecialPowers.setBoolPref("media.webspeech.test.fake_fsm_events", true);
SpecialPowers.setBoolPref("media.webspeech.test.fake_recognition_service", true);
function endHandler(evt, sr) {
try {
sr.start(); // shouldn't fail
@ -33,19 +30,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650295
info("Successfully start() from end() callback");
}
performTest([
'EVENT_START',
'EVENT_AUDIO_DATA',
'EVENT_RECOGNITIONSERVICE_FINAL_RESULT'
], {
'start': null,
'audiostart': null,
'speechstart': null,
'speechend': null,
'audioend': null,
'result': buildResultCallback("Mock final result"),
'end': endHandler,
}, SimpleTest.finish);
performTest({
eventsToRequest: [
'EVENT_START',
'EVENT_AUDIO_DATA',
'EVENT_RECOGNITIONSERVICE_FINAL_RESULT'
],
expectedEvents: {
'start': null,
'audiostart': null,
'speechstart': null,
'speechend': null,
'audioend': null,
'result': buildResultCallback("Mock final result"),
'end': endHandler,
},
doneFunc: SimpleTest.finish,
prefs: [["media.webspeech.test.fake_fsm_events", true], ["media.webspeech.test.fake_recognition_service", true]]
});
</script>
</pre>

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

@ -17,20 +17,26 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650295
</div>
<pre id="test">
<script type="text/javascript">
SpecialPowers.setBoolPref("media.webspeech.recognition.enable", false);
SimpleTest.waitForExplicitFinish();
var objects = [
"SpeechRecognition",
"SpeechGrammar",
"SpeechRecognitionResult",
"SpeechRecognitionResultList",
"SpeechRecognitionAlternative"
];
SpecialPowers.pushPrefEnv({
set: [["media.webspeech.recognition.enable", false]]
}, function() {
var objects = [
"SpeechRecognition",
"SpeechGrammar",
"SpeechRecognitionResult",
"SpeechRecognitionResultList",
"SpeechRecognitionAlternative"
];
for (var i = 0; i < objects.length; i++) {
is(window[objects[i]], undefined,
objects[i] + " should be undefined with pref off");
}
for (var i = 0; i < objects.length; i++) {
is(window[objects[i]], undefined,
objects[i] + " should be undefined with pref off");
}
SimpleTest.finish();
});
</script>
</pre>
</body>

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

@ -20,22 +20,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650295
<script type="text/javascript">
SimpleTest.waitForExplicitFinish();
SpecialPowers.setBoolPref("media.webspeech.test.fake_fsm_events", true);
SpecialPowers.setBoolPref("media.webspeech.test.fake_recognition_service", true);
performTest([
'EVENT_START',
'EVENT_AUDIO_DATA',
'EVENT_RECOGNITIONSERVICE_ERROR'
], {
'start': null,
'audiostart': null,
'speechstart': null,
'speechend': null,
'audioend': null,
'error': buildErrorCallback(errorCodes.NETWORK),
'end': null
}, SimpleTest.finish);
performTest({
eventsToRequest: [
'EVENT_START',
'EVENT_AUDIO_DATA',
'EVENT_RECOGNITIONSERVICE_ERROR'
],
expectedEvents: {
'start': null,
'audiostart': null,
'speechstart': null,
'speechend': null,
'audioend': null,
'error': buildErrorCallback(errorCodes.NETWORK),
'end': null
},
doneFunc: SimpleTest.finish,
prefs: [["media.webspeech.test.fake_fsm_events", true], ["media.webspeech.test.fake_recognition_service", true]]
});
</script>
</pre>

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