Merge mozilla-central into services-central

This commit is contained in:
Gregory Szorc 2012-07-25 11:20:58 -07:00
commit 008d42709b
217 changed files with 2952 additions and 1370 deletions

View File

@ -122,11 +122,14 @@ var shell = {
.sessionHistory = Cc["@mozilla.org/browser/shistory;1"]
.createInstance(Ci.nsISHistory);
['keydown', 'keypress', 'keyup'].forEach((function listenKey(type) {
window.addEventListener(type, this, false, true);
window.addEventListener(type, this, true, true);
}).bind(this));
// Capture all key events so we can filter out hardware buttons
// And send them to Gaia via mozChromeEvents.
// Ideally, hardware buttons wouldn't generate key events at all, or
// if they did, they would use keycodes that conform to DOM 3 Events.
// See discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=762362
window.addEventListener('keydown', this, true);
window.addEventListener('keypress', this, true);
window.addEventListener('keyup', this, true);
window.addEventListener('MozApplicationManifest', this);
window.addEventListener('mozfullscreenchange', this);
window.addEventListener('sizemodechange', this);
@ -165,11 +168,9 @@ var shell = {
},
stop: function shell_stop() {
['keydown', 'keypress', 'keyup'].forEach((function unlistenKey(type) {
window.removeEventListener(type, this, false, true);
window.removeEventListener(type, this, true, true);
}).bind(this));
window.removeEventListener('keydown', this, true);
window.removeEventListener('keypress', this, true);
window.removeEventListener('keyup', this, true);
window.removeEventListener('MozApplicationManifest', this);
window.removeEventListener('mozfullscreenchange', this);
window.removeEventListener('sizemodechange', this);
@ -180,15 +181,66 @@ var shell = {
#endif
},
forwardKeyToContent: function shell_forwardKeyToContent(evt) {
let content = shell.contentBrowser.contentWindow;
let generatedEvent = content.document.createEvent('KeyboardEvent');
generatedEvent.initKeyEvent(evt.type, true, true, evt.view, evt.ctrlKey,
evt.altKey, evt.shiftKey, evt.metaKey,
evt.keyCode, evt.charCode);
// If this key event actually represents a hardware button, filter it here
// and send a mozChromeEvent with detail.type set to xxx-button-press or
// xxx-button-release instead.
filterHardwareKeys: function shell_filterHardwareKeys(evt) {
var type;
switch (evt.keyCode) {
case evt.DOM_VK_HOME: // Home button
type = 'home-button';
break;
case evt.DOM_VK_SLEEP: // Sleep button
type = 'sleep-button';
break;
case evt.DOM_VK_PAGE_UP: // Volume up button
type = 'volume-up-button';
break;
case evt.DOM_VK_PAGE_DOWN: // Volume down button
type = 'volume-down-button';
break;
case evt.DOM_VK_ESCAPE: // Back button (should be disabled)
type = 'back-button';
break;
case evt.DOM_VK_CONTEXT_MENU: // Menu button
type = 'menu-button';
break;
default: // Anything else is a real key
return; // Don't filter it at all; let it propagate to Gaia
}
content.document.documentElement.dispatchEvent(generatedEvent);
// If we didn't return, then the key event represents a hardware key
// and we need to prevent it from propagating to Gaia
evt.stopImmediatePropagation();
evt.preventDefault(); // Prevent keypress events (when #501496 is fixed).
// If it is a key down or key up event, we send a chrome event to Gaia.
// If it is a keypress event we just ignore it.
switch (evt.type) {
case 'keydown':
type = type + '-press';
break;
case 'keyup':
type = type + '-release';
break;
case 'keypress':
return;
}
// On my device, the physical hardware buttons (sleep and volume)
// send multiple events (press press release release), but the
// soft home button just sends one. This hack is to manually
// "debounce" the keys. If the type of this event is the same as
// the type of the last one, then don't send it. We'll never send
// two presses or two releases in a row.
// FIXME: https://bugzilla.mozilla.org/show_bug.cgi?id=761067
if (type !== this.lastHardwareButtonEventType) {
this.lastHardwareButtonEventType = type;
this.sendChromeEvent({type: type});
}
},
lastHardwareButtonEventType: null, // property for the hack above
handleEvent: function shell_handleEvent(evt) {
let content = this.contentBrowser.contentWindow;
@ -196,17 +248,8 @@ var shell = {
case 'keydown':
case 'keyup':
case 'keypress':
// Redirect the HOME key to System app and stop the applications from
// handling it.
let rootContentEvt = (evt.target.ownerDocument.defaultView == content);
if (!rootContentEvt && evt.eventPhase == evt.CAPTURING_PHASE &&
evt.keyCode == evt.DOM_VK_HOME) {
this.forwardKeyToContent(evt);
evt.preventDefault();
evt.stopImmediatePropagation();
}
this.filterHardwareKeys(evt);
break;
case 'mozfullscreenchange':
// When the screen goes fullscreen make sure to set the focus to the
// main window so noboby can prevent the ESC key to get out fullscreen
@ -272,6 +315,9 @@ var shell = {
let event = content.document.createEvent('CustomEvent');
event.initCustomEvent(type, true, true, details ? details : {});
content.dispatchEvent(event);
},
sendChromeEvent: function shell_sendChromeEvent(details) {
this.sendEvent(getContentWindow(), "mozChromeEvent", details);
}
};
@ -310,7 +356,7 @@ nsBrowserAccess.prototype = {
Services.obs.addObserver(function onSystemMessage(subject, topic, data) {
let msg = JSON.parse(data);
let origin = Services.io.newURI(msg.manifest, null, null).prePath;
shell.sendEvent(shell.contentBrowser.contentWindow, 'mozChromeEvent', {
shell.sendChromeEvent({
type: 'open-app',
url: msg.uri,
origin: origin,
@ -415,12 +461,22 @@ var AlertsHelper = {
return id;
},
showAlertNotification: function alert_showAlertNotification(imageUrl, title, text, textClickable,
cookie, alertListener, name) {
showAlertNotification: function alert_showAlertNotification(imageUrl,
title,
text,
textClickable,
cookie,
alertListener,
name)
{
let id = this.registerListener(cookie, alertListener);
let content = shell.contentBrowser.contentWindow;
shell.sendEvent(content, "mozChromeEvent", { type: "desktop-notification", id: id, icon: imageUrl,
title: title, text: text } );
shell.sendChromeEvent({
type: "desktop-notification",
id: id,
icon: imageUrl,
title: title,
text: text
});
}
}
@ -456,7 +512,6 @@ var WebappsHelper = {
},
observe: function webapps_observe(subject, topic, data) {
let content = shell.contentBrowser.contentWindow;
let json = JSON.parse(data);
switch(topic) {
case "webapps-launch":
@ -465,7 +520,7 @@ var WebappsHelper = {
return;
let manifest = new DOMApplicationManifest(aManifest, json.origin);
shell.sendEvent(content, "mozChromeEvent", {
shell.sendChromeEvent({
"type": "webapps-launch",
"url": manifest.fullLaunchPath(json.startPoint),
"origin": json.origin
@ -474,7 +529,11 @@ var WebappsHelper = {
break;
case "webapps-ask-install":
let id = this.registerInstaller(json);
shell.sendEvent(content, "mozChromeEvent", { type: "webapps-ask-install", id: id, app: json.app } );
shell.sendChromeEvent({
type: "webapps-ask-install",
id: id,
app: json.app
});
break;
}
}
@ -529,16 +588,28 @@ window.addEventListener('ContentStart', function ss_onContentStart() {
context.drawWindow(window, 0, 0, width, height,
'rgb(255,255,255)', flags);
shell.sendEvent(content, 'mozChromeEvent', {
type: 'take-screenshot-success',
file: canvas.mozGetAsFile('screenshot', 'image/png')
shell.sendChromeEvent({
type: 'take-screenshot-success',
file: canvas.mozGetAsFile('screenshot', 'image/png')
});
} catch (e) {
dump('exception while creating screenshot: ' + e + '\n');
shell.sendEvent(content, 'mozChromeEvent', {
shell.sendChromeEvent({
type: 'take-screenshot-error',
error: String(e)
});
}
});
});
Services.obs.addObserver(function ContentHandler(subject, topic, data) {
let handler = JSON.parse(data);
new MozActivity({
name: 'view',
data: {
type: handler.type,
url: handler.url
}
});
}, 'content-handler', false);

View File

@ -38,3 +38,8 @@ contract @mozilla.org/dom/activities/ui-glue;1 {70a83123-7467-4389-a309-3e81c74a
component {1a94c87a-5ece-4d11-91e1-d29c29f21b28} ProcessGlobal.js
contract @mozilla.org/b2g-process-global;1 {1a94c87a-5ece-4d11-91e1-d29c29f21b28}
category app-startup ProcessGlobal service,@mozilla.org/b2g-process-global;1
# ContentHandler.js
component {d18d0216-d50c-11e1-ba54-efb18d0ef0ac} ContentHandler.js
contract @mozilla.org/uriloader/content-handler;1?type=application/pdf {d18d0216-d50c-11e1-ba54-efb18d0ef0ac}

View File

@ -0,0 +1,48 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
"use strict";
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
const PDF_CONTENT_TYPE = "application/pdf";
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
function log(aMsg) {
let msg = "ContentHandler.js: " + (aMsg.join ? aMsg.join("") : aMsg);
Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService)
.logStringMessage(msg);
dump(msg + "\n");
}
const NS_ERROR_WONT_HANDLE_CONTENT = 0x805d0001;
function ContentHandler() {
}
ContentHandler.prototype = {
handleContent: function handleContent(aMimetype, aContext, aRequest) {
if (aMimetype != PDF_CONTENT_TYPE)
throw NS_ERROR_WONT_HANDLE_CONTENT;
if (!(aRequest instanceof Ci.nsIChannel))
throw NS_ERROR_WONT_HANDLE_CONTENT;
let detail = {
"type": aMimetype,
"url": aRequest.URI.spec
};
Services.obs.notifyObservers(this, "content-handler", JSON.stringify(detail));
aRequest.cancel(Cr.NS_BINDING_ABORTED);
},
classID: Components.ID("{d18d0216-d50c-11e1-ba54-efb18d0ef0ac}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentHandler])
};
var NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentHandler]);

View File

@ -22,7 +22,7 @@ DirectoryProvider.prototype = {
getFile: function dp_getFile(prop, persistent) {
#ifdef MOZ_WIDGET_GONK
let localProps = ["cachePDir", "webappsDir", "PrefD", "indexedDBPDir"];
let localProps = ["cachePDir", "webappsDir", "PrefD", "indexedDBPDir", "permissionDBPDir"];
if (localProps.indexOf(prop) != -1) {
prop.persistent = true;
let file = Cc["@mozilla.org/file/local;1"]

View File

@ -17,14 +17,15 @@ XPIDLSRCS = \
$(NULL)
EXTRA_PP_COMPONENTS = \
ActivitiesGlue.js \
AlertsService.js \
B2GComponents.manifest \
CameraContent.js \
ContentHandler.js \
ContentPermissionPrompt.js \
DirectoryProvider.js \
MozKeyboard.js \
ProcessGlobal.js \
ActivitiesGlue.js \
$(NULL)
ifdef MOZ_UPDATER

View File

@ -684,3 +684,4 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
@BINPATH@/components/DirectoryProvider.js
@BINPATH@/components/ActivitiesGlue.js
@BINPATH@/components/ProcessGlobal.js
@BINPATH@/components/ContentHandler.js

View File

@ -43,12 +43,26 @@ static void Output(const char *fmt, ... )
va_list ap;
va_start(ap, fmt);
#if defined(XP_WIN) && !MOZ_WINCONSOLE
PRUnichar msg[2048];
_vsnwprintf(msg, sizeof(msg)/sizeof(msg[0]), NS_ConvertUTF8toUTF16(fmt).get(), ap);
MessageBoxW(NULL, msg, L"XULRunner", MB_OK | MB_ICONERROR);
#else
#ifndef XP_WIN
vfprintf(stderr, fmt, ap);
#else
char msg[2048];
vsnprintf_s(msg, _countof(msg), _TRUNCATE, fmt, ap);
wchar_t wide_msg[2048];
MultiByteToWideChar(CP_UTF8,
0,
msg,
-1,
wide_msg,
_countof(wide_msg));
#if MOZ_WINCONSOLE
fwprintf_s(stderr, wide_msg);
#else
MessageBoxW(NULL, wide_msg, L"Firefox", MB_OK
| MB_ICONERROR
| MB_SETFOREGROUND);
#endif
#endif
va_end(ap);

View File

@ -1186,3 +1186,5 @@ pref("image.mem.max_decoded_image_kb", 256000);
// Example social provider
pref("social.manifest.motown", "{\"origin\":\"https://motown-dev.mozillalabs.com\",\"name\":\"MoTown\",\"workerURL\":\"https://motown-dev.mozillalabs.com/social/worker.js\",\"iconURL\":\"https://motown-dev.mozillalabs.com/images/motown-icon.png\",\"sidebarURL\":\"https://motown-dev.mozillalabs.com/social/sidebar\"}");
pref("social.sidebar.open", true);
pref("browser.social.whitelist", "");
pref("social.active", false);

View File

@ -332,6 +332,10 @@
label="&preferencesCmd2.label;"
#endif
oncommand="openPreferences();">
<menuitem id="appmenu_socialToggle"
type="checkbox"
autocheck="false"
command="Social:Toggle"/>
<menupopup id="appmenu_customizeMenu"
onpopupshowing="onViewToolbarsPopupShowing(event, document.getElementById('appmenu_toggleToolbarsSeparator'));">
<menuitem id="appmenu_preferences"

View File

@ -496,6 +496,10 @@
accesskey="&addons.accesskey;"
key="key_openAddons"
command="Tools:Addons"/>
<menuitem id="menu_socialToggle"
type="checkbox"
autocheck="false"
command="Social:Toggle"/>
#ifdef MOZ_SERVICES_SYNC
<!-- only one of sync-setup or sync-menu will be showing at once -->
<menuitem id="sync-setup"

View File

@ -108,6 +108,7 @@
<command id="Social:SharePage" oncommand="SocialShareButton.sharePage();"/>
<command id="Social:UnsharePage" oncommand="SocialShareButton.unsharePage();"/>
<command id="Social:ToggleSidebar" oncommand="Social.toggleSidebar();"/>
<command id="Social:Toggle" oncommand="Social.toggle();" hidden="true"/>
</commandset>
<commandset id="placesCommands">

View File

@ -11,6 +11,8 @@ let SocialUI = {
Services.prefs.addObserver("social.sidebar.open", this, false);
gBrowser.addEventListener("ActivateSocialFeature", this._activationEventHandler, true, true);
Social.init(this._providerReady.bind(this));
},
@ -31,6 +33,7 @@ let SocialUI = {
observe: function SocialUI_observe(subject, topic, data) {
switch (topic) {
case "social:pref-changed":
this.updateToggleCommand();
SocialShareButton.updateButtonHiddenState();
SocialToolbar.updateButtonHiddenState();
SocialSidebar.updateSidebar();
@ -46,11 +49,103 @@ let SocialUI = {
}
},
get toggleCommand() {
return document.getElementById("Social:Toggle");
},
// Called once Social.jsm's provider has been set
_providerReady: function SocialUI_providerReady() {
// If we couldn't find a provider, nothing to do here.
if (!Social.provider)
return;
this.updateToggleCommand();
let toggleCommand = this.toggleCommand;
let label = gNavigatorBundle.getFormattedString("social.enable.label",
[Social.provider.name]);
let accesskey = gNavigatorBundle.getString("social.enable.accesskey");
toggleCommand.setAttribute("label", label);
toggleCommand.setAttribute("accesskey", accesskey);
SocialToolbar.init();
SocialShareButton.init();
SocialSidebar.init();
},
updateToggleCommand: function SocialUI_updateToggleCommand() {
let toggleCommand = this.toggleCommand;
toggleCommand.setAttribute("checked", Social.enabled);
// FIXME: bug 772808: menu items don't inherit the "hidden" state properly,
// need to update them manually.
// This should just be: toggleCommand.hidden = !Social.active;
for (let id of ["appmenu_socialToggle", "menu_socialToggle"]) {
let el = document.getElementById(id);
if (!el)
continue;
if (Social.active)
el.removeAttribute("hidden");
else
el.setAttribute("hidden", "true");
}
},
// This handles "ActivateSocialFeature" events fired against content documents
// in this window.
_activationEventHandler: function SocialUI_activationHandler(e) {
// Nothing to do if Social is already active, or we don't have a provider
// to enable yet.
if (Social.active || !Social.provider)
return;
let targetDoc = e.target;
// Event must be fired against the document
if (!(targetDoc instanceof HTMLDocument))
return;
// Ignore events fired in background tabs
if (targetDoc.defaultView.top != content)
return;
// Check that the associated document's origin is in our whitelist
let prePath = targetDoc.documentURIObject.prePath;
let whitelist = Services.prefs.getCharPref("browser.social.whitelist");
if (whitelist.split(",").indexOf(prePath) == -1)
return;
// If the last event was received < 1s ago, ignore this one
let now = Date.now();
if (now - Social.lastEventReceived < 1000)
return;
Social.lastEventReceived = now;
// Enable the social functionality, and indicate that it was activated
Social.active = true;
// Show a warning, allow undoing the activation
let description = document.getElementById("social-activation-message");
let brandShortName = document.getElementById("bundle_brand").getString("brandShortName");
let message = gNavigatorBundle.getFormattedString("social.activated.message",
[Social.provider.name, brandShortName]);
description.value = message;
SocialUI.notificationPanel.hidden = false;
setTimeout(function () {
SocialUI.notificationPanel.openPopup(SocialToolbar.button, "bottomcenter topright");
}.bind(this), 0);
},
get notificationPanel() {
return document.getElementById("socialActivatedNotification")
},
undoActivation: function SocialUI_undoActivation() {
Social.active = false;
this.notificationPanel.hidePopup();
}
}
@ -153,22 +248,33 @@ var SocialToolbar = {
// Called once, after window load, when the Social.provider object is initialized
init: function SocialToolbar_init() {
document.getElementById("social-provider-image").setAttribute("image", Social.provider.iconURL);
// handle button state
document.getElementById("social-statusarea-popup").addEventListener("popupshowing", function(e) {
document.getElementById("social-toolbar-button").setAttribute("open", "true");
}, false);
document.getElementById("social-statusarea-popup").addEventListener("popuphiding", function(e) {
document.getElementById("social-toolbar-button").removeAttribute("open");
}, false);
let removeItem = document.getElementById("social-remove-menuitem");
let brandShortName = document.getElementById("bundle_brand").getString("brandShortName");
let label = gNavigatorBundle.getFormattedString("social.remove.label",
[brandShortName]);
let accesskey = gNavigatorBundle.getString("social.remove.accesskey");
removeItem.setAttribute("label", label);
removeItem.setAttribute("accesskey", accesskey);
let statusAreaPopup = document.getElementById("social-statusarea-popup");
statusAreaPopup.addEventListener("popupshowing", function(e) {
this.button.setAttribute("open", "true");
}.bind(this));
statusAreaPopup.addEventListener("popuphidden", function(e) {
this.button.removeAttribute("open");
}.bind(this));
this.updateButton();
this.updateProfile();
},
get button() {
return document.getElementById("social-toolbar-button");
},
updateButtonHiddenState: function SocialToolbar_updateButtonHiddenState() {
let toolbarbutton = document.getElementById("social-toolbar-button");
toolbarbutton.hidden = !Social.uiVisible;
this.button.hidden = !Social.uiVisible;
},
updateProfile: function SocialToolbar_updateProfile() {
@ -233,10 +339,10 @@ var SocialToolbar = {
panel.hidden = false;
function sizePanelToContent() {
// XXX Maybe we can use nsIDOMWindowUtils.getRootBounds() here?
// XXX need to handle dynamic sizing
// FIXME: bug 764787: Maybe we can use nsIDOMWindowUtils.getRootBounds() here?
// Need to handle dynamic sizing
let doc = notifBrowser.contentDocument;
// XXX "notif" is an implementation detail that we should get rid of
// "notif" is an implementation detail that we should get rid of
// eventually
let body = doc.getElementById("notif") || doc.body.firstChild;
if (!body)
@ -254,13 +360,13 @@ var SocialToolbar = {
panel.addEventListener("popuphiding", function onpopuphiding() {
panel.removeEventListener("popuphiding", onpopuphiding);
// unload the panel
document.getElementById("social-toolbar-button").removeAttribute("open");
SocialToolbar.button.removeAttribute("open");
notifBrowser.setAttribute("src", "about:blank");
});
notifBrowser.setAttribute("origin", Social.provider.origin);
notifBrowser.setAttribute("src", iconImage.getAttribute("contentPanel"));
document.getElementById("social-toolbar-button").setAttribute("open", "true");
this.button.setAttribute("open", "true");
panel.openPopup(iconImage, "bottomcenter topleft", 0, 0, false, false);
}
}

View File

@ -182,6 +182,44 @@
</hbox>
</panel>
<panel id="socialActivatedNotification"
type="arrow"
hidden="true"
consumeoutsideclicks="true"
align="start"
role="alert">
<hbox flex="1">
<image src="chrome://browser/content/social-icon.png" class="popup-notification-icon"/>
<vbox flex="1">
<description id="social-activation-message" class="popup-notification-description"/>
<spacer flex="1"/>
<hbox pack="end" align="center" class="popup-notification-button-container">
#ifdef XP_UNIX
<button id="social-undoactivation-button"
label="&social.activated.button.label;"
accesskey="&social.activated.button.accesskey;"
onclick="SocialUI.undoActivation();"/>
<button default="true"
autofocus="autofocus"
label="&social.ok.label;"
accesskey="&social.ok.accesskey;"
oncommand="SocialUI.notificationPanel.hidePopup();"/>
#else
<button default="true"
autofocus="autofocus"
label="&social.ok.label;"
accesskey="&social.ok.accesskey;"
oncommand="SocialUI.notificationPanel.hidePopup();"/>
<button id="social-undoactivation-button"
label="&social.activated.button.label;"
accesskey="&social.activated.button.accesskey;"
onclick="SocialUI.undoActivation();"/>
#endif
</hbox>
</vbox>
</hbox>
</panel>
<panel id="editSharePopup"
type="arrow"
orient="vertical"
@ -214,16 +252,16 @@
class="editSharePopupBottomButton"
default="true"
autofocus="autofocus"
label="&social.sharePopup.ok.label;"
accesskey="&social.sharePopup.ok.accesskey;"
label="&social.ok.label;"
accesskey="&social.ok.accesskey;"
oncommand="SocialShareButton.dismissSharePopup();"/>
#else
<button id="editSharePopupOkButton"
class="editSharePopupBottomButton"
default="true"
autofocus="autofocus"
label="&social.sharePopup.ok.label;"
accesskey="&social.sharePopup.ok.accesskey;"
label="&social.ok.label;"
accesskey="&social.ok.accesskey;"
oncommand="SocialShareButton.dismissSharePopup();"/>
<button id="editSharePopupUndoButton"
class="editSharePopupBottomButton"
@ -638,6 +676,8 @@
oncommand="SocialUI.showProfile(); document.getElementById('social-statusarea-popup').hidePopup();"/>
</vbox>
</hbox>
<menuitem id="social-remove-menuitem"
oncommand="Social.active = false;"/>
<menuitem id="social-toggle-sidebar-menuitem"
type="checkbox"
autocheck="false"

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1214,9 +1214,10 @@
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"tab");
var blank = !aURI || (aURI == "about:blank");
var uriIsBlankPage = !aURI || isBlankPageURL(aURI);
var uriIsNotAboutBlank = aURI && aURI != "about:blank";
if (blank)
if (uriIsBlankPage)
t.setAttribute("label", this.mStringBundle.getString("tabs.emptyTabTitle"));
else
t.setAttribute("label", aURI);
@ -1328,8 +1329,15 @@
this.tabContainer.updateVisibility();
if (uriIsNotAboutBlank) {
// Stop the existing about:blank load. Otherwise, if aURI
// doesn't stop in-progress loads on its own, we'll get into
// trouble with multiple parallel loads running at once.
b.stop();
}
// wire up a progress listener for the new browser object.
var tabListener = this.mTabProgressListener(t, b, blank);
var tabListener = this.mTabProgressListener(t, b, uriIsBlankPage);
const filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"]
.createInstance(Components.interfaces.nsIWebProgress);
filter.addProgressListener(tabListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
@ -1351,15 +1359,10 @@
evt.initEvent("TabOpen", true, false);
t.dispatchEvent(evt);
if (!blank) {
// Stop the existing about:blank load. Otherwise, if aURI
// doesn't stop in-progress loads on its own, we'll get into
// trouble with multiple parallel loads running at once.
b.stop();
if (uriIsNotAboutBlank) {
// pretend the user typed this so it'll be available till
// the document successfully loads
if (!isBlankPageURL(aURI))
if (!uriIsBlankPage)
b.userTypedValue = aURI;
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;

View File

@ -258,6 +258,10 @@ _BROWSER_FILES = \
browser_bug734076.js \
browser_social_toolbar.js \
browser_social_sidebar.js \
browser_social_mozSocial_API.js \
social_panel.html \
social_sidebar.html \
social_worker.js \
$(NULL)
ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))

View File

@ -0,0 +1,87 @@
/* 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 SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
function test() {
// XXX Bug 775779
if (Cc["@mozilla.org/xpcom/debug;1"].getService(Ci.nsIDebug2).isDebugBuild) {
ok(true, "can't run social sidebar test in debug builds because they falsely report leaks");
return;
}
waitForExplicitFinish();
let manifest = { // normal provider
name: "provider 1",
origin: "http://example.com",
sidebarURL: "http://example.com/browser/browser/base/content/test/social_sidebar.html",
workerURL: "http://example.com/browser/browser/base/content/test/social_worker.js",
iconURL: "chrome://branding/content/icon48.png"
};
runSocialTestWithProvider(manifest, doTest);
}
function doTest() {
let iconsReady = false;
let gotSidebarMessage = false;
function checkNext() {
if (iconsReady && gotSidebarMessage)
triggerIconPanel();
}
function triggerIconPanel() {
let statusIcons = document.getElementById("social-status-iconbox");
ok(!statusIcons.firstChild.collapsed, "status icon is visible");
// Click the button to trigger its contentPanel
let panel = document.getElementById("social-notification-panel");
EventUtils.synthesizeMouseAtCenter(statusIcons.firstChild, {});
}
let port = Social.provider.port;
ok(port, "provider has a port");
port.postMessage({topic: "test-init"});
Social.provider.port.onmessage = function (e) {
let topic = e.data.topic;
switch (topic) {
case "got-panel-message":
ok(true, "got panel message");
// Wait for the panel to close before ending the test
let panel = document.getElementById("social-notification-panel");
panel.addEventListener("popuphidden", function hiddenListener() {
panel.removeEventListener("popuphidden", hiddenListener);
SocialService.removeProvider(Social.provider.origin, finish);
});
panel.hidePopup();
break;
case "got-sidebar-message":
// The sidebar message will always come first, since it loads by default
ok(true, "got sidebar message");
info(topic);
gotSidebarMessage = true;
checkNext();
break;
}
}
// Our worker sets up ambient notification at the same time as it responds to
// the workerAPI initialization. If it's already initialized, we can
// immediately check the icons, otherwise wait for initialization by
// observing the topic sent out by the social service.
if (Social.provider.workerAPI.initialized) {
iconsReady = true;
checkNext();
} else {
Services.obs.addObserver(function obs() {
Services.obs.removeObserver(obs, "social:ambient-notification-changed");
// Let the other observers (like the one that updates the UI) run before
// checking the icons.
executeSoon(function () {
iconsReady = true;
checkNext();
});
}, "social:ambient-notification-changed", false);
}
}

View File

@ -0,0 +1,14 @@
<html>
<head>
<meta charset="utf-8">
<script>
function pingWorker() {
var port = navigator.mozSocial.getWorker().port;
port.postMessage({topic: "panel-message", result: "ok"});
}
</script>
</head>
<body onload="pingWorker();">
<p>This is a test social panel.</p>
</body>
</html>

View File

@ -0,0 +1,14 @@
<html>
<head>
<meta charset="utf-8">
<script>
function pingWorker() {
var port = navigator.mozSocial.getWorker().port;
port.postMessage({topic: "sidebar-message", result: "ok"});
}
</script>
</head>
<body onload="pingWorker();">
<p>This is a test social sidebar.</p>
</body>
</html>

View File

@ -0,0 +1,40 @@
/* 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 testPort;
onconnect = function(e) {
let port = e.ports[0];
port.onmessage = function onMessage(event) {
let topic = event.data.topic;
switch (topic) {
case "test-init":
testPort = port;
break;
case "sidebar-message":
if (testPort && event.data.result == "ok")
testPort.postMessage({topic:"got-sidebar-message"});
break;
case "panel-message":
if (testPort && event.data.result == "ok")
testPort.postMessage({topic:"got-panel-message"});
break;
case "social.initialize":
// This is the workerAPI port, respond and set up a notification icon.
port.postMessage({topic: "social.initialize-response"});
let profile = {
userName: "foo"
};
port.postMessage({topic: "social.user-profile", data: profile});
let icon = {
name: "testIcon",
iconURL: "chrome://branding/content/icon48.png",
contentPanel: "http://example.com/browser/browser/base/content/test/social_panel.html",
counter: 1
};
port.postMessage({topic: "social.ambient-notification", data: icon});
break;
}
}
}

View File

@ -101,6 +101,7 @@ browser.jar:
#ifdef XP_WIN
* content/browser/win6BrowserOverlay.xul (content/win6BrowserOverlay.xul)
#endif
content/browser/social-icon.png (content/social-icon.png)
# the following files are browser-specific overrides
* content/browser/license.html (/toolkit/content/license.html)
% override chrome://global/content/license.html chrome://browser/content/license.html

View File

@ -68,7 +68,7 @@ PlacesViewBase.prototype = {
if (val) {
this._resultNode = val.root;
this._rootElt._placesNode = this._resultNode;
this._domNodes = new WeakMap();
this._domNodes = new Map();
this._domNodes.set(this._resultNode, this._rootElt);
// This calls _rebuild through invalidateContainer.

View File

@ -80,7 +80,7 @@ function PlacesController(aView) {
return Services.dirsvc.get("ProfD", Ci.nsIFile).leafName;
});
this._cachedLivemarkInfoObjects = new WeakMap();
this._cachedLivemarkInfoObjects = new Map();
}
PlacesController.prototype = {

View File

@ -51,7 +51,7 @@ PlacesTreeView.prototype = {
// Bug 761494:
// ----------
// Some addons use methods from nsINavHistoryResultObserver and
// nsINavHistoryResultTreeViewer, without QIing to these intefaces first.
// nsINavHistoryResultTreeViewer, without QIing to these interfaces first.
// That's not a problem when the view is retrieved through the
// <tree>.view getter (which returns the wrappedJSObject of this object),
// it raises an issue when the view retrieved through the treeBoxObject.view
@ -153,12 +153,21 @@ PlacesTreeView.prototype = {
_getRowForNode:
function PTV__getRowForNode(aNode, aForceBuild, aParentRow, aNodeIndex) {
if (aNode == this._rootNode)
throw "The root node is never visible";
throw new Error("The root node is never visible");
let ancestors = PlacesUtils.nodeAncestors(aNode);
for (let ancestor in ancestors) {
// A node is removed form the view either if it has no parent or if its
// root-ancestor is not the root node (in which case that's the node
// for which nodeRemoved was called).
let ancestors = [x for each (x in PlacesUtils.nodeAncestors(aNode))];
if (ancestors.length == 0 ||
ancestors[ancestors.length - 1] != this._rootNode) {
throw new Error("Removed node passed to _getRowForNode");
}
// Ensure that the entire chain is open, otherwise that node is invisible.
for (let ancestor of ancestors) {
if (!ancestor.containerOpen)
throw "Invisible node passed to _getRowForNode";
throw new Error("Invisible node passed to _getRowForNode");
}
// Non-plain containers are initially built with their contents.
@ -1097,7 +1106,7 @@ PlacesTreeView.prototype = {
if (val) {
this._result = val;
this._rootNode = this._result.root;
this._cellProperties = new WeakMap();
this._cellProperties = new Map();
this._cuttingNodes = new Set();
}
else if (this._result) {

View File

@ -26,7 +26,7 @@
var EXPORTED_SYMBOLS = [ "gcli" ];
Components.utils.import("resource:///modules/devtools/Require.jsm");
Components.utils.import("resource://gre/modules/Require.jsm");
Components.utils.import("resource:///modules/devtools/Console.jsm");
Components.utils.import("resource:///modules/devtools/Browser.jsm");

View File

@ -11,7 +11,7 @@ function test() {
let [ define, require ] = (function() {
let tempScope = {};
Components.utils.import("resource:///modules/devtools/Require.jsm", tempScope);
Components.utils.import("resource://gre/modules/Require.jsm", tempScope);
return [ tempScope.define, tempScope.require ];
})();

View File

@ -42,7 +42,7 @@ let tabSizeOrig = undefined;
let remoteHostOrig = undefined;
function setup() {
Components.utils.import("resource:///modules/devtools/Require.jsm", imports);
Components.utils.import("resource://gre/modules/Require.jsm", imports);
imports.settings = imports.require("gcli/settings");
tiltEnabledOrig = imports.prefBranch.getBoolPref("devtools.tilt.enabled");

View File

@ -41,7 +41,7 @@ let tabSizeOrig = undefined;
let remoteHostOrig = undefined;
function setup() {
Components.utils.import("resource:///modules/devtools/Require.jsm", imports);
Components.utils.import("resource://gre/modules/Require.jsm", imports);
imports.settings = imports.require("gcli/settings");
tiltEnabled = imports.settings.getSetting("devtools.tilt.enabled");

View File

@ -54,7 +54,7 @@
let [ define, require ] = (function() {
let tempScope = {};
Components.utils.import("resource:///modules/devtools/Require.jsm", tempScope);
Components.utils.import("resource://gre/modules/Require.jsm", tempScope);
return [ tempScope.define, tempScope.require ];
})();

View File

@ -6,7 +6,7 @@
let [ define, require ] = (function() {
let tempScope = {};
Components.utils.import("resource:///modules/devtools/Require.jsm", tempScope);
Components.utils.import("resource://gre/modules/Require.jsm", tempScope);
return [ tempScope.define, tempScope.require ];
})();

View File

@ -657,11 +657,21 @@ toolbar button -->
<!ENTITY socialToolbar.title "Social Toolbar Button">
<!ENTITY social.notLoggedIn.label "Not logged in">
<!-- LOCALIZATION NOTE (social.ok.label, social.ok.accesskey): this string is
used for the "OK" button for two different social panels. One appears when
the feature is activated (social.activated.* below), and the other when
the user clicks the "Share" button a second time (social.sharePopup.*
below). -->
<!ENTITY social.ok.label "OK">
<!ENTITY social.ok.accesskey "O">
<!ENTITY social.sharePopup.undo.label "Unshare">
<!ENTITY social.sharePopup.undo.accesskey "U">
<!ENTITY social.sharePopup.ok.label "OK">
<!ENTITY social.sharePopup.ok.accesskey "O">
<!ENTITY social.sharePopup.shared.label "You shared this page.">
<!ENTITY social.sharePopup.portrait.arialabel "User profile picture">
<!ENTITY social.toggleSidebar.label "Show sidebar">
<!ENTITY social.toggleSidebar.accesskey "s">
<!ENTITY social.activated.button.label "Oops, undo">
<!ENTITY social.activated.button.accesskey "u">

View File

@ -372,3 +372,14 @@ fullscreen.rememberDecision=Remember decision for %S
social.shareButton.tooltip=Share this
social.shareButton.sharedtooltip=You shared this
social.pageShared.label=Page shared
# LOCALIZATION NOTE (social.enable.label): %S = Social networking provider
social.enable.label=%S integration
social.enable.accesskey=n
# LOCALIZATION NOTE (social.remove.label): %S = brandShortName
social.remove.label=Remove from %S
social.remove.accesskey=R
# LOCALIZATION NOTE (social.enabled.message): %1$S is the name of the social provider, %2$S is brandShortName (e.g. Firefox)
social.activated.message=%1$S integration with %2$S has been activated.

View File

@ -17,6 +17,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "SocialService",
"resource://gre/modules/SocialService.jsm");
let Social = {
lastEventReceived: 0,
provider: null,
init: function Social_init(callback) {
if (this.provider) {
@ -38,6 +39,25 @@ let Social = {
return this.provider && this.provider.enabled && this.provider.port;
},
set enabled(val) {
SocialService.enabled = val;
},
get enabled() {
return SocialService.enabled;
},
get active() {
return Services.prefs.getBoolPref("social.active");
},
set active(val) {
Services.prefs.setBoolPref("social.active", !!val);
this.enabled = !!val;
},
toggle: function Social_toggle() {
this.enabled = !this.enabled;
},
toggleSidebar: function SocialSidebar_toggle() {
let prefValue = Services.prefs.getBoolPref("social.sidebar.open");
Services.prefs.setBoolPref("social.sidebar.open", !prefValue);

View File

@ -6,4 +6,4 @@ setup.py:testing/mozbase/mozlog:develop
setup.py:testing/mozbase/mozprocess:develop
setup.py:testing/mozbase/mozprofile:develop
setup.py:testing/mozbase/mozrunner:develop
setup.py:build/pylib/blessings:develop
setup.py:python/blessings:develop

View File

@ -291,11 +291,9 @@ endif
ifndef MOZ_AUTO_DEPS
ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS))
MDDEPFILES = $(addprefix $(MDDEPDIR)/,$(OBJS:=.pp))
ifndef NO_GEN_XPT
MDDEPFILES += $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.h.pp) $(XPIDLSRCS:.idl=.xpt.pp))
endif
endif
endif
ALL_TRASH = \
$(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
@ -1298,7 +1296,6 @@ $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(xpidl-preqs)
@if test -n "$(findstring $*.h, $(EXPORTS))"; \
then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
ifndef NO_GEN_XPT
# generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link
# into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
$(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_DEPS) $(xpidl-preqs)
@ -1323,8 +1320,6 @@ ifndef NO_INTERFACES_MANIFEST
endif
endif
endif # NO_GEN_XPT
GARBAGE_DIRS += $(XPIDL_GEN_DIR)
endif #} XPIDLSRCS

View File

@ -363,6 +363,10 @@ else
fi
fi
if test -n "$MOZ_WINCONSOLE"; then
AC_DEFINE(MOZ_WINCONSOLE)
fi
MOZ_TOOL_VARIABLES
dnl ========================================================
@ -4206,6 +4210,7 @@ MOZ_ANDROID_HISTORY=
MOZ_WEBSMS_BACKEND=
MOZ_GRAPHITE=1
ACCESSIBILITY=1
MOZ_SYS_MSG=
case "$target_os" in
mingw*)
@ -7313,7 +7318,7 @@ MOZ_ARG_ENABLE_BOOL(b2g-ril,
MOZ_B2G_RIL=1,
MOZ_B2G_RIL= )
if test -n "$MOZ_B2G_RIL"; then
AC_DEFINE(MOZ_B2G_RIL)
AC_DEFINE(MOZ_B2G_RIL)
fi
AC_SUBST(MOZ_B2G_RIL)
@ -7325,14 +7330,16 @@ MOZ_ARG_ENABLE_BOOL(b2g-bt,
MOZ_B2G_BT=1,
MOZ_B2G_BT= )
if test -n "$MOZ_B2G_BT"; then
AC_DEFINE(MOZ_B2G_BT)
AC_DEFINE(MOZ_B2G_BT)
fi
AC_SUBST(MOZ_B2G_BT)
dnl ========================================================
dnl = Enable Support for System Messages API
dnl ========================================================
if test -n "$MOZ_SYS_MSG"; then
AC_DEFINE(MOZ_SYS_MSG)
fi
AC_SUBST(MOZ_SYS_MSG)
dnl ========================================================

View File

@ -178,8 +178,6 @@ MOCHITEST_FILES_A = \
file_bug426646-1.html \
file_bug426646-2.html \
test_bug429157.html \
test_header.html \
header.sjs \
test_XHR.html \
file_XHR_pass1.xml \
file_XHR_pass2.txt \

View File

@ -1,8 +0,0 @@
function handleRequest(request, response) {
response.setHeader("Content-Type", "text/plain", false);
response.setHeader("Cache-Control", "no-cache", false);
var value = request.hasHeader("SomeHeader") ? request.getHeader("SomeHeader")
: "";
response.write("SomeHeader: " + value);
}

View File

@ -1,31 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for XHR header preservation</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 421622 **/
const SJS_URL = "http://mochi.test:8888/tests/content/base/test/header.sjs";
const VALUE = "http://www.mozilla.org/";
var req = new XMLHttpRequest();
req.open("GET", SJS_URL, false);
req.setRequestHeader("SomeHeader", VALUE);
req.send(null);
is(req.responseText,
"SomeHeader: " + VALUE,
"Header received by server does not match what was set");
</script>
</pre>
</body>
</html>

View File

@ -4901,6 +4901,13 @@ nsDocShell::SetParentNativeWindow(nativeWindow parentNativeWindow)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDocShell::GetNativeHandle(nsAString& aNativeHandle)
{
// the nativeHandle should be accessed from nsIXULWindow
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDocShell::GetVisibility(bool * aVisibility)
{

View File

@ -228,8 +228,8 @@ let AlarmService = {
if (this._currentAlarm) {
debug("Fire system intent: " + JSON.stringify(this._currentAlarm));
if (this._currentAlarm.manifestURL)
messenger.sendMessage("alarm", this._currentAlarm, this._currentAlarm.manifestURL);
let manifestURI = Services.io.newURI(this._currentAlarm.manifestURL, null, null);
messenger.sendMessage("alarm", this._currentAlarm, manifestURI);
this._currentAlarm = null;
}
@ -244,8 +244,8 @@ let AlarmService = {
// fire system intent for it instead of setting it
if (nextAlarmTime <= nowTime) {
debug("Fire system intent: " + JSON.stringify(nextAlarm));
if (nextAlarm.manifestURL)
messenger.sendMessage("alarm", nextAlarm, nextAlarm.manifestURL);
let manifestURI = Services.io.newURI(nextAlarm.manifestURL, null, null);
messenger.sendMessage("alarm", nextAlarm, manifestURI);
} else {
this._currentAlarm = nextAlarm;
break;

View File

@ -45,6 +45,11 @@ AlarmsManager.prototype = {
add: function add(aDate, aRespectTimezone, aData) {
debug("add()");
if (!this._manifestURL) {
debug("Cannot add alarms for non-installed apps.");
throw Components.results.NS_ERROR_FAILURE;
}
let isIgnoreTimezone = true;
switch (aRespectTimezone) {
case "honorTimezone":
@ -150,8 +155,7 @@ AlarmsManager.prototype = {
// Get the manifest URL if this is an installed app
this._manifestURL = null;
let utils = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
let utils = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
let app = utils.getApp();
if (app)
this._manifestURL = app.manifestURL;

View File

@ -1298,7 +1298,7 @@ Navigator::GetMozBluetooth(nsIDOMBluetoothManager** aBluetooth)
// nsNavigator::nsIDOMNavigatorSystemMessages
//*****************************************************************************
#ifdef MOZ_SYS_MSG
NS_IMETHODIMP
nsresult
Navigator::EnsureMessagesManager()
{
if (mMessagesManager) {

View File

@ -5973,6 +5973,9 @@ DefineIDBInterfaceConstants(JSContext *cx, JSObject *obj, const nsIID *aIID)
else if (aIID->Equals(NS_GET_IID(nsIIDBTransaction))) {
interface = IDBConstant::IDBTransaction;
}
else {
MOZ_NOT_REACHED("unexpected IID");
}
for (int8_t i = 0; i < (int8_t)mozilla::ArrayLength(sIDBConstants); ++i) {
const IDBConstant& c = sIDBConstants[i];

View File

@ -9400,9 +9400,7 @@ nsGlobalWindow::SetTimeoutOrInterval(nsIScriptTimeoutHandler *aHandler,
nsRefPtr<nsTimeout> copy = timeout;
rv = timeout->mTimer->InitWithFuncCallback(TimerCallback, timeout,
realInterval,
nsITimer::TYPE_ONE_SHOT);
rv = timeout->InitTimer(TimerCallback, realInterval);
if (NS_FAILED(rv)) {
return rv;
}
@ -9637,10 +9635,7 @@ nsGlobalWindow::RescheduleTimeout(nsTimeout* aTimeout, const TimeStamp& now,
// platforms whether delay is positive or negative (which we
// know is always positive here, but cast anyways for
// consistency).
nsresult rv = aTimeout->mTimer->
InitWithFuncCallback(TimerCallback, aTimeout,
delay.ToMilliseconds(),
nsITimer::TYPE_ONE_SHOT);
nsresult rv = aTimeout->InitTimer(TimerCallback, delay.ToMilliseconds());
if (NS_FAILED(rv)) {
NS_ERROR("Error initializing timer for DOM timeout!");
@ -9982,11 +9977,7 @@ nsresult nsGlobalWindow::ResetTimersForNonBackgroundWindow()
timeout->mFiringDepth = firingDepth;
timeout->Release();
nsresult rv =
timeout->mTimer->InitWithFuncCallback(TimerCallback,
timeout,
delay.ToMilliseconds(),
nsITimer::TYPE_ONE_SHOT);
nsresult rv = timeout->InitTimer(TimerCallback, delay.ToMilliseconds());
if (NS_FAILED(rv)) {
NS_WARNING("Error resetting non background timer for DOM timeout!");
@ -10499,8 +10490,7 @@ nsGlobalWindow::ResumeTimeouts(bool aThawChildren)
t->mTimer = do_CreateInstance("@mozilla.org/timer;1");
NS_ENSURE_TRUE(t->mTimer, NS_ERROR_OUT_OF_MEMORY);
rv = t->mTimer->InitWithFuncCallback(TimerCallback, t, delay,
nsITimer::TYPE_ONE_SHOT);
rv = t->InitTimer(TimerCallback, delay);
if (NS_FAILED(rv)) {
t->mTimer = nsnull;
return rv;

View File

@ -153,6 +153,11 @@ struct nsTimeout : PRCList
return static_cast<nsTimeout*>(PR_PREV_LINK(this));
}
nsresult InitTimer(nsTimerCallbackFunc aFunc, PRUint64 delay) {
return mTimer->InitWithFuncCallback(aFunc, this, delay,
nsITimer::TYPE_ONE_SHOT);
}
// Window for which this timeout fires
nsRefPtr<nsGlobalWindow> mWindow;

View File

@ -80,8 +80,9 @@ template<>
struct PrimitiveConversionTraits<bool> {
typedef JSBool jstype;
typedef bool intermediateType;
static inline bool converter(JSContext* cx, JS::Value v, jstype* retval) {
return JS_ValueToBoolean(cx, v, retval);
static inline bool converter(JSContext* /* unused */, JS::Value v, jstype* retval) {
*retval = JS::ToBoolean(v);
return true;
}
};

View File

@ -403,8 +403,10 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData)
DBusMessageIter iter;
NS_ASSERTION(dbus_message_iter_init(aMsg, &iter),
"Can't create message iterator!");
if (!dbus_message_iter_init(aMsg, &iter)) {
NS_WARNING("Can't create iterator!");
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
InfallibleTArray<BluetoothNamedValue> value;
const char* addr;

View File

@ -13,7 +13,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=717103
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<body onunload="unload()">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=717103">Mozilla Bug 717103</a>
<p id="display"></p>
<div id="content" style="display: none">
@ -22,11 +22,21 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=717103
<pre id="test">
<script class="testbody" type="text/javascript">
function unload() {
delete gDataBlob;
gDataBlob = null;
delete gFileReader;
gFileReader = null;
}
devicestorage_setup();
var gFileName = "devicestorage/hi";
var gData = "My name is Doug Turner. My IRC nick is DougT. I like Maple cookies."
var gDataBlob = new Blob([gData], {type: 'text/plain'});
var gFileReader = new FileReader();
function getAfterDeleteSuccess(e) {
ok(false, "file was deleted not successfully");
@ -63,9 +73,8 @@ function getSuccess(e) {
var name = e.target.result.name;
var reader = new FileReader();
reader.readAsArrayBuffer(gDataBlob);
reader.onload = function(e) {
gFileReader.readAsArrayBuffer(gDataBlob);
gFileReader.onload = function(e) {
readerCallback(e);
request = storage[0].delete(name)

View File

@ -17,7 +17,7 @@ namespace dom {
void
CrashReporterParent::ActorDestroy(ActorDestroyReason why)
{
#if defined(__ANDROID__) && defined(MOZ_CRASHREPORTER)
#if defined(MOZ_WIDGET_ANDROID) && defined(MOZ_CRASHREPORTER)
CrashReporter::RemoveLibraryMappingsForChild(ProcessId(OtherProcess()));
#endif
}
@ -25,7 +25,7 @@ CrashReporterParent::ActorDestroy(ActorDestroyReason why)
bool
CrashReporterParent::RecvAddLibraryMappings(const InfallibleTArray<Mapping>& mappings)
{
#if defined(__ANDROID__) && defined(MOZ_CRASHREPORTER)
#if defined(MOZ_WIDGET_ANDROID) && defined(MOZ_CRASHREPORTER)
for (PRUint32 i = 0; i < mappings.Length(); i++) {
const Mapping& m = mappings[i];
CrashReporter::AddLibraryMappingForChild(ProcessId(OtherProcess()),

View File

@ -1947,6 +1947,68 @@ nsPluginHost::IsLiveTag(nsIPluginTag* aPluginTag)
return false;
}
nsPluginTag*
nsPluginHost::HaveSamePlugin(const nsPluginTag* aPluginTag)
{
for (nsPluginTag* tag = mPlugins; tag; tag = tag->mNext) {
if (tag->HasSameNameAndMimes(aPluginTag)) {
return tag;
}
}
return nsnull;
}
nsPluginTag*
nsPluginHost::FirstPluginWithPath(const nsCString& path)
{
for (nsPluginTag* tag = mPlugins; tag; tag = tag->mNext) {
if (tag->mFullPath.Equals(path)) {
return tag;
}
}
return nsnull;
}
namespace {
PRInt64 GetPluginLastModifiedTime(const nsCOMPtr<nsIFile>& localfile)
{
PRInt64 fileModTime = LL_ZERO;
#if defined(XP_MACOSX)
// On OS X the date of a bundle's "contents" (i.e. of its Info.plist file)
// is a much better guide to when it was last modified than the date of
// its package directory. See bug 313700.
nsCOMPtr<nsILocalFileMac> localFileMac = do_QueryInterface(localfile);
if (localFileMac) {
localFileMac->GetBundleContentsLastModifiedTime(&fileModTime);
} else {
localfile->GetLastModifiedTime(&fileModTime);
}
#else
localfile->GetLastModifiedTime(&fileModTime);
#endif
return fileModTime;
}
struct CompareFilesByTime
{
bool
LessThan(const nsCOMPtr<nsIFile>& a, const nsCOMPtr<nsIFile>& b) const
{
return LL_CMP(GetPluginLastModifiedTime(a), <, GetPluginLastModifiedTime(b));
}
bool
Equals(const nsCOMPtr<nsIFile>& a, const nsCOMPtr<nsIFile>& b) const
{
return LL_EQ(GetPluginLastModifiedTime(a), GetPluginLastModifiedTime(b));
}
};
} // anonymous namespace
typedef NS_NPAPIPLUGIN_CALLBACK(char *, NP_GETMIMEDESCRIPTION)(void);
nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
@ -1991,9 +2053,11 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
}
}
pluginFiles.Sort(CompareFilesByTime());
bool warnOutdated = false;
for (PRUint32 i = 0; i < pluginFiles.Length(); i++) {
for (PRInt32 i = (pluginFiles.Length() - 1); i >= 0; i--) {
nsCOMPtr<nsIFile>& localfile = pluginFiles[i];
nsString utf16FilePath;
@ -2001,21 +2065,8 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
if (NS_FAILED(rv))
continue;
PRInt64 fileModTime = LL_ZERO;
#if defined(XP_MACOSX)
// On OS X the date of a bundle's "contents" (i.e. of its Info.plist file)
// is a much better guide to when it was last modified than the date of
// its package directory. See bug 313700.
nsCOMPtr<nsILocalFileMac> localFileMac = do_QueryInterface(localfile);
if (localFileMac) {
localFileMac->GetBundleContentsLastModifiedTime(&fileModTime);
} else {
localfile->GetLastModifiedTime(&fileModTime);
}
#else
localfile->GetLastModifiedTime(&fileModTime);
#endif
PRInt64 fileModTime = GetPluginLastModifiedTime(localfile);
// Look for it in our cache
NS_ConvertUTF16toUTF8 filePath(utf16FilePath);
nsRefPtr<nsPluginTag> pluginTag;
@ -2146,6 +2197,21 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
// We have a valid new plugin so report that plugins have changed.
*aPluginsChanged = true;
}
// Avoid adding different versions of the same plugin if they are running
// in-process, otherwise we risk undefined behaviour.
if (!nsNPAPIPlugin::RunPluginOOP(pluginTag)) {
if (nsPluginTag *duplicate = HaveSamePlugin(pluginTag)) {
continue;
}
}
// Don't add the same plugin again if it hasn't changed
if (nsPluginTag* duplicate = FirstPluginWithPath(pluginTag->mFullPath)) {
if (LL_EQ(pluginTag->mLastModifiedTime, duplicate->mLastModifiedTime)) {
continue;
}
}
// If we're not creating a plugin list, simply looking for changes,
// then we're done.

View File

@ -267,6 +267,12 @@ private:
// Checks to see if a tag object is in our list of live tags.
bool IsLiveTag(nsIPluginTag* tag);
// Checks our list of live tags for an equivalent tag.
nsPluginTag* HaveSamePlugin(const nsPluginTag * aPluginTag);
// Returns the first plugin at |path|
nsPluginTag* FirstPluginWithPath(const nsCString& path);
nsresult EnsurePrivateDirServiceProvider();

View File

@ -379,6 +379,25 @@ bool nsPluginTag::IsEnabled()
return HasFlag(NS_PLUGIN_FLAG_ENABLED) && !HasFlag(NS_PLUGIN_FLAG_BLOCKLISTED);
}
bool
nsPluginTag::HasSameNameAndMimes(const nsPluginTag *aPluginTag) const
{
NS_ENSURE_TRUE(aPluginTag, false);
if ((!mName.Equals(aPluginTag->mName)) ||
(mMimeTypes.Length() != aPluginTag->mMimeTypes.Length())) {
return false;
}
for (PRUint32 i = 0; i < mMimeTypes.Length(); i++) {
if (!mMimeTypes[i].Equals(aPluginTag->mMimeTypes[i])) {
return false;
}
}
return true;
}
void nsPluginTag::TryUnloadPlugin(bool inShutdown)
{
// We never want to send NPP_Shutdown to an in-process plugin unless

View File

@ -58,6 +58,7 @@ public:
void UnMark(PRUint32 mask);
bool HasFlag(PRUint32 flag);
PRUint32 Flags();
bool HasSameNameAndMimes(const nsPluginTag *aPluginTag) const;
bool IsEnabled();
nsRefPtr<nsPluginTag> mNext;

View File

@ -140,17 +140,17 @@ function RILContentHelper() {
this.initMessageListener(RIL_IPC_MSG_NAMES);
Services.obs.addObserver(this, "xpcom-shutdown", false);
// Request initial state.
let radioState = cpmm.QueryInterface(Ci.nsISyncMessageSender)
.sendSyncMessage("RIL:GetRadioState")[0];
// Request initial context.
let rilContext = cpmm.QueryInterface(Ci.nsISyncMessageSender)
.sendSyncMessage("RIL:GetRilContext")[0];
if (!radioState) {
debug("Received null radioState from chrome process.");
if (!rilContext) {
debug("Received null rilContext from chrome process.");
return;
}
this.cardState = radioState.cardState;
this.updateConnectionInfo(radioState.voice, this.voiceConnectionInfo);
this.updateConnectionInfo(radioState.data, this.dataConnectionInfo);
this.cardState = rilContext.cardState;
this.updateConnectionInfo(rilContext.voice, this.voiceConnectionInfo);
this.updateConnectionInfo(rilContext.data, this.dataConnectionInfo);
}
RILContentHelper.prototype = {

View File

@ -60,6 +60,7 @@ let RILQUIRKS_DATACALLSTATE_DOWN_IS_UP = false;
let RILQUIRKS_V5_LEGACY = true;
let RILQUIRKS_REQUEST_USE_DIAL_EMERGENCY_CALL = false;
let RILQUIRKS_MODEM_DEFAULTS_TO_EMERGENCY_MODE = false;
let RILQUIRKS_SIM_APP_STATE_EXTRA_FIELDS = false;
/**
* This object contains helpers buffering incoming data & deconstructing it
@ -727,6 +728,10 @@ let RIL = {
case "Qualcomm RIL 1.0":
let product_model = libcutils.property_get("ro.product.model");
if (DEBUG) debug("Detected product model " + product_model);
if (product_model == "otoro1") {
if (DEBUG) debug("Enabling RILQUIRKS_SIM_APP_STATE_EXTRA_FIELDS.");
RILQUIRKS_SIM_APP_STATE_EXTRA_FIELDS = true;
}
if (DEBUG) {
debug("Detected Qualcomm RIL 1.0, " +
"disabling RILQUIRKS_V5_LEGACY and " +
@ -2825,6 +2830,12 @@ RIL[REQUEST_GET_SIM_STATUS] = function REQUEST_GET_SIM_STATUS(length, options) {
pin1: Buf.readUint32(),
pin2: Buf.readUint32()
});
if (RILQUIRKS_SIM_APP_STATE_EXTRA_FIELDS) {
Buf.readUint32();
Buf.readUint32();
Buf.readUint32();
Buf.readUint32();
}
}
if (DEBUG) debug("iccStatus: " + JSON.stringify(iccStatus));

View File

@ -7,7 +7,9 @@
#include "nsEditor.h"
#include "IMETextTxn.h"
#include "nsGkAtoms.h"
#include "nsISelection.h"
#include "mozilla/Selection.h"
using namespace mozilla;
PlaceholderTxn::PlaceholderTxn() : EditAggregateTxn(),
mAbsorb(true),
@ -42,7 +44,9 @@ NS_INTERFACE_MAP_END_INHERITING(EditAggregateTxn)
NS_IMPL_ADDREF_INHERITED(PlaceholderTxn, EditAggregateTxn)
NS_IMPL_RELEASE_INHERITED(PlaceholderTxn, EditAggregateTxn)
NS_IMETHODIMP PlaceholderTxn::Init(nsIAtom *aName, nsSelectionState *aSelState, nsIEditor *aEditor)
NS_IMETHODIMP
PlaceholderTxn::Init(nsIAtom* aName, nsSelectionState* aSelState,
nsEditor* aEditor)
{
NS_ENSURE_TRUE(aEditor && aSelState, NS_ERROR_NULL_POINTER);
@ -256,10 +260,9 @@ NS_IMETHODIMP PlaceholderTxn::Commit()
NS_IMETHODIMP PlaceholderTxn::RememberEndingSelection()
{
nsCOMPtr<nsISelection> selection;
nsresult res = mEditor->GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(res, res);
nsRefPtr<Selection> selection = mEditor->GetSelection();
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
return mEndSel.SaveSelection(selection);
mEndSel.SaveSelection(selection);
return NS_OK;
}

View File

@ -44,7 +44,8 @@ public:
// ------------ nsIAbsorbingTransaction -----------------------
NS_IMETHOD Init(nsIAtom *aName, nsSelectionState *aSelState, nsIEditor *aEditor);
NS_IMETHOD Init(nsIAtom* aName, nsSelectionState* aSelState,
nsEditor* aEditor);
NS_IMETHOD GetTxnName(nsIAtom **aName);
@ -72,7 +73,7 @@ protected:
// selection properly.
nsAutoPtr<nsSelectionState> mStartSel; // use a pointer because this is constructed before we exist
nsSelectionState mEndSel;
nsIEditor* mEditor; /** the editor for this transaction */
nsEditor* mEditor; /** the editor for this transaction */
};

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html contenteditable="true">
<head>
<script>
function boom()
{
document.execCommand("inserthtml", false, "b");
var myrange = document.createRange();
myrange.selectNodeContents(document.getElementsByTagName("img")[0]);
window.getSelection().addRange(myrange);
document.execCommand("strikethrough", false, null);
}
</script>
</head>
<body onload="boom();"><img></body>
</html>

View File

@ -17,3 +17,4 @@ load 766845.xhtml
load 768765.html
needs-focus load 771749.html
load 772282.html
load 776323.html

View File

@ -904,9 +904,8 @@ nsEditor::BeginPlaceHolderTransaction(nsIAtom *aName)
BeginUpdateViewBatch();
mPlaceHolderTxn = nsnull;
mPlaceHolderName = aName;
nsCOMPtr<nsISelection> selection;
nsresult res = GetSelection(getter_AddRefs(selection));
if (NS_SUCCEEDED(res)) {
nsRefPtr<Selection> selection = GetSelection();
if (selection) {
mSelState = new nsSelectionState();
mSelState->SaveSelection(selection);
}
@ -1979,7 +1978,7 @@ nsEditor::ArePreservingSelection()
}
void
nsEditor::PreserveSelectionAcrossActions(nsISelection *aSel)
nsEditor::PreserveSelectionAcrossActions(Selection* aSel)
{
mSavedSel.SaveSelection(aSel);
mRangeUpdater.RegisterSelectionState(mSavedSel);

View File

@ -425,7 +425,7 @@ public:
/** routines for managing the preservation of selection across
* various editor actions */
bool ArePreservingSelection();
void PreserveSelectionAcrossActions(nsISelection *aSel);
void PreserveSelectionAcrossActions(mozilla::Selection* aSel);
nsresult RestorePreservedSelection(nsISelection *aSel);
void StopPreservingSelection();

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Selection.h"
#include "nsCOMArray.h"
#include "nsComponentManagerUtils.h"
#include "nsEditorUtils.h"
@ -18,24 +18,23 @@
#include "nsIDocument.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsINode.h"
#include "nsISelection.h"
#include "nsISimpleEnumerator.h"
class nsIDOMRange;
class nsISupports;
using namespace mozilla;
/******************************************************************************
* nsAutoSelectionReset
*****************************************************************************/
nsAutoSelectionReset::nsAutoSelectionReset(nsISelection *aSel, nsEditor *aEd) :
mSel(nsnull)
,mEd(nsnull)
nsAutoSelectionReset::nsAutoSelectionReset(Selection* aSel, nsEditor* aEd)
: mSel(nsnull), mEd(nsnull)
{
if (!aSel || !aEd) return; // not much we can do, bail.
if (aEd->ArePreservingSelection()) return; // we already have initted mSavedSel, so this must be nested call.
mSel = do_QueryInterface(aSel);
mSel = aSel;
mEd = aEd;
if (mSel)
{

View File

@ -57,12 +57,12 @@ class NS_STACK_CLASS nsAutoSelectionReset
{
private:
/** ref-counted reference to the selection that we are supposed to restore */
nsCOMPtr<nsISelection> mSel;
nsRefPtr<mozilla::Selection> mSel;
nsEditor *mEd; // non-owning ref to nsEditor
public:
/** constructor responsible for remembering all state needed to restore aSel */
nsAutoSelectionReset(nsISelection *aSel, nsEditor *aEd);
nsAutoSelectionReset(mozilla::Selection* aSel, nsEditor* aEd);
/** destructor restores mSel to its former state */
~nsAutoSelectionReset();

View File

@ -32,7 +32,8 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IABSORBINGTRANSACTION_IID)
NS_IMETHOD Init(nsIAtom *aName, nsSelectionState *aSelState, nsIEditor *aEditor)=0;
NS_IMETHOD Init(nsIAtom* aName, nsSelectionState* aSelState,
nsEditor* aEditor) = 0;
NS_IMETHOD EndPlaceHolderBatch()=0;

View File

@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/Selection.h" // for Selection
#include "nsAString.h" // for nsAString_internal::Length
#include "nsAutoPtr.h" // for nsRefPtr, getter_AddRefs, etc
#include "nsCycleCollectionParticipant.h"
@ -19,6 +20,7 @@
#include "nsRange.h" // for nsRange
#include "nsSelectionState.h"
using namespace mozilla;
/***************************************************************************
* class for recording selection info. stores selection as collection of
@ -47,43 +49,30 @@ nsSelectionState::DoTraverse(nsCycleCollectionTraversalCallback &cb)
}
}
nsresult
nsSelectionState::SaveSelection(nsISelection *aSel)
void
nsSelectionState::SaveSelection(Selection* aSel)
{
NS_ENSURE_TRUE(aSel, NS_ERROR_NULL_POINTER);
PRInt32 i,rangeCount, arrayCount = mArray.Length();
aSel->GetRangeCount(&rangeCount);
MOZ_ASSERT(aSel);
PRInt32 arrayCount = mArray.Length();
PRInt32 rangeCount = aSel->GetRangeCount();
// if we need more items in the array, new them
if (arrayCount<rangeCount)
{
PRInt32 count = rangeCount-arrayCount;
for (i=0; i<count; i++)
{
if (arrayCount < rangeCount) {
for (PRInt32 i = arrayCount; i < rangeCount; i++) {
mArray.AppendElement();
mArray[i] = new nsRangeStore();
}
}
// else if we have too many, delete them
else if (arrayCount>rangeCount)
{
for (i = arrayCount-1; i >= rangeCount; i--)
{
} else if (arrayCount > rangeCount) {
// else if we have too many, delete them
for (PRInt32 i = arrayCount - 1; i >= rangeCount; i--) {
mArray.RemoveElementAt(i);
}
}
// now store the selection ranges
nsresult res = NS_OK;
for (i=0; i<rangeCount; i++)
{
nsCOMPtr<nsIDOMRange> range;
res = aSel->GetRangeAt(i, getter_AddRefs(range));
mArray[i]->StoreRange(range);
for (PRInt32 i = 0; i < rangeCount; i++) {
mArray[i]->StoreRange(aSel->GetRangeAt(i));
}
return res;
}
nsresult

View File

@ -18,6 +18,9 @@ class nsIDOMCharacterData;
class nsIDOMRange;
class nsISelection;
class nsRange;
namespace mozilla {
class Selection;
}
/***************************************************************************
* class for recording selection info. stores selection as collection of
@ -52,7 +55,7 @@ class nsSelectionState
void DoTraverse(nsCycleCollectionTraversalCallback &cb);
void DoUnlink() { MakeEmpty(); }
nsresult SaveSelection(nsISelection *aSel);
void SaveSelection(mozilla::Selection *aSel);
nsresult RestoreSelection(nsISelection *aSel);
bool IsCollapsed();
bool IsEqual(nsSelectionState *aSelState);

View File

@ -2869,7 +2869,7 @@ nsHTMLEditRules::DidDeleteSelection(nsISelection *aSelection,
}
nsresult
nsHTMLEditRules::WillMakeList(nsISelection* aSelection,
nsHTMLEditRules::WillMakeList(Selection* aSelection,
const nsAString* aListType,
bool aEntireList,
const nsAString* aBulletType,
@ -3159,7 +3159,7 @@ nsHTMLEditRules::WillMakeList(nsISelection* aSelection,
nsresult
nsHTMLEditRules::WillRemoveList(nsISelection *aSelection,
nsHTMLEditRules::WillRemoveList(Selection* aSelection,
bool aOrdered,
bool *aCancel,
bool *aHandled)
@ -3226,7 +3226,7 @@ nsHTMLEditRules::WillRemoveList(nsISelection *aSelection,
nsresult
nsHTMLEditRules::WillMakeDefListItem(nsISelection *aSelection,
nsHTMLEditRules::WillMakeDefListItem(Selection* aSelection,
const nsAString *aItemType,
bool aEntireList,
bool *aCancel,
@ -3238,7 +3238,7 @@ nsHTMLEditRules::WillMakeDefListItem(nsISelection *aSelection,
}
nsresult
nsHTMLEditRules::WillMakeBasicBlock(nsISelection *aSelection,
nsHTMLEditRules::WillMakeBasicBlock(Selection* aSelection,
const nsAString *aBlockType,
bool *aCancel,
bool *aHandled)
@ -3395,7 +3395,8 @@ nsHTMLEditRules::DidMakeBasicBlock(nsISelection *aSelection,
}
nsresult
nsHTMLEditRules::WillIndent(nsISelection *aSelection, bool *aCancel, bool * aHandled)
nsHTMLEditRules::WillIndent(Selection* aSelection,
bool* aCancel, bool* aHandled)
{
nsresult res;
if (mHTMLEditor->IsCSSEnabled()) {
@ -3408,7 +3409,8 @@ nsHTMLEditRules::WillIndent(nsISelection *aSelection, bool *aCancel, bool * aHan
}
nsresult
nsHTMLEditRules::WillCSSIndent(nsISelection *aSelection, bool *aCancel, bool * aHandled)
nsHTMLEditRules::WillCSSIndent(Selection* aSelection,
bool* aCancel, bool* aHandled)
{
if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
@ -3614,7 +3616,8 @@ nsHTMLEditRules::WillCSSIndent(nsISelection *aSelection, bool *aCancel, bool * a
}
nsresult
nsHTMLEditRules::WillHTMLIndent(nsISelection *aSelection, bool *aCancel, bool * aHandled)
nsHTMLEditRules::WillHTMLIndent(Selection* aSelection,
bool* aCancel, bool* aHandled)
{
if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
nsresult res = WillInsert(aSelection, aCancel);
@ -3842,7 +3845,8 @@ nsHTMLEditRules::WillHTMLIndent(nsISelection *aSelection, bool *aCancel, bool *
nsresult
nsHTMLEditRules::WillOutdent(nsISelection *aSelection, bool *aCancel, bool *aHandled)
nsHTMLEditRules::WillOutdent(Selection* aSelection,
bool* aCancel, bool* aHandled)
{
if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
// initialize out param
@ -4412,7 +4416,7 @@ nsHTMLEditRules::IsEmptyBlock(nsIDOMNode *aNode,
nsresult
nsHTMLEditRules::WillAlign(nsISelection *aSelection,
nsHTMLEditRules::WillAlign(Selection* aSelection,
const nsAString *alignType,
bool *aCancel,
bool *aHandled)
@ -8570,7 +8574,8 @@ nsHTMLEditRules::RelativeChangeIndentationOfElementNode(nsIDOMNode *aNode, PRInt
//
nsresult
nsHTMLEditRules::WillAbsolutePosition(nsISelection *aSelection, bool *aCancel, bool * aHandled)
nsHTMLEditRules::WillAbsolutePosition(Selection* aSelection,
bool* aCancel, bool* aHandled)
{
if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
nsresult res = WillInsert(aSelection, aCancel);
@ -8786,8 +8791,8 @@ nsHTMLEditRules::DidAbsolutePosition()
}
nsresult
nsHTMLEditRules::WillRemoveAbsolutePosition(nsISelection *aSelection, bool *aCancel, bool * aHandled)
{
nsHTMLEditRules::WillRemoveAbsolutePosition(Selection* aSelection,
bool* aCancel, bool* aHandled) {
if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
nsresult res = WillInsert(aSelection, aCancel);
NS_ENSURE_SUCCESS(res, res);
@ -8808,7 +8813,7 @@ nsHTMLEditRules::WillRemoveAbsolutePosition(nsISelection *aSelection, bool *aCan
}
nsresult
nsHTMLEditRules::WillRelativeChangeZIndex(nsISelection *aSelection,
nsHTMLEditRules::WillRelativeChangeZIndex(Selection* aSelection,
PRInt32 aChange,
bool *aCancel,
bool * aHandled)

View File

@ -156,18 +156,38 @@ protected:
nsresult MoveNodeSmart(nsIDOMNode *aSource, nsIDOMNode *aDest, PRInt32 *aOffset);
nsresult MoveContents(nsIDOMNode *aSource, nsIDOMNode *aDest, PRInt32 *aOffset);
nsresult DeleteNonTableElements(nsINode* aNode);
nsresult WillMakeList(nsISelection *aSelection, const nsAString *aListType, bool aEntireList, const nsAString *aBulletType, bool *aCancel, bool *aHandled, const nsAString *aItemType=nsnull);
nsresult WillRemoveList(nsISelection *aSelection, bool aOrderd, bool *aCancel, bool *aHandled);
nsresult WillIndent(nsISelection *aSelection, bool *aCancel, bool *aHandled);
nsresult WillCSSIndent(nsISelection *aSelection, bool *aCancel, bool *aHandled);
nsresult WillHTMLIndent(nsISelection *aSelection, bool *aCancel, bool *aHandled);
nsresult WillOutdent(nsISelection *aSelection, bool *aCancel, bool *aHandled);
nsresult WillAlign(nsISelection *aSelection, const nsAString *alignType, bool *aCancel, bool *aHandled);
nsresult WillAbsolutePosition(nsISelection *aSelection, bool *aCancel, bool * aHandled);
nsresult WillRemoveAbsolutePosition(nsISelection *aSelection, bool *aCancel, bool * aHandled);
nsresult WillRelativeChangeZIndex(nsISelection *aSelection, PRInt32 aChange, bool *aCancel, bool * aHandled);
nsresult WillMakeDefListItem(nsISelection *aSelection, const nsAString *aBlockType, bool aEntireList, bool *aCancel, bool *aHandled);
nsresult WillMakeBasicBlock(nsISelection *aSelection, const nsAString *aBlockType, bool *aCancel, bool *aHandled);
nsresult WillMakeList(mozilla::Selection* aSelection,
const nsAString* aListType,
bool aEntireList,
const nsAString* aBulletType,
bool* aCancel, bool* aHandled,
const nsAString* aItemType = nsnull);
nsresult WillRemoveList(mozilla::Selection* aSelection,
bool aOrdered, bool* aCancel, bool* aHandled);
nsresult WillIndent(mozilla::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillCSSIndent(mozilla::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillHTMLIndent(mozilla::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillOutdent(mozilla::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillAlign(mozilla::Selection* aSelection,
const nsAString* alignType,
bool* aCancel, bool* aHandled);
nsresult WillAbsolutePosition(mozilla::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillRemoveAbsolutePosition(mozilla::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillRelativeChangeZIndex(mozilla::Selection* aSelection,
PRInt32 aChange,
bool* aCancel, bool* aHandled);
nsresult WillMakeDefListItem(mozilla::Selection* aSelection,
const nsAString* aBlockType, bool aEntireList,
bool* aCancel, bool* aHandled);
nsresult WillMakeBasicBlock(mozilla::Selection* aSelection,
const nsAString* aBlockType,
bool* aCancel, bool* aHandled);
nsresult DidMakeBasicBlock(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult);
nsresult DidAbsolutePosition();
nsresult AlignInnerBlocks(nsIDOMNode *aNode, const nsAString *alignType);

View File

@ -3379,15 +3379,13 @@ SetSelectionAroundHeadChildren(nsISelection* aSelection,
NS_IMETHODIMP
nsHTMLEditor::GetHeadContentsAsHTML(nsAString& aOutputString)
{
nsCOMPtr<nsISelection> selection;
nsresult res = GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(res, res);
nsRefPtr<Selection> selection = GetSelection();
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
// Save current selection
nsAutoSelectionReset selectionResetter(selection, this);
res = SetSelectionAroundHeadChildren(selection, mDocWeak);
nsresult res = SetSelectionAroundHeadChildren(selection, mDocWeak);
NS_ENSURE_SUCCESS(res, res);
res = OutputToString(NS_LITERAL_STRING("text/html"),

View File

@ -1535,11 +1535,8 @@ nsHTMLEditor::RelativeFontChange( PRInt32 aSizeChange)
ForceCompositionEnd();
// Get the selection
nsCOMPtr<nsISelection>selection;
nsresult res = GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(res, res);
nsRefPtr<Selection> selection = GetSelection();
NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
nsCOMPtr<nsISelectionPrivate> selPriv(do_QueryInterface(selection));
// Is the selection collapsed?
// if it's collapsed set typing state
if (selection->Collapsed()) {
@ -1554,7 +1551,7 @@ nsHTMLEditor::RelativeFontChange( PRInt32 aSizeChange)
NS_ENSURE_TRUE(selectedNode, NS_OK);
if (IsTextNode(selectedNode)) {
nsCOMPtr<nsIDOMNode> parent;
res = selectedNode->GetParentNode(getter_AddRefs(parent));
nsresult res = selectedNode->GetParentNode(getter_AddRefs(parent));
NS_ENSURE_SUCCESS(res, res);
selectedNode = parent;
}
@ -1575,7 +1572,7 @@ nsHTMLEditor::RelativeFontChange( PRInt32 aSizeChange)
// get selection range enumerator
nsCOMPtr<nsIEnumerator> enumerator;
res = selPriv->GetEnumerator(getter_AddRefs(enumerator));
nsresult res = selection->GetEnumerator(getter_AddRefs(enumerator));
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(enumerator, NS_ERROR_FAILURE);

View File

@ -6,6 +6,7 @@
#include <stdio.h>
#include "mozilla/Assertions.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Element.h"
#include "nsAString.h"
#include "nsAlgorithm.h"
@ -28,8 +29,6 @@
#include "nsIHTMLEditor.h"
#include "nsINode.h"
#include "nsIPresShell.h"
#include "nsISelection.h"
#include "nsISelectionPrivate.h" // For nsISelectionPrivate::TABLESELECTION_ defines
#include "nsISupportsUtils.h"
#include "nsITableCellLayout.h" // For efficient access to table cell
#include "nsITableEditor.h"
@ -1953,9 +1952,7 @@ nsHTMLEditor::SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElemen
// Save current selection to restore when done
// This is needed so ReplaceContainer can monitor selection
// when replacing nodes
nsCOMPtr<nsISelection>selection;
nsresult res = GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(res, res);
nsRefPtr<Selection> selection = GetSelection();
NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
nsAutoSelectionReset selectionResetter(selection, this);
@ -1965,7 +1962,8 @@ nsHTMLEditor::SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElemen
// This creates new node, moves children, copies attributes (true)
// and manages the selection!
res = ReplaceContainer(aSourceCell, address_of(newNode), newCellType, nsnull, nsnull, true);
nsresult res = ReplaceContainer(aSourceCell, address_of(newNode),
newCellType, nsnull, nsnull, true);
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(newNode, NS_ERROR_FAILURE);
@ -2491,13 +2489,12 @@ nsHTMLEditor::FixBadColSpan(nsIDOMElement *aTable, PRInt32 aColIndex, PRInt32& a
NS_IMETHODIMP
nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable)
{
nsCOMPtr<nsISelection>selection;
nsresult res = GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(res, res);
nsRefPtr<Selection> selection = GetSelection();
NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMElement> table;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("table"), aTable, getter_AddRefs(table));
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("table"),
aTable, getter_AddRefs(table));
NS_ENSURE_SUCCESS(res, res);
// Don't fail if we didn't find a table
NS_ENSURE_TRUE(table, NS_OK);

View File

@ -583,6 +583,13 @@ nsDocShellTreeOwner::SetParentNativeWindow(nativeWindow aParentNativeWindow)
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP
nsDocShellTreeOwner::GetNativeHandle(nsAString& aNativeHandle)
{
// the nativeHandle should be accessed from nsIXULWindow
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDocShellTreeOwner::GetVisibility(bool* aVisibility)
{

View File

@ -1378,6 +1378,12 @@ NS_IMETHODIMP nsWebBrowser::SetParentNativeWindow(nativeWindow aParentNativeWind
return NS_OK;
}
NS_IMETHODIMP nsWebBrowser::GetNativeHandle(nsAString& aNativeHandle)
{
// the nativeHandle should be accessed from nsIXULWindow
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsWebBrowser::GetVisibility(bool* visibility)
{
NS_ENSURE_ARG_POINTER(visibility);

View File

@ -303,11 +303,13 @@ nsresult
nsPermissionManager::InitDB(bool aRemoveFile)
{
nsCOMPtr<nsIFile> permissionsFile;
NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(permissionsFile));
if (!permissionsFile)
return NS_ERROR_UNEXPECTED;
nsresult rv = NS_GetSpecialDirectory(NS_APP_PERMISSION_PARENT_DIR, getter_AddRefs(permissionsFile));
if (NS_FAILED(rv)) {
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(permissionsFile));
}
NS_ENSURE_SUCCESS(rv, NS_ERROR_UNEXPECTED);
nsresult rv = permissionsFile->AppendNative(NS_LITERAL_CSTRING(kPermissionsFileName));
rv = permissionsFile->AppendNative(NS_LITERAL_CSTRING(kPermissionsFileName));
NS_ENSURE_SUCCESS(rv, rv);
if (aRemoveFile) {

View File

@ -22,6 +22,7 @@
#include "BasicThebesLayer.h"
#include "BasicContainerLayer.h"
#include "mozilla/Preferences.h"
#include "nsIWidget.h"
using namespace mozilla::gfx;
@ -132,7 +133,8 @@ BasicLayerManager::~BasicLayerManager()
void
BasicLayerManager::SetDefaultTarget(gfxContext* aContext,
BufferMode aDoubleBuffering)
BufferMode aDoubleBuffering,
ScreenRotation aRotation)
{
NS_ASSERTION(!InTransaction(),
"Must set default target outside transaction");
@ -922,7 +924,7 @@ BasicLayerManager::CreateReadbackLayer()
}
BasicShadowLayerManager::BasicShadowLayerManager(nsIWidget* aWidget) :
BasicLayerManager(aWidget)
BasicLayerManager(aWidget), mTargetRotation(ROTATION_0)
{
MOZ_COUNT_CTOR(BasicShadowLayerManager);
}
@ -942,6 +944,18 @@ BasicShadowLayerManager::GetMaxTextureSize() const
return PR_INT32_MAX;
}
void
BasicShadowLayerManager::SetDefaultTarget(gfxContext* aContext,
BufferMode aDoubleBuffering,
ScreenRotation aRotation)
{
BasicLayerManager::SetDefaultTarget(aContext, aDoubleBuffering, aRotation);
mTargetRotation = aRotation;
if (mWidget) {
mTargetBounds = mWidget->GetNaturalBounds();
}
}
void
BasicShadowLayerManager::SetRoot(Layer* aLayer)
{
@ -981,7 +995,7 @@ BasicShadowLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
// don't signal a new transaction to ShadowLayerForwarder. Carry on adding
// to the previous transaction.
if (HasShadowManager()) {
ShadowLayerForwarder::BeginTransaction();
ShadowLayerForwarder::BeginTransaction(mTargetBounds, mTargetRotation);
// If we have a non-default target, we need to let our shadow manager draw
// to it. This will happen at the end of the transaction.

View File

@ -10,11 +10,11 @@
#include "gfxContext.h"
#include "gfxCachedTempSurface.h"
#include "mozilla/layers/ShadowLayers.h"
#include "mozilla/WidgetUtils.h"
#include "nsAutoRef.h"
#include "nsThreadUtils.h"
#include "mozilla/layers/ShadowLayers.h"
class nsIWidget;
namespace mozilla {
@ -80,7 +80,8 @@ public:
BUFFER_NONE,
BUFFER_BUFFERED
};
void SetDefaultTarget(gfxContext* aContext, BufferMode aDoubleBuffering);
virtual void SetDefaultTarget(gfxContext* aContext, BufferMode aDoubleBuffering,
ScreenRotation aRotation);
gfxContext* GetDefaultTarget() { return mDefaultTarget; }
nsIWidget* GetRetainerWidget() { return mWidget; }
@ -221,6 +222,8 @@ public:
virtual PRInt32 GetMaxTextureSize() const;
virtual void SetDefaultTarget(gfxContext* aContext, BufferMode aDoubleBuffering,
ScreenRotation aRotation) MOZ_OVERRIDE;
virtual void BeginTransactionWithTarget(gfxContext* aTarget);
virtual bool EndEmptyTransaction();
virtual void EndTransaction(DrawThebesLayerCallback aCallback,
@ -261,11 +264,20 @@ private:
*/
void ForwardTransaction();
// The bounds of |mTarget| in device pixels.
nsIntRect mTargetBounds;
LayerRefArray mKeepAlive;
// Sometimes we draw to targets that don't natively support
// landscape/portrait orientation. When we need to implement that
// ourselves, |mTargetRotation| describes the induced transform we
// need to apply when compositing content to our target.
ScreenRotation mTargetRotation;
// Used to repeat the transaction right away (to avoid rebuilding
// a display list) to support progressive drawing.
bool mRepeatTransaction;
LayerRefArray mKeepAlive;
};
class BasicShadowableThebesLayer;

View File

@ -20,6 +20,7 @@
#include "ReadbackLayerD3D10.h"
#include "ImageLayerD3D10.h"
#include "mozilla/layers/PLayerChild.h"
#include "mozilla/WidgetUtils.h"
#include "../d3d9/Nv3DVUtils.h"
@ -448,7 +449,6 @@ LayerManagerD3D10::CreateOptimalSurface(const gfxIntSize &aSize,
CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aSize.width, aSize.height, 1, 1);
desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
desc.MiscFlags = D3D10_RESOURCE_MISC_GDI_COMPATIBLE;
HRESULT hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(texture));
@ -729,7 +729,8 @@ LayerManagerD3D10::Render()
if (mTarget) {
PaintToTarget();
} else if (mBackBuffer) {
ShadowLayerForwarder::BeginTransaction();
ShadowLayerForwarder::BeginTransaction(mWidget->GetNaturalBounds(),
ROTATION_0);
nsIntRect contentRect = nsIntRect(0, 0, rect.width, rect.height);
if (!mRootForShadowTree) {

View File

@ -470,7 +470,6 @@ ThebesLayerD3D10::CreateNewTextures(const gfxIntSize &aSize, SurfaceMode aMode)
CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aSize.width, aSize.height, 1, 1);
desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
desc.MiscFlags = D3D10_RESOURCE_MISC_GDI_COMPATIBLE;
HRESULT hr;
if (!mTexture) {

View File

@ -422,6 +422,13 @@ CompositorParent::Composite()
RenderTraceLayers(aLayer, "0000");
if (LAYERS_OPENGL == mLayerManager->GetBackendType() &&
!mTargetConfig.naturalBounds().IsEmpty()) {
LayerManagerOGL* lm = static_cast<LayerManagerOGL*>(mLayerManager.get());
lm->SetWorldTransform(
ComputeGLTransformForRotation(mTargetConfig.naturalBounds(),
mTargetConfig.rotation()));
}
mLayerManager->EndEmptyTransaction();
#ifdef COMPOSITOR_PERFORMANCE_WARNING
@ -694,8 +701,10 @@ CompositorParent::SyncViewportInfo(const nsIntRect& aDisplayPort,
void
CompositorParent::ShadowLayersUpdated(ShadowLayersParent* aLayerTree,
const TargetConfig& aTargetConfig,
bool isFirstPaint)
{
mTargetConfig = aTargetConfig;
mIsFirstPaint = mIsFirstPaint || isFirstPaint;
mLayersUpdated = true;
Layer* root = aLayerTree->GetRoot();
@ -898,6 +907,7 @@ public:
virtual bool DeallocPLayers(PLayersParent* aLayers) MOZ_OVERRIDE;
virtual void ShadowLayersUpdated(ShadowLayersParent* aLayerTree,
const TargetConfig& aTargetConfig,
bool isFirstPaint) MOZ_OVERRIDE;
private:
@ -997,8 +1007,10 @@ CrossProcessCompositorParent::DeallocPLayers(PLayersParent* aLayers)
}
void
CrossProcessCompositorParent::ShadowLayersUpdated(ShadowLayersParent* aLayerTree,
bool isFirstPaint)
CrossProcessCompositorParent::ShadowLayersUpdated(
ShadowLayersParent* aLayerTree,
const TargetConfig& aTargetConfig,
bool isFirstPaint)
{
uint64_t id = aLayerTree->GetId();
MOZ_ASSERT(id != 0);

View File

@ -70,6 +70,7 @@ public:
virtual bool RecvResume() MOZ_OVERRIDE;
virtual void ShadowLayersUpdated(ShadowLayersParent* aLayerTree,
const TargetConfig& aTargetConfig,
bool isFirstPaint) MOZ_OVERRIDE;
void Destroy();
@ -227,6 +228,7 @@ private:
nsRefPtr<LayerManager> mLayerManager;
nsIWidget* mWidget;
TargetConfig mTargetConfig;
CancelableTask *mCurrentCompositeTask;
TimeStamp mLastCompose;
#ifdef COMPOSITOR_PERFORMANCE_WARNING

View File

@ -22,8 +22,8 @@ public:
*/
virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics) = 0;
GeckoContentController() {};
virtual ~GeckoContentController() {};
GeckoContentController() {}
virtual ~GeckoContentController() {}
};
}

View File

@ -6,12 +6,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include LayersSurfaces;
using mozilla::ScreenRotation;
include protocol PCompositor;
include protocol PGrallocBuffer;
include protocol PLayer;
include protocol PRenderFrame;
include "gfxipc/ShadowLayerUtils.h";
include "mozilla/WidgetUtils.h";
/**
* The layers protocol is spoken between thread contexts that manage
@ -24,6 +26,11 @@ include "gfxipc/ShadowLayerUtils.h";
namespace mozilla {
namespace layers {
struct TargetConfig {
nsIntRect naturalBounds;
ScreenRotation rotation;
};
// Create a shadow layer for |layer|
struct OpCreateThebesLayer { PLayer layer; };
struct OpCreateContainerLayer { PLayer layer; };
@ -191,7 +198,7 @@ parent:
// The isFirstPaint flag can be used to indicate that this is the first update
// for a particular document.
sync Update(Edit[] cset, bool isFirstPaint)
sync Update(Edit[] cset, TargetConfig targetConfig, bool isFirstPaint)
returns (EditReply[] reply);
// Composite the layer tree to the given surface, and return the surface.
@ -200,7 +207,7 @@ parent:
// We don't need to send a sync transaction if
// no transaction operate require a swap.
async UpdateNoSwap(Edit[] cset, bool isFirstPaint);
async UpdateNoSwap(Edit[] cset, TargetConfig targetConfig, bool isFirstPaint);
async __delete__();
};

View File

@ -11,6 +11,7 @@
#include "IPC/IPCMessageUtils.h"
#include "Layers.h"
#include "GLContext.h"
#include "mozilla/WidgetUtils.h"
#if defined(MOZ_ENABLE_D3D10_LAYER)
# include "mozilla/layers/ShadowLayerUtilsD3D10.h"
@ -107,6 +108,13 @@ struct ParamTraits<mozilla::layers::MagicGrallocBufferHandle> {
};
#endif // !defined(MOZ_HAVE_XSURFACEDESCRIPTORGRALLOC)
}
template <>
struct ParamTraits<mozilla::ScreenRotation>
: public EnumSerializer<mozilla::ScreenRotation,
mozilla::ROTATION_0,
mozilla::ROTATION_COUNT>
{};
} // namespace IPC
#endif // IPC_ShadowLayerUtils_h

View File

@ -41,7 +41,12 @@ public:
, mOpen(false)
{}
void Begin() { mOpen = true; }
void Begin(const nsIntRect& aTargetBounds, ScreenRotation aRotation)
{
mOpen = true;
mTargetBounds = aTargetBounds;
mTargetRotation = aRotation;
}
void AddEdit(const Edit& aEdit)
{
@ -92,6 +97,8 @@ public:
EditVector mPaints;
BufferArray mDyingBuffers;
ShadowableLayerSet mMutants;
nsIntRect mTargetBounds;
ScreenRotation mTargetRotation;
bool mSwapRequired;
private:
@ -123,11 +130,12 @@ ShadowLayerForwarder::~ShadowLayerForwarder()
}
void
ShadowLayerForwarder::BeginTransaction()
ShadowLayerForwarder::BeginTransaction(const nsIntRect& aTargetBounds,
ScreenRotation aRotation)
{
NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to");
NS_ABORT_IF_FALSE(mTxn->Finished(), "uncommitted txn?");
mTxn->Begin();
mTxn->Begin(aTargetBounds, aRotation);
}
static PLayerChild*
@ -325,13 +333,16 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
cset.AppendElements(&mTxn->mPaints.front(), mTxn->mPaints.size());
}
TargetConfig targetConfig(mTxn->mTargetBounds, mTxn->mTargetRotation);
MOZ_LAYERS_LOG(("[LayersForwarder] syncing before send..."));
PlatformSyncBeforeUpdate();
if (mTxn->mSwapRequired) {
MOZ_LAYERS_LOG(("[LayersForwarder] sending transaction..."));
RenderTraceScope rendertrace3("Forward Transaction", "000093");
if (!mShadowManager->SendUpdate(cset, mIsFirstPaint, aReplies)) {
if (!mShadowManager->SendUpdate(cset, targetConfig, mIsFirstPaint,
aReplies)) {
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
return false;
}
@ -340,7 +351,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
// assumes that aReplies is empty (DEBUG assertion)
MOZ_LAYERS_LOG(("[LayersForwarder] sending no swap transaction..."));
RenderTraceScope rendertrace3("Forward NoSwap Transaction", "000093");
if (!mShadowManager->SendUpdateNoSwap(cset, mIsFirstPaint)) {
if (!mShadowManager->SendUpdateNoSwap(cset, targetConfig, mIsFirstPaint)) {
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
return false;
}

View File

@ -14,6 +14,7 @@
#include "ImageLayers.h"
#include "LayersBackend.h"
#include "mozilla/ipc/SharedMemory.h"
#include "mozilla/WidgetUtils.h"
class gfxSharedImageSurface;
@ -116,7 +117,8 @@ public:
* Begin recording a transaction to be forwarded atomically to a
* ShadowLayerManager.
*/
void BeginTransaction();
void BeginTransaction(const nsIntRect& aTargetBounds,
ScreenRotation aRotation);
/**
* The following methods may only be called after BeginTransaction()

View File

@ -10,13 +10,14 @@
namespace mozilla {
namespace layers {
class TargetConfig;
class ShadowLayersParent;
class ShadowLayersManager
{
public:
virtual void ShadowLayersUpdated(ShadowLayersParent* aLayerTree,
// FIXME nuke this
const TargetConfig& aTargetConfig,
bool isFirstPaint) = 0;
};

View File

@ -119,16 +119,18 @@ ShadowLayersParent::Destroy()
/* virtual */
bool
ShadowLayersParent::RecvUpdateNoSwap(const InfallibleTArray<Edit>& cset,
const bool& isFirstPaint)
const TargetConfig& targetConfig,
const bool& isFirstPaint)
{
InfallibleTArray<EditReply> noReplies;
bool success = RecvUpdate(cset, isFirstPaint, &noReplies);
bool success = RecvUpdate(cset, targetConfig, isFirstPaint, &noReplies);
NS_ABORT_IF_FALSE(noReplies.Length() == 0, "RecvUpdateNoSwap requires a sync Update to carry Edits");
return success;
}
bool
ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
const TargetConfig& targetConfig,
const bool& isFirstPaint,
InfallibleTArray<EditReply>* reply)
{
@ -417,7 +419,7 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
// other's buffer contents.
ShadowLayerManager::PlatformSyncBeforeReplyUpdate();
mShadowLayersManager->ShadowLayersUpdated(this, isFirstPaint);
mShadowLayersManager->ShadowLayersUpdated(this, targetConfig, isFirstPaint);
#ifdef COMPOSITOR_PERFORMANCE_WARNING
int compositeTime = (int)(mozilla::TimeStamp::Now() - updateStart).ToMilliseconds();

View File

@ -48,6 +48,7 @@ public:
protected:
virtual bool RecvUpdate(const EditArray& cset,
const TargetConfig& targetConfig,
const bool& isFirstPaint,
EditReplyArray* reply) MOZ_OVERRIDE;
@ -55,6 +56,7 @@ protected:
SurfaceDescriptor* surfaceOut) MOZ_OVERRIDE;
virtual bool RecvUpdateNoSwap(const EditArray& cset,
const TargetConfig& targetConfig,
const bool& isFirstPaint) MOZ_OVERRIDE;
virtual PGrallocBufferParent*

View File

@ -3641,6 +3641,29 @@ gfxFontGroup::InitScriptRun(gfxContext *aContext,
}
}
already_AddRefed<gfxFont>
gfxFontGroup::TryOtherFamilyMembers(gfxFont* aFont, PRUint32 aCh)
{
gfxFontFamily *family = aFont->GetFontEntry()->Family();
if (family && !aFont->GetFontEntry()->mIsProxy &&
family->TestCharacterMap(aCh)) {
// Note that we don't need the actual runScript in matchData for
// gfxFontFamily::SearchAllFontsForChar, it's only used for the
// system-fallback case. So we can just set it to 0 here.
GlobalFontMatch matchData(aCh, 0, &mStyle);
family->SearchAllFontsForChar(&matchData);
gfxFontEntry *fe = matchData.mBestMatch;
if (fe) {
bool needsBold = aFont->GetStyle()->weight >= 600 && !fe->IsBold();
nsRefPtr<gfxFont> font = fe->FindOrMakeFont(&mStyle, needsBold);
if (font) {
return font.forget();
}
}
}
return nsnull;
}
already_AddRefed<gfxFont>
gfxFontGroup::FindFontForChar(PRUint32 aCh, PRUint32 aPrevCh,
PRInt32 aRunScript, gfxFont *aPrevMatchedFont,
@ -3660,6 +3683,13 @@ gfxFontGroup::FindFontForChar(PRUint32 aCh, PRUint32 aPrevCh,
firstFont->AddRef();
return firstFont;
}
// It's possible that another font in the family (e.g. regular face,
// where the requested style was italic) will support the character
nsRefPtr<gfxFont> font = TryOtherFamilyMembers(firstFont, aCh);
if (font) {
*aMatchType = gfxTextRange::kFontGroup;
return font.forget();
}
// we don't need to check the first font again below
++nextIndex;
}
@ -3705,22 +3735,10 @@ gfxFontGroup::FindFontForChar(PRUint32 aCh, PRUint32 aPrevCh,
return font.forget();
}
// check other faces of the family
gfxFontFamily *family = font->GetFontEntry()->Family();
if (family && !font->GetFontEntry()->mIsProxy &&
family->TestCharacterMap(aCh))
{
GlobalFontMatch matchData(aCh, aRunScript, &mStyle);
family->SearchAllFontsForChar(&matchData);
gfxFontEntry *fe = matchData.mBestMatch;
if (fe) {
bool needsBold =
font->GetStyle()->weight >= 600 && !fe->IsBold();
font = fe->FindOrMakeFont(font->GetStyle(), needsBold);
if (font) {
return font.forget();
}
}
font = TryOtherFamilyMembers(font, aCh);
if (font) {
*aMatchType = gfxTextRange::kFontGroup;
return font.forget();
}
}

View File

@ -3181,6 +3181,12 @@ protected:
FontCreationCallback fc,
void *closure);
// Helper for font-matching:
// see if aCh is supported in any of the other faces from aFont's family;
// if so return the best style match, else return null.
already_AddRefed<gfxFont> TryOtherFamilyMembers(gfxFont* aFont,
PRUint32 aCh);
static bool FontResolverProc(const nsAString& aName, void *aClosure);
static bool FindPlatformFont(const nsAString& aName,

View File

@ -26,16 +26,18 @@ interface nsIUTF8ConverterService : nsISupports
* like ISO-2022-JP, HZ or UTF-7 (in its original form or
* a modified form used in IMAP folder names).
* @param aAllowSubstitution when true, allow the decoder to substitute
* invalid input sequences by replacement characters
* invalid input sequences by replacement characters (defaults to
* true)
* @return the converted string in UTF-8.
* @throws NS_ERROR_UCONV_NOCONV when there is no decoder for aCharset
* or error code of nsIUnicodeDecoder in case of conversion failure
*/
[optional_argc]
AUTF8String convertStringToUTF8(in ACString aString,
in string aCharset,
in boolean aSkipCheck,
in boolean aAllowSubstitution);
[optional] in boolean aAllowSubstitution);
/* XXX : To-be-added. convertStringFromUTF8 */

View File

@ -59,8 +59,11 @@ nsUTF8ConverterService::ConvertStringToUTF8(const nsACString &aString,
const char *aCharset,
bool aSkipCheck,
bool aAllowSubstitution,
PRUint8 aOptionalArgc,
nsACString &aUTF8String)
{
bool allowSubstitution = (aOptionalArgc == 1) ? aAllowSubstitution : true;
// return if ASCII only or valid UTF-8 providing that the ASCII/UTF-8
// check is requested. It may not be asked for if a caller suspects
// that the input is in non-ASCII 7bit charset (ISO-2022-xx, HZ) or
@ -72,7 +75,7 @@ nsUTF8ConverterService::ConvertStringToUTF8(const nsACString &aString,
aUTF8String.Truncate();
nsresult rv = ToUTF8(aString, aCharset, aAllowSubstitution, aUTF8String);
nsresult rv = ToUTF8(aString, aCharset, allowSubstitution, aUTF8String);
// additional protection for cases where check is skipped and the input
// is actually in UTF-8 as opposed to aCharset. (i.e. caller's hunch

View File

@ -85,6 +85,86 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
if (!JS_SetProperty(cx, info, "has-gczeal", &value))
return false;
#ifdef JS_MORE_DETERMINISTIC
value = BooleanValue(true);
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "more-deterministic", &value))
return false;
#ifdef MOZ_PROFILING
value = BooleanValue(true);
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "profiling", &value))
return false;
#ifdef INCLUDE_MOZILLA_DTRACE
value = BooleanValue(true);
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "dtrace", &value))
return false;
#ifdef MOZ_TRACE_JSCALLS
value = BooleanValue(true);
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "trace-jscalls-api", &value))
return false;
#ifdef JSGC_INCREMENTAL
value = BooleanValue(true);
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "incremental-gc", &value))
return false;
#ifdef JSGC_GENERATIONAL
value = BooleanValue(true);
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "generational-gc", &value))
return false;
#ifdef MOZ_VALGRIND
value = BooleanValue(true);
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "valgrind", &value))
return false;
#ifdef JS_OOM_DO_BACKTRACES
value = BooleanValue(true);
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "oom-backtraces", &value))
return false;
#ifdef JS_METHODJIT
value = BooleanValue(true);
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "methodjit", &value))
return false;
#ifdef JS_HAS_XML_SUPPORT
value = BooleanValue(true);
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "e4x", &value))
return false;
*vp = ObjectValue(*info);
return true;
}
@ -383,7 +463,7 @@ DeterministicGC(JSContext *cx, unsigned argc, jsval *vp)
return JS_FALSE;
}
gc::SetDeterministicGC(cx, js_ValueToBoolean(vp[2]));
gc::SetDeterministicGC(cx, ToBoolean(vp[2]));
*vp = JSVAL_VOID;
return JS_TRUE;
}

View File

@ -291,11 +291,9 @@ endif
ifndef MOZ_AUTO_DEPS
ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS))
MDDEPFILES = $(addprefix $(MDDEPDIR)/,$(OBJS:=.pp))
ifndef NO_GEN_XPT
MDDEPFILES += $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.h.pp) $(XPIDLSRCS:.idl=.xpt.pp))
endif
endif
endif
ALL_TRASH = \
$(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
@ -1298,7 +1296,6 @@ $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(xpidl-preqs)
@if test -n "$(findstring $*.h, $(EXPORTS))"; \
then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
ifndef NO_GEN_XPT
# generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link
# into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
$(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_DEPS) $(xpidl-preqs)
@ -1323,8 +1320,6 @@ ifndef NO_INTERFACES_MANIFEST
endif
endif
endif # NO_GEN_XPT
GARBAGE_DIRS += $(XPIDL_GEN_DIR)
endif #} XPIDLSRCS

View File

@ -599,6 +599,8 @@ EmitNonLocalJumpFixup(JSContext *cx, BytecodeEmitter *bce, StmtInfoBCE *toStmt)
stmt = stmt->down;
if (stmt == toStmt)
break;
if (NewSrcNote(cx, bce, SRC_HIDDEN) < 0)
return false;
if (Emit1(cx, bce, JSOP_LEAVEFORLETIN) < 0)
return false;
if (!PopIterator(cx, bce))

View File

@ -0,0 +1,7 @@
function getgen() {
gen = getgen.caller;
}
var gen;
(getgen() for (x of [1])).next();
assertEq(gen.toSource(), "function genexp() {\n [generator expression]\n}");
assertEq(decompileBody(gen), "\n [generator expression]\n");

View File

@ -322,7 +322,7 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for
}
switch (c) {
case 'b':
*va_arg(ap, JSBool *) = js_ValueToBoolean(*sp);
*va_arg(ap, JSBool *) = ToBoolean(*sp);
break;
case 'c':
if (!JS_ValueToUint16(cx, *sp, va_arg(ap, uint16_t *)))
@ -480,7 +480,7 @@ JS_ConvertValue(JSContext *cx, jsval v, JSType type, jsval *vp)
*vp = DOUBLE_TO_JSVAL(d);
break;
case JSTYPE_BOOLEAN:
*vp = BOOLEAN_TO_JSVAL(js_ValueToBoolean(v));
*vp = BooleanValue(ToBoolean(v));
return JS_TRUE;
default: {
char numBuf[12];
@ -632,7 +632,7 @@ JS_ValueToBoolean(JSContext *cx, jsval v, JSBool *bp)
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, v);
*bp = js_ValueToBoolean(v);
*bp = ToBoolean(v);
return JS_TRUE;
}
@ -5342,29 +5342,32 @@ JS_DecompileScript(JSContext *cx, JSScript *script, const char *name, unsigned i
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
if (script->function())
return JS_DecompileFunction(cx, script->function(), indent);
RootedFunction fun(cx, script->function());
if (fun)
return JS_DecompileFunction(cx, fun, indent);
return script->sourceData(cx);
}
JS_PUBLIC_API(JSString *)
JS_DecompileFunction(JSContext *cx, JSFunction *fun, unsigned indent)
JS_DecompileFunction(JSContext *cx, JSFunction *funArg, unsigned indent)
{
JS_THREADSAFE_ASSERT(cx->compartment != cx->runtime->atomsCompartment);
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, fun);
return fun->toString(cx, false, !(indent & JS_DONT_PRETTY_PRINT));
assertSameCompartment(cx, funArg);
RootedFunction fun(cx, funArg);
return FunctionToString(cx, fun, false, !(indent & JS_DONT_PRETTY_PRINT));
}
JS_PUBLIC_API(JSString *)
JS_DecompileFunctionBody(JSContext *cx, JSFunction *fun, unsigned indent)
JS_DecompileFunctionBody(JSContext *cx, JSFunction *funArg, unsigned indent)
{
JS_THREADSAFE_ASSERT(cx->compartment != cx->runtime->atomsCompartment);
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, fun);
return fun->toString(cx, true, !(indent & JS_DONT_PRETTY_PRINT));
assertSameCompartment(cx, funArg);
RootedFunction fun(cx, funArg);
return FunctionToString(cx, fun, true, !(indent & JS_DONT_PRETTY_PRINT));
}
JS_NEVER_INLINE JS_PUBLIC_API(JSBool)

View File

@ -2664,6 +2664,12 @@ namespace js {
*/
extern JS_PUBLIC_API(bool)
ToNumberSlow(JSContext *cx, JS::Value v, double *dp);
/*
* DO NOT CALL THIS. Use JS::ToBoolean
*/
extern JS_PUBLIC_API(bool)
ToBooleanSlow(const JS::Value &v);
} /* namespace js */
namespace JS {
@ -2682,6 +2688,26 @@ ToNumber(JSContext *cx, const Value &v, double *out)
return js::ToNumberSlow(cx, v, out);
}
JS_ALWAYS_INLINE bool
ToBoolean(const Value &v)
{
if (v.isBoolean())
return v.toBoolean();
if (v.isInt32())
return v.toInt32() != 0;
if (v.isObject())
return true;
if (v.isNullOrUndefined())
return false;
if (v.isDouble()) {
double d = v.toDouble();
return !MOZ_DOUBLE_IS_NaN(d) && d != 0;
}
/* Slow path. Handle Strings. */
return js::ToBooleanSlow(v);
}
} /* namespace JS */
#endif /* __cplusplus */

View File

@ -3091,7 +3091,7 @@ class ArrayEveryBehavior
public:
static bool shouldExit(Value &callval, Value *rval)
{
if (!js_ValueToBoolean(callval)) {
if (!ToBoolean(callval)) {
*rval = BooleanValue(false);
return true;
}
@ -3105,7 +3105,7 @@ class ArraySomeBehavior
public:
static bool shouldExit(Value &callval, Value *rval)
{
if (js_ValueToBoolean(callval)) {
if (ToBoolean(callval)) {
*rval = BooleanValue(true);
return true;
}
@ -3347,7 +3347,7 @@ array_filter(JSContext *cx, unsigned argc, Value *vp)
if (!Invoke(cx, ag))
return false;
if (js_ValueToBoolean(ag.rval())) {
if (ToBoolean(ag.rval())) {
if(!SetArrayElement(cx, arr, to, kValue))
return false;
to++;

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