Merge m-c to b2ginbound a=merge CLOSED TREE

This commit is contained in:
Wes Kocher 2015-04-20 17:17:44 -07:00
commit 02314c6b8d
232 changed files with 2707 additions and 1593 deletions

View File

@ -11,6 +11,7 @@
#include "nsIMutableArray.h"
#include "nsComponentManagerUtils.h"
#include "nsQueryObject.h"
using namespace mozilla;
using namespace mozilla::a11y;

View File

@ -17,6 +17,7 @@
#include "Role.h"
#include "States.h"
#include "XULTreeGridAccessible.h"
#include "nsQueryObject.h"
#include "nsComponentManagerUtils.h"
#include "nsIAccessibleRelation.h"

View File

@ -13,6 +13,7 @@
#include "Relation.h"
#include "Role.h"
#include "States.h"
#include "nsQueryObject.h"
#include "nsIBoxObject.h"
#include "nsIMutableArray.h"

View File

@ -253,7 +253,9 @@ loop.conversationViews = (function(mozL10n) {
onClick: this._handleDecline},
mozL10n.get("incoming_call_cancel_button")
),
React.createElement("div", {className: "btn-chevron", onClick: this.toggleDropdownMenu})
React.createElement("div", {className: "btn-chevron",
onClick: this.toggleDropdownMenu,
ref: "menu-button"})
),
React.createElement("ul", {className: dropdownMenuClassesDecline},

View File

@ -253,7 +253,9 @@ loop.conversationViews = (function(mozL10n) {
onClick={this._handleDecline}>
{mozL10n.get("incoming_call_cancel_button")}
</button>
<div className="btn-chevron" onClick={this.toggleDropdownMenu} />
<div className="btn-chevron"
onClick={this.toggleDropdownMenu}
ref="menu-button" />
</div>
<ul className={dropdownMenuClassesDecline}>

View File

@ -163,7 +163,7 @@ loop.panel = (function(_, mozL10n) {
return (
React.createElement("div", {className: "dropdown"},
React.createElement("p", {className: "dnd-status", onClick: this.showDropdownMenu},
React.createElement("p", {className: "dnd-status", onClick: this.toggleDropdownMenu, ref: "menu-button"},
React.createElement("span", null, availabilityText),
React.createElement("i", {className: availabilityStatus})
),
@ -344,8 +344,10 @@ loop.panel = (function(_, mozL10n) {
return (
React.createElement("div", {className: "settings-menu dropdown"},
React.createElement("a", {className: "button-settings", onClick: this.showDropdownMenu,
title: mozL10n.get("settings_menu_button_tooltip")}),
React.createElement("a", {className: "button-settings",
onClick: this.toggleDropdownMenu,
title: mozL10n.get("settings_menu_button_tooltip"),
ref: "menu-button"}),
React.createElement("ul", {className: cx({"dropdown-menu": true, hide: !this.state.showMenu})},
React.createElement(SettingsDropdownEntry, {label: mozL10n.get("settings_menu_item_settings"),
onClick: this.handleClickSettingsEntry,

View File

@ -163,7 +163,7 @@ loop.panel = (function(_, mozL10n) {
return (
<div className="dropdown">
<p className="dnd-status" onClick={this.showDropdownMenu}>
<p className="dnd-status" onClick={this.toggleDropdownMenu} ref="menu-button">
<span>{availabilityText}</span>
<i className={availabilityStatus}></i>
</p>
@ -344,8 +344,10 @@ loop.panel = (function(_, mozL10n) {
return (
<div className="settings-menu dropdown">
<a className="button-settings" onClick={this.showDropdownMenu}
title={mozL10n.get("settings_menu_button_tooltip")} />
<a className="button-settings"
onClick={this.toggleDropdownMenu}
title={mozL10n.get("settings_menu_button_tooltip")}
ref="menu-button" />
<ul className={cx({"dropdown-menu": true, hide: !this.state.showMenu})}>
<SettingsDropdownEntry label={mozL10n.get("settings_menu_item_settings")}
onClick={this.handleClickSettingsEntry}

View File

@ -94,8 +94,16 @@ loop.shared.mixins = (function() {
return {showMenu: false};
},
_onBodyClick: function() {
this.setState({showMenu: false});
_onBodyClick: function(event) {
var menuButton = this.refs["menu-button"] && this.refs["menu-button"].getDOMNode();
if (this.refs.anchor) {
menuButton = this.refs.anchor.getDOMNode();
}
// If a menu button/ anchor is defined and clicked on, it will be in charge
// of hiding or showing the popup.
if (event.target !== menuButton) {
this.setState({ showMenu: false });
}
},
_correctMenuPosition: function() {

View File

@ -163,6 +163,7 @@ loop.shared.views = (function(_, l10n) {
React.createElement("div", null,
React.createElement("button", {className: screenShareClasses,
onClick: this.handleClick,
ref: "menu-button",
title: this._getTitle()},
isActive ? null : React.createElement("span", {className: "chevron"})
),

View File

@ -163,6 +163,7 @@ loop.shared.views = (function(_, l10n) {
<div>
<button className={screenShareClasses}
onClick={this.handleClick}
ref="menu-button"
title={this._getTitle()}>
{isActive ? null : <span className="chevron"/>}
</button>

View File

@ -20,6 +20,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource:///modules/MigrationUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
@ -42,29 +43,24 @@ function chromeTimeToDate(aTime)
/**
* Insert bookmark items into specific folder.
*
* @param aFolderId
* id of folder where items will be inserted
* @param aItems
* @param parentGuid
* GUID of the folder where items will be inserted
* @param items
* bookmark items to be inserted
*/
function insertBookmarkItems(aFolderId, aItems)
{
for (let i = 0; i < aItems.length; i++) {
let item = aItems[i];
function* insertBookmarkItems(parentGuid, items) {
for (let item of items) {
try {
if (item.type == "url") {
PlacesUtils.bookmarks.insertBookmark(aFolderId,
NetUtil.newURI(item.url),
PlacesUtils.bookmarks.DEFAULT_INDEX,
item.name);
yield PlacesUtils.bookmarks.insert({
parentGuid, url: item.url, title: item.name
});
} else if (item.type == "folder") {
let newFolderId =
PlacesUtils.bookmarks.createFolder(aFolderId,
item.name,
PlacesUtils.bookmarks.DEFAULT_INDEX);
let newFolderGuid = (yield PlacesUtils.bookmarks.insert({
parentGuid, type: PlacesUtils.bookmarks.TYPE_FOLDER, title: item.name
})).guid;
insertBookmarkItems(newFolderId, item.children);
yield insertBookmarkItems(newFolderGuid, item.children);
}
} catch (e) {
Cu.reportError(e);
@ -189,48 +185,51 @@ function GetBookmarksResource(aProfileFolder) {
type: MigrationUtils.resourceTypes.BOOKMARKS,
migrate: function(aCallback) {
NetUtil.asyncFetch2(bookmarksFile, MigrationUtils.wrapMigrateFunction(
function(aInputStream, aResultCode) {
if (!Components.isSuccessCode(aResultCode))
throw new Error("Could not read Bookmarks file");
// Parse Chrome bookmark file that is JSON format
let bookmarkJSON = NetUtil.readInputStreamToString(
aInputStream, aInputStream.available(), { charset : "UTF-8" });
let roots = JSON.parse(bookmarkJSON).roots;
PlacesUtils.bookmarks.runInBatchMode({
runBatched: function() {
// Importing bookmark bar items
if (roots.bookmark_bar.children &&
roots.bookmark_bar.children.length > 0) {
// Toolbar
let parentId = PlacesUtils.toolbarFolderId;
if (!MigrationUtils.isStartupMigration) {
parentId = MigrationUtils.createImportedBookmarksFolder(
"Chrome", parentId);
}
insertBookmarkItems(parentId, roots.bookmark_bar.children);
}
return Task.spawn(function* () {
let jsonStream = yield new Promise(resolve =>
NetUtil.asyncFetch({ uri: NetUtil.newURI(bookmarksFile),
loadUsingSystemPrincipal: true
},
(inputStream, resultCode) => {
if (Components.isSuccessCode(resultCode)) {
resolve(inputStream);
} else {
reject(new Error("Could not read Bookmarks file"));
}
}
)
);
// Importing bookmark menu items
if (roots.other.children &&
roots.other.children.length > 0) {
// Bookmark menu
let parentId = PlacesUtils.bookmarksMenuFolderId;
if (!MigrationUtils.isStartupMigration) {
parentId = MigrationUtils.createImportedBookmarksFolder(
"Chrome", parentId);
}
insertBookmarkItems(parentId, roots.other.children);
}
}
}, null);
}, aCallback),
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
// Parse Chrome bookmark file that is JSON format
let bookmarkJSON = NetUtil.readInputStreamToString(
jsonStream, jsonStream.available(), { charset : "UTF-8" });
let roots = JSON.parse(bookmarkJSON).roots;
// Importing bookmark bar items
if (roots.bookmark_bar.children &&
roots.bookmark_bar.children.length > 0) {
// Toolbar
let parentGuid = PlacesUtils.bookmarks.toolbarGuid;
if (!MigrationUtils.isStartupMigration) {
parentGuid =
yield MigrationUtils.createImportedBookmarksFolder("Chrome", parentGuid);
}
yield insertBookmarkItems(parentGuid, roots.bookmark_bar.children);
}
// Importing bookmark menu items
if (roots.other.children &&
roots.other.children.length > 0) {
// Bookmark menu
let parentGuid = PlacesUtils.bookmarks.menuGuid;
if (!MigrationUtils.isStartupMigration) {
parentGuid =
yield MigrationUtils.createImportedBookmarksFolder("Chrome", parentGuid);
}
yield insertBookmarkItems(parentGuid, roots.other.children);
}
}.bind(this)).then(() => aCallback(true),
e => { Cu.reportError(e); aCallback(false) });
}
};
}

View File

@ -13,7 +13,7 @@ const kMainKey = "Software\\Microsoft\\Internet Explorer\\Main";
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource:///modules/MigrationUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
@ -169,23 +169,19 @@ Bookmarks.prototype = {
},
migrate: function B_migrate(aCallback) {
PlacesUtils.bookmarks.runInBatchMode({
runBatched: (function migrateBatched() {
// Import to the bookmarks menu.
let destFolderId = PlacesUtils.bookmarksMenuFolderId;
if (!MigrationUtils.isStartupMigration) {
destFolderId =
MigrationUtils.createImportedBookmarksFolder("IE", destFolderId);
}
this._migrateFolder(this._favoritesFolder, destFolderId);
aCallback(true);
}).bind(this)
}, null);
return Task.spawn(function* () {
// Import to the bookmarks menu.
let folderGuid = PlacesUtils.bookmarks.menuGuid;
if (!MigrationUtils.isStartupMigration) {
folderGuid =
yield MigrationUtils.createImportedBookmarksFolder("IE", folderGuid);
}
yield this._migrateFolder(this._favoritesFolder, folderGuid);
}.bind(this)).then(() => aCallback(true),
e => { Cu.reportError(e); aCallback(false) });
},
_migrateFolder: function B__migrateFolder(aSourceFolder, aDestFolderId) {
_migrateFolder: Task.async(function* (aSourceFolder, aDestFolderGuid) {
// TODO (bug 741993): the favorites order is stored in the Registry, at
// HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Favorites
// Until we support it, bookmarks are imported in alphabetical order.
@ -198,26 +194,28 @@ Bookmarks.prototype = {
// Don't use isSymlink(), since it would throw for invalid
// lnk files pointing to URLs or to unresolvable paths.
if (entry.path == entry.target && entry.isDirectory()) {
let destFolderId;
let folderGuid;
if (entry.leafName == this._toolbarFolderName &&
entry.parent.equals(this._favoritesFolder)) {
// Import to the bookmarks toolbar.
destFolderId = PlacesUtils.toolbarFolderId;
folderGuid = PlacesUtils.bookmarks.toolbarGuid;
if (!MigrationUtils.isStartupMigration) {
destFolderId =
MigrationUtils.createImportedBookmarksFolder("IE", destFolderId);
folderGuid =
yield MigrationUtils.createImportedBookmarksFolder("IE", folderGuid);
}
}
else {
// Import to a new folder.
destFolderId =
PlacesUtils.bookmarks.createFolder(aDestFolderId, entry.leafName,
PlacesUtils.bookmarks.DEFAULT_INDEX);
folderGuid = (yield PlacesUtils.bookmarks.insert({
type: PlacesUtils.bookmarks.TYPE_FOLDER,
parentGuid: aDestFolderGuid,
title: entry.leafName
})).guid;
}
if (entry.isReadable()) {
// Recursively import the folder.
this._migrateFolder(entry, destFolderId);
yield this._migrateFolder(entry, folderGuid);
}
}
else {
@ -230,17 +228,16 @@ Bookmarks.prototype = {
let uri = fileHandler.readURLFile(entry);
let title = matches[1];
PlacesUtils.bookmarks.insertBookmark(aDestFolderId,
uri,
PlacesUtils.bookmarks.DEFAULT_INDEX,
title);
yield PlacesUtils.bookmarks.insert({
parentGuid: aDestFolderGuid, url: uri, title
});
}
}
} catch (ex) {
Components.utils.reportError("Unable to import IE favorite (" + entry.leafName + "): " + ex);
}
}
}
})
};
function History() {

View File

@ -15,11 +15,10 @@ const TOPIC_DID_IMPORT_BOOKMARKS = "initial-migration-did-import-default-bookmar
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BookmarkHTMLUtils",
"resource://gre/modules/BookmarkHTMLUtils.jsm");
@ -422,23 +421,22 @@ this.MigrationUtils = Object.freeze({
* Helper for creating a folder for imported bookmarks from a particular
* migration source. The folder is created at the end of the given folder.
*
* @param aSourceNameStr
* @param sourceNameStr
* the source name (first letter capitalized). This is used
* for reading the localized source name from the migration
* bundle (e.g. if aSourceNameStr is Mosaic, this will try to read
* sourceNameMosaic from the migration bundle).
* @param aParentId
* the item-id of the folder in which the new folder should be
* created.
* @return the item-id of the new folder.
* @param parentGuid
* the GUID of the folder in which the new folder should be created.
* @return the GUID of the new folder.
*/
createImportedBookmarksFolder:
function MU_createImportedBookmarksFolder(aSourceNameStr, aParentId) {
let source = this.getLocalizedString("sourceName" + aSourceNameStr);
let label = this.getLocalizedString("importedBookmarksFolder", [source]);
return PlacesUtils.bookmarks.createFolder(
aParentId, label, PlacesUtils.bookmarks.DEFAULT_INDEX);
},
createImportedBookmarksFolder: Task.async(function* (sourceNameStr, parentGuid) {
let source = this.getLocalizedString("sourceName" + sourceNameStr);
let title = this.getLocalizedString("importedBookmarksFolder", [source]);
return (yield PlacesUtils.bookmarks.insert({
type: PlacesUtils.bookmarks.TYPE_FOLDER, parentGuid, title
})).guid;
}),
get _migrators() {
return gMigrators ? gMigrators : gMigrators = new Map();

View File

@ -32,23 +32,21 @@ Bookmarks.prototype = {
type: MigrationUtils.resourceTypes.BOOKMARKS,
migrate: function B_migrate(aCallback) {
PropertyListUtils.read(this._file,
MigrationUtils.wrapMigrateFunction(function migrateBookmarks(aDict) {
if (!aDict)
throw new Error("Could not read Bookmarks.plist");
return Task.spawn(function* () {
let dict = yield new Promise(resolve =>
PropertyListUtils.read(this._file, resolve)
);
if (!dict)
throw new Error("Could not read Bookmarks.plist");
let children = dict.get("Children");
if (!children)
throw new Error("Invalid Bookmarks.plist format");
let children = aDict.get("Children");;
if (!children)
throw new Error("Invalid Bookmarks.plist format");
PlacesUtils.bookmarks.runInBatchMode({
runBatched: function() {
let collection = aDict.get("Title") == "com.apple.ReadingList" ?
this.READING_LIST_COLLECTION : this.ROOT_COLLECTION;
this._migrateCollection(children, collection);
}.bind(this)
}, null);
}.bind(this), aCallback));
let collection = dict.get("Title") == "com.apple.ReadingList" ?
this.READING_LIST_COLLECTION : this.ROOT_COLLECTION;
yield this._migrateCollection(children, collection);
}.bind(this)).then(() => aCallback(true),
e => { Cu.reportError(e); aCallback(false) });
},
// Bookmarks collections in Safari. Constants for migrateCollection.
@ -65,7 +63,7 @@ Bookmarks.prototype = {
* @param aCollection
* one of the values above.
*/
_migrateCollection: function B__migrateCollection(aEntries, aCollection) {
_migrateCollection: Task.async(function* (aEntries, aCollection) {
// A collection of bookmarks in Safari resembles places roots. In the
// property list files (Bookmarks.plist, ReadingList.plist) they are
// stored as regular bookmarks folders, and thus can only be distinguished
@ -79,11 +77,11 @@ Bookmarks.prototype = {
let title = entry.get("Title");
let children = entry.get("Children");
if (title == "BookmarksBar")
this._migrateCollection(children, this.TOOLBAR_COLLECTION);
yield this._migrateCollection(children, this.TOOLBAR_COLLECTION);
else if (title == "BookmarksMenu")
this._migrateCollection(children, this.MENU_COLLECTION);
yield this._migrateCollection(children, this.MENU_COLLECTION);
else if (title == "com.apple.ReadingList")
this._migrateCollection(children, this.READING_LIST_COLLECTION);
yield this._migrateCollection(children, this.READING_LIST_COLLECTION);
else if (entry.get("ShouldOmitFromUI") !== true)
entriesFiltered.push(entry);
}
@ -99,7 +97,7 @@ Bookmarks.prototype = {
if (entriesFiltered.length == 0)
return;
let folder = -1;
let folderGuid = -1;
switch (aCollection) {
case this.ROOT_COLLECTION: {
// In Safari, it is possible (though quite cumbersome) to move
@ -108,22 +106,22 @@ Bookmarks.prototype = {
// both the places root and the unfiled-bookmarks root.
// Because the former is only an implementation detail in our UI,
// the unfiled root seems to be the best choice.
folder = PlacesUtils.unfiledBookmarksFolderId;
folderGuid = PlacesUtils.bookmarks.unfiledGuid;
break;
}
case this.MENU_COLLECTION: {
folder = PlacesUtils.bookmarksMenuFolderId;
folderGuid = PlacesUtils.bookmarks.menuGuid;
if (!MigrationUtils.isStartupMigration) {
folder = MigrationUtils.createImportedBookmarksFolder("Safari",
folder);
folderGuid =
yield MigrationUtils.createImportedBookmarksFolder("Safari", folderGuid);
}
break;
}
case this.TOOLBAR_COLLECTION: {
folder = PlacesUtils.toolbarFolderId;
folderGuid = PlacesUtils.bookmarks.toolbarGuid;
if (!MigrationUtils.isStartupMigration) {
folder = MigrationUtils.createImportedBookmarksFolder("Safari",
folder);
folderGuid =
yield MigrationUtils.createImportedBookmarksFolder("Safari", folderGuid);
}
break;
}
@ -131,51 +129,52 @@ Bookmarks.prototype = {
// Reading list items are imported as regular bookmarks.
// They are imported under their own folder, created either under the
// bookmarks menu (in the case of startup migration).
folder = PlacesUtils.bookmarks.createFolder(
PlacesUtils.bookmarksMenuFolderId,
MigrationUtils.getLocalizedString("importedSafariReadingList"),
PlacesUtils.bookmarks.DEFAULT_INDEX);
folderGuid = (yield PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.menuGuid,
type: PlacesUtils.bookmarks.TYPE_FOLDER,
title: MigrationUtils.getLocalizedString("importedSafariReadingList"),
})).guid;
break;
}
default:
throw new Error("Unexpected value for aCollection!");
}
if (folderGuid == -1)
throw new Error("Invalid folder GUID");
this._migrateEntries(entriesFiltered, folder);
},
yield this._migrateEntries(entriesFiltered, folderGuid);
}),
// migrate the given array of safari bookmarks to the given places
// folder.
_migrateEntries: function B__migrateEntries(aEntries, aFolderId) {
for (let entry of aEntries) {
_migrateEntries: Task.async(function* (entries, parentGuid) {
for (let entry of entries) {
let type = entry.get("WebBookmarkType");
if (type == "WebBookmarkTypeList" && entry.has("Children")) {
let title = entry.get("Title");
let folderId = PlacesUtils.bookmarks.createFolder(
aFolderId, title, PlacesUtils.bookmarks.DEFAULT_INDEX);
let newFolderGuid = (yield PlacesUtils.bookmarks.insert({
parentGuid, type: PlacesUtils.bookmarks.TYPE_FOLDER, title
})).guid;
// Empty folders may not have a children array.
if (entry.has("Children"))
this._migrateEntries(entry.get("Children"), folderId, false);
yield this._migrateEntries(entry.get("Children"), newFolderGuid, false);
}
else if (type == "WebBookmarkTypeLeaf" && entry.has("URLString")) {
let title, uri;
let title;
if (entry.has("URIDictionary"))
title = entry.get("URIDictionary").get("title");
try {
uri = NetUtil.newURI(entry.get("URLString"));
}
catch(ex) {
Cu.reportError("Invalid uri set for Safari bookmark: " + entry.get("URLString"));
}
if (uri) {
PlacesUtils.bookmarks.insertBookmark(aFolderId, uri,
PlacesUtils.bookmarks.DEFAULT_INDEX, title);
yield PlacesUtils.bookmarks.insert({
parentGuid, url: entry.get("URLString"), title
});
} catch(ex) {
Cu.reportError("Invalid Safari bookmark: " + ex);
}
}
}
}
})
};
function History(aHistoryFile) {

View File

@ -35,3 +35,26 @@ function promiseMigration(migrator, resourceType) {
migrator.migrate(resourceType, null, null);
});
}
/**
* Replaces a directory service entry with a given nsIFile.
*/
function registerFakePath(key, file) {
// Register our own provider for the Library directory.
let provider = {
getFile(prop, persistent) {
persistent.value = true;
if (prop == key) {
return file;
}
throw Cr.NS_ERROR_FAILURE;
},
QueryInterface: XPCOMUtils.generateQI([ Ci.nsIDirectoryServiceProvider ])
};
Services.dirsvc.QueryInterface(Ci.nsIDirectoryService)
.registerProvider(provider);
do_register_cleanup(() => {
Services.dirsvc.QueryInterface(Ci.nsIDirectoryService)
.unregisterProvider(provider);
});
}

View File

@ -0,0 +1,37 @@
add_task(function* () {
registerFakePath("ULibDir", do_get_file("Library/"));
let migrator = MigrationUtils.getMigrator("safari");
// Sanity check for the source.
Assert.ok(migrator.sourceExists);
// Wait for the imported bookmarks. Check that "From Safari"
// folders are created on the toolbar.
let source = MigrationUtils.getLocalizedString("sourceNameSafari");
let label = MigrationUtils.getLocalizedString("importedBookmarksFolder", [source]);
let expectedParents = [ PlacesUtils.toolbarFolderId ];
PlacesUtils.bookmarks.addObserver({
onItemAdded(aItemId, aParentId, aIndex, aItemType, aURI, aTitle) {
if (aTitle == label) {
let index = expectedParents.indexOf(aParentId);
Assert.notEqual(index, -1);
expectedParents.splice(index, 1);
if (expectedParents.length == 0)
PlacesUtils.bookmarks.removeObserver(this);
}
},
onBeginUpdateBatch() {},
onEndUpdateBatch() {},
onItemRemoved() {},
onItemChanged() {},
onItemVisited() {},
onItemMoved() {},
}, false);
yield promiseMigration(migrator, MigrationUtils.resourceTypes.BOOKMARKS);
// Check the bookmarks have been imported to all the expected parents.
Assert.equal(expectedParents.length, 0);
});

View File

@ -3,9 +3,13 @@ head = head_migration.js
tail =
firefox-appdir = browser
skip-if = toolkit == 'android' || toolkit == 'gonk'
support-files =
Library/Safari/Bookmarks.plist
[test_fx_fhr.js]
[test_IE_bookmarks.js]
skip-if = os != "win"
[test_IE_cookies.js]
skip-if = os != "win"
[test_Safari_bookmarks.js]
skip-if = os != "mac"

View File

@ -220,7 +220,13 @@ let SessionFileInternal = {
break;
} catch (ex if ex instanceof OS.File.Error && ex.becauseNoSuchFile) {
exists = false;
} catch (ex if ex instanceof OS.File.Error) {
// The file might be inaccessible due to wrong permissions
// or similar failures. We'll just count it as "corrupted".
console.error("Could not read session file ", ex, ex.stack);
corrupted = true;
} catch (ex if ex instanceof SyntaxError) {
console.error("Corrupt session file (invalid JSON found) ", ex, ex.stack);
// File is corrupted, try next file
corrupted = true;
} finally {

View File

@ -368,24 +368,31 @@ function test() {
browserWindowsCount([0, 1], "browser windows while running testOpenCloseRestoreFromPopup");
newWin = undoCloseWindow(0);
newWin.addEventListener("load", function whenloaded() {
newWin.removeEventListener("load", whenloaded, false);
whenNewWindowLoaded({}, function (newWin2) {
is(newWin2.gBrowser.browsers.length, 1,
"Did not restore, as undoCloseWindow() was last called");
is(TEST_URLS.indexOf(newWin2.gBrowser.browsers[0].currentURI.spec), -1,
"Did not restore, as undoCloseWindow() was last called (2)");
newWin.gBrowser.tabContainer.addEventListener("SSTabRestored", function whenSSTabRestored() {
newWin.gBrowser.tabContainer.removeEventListener("SSTabRestored", whenSSTabRestored, false);
browserWindowsCount([2, 3], "browser windows while running testOpenCloseRestoreFromPopup");
whenNewWindowLoaded({}, function (newWin2) {
is(newWin2.gBrowser.browsers.length, 1,
"Did not restore, as undoCloseWindow() was last called");
is(TEST_URLS.indexOf(newWin2.gBrowser.browsers[0].currentURI.spec), -1,
"Did not restore, as undoCloseWindow() was last called (2)");
// Cleanup
newWin.close();
newWin2.close();
browserWindowsCount([2, 3], "browser windows while running testOpenCloseRestoreFromPopup");
browserWindowsCount([0, 1], "browser windows while running testOpenCloseRestoreFromPopup");
// Cleanup
newWin.close();
newWin2.close();
// Next please
executeSoon(nextFn);
});
browserWindowsCount([0, 1], "browser windows while running testOpenCloseRestoreFromPopup");
// Next please
executeSoon(nextFn);
});
}, false);
}, false);
});
});
}

View File

@ -30,7 +30,6 @@ add_task(function* init() {
});
add_task(function* test_creation() {
let OLD_BACKUP = Path.join(Constants.Path.profileDir, "sessionstore.bak");
let OLD_UPGRADE_BACKUP = Path.join(Constants.Path.profileDir, "sessionstore.bak-0000000");
@ -115,6 +114,27 @@ add_task(function* test_recovery() {
yield File.writeAtomic(Paths.recoveryBackup, SOURCE);
yield File.writeAtomic(Paths.recovery, "<Invalid JSON>");
is((yield SessionFile.read()).source, SOURCE, "Recovered the correct source from the recovery file");
yield SessionFile.wipe();
});
add_task(function* test_recovery_inaccessible() {
// Can't do chmod() on non-UNIX platforms, we need that for this test.
if (AppConstants.platform != "macosx" && AppConstants.platform != "linux") {
return;
}
info("Making recovery file inaccessible, attempting to recover from recovery backup");
let SOURCE_RECOVERY = yield promiseSource("Paths.recovery");
let SOURCE = yield promiseSource("Paths.recoveryBackup");
yield File.makeDir(Paths.backups);
yield File.writeAtomic(Paths.recoveryBackup, SOURCE);
// Write a valid recovery file but make it inaccessible.
yield File.writeAtomic(Paths.recovery, SOURCE_RECOVERY);
yield File.setPermissions(Paths.recovery, { unixMode: 0 });
is((yield SessionFile.read()).source, SOURCE, "Recovered the correct source from the recovery file");
yield File.setPermissions(Paths.recovery, { unixMode: 0644 });
});
add_task(function* test_clean() {

View File

@ -8,14 +8,14 @@ const TEST_URI = "data:text/html;charset=utf-8,<p>Web Console test for notificat
let test = asyncTest(function* () {
yield loadTab(TEST_URI);
let gotEvents = waitForEvents();
let hud = yield openConsole();
let consoleOpened = promise.defer();
let gotEvents = waitForEvents(consoleOpened.promise);
let hud = yield openConsole().then(() => consoleOpened.resolve());
yield gotEvents;
});
function waitForEvents() {
function waitForEvents(onConsoleOpened) {
let deferred = promise.defer();
function webConsoleCreated(aID)
@ -37,7 +37,7 @@ function waitForEvents() {
Services.obs.removeObserver(observer, "web-console-message-created");
ok(aID, "we have a console ID");
is(typeof aNodeID, "string", "message node id is a string");
executeSoon(closeConsole);
onConsoleOpened.then(closeConsole);
}
let observer = {

View File

@ -15,6 +15,7 @@
#include "nsEscape.h"
#include "nsNetUtil.h"
#include "nsString.h"
#include "nsQueryObject.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/dom/URL.h"

View File

@ -14,6 +14,7 @@
#include "nsIDOMWindow.h"
#include "nsNetUtil.h"
#include "nsAutoPtr.h"
#include "nsQueryObject.h"
#include "nsIHttpChannel.h"
#include "nsIScriptSecurityManager.h"
#include "nsError.h"

View File

@ -59,6 +59,7 @@
#include "nsContentPolicyUtils.h" // NS_CheckContentLoadPolicy(...)
#include "nsISeekableStream.h"
#include "nsAutoPtr.h"
#include "nsQueryObject.h"
#include "nsIWritablePropertyBag2.h"
#include "nsIAppShell.h"
#include "nsWidgetsCID.h"

View File

@ -37,10 +37,6 @@ using mozilla::dom::NodeInfo;
NodeInfo::~NodeInfo()
{
mOwnerManager->RemoveNodeInfo(this);
NS_RELEASE(mInner.mName);
NS_IF_RELEASE(mInner.mPrefix);
NS_IF_RELEASE(mInner.mExtraName);
}
NodeInfo::NodeInfo(nsIAtom *aName, nsIAtom *aPrefix, int32_t aNamespaceID,
@ -51,12 +47,12 @@ NodeInfo::NodeInfo(nsIAtom *aName, nsIAtom *aPrefix, int32_t aNamespaceID,
MOZ_ASSERT(aOwnerManager, "Invalid aOwnerManager");
// Initialize mInner
NS_ADDREF(mInner.mName = aName);
NS_IF_ADDREF(mInner.mPrefix = aPrefix);
mInner.mName = aName;
mInner.mPrefix = aPrefix;
mInner.mNamespaceID = aNamespaceID;
mInner.mNodeType = aNodeType;
mOwnerManager = aOwnerManager;
NS_IF_ADDREF(mInner.mExtraName = aExtraName);
mInner.mExtraName = aExtraName;
mDocument = aOwnerManager->GetDocument();

View File

@ -26,8 +26,8 @@
#include "mozilla/dom/NameSpaceConstants.h"
#include "nsStringGlue.h"
#include "mozilla/Attributes.h"
#include "nsIAtom.h"
class nsIAtom;
class nsIDocument;
class nsNodeInfoManager;
@ -263,14 +263,12 @@ protected:
{
}
// These atoms hold pointers to nsGkAtoms members, and are therefore safe
// as a non-owning reference.
nsIAtom* MOZ_NON_OWNING_REF mName;
nsIAtom* MOZ_NON_OWNING_REF mPrefix;
nsCOMPtr<nsIAtom> mName;
nsCOMPtr<nsIAtom> mPrefix;
int32_t mNamespaceID;
uint16_t mNodeType; // As defined by nsIDOMNode.nodeType
const nsAString* mNameString;
nsIAtom* MOZ_NON_OWNING_REF mExtraName; // Only used by PIs and DocTypes
nsCOMPtr<nsIAtom> mExtraName; // Only used by PIs and DocTypes
};
// nsNodeInfoManager needs to pass mInner to the hash table.

View File

@ -115,6 +115,7 @@
#include "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsIDOMWindowUtils.h"
#include "nsIDOMXULCommandEvent.h"
#include "nsIDragService.h"
#include "nsIEditor.h"
@ -7391,3 +7392,300 @@ nsContentUtils::GetSurfaceData(mozilla::gfx::DataSourceSurface* aSurface,
aSurface->Unmap();
return surfaceData;
}
mozilla::Modifiers
nsContentUtils::GetWidgetModifiers(int32_t aModifiers)
{
Modifiers result = 0;
if (aModifiers & nsIDOMWindowUtils::MODIFIER_SHIFT) {
result |= mozilla::MODIFIER_SHIFT;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_CONTROL) {
result |= mozilla::MODIFIER_CONTROL;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_ALT) {
result |= mozilla::MODIFIER_ALT;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_META) {
result |= mozilla::MODIFIER_META;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_ALTGRAPH) {
result |= mozilla::MODIFIER_ALTGRAPH;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_CAPSLOCK) {
result |= mozilla::MODIFIER_CAPSLOCK;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_FN) {
result |= mozilla::MODIFIER_FN;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_FNLOCK) {
result |= mozilla::MODIFIER_FNLOCK;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_NUMLOCK) {
result |= mozilla::MODIFIER_NUMLOCK;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_SCROLLLOCK) {
result |= mozilla::MODIFIER_SCROLLLOCK;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_SYMBOL) {
result |= mozilla::MODIFIER_SYMBOL;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_SYMBOLLOCK) {
result |= mozilla::MODIFIER_SYMBOLLOCK;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_OS) {
result |= mozilla::MODIFIER_OS;
}
return result;
}
nsIWidget*
nsContentUtils::GetWidget(nsIPresShell* aPresShell, nsPoint* aOffset) {
if (aPresShell) {
nsIFrame* frame = aPresShell->GetRootFrame();
if (frame)
return frame->GetView()->GetNearestWidget(aOffset);
}
return nullptr;
}
int16_t
nsContentUtils::GetButtonsFlagForButton(int32_t aButton)
{
switch (aButton) {
case WidgetMouseEvent::eLeftButton:
return WidgetMouseEvent::eLeftButtonFlag;
case WidgetMouseEvent::eMiddleButton:
return WidgetMouseEvent::eMiddleButtonFlag;
case WidgetMouseEvent::eRightButton:
return WidgetMouseEvent::eRightButtonFlag;
case 4:
return WidgetMouseEvent::e4thButtonFlag;
case 5:
return WidgetMouseEvent::e5thButtonFlag;
default:
NS_ERROR("Button not known.");
return 0;
}
}
LayoutDeviceIntPoint
nsContentUtils::ToWidgetPoint(const CSSPoint& aPoint,
const nsPoint& aOffset,
nsPresContext* aPresContext)
{
return LayoutDeviceIntPoint::FromAppUnitsRounded(
CSSPoint::ToAppUnits(aPoint) + aOffset,
aPresContext->AppUnitsPerDevPixel());
}
nsView*
nsContentUtils::GetViewToDispatchEvent(nsPresContext* presContext,
nsIPresShell** presShell)
{
if (presContext && presShell) {
*presShell = presContext->PresShell();
if (*presShell) {
NS_ADDREF(*presShell);
if (nsViewManager* viewManager = (*presShell)->GetViewManager()) {
if (nsView* view = viewManager->GetRootView()) {
return view;
}
}
}
}
return nullptr;
}
nsresult
nsContentUtils::SendKeyEvent(nsCOMPtr<nsIWidget> aWidget,
const nsAString& aType,
int32_t aKeyCode,
int32_t aCharCode,
int32_t aModifiers,
uint32_t aAdditionalFlags,
bool* aDefaultActionTaken)
{
// get the widget to send the event to
if (!aWidget)
return NS_ERROR_FAILURE;
int32_t msg;
if (aType.EqualsLiteral("keydown"))
msg = NS_KEY_DOWN;
else if (aType.EqualsLiteral("keyup"))
msg = NS_KEY_UP;
else if (aType.EqualsLiteral("keypress"))
msg = NS_KEY_PRESS;
else
return NS_ERROR_FAILURE;
WidgetKeyboardEvent event(true, msg, aWidget);
event.modifiers = GetWidgetModifiers(aModifiers);
if (msg == NS_KEY_PRESS) {
event.keyCode = aCharCode ? 0 : aKeyCode;
event.charCode = aCharCode;
} else {
event.keyCode = aKeyCode;
event.charCode = 0;
}
uint32_t locationFlag = (aAdditionalFlags &
(nsIDOMWindowUtils::KEY_FLAG_LOCATION_STANDARD | nsIDOMWindowUtils::KEY_FLAG_LOCATION_LEFT |
nsIDOMWindowUtils::KEY_FLAG_LOCATION_RIGHT | nsIDOMWindowUtils::KEY_FLAG_LOCATION_NUMPAD));
switch (locationFlag) {
case nsIDOMWindowUtils::KEY_FLAG_LOCATION_STANDARD:
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
break;
case nsIDOMWindowUtils::KEY_FLAG_LOCATION_LEFT:
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
break;
case nsIDOMWindowUtils::KEY_FLAG_LOCATION_RIGHT:
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT;
break;
case nsIDOMWindowUtils::KEY_FLAG_LOCATION_NUMPAD:
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
break;
default:
if (locationFlag != 0) {
return NS_ERROR_INVALID_ARG;
}
// If location flag isn't set, choose the location from keycode.
switch (aKeyCode) {
case nsIDOMKeyEvent::DOM_VK_NUMPAD0:
case nsIDOMKeyEvent::DOM_VK_NUMPAD1:
case nsIDOMKeyEvent::DOM_VK_NUMPAD2:
case nsIDOMKeyEvent::DOM_VK_NUMPAD3:
case nsIDOMKeyEvent::DOM_VK_NUMPAD4:
case nsIDOMKeyEvent::DOM_VK_NUMPAD5:
case nsIDOMKeyEvent::DOM_VK_NUMPAD6:
case nsIDOMKeyEvent::DOM_VK_NUMPAD7:
case nsIDOMKeyEvent::DOM_VK_NUMPAD8:
case nsIDOMKeyEvent::DOM_VK_NUMPAD9:
case nsIDOMKeyEvent::DOM_VK_MULTIPLY:
case nsIDOMKeyEvent::DOM_VK_ADD:
case nsIDOMKeyEvent::DOM_VK_SEPARATOR:
case nsIDOMKeyEvent::DOM_VK_SUBTRACT:
case nsIDOMKeyEvent::DOM_VK_DECIMAL:
case nsIDOMKeyEvent::DOM_VK_DIVIDE:
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
break;
case nsIDOMKeyEvent::DOM_VK_SHIFT:
case nsIDOMKeyEvent::DOM_VK_CONTROL:
case nsIDOMKeyEvent::DOM_VK_ALT:
case nsIDOMKeyEvent::DOM_VK_META:
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
break;
default:
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
break;
}
break;
}
event.refPoint.x = event.refPoint.y = 0;
event.time = PR_IntervalNow();
if (!(aAdditionalFlags & nsIDOMWindowUtils::KEY_FLAG_NOT_SYNTHESIZED_FOR_TESTS)) {
event.mFlags.mIsSynthesizedForTests = true;
}
if (aAdditionalFlags & nsIDOMWindowUtils::KEY_FLAG_PREVENT_DEFAULT) {
event.mFlags.mDefaultPrevented = true;
}
nsEventStatus status;
nsresult rv = aWidget->DispatchEvent(&event, status);
NS_ENSURE_SUCCESS(rv, rv);
*aDefaultActionTaken = (status != nsEventStatus_eConsumeNoDefault);
return NS_OK;
}
nsresult
nsContentUtils::SendMouseEvent(nsCOMPtr<nsIPresShell> aPresShell,
const nsAString& aType,
float aX,
float aY,
int32_t aButton,
int32_t aClickCount,
int32_t aModifiers,
bool aIgnoreRootScrollFrame,
float aPressure,
unsigned short aInputSourceArg,
bool aToWindow,
bool *aPreventDefault,
bool aIsSynthesized)
{
nsPoint offset;
nsCOMPtr<nsIWidget> widget = GetWidget(aPresShell, &offset);
if (!widget)
return NS_ERROR_FAILURE;
int32_t msg;
bool contextMenuKey = false;
if (aType.EqualsLiteral("mousedown"))
msg = NS_MOUSE_BUTTON_DOWN;
else if (aType.EqualsLiteral("mouseup"))
msg = NS_MOUSE_BUTTON_UP;
else if (aType.EqualsLiteral("mousemove"))
msg = NS_MOUSE_MOVE;
else if (aType.EqualsLiteral("mouseover"))
msg = NS_MOUSE_ENTER;
else if (aType.EqualsLiteral("mouseout"))
msg = NS_MOUSE_EXIT;
else if (aType.EqualsLiteral("contextmenu")) {
msg = NS_CONTEXTMENU;
contextMenuKey = (aButton == 0);
} else if (aType.EqualsLiteral("MozMouseHittest"))
msg = NS_MOUSE_MOZHITTEST;
else
return NS_ERROR_FAILURE;
if (aInputSourceArg == nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN) {
aInputSourceArg = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE;
}
WidgetMouseEvent event(true, msg, widget, WidgetMouseEvent::eReal,
contextMenuKey ? WidgetMouseEvent::eContextMenuKey :
WidgetMouseEvent::eNormal);
event.modifiers = GetWidgetModifiers(aModifiers);
event.button = aButton;
event.buttons = GetButtonsFlagForButton(aButton);
event.widget = widget;
event.pressure = aPressure;
event.inputSource = aInputSourceArg;
event.clickCount = aClickCount;
event.time = PR_IntervalNow();
event.mFlags.mIsSynthesizedForTests = aIsSynthesized;
nsPresContext* presContext = aPresShell->GetPresContext();
if (!presContext)
return NS_ERROR_FAILURE;
event.refPoint = ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
event.ignoreRootScrollFrame = aIgnoreRootScrollFrame;
nsEventStatus status = nsEventStatus_eIgnore;
if (aToWindow) {
nsCOMPtr<nsIPresShell> presShell;
nsView* view = GetViewToDispatchEvent(presContext, getter_AddRefs(presShell));
if (!presShell || !view) {
return NS_ERROR_FAILURE;
}
return presShell->HandleEvent(view->GetFrame(), &event, false, &status);
}
if (gfxPrefs::TestEventsAsyncEnabled()) {
status = widget->DispatchInputEvent(&event);
} else {
nsresult rv = widget->DispatchEvent(&event, status);
NS_ENSURE_SUCCESS(rv, rv);
}
if (aPreventDefault) {
*aPreventDefault = (status == nsEventStatus_eConsumeNoDefault);
}
return NS_OK;
}

View File

@ -100,6 +100,7 @@ class nsScriptObjectTracer;
class nsStringBuffer;
class nsStringHashKey;
class nsTextFragment;
class nsView;
class nsViewportInfo;
class nsWrapperCache;
class nsAttrValue;
@ -2316,6 +2317,47 @@ public:
static mozilla::UniquePtr<char[]> GetSurfaceData(mozilla::gfx::DataSourceSurface* aSurface,
size_t* aLength, int32_t* aStride);
// Helpers shared by the implementations of nsContentUtils methods and
// nsIDOMWindowUtils methods.
static mozilla::Modifiers GetWidgetModifiers(int32_t aModifiers);
static nsIWidget* GetWidget(nsIPresShell* aPresShell, nsPoint* aOffset);
static int16_t GetButtonsFlagForButton(int32_t aButton);
static mozilla::LayoutDeviceIntPoint ToWidgetPoint(const mozilla::CSSPoint& aPoint,
const nsPoint& aOffset,
nsPresContext* aPresContext);
static nsView* GetViewToDispatchEvent(nsPresContext* aPresContext,
nsIPresShell** aPresShell);
/**
* Synthesize a key event to the given widget
* (see nsIDOMWindowUtils.sendKeyEvent).
*/
static nsresult SendKeyEvent(nsCOMPtr<nsIWidget> aWidget,
const nsAString& aType,
int32_t aKeyCode,
int32_t aCharCode,
int32_t aModifiers,
uint32_t aAdditionalFlags,
bool* aDefaultActionTaken);
/**
* Synthesize a mouse event to the given widget
* (see nsIDOMWindowUtils.sendMouseEvent).
*/
static nsresult SendMouseEvent(nsCOMPtr<nsIPresShell> aPresShell,
const nsAString& aType,
float aX,
float aY,
int32_t aButton,
int32_t aClickCount,
int32_t aModifiers,
bool aIgnoreRootScrollFrame,
float aPressure,
unsigned short aInputSourceArg,
bool aToWindow,
bool *aPreventDefault,
bool aIsSynthesized);
private:
static bool InitializeEventTable();

View File

@ -24,6 +24,7 @@
#include "nsFrame.h"
#include "mozilla/layers/ShadowLayers.h"
#include "ClientLayerManager.h"
#include "nsQueryObject.h"
#include "nsIScrollableFrame.h"
@ -591,53 +592,6 @@ nsDOMWindowUtils::GetPresShellId(uint32_t *aPresShellId)
return NS_ERROR_FAILURE;
}
/* static */
mozilla::Modifiers
nsDOMWindowUtils::GetWidgetModifiers(int32_t aModifiers)
{
Modifiers result = 0;
if (aModifiers & nsIDOMWindowUtils::MODIFIER_SHIFT) {
result |= mozilla::MODIFIER_SHIFT;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_CONTROL) {
result |= mozilla::MODIFIER_CONTROL;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_ALT) {
result |= mozilla::MODIFIER_ALT;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_META) {
result |= mozilla::MODIFIER_META;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_ALTGRAPH) {
result |= mozilla::MODIFIER_ALTGRAPH;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_CAPSLOCK) {
result |= mozilla::MODIFIER_CAPSLOCK;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_FN) {
result |= mozilla::MODIFIER_FN;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_FNLOCK) {
result |= mozilla::MODIFIER_FNLOCK;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_NUMLOCK) {
result |= mozilla::MODIFIER_NUMLOCK;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_SCROLLLOCK) {
result |= mozilla::MODIFIER_SCROLLLOCK;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_SYMBOL) {
result |= mozilla::MODIFIER_SYMBOL;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_SYMBOLLOCK) {
result |= mozilla::MODIFIER_SYMBOLLOCK;
}
if (aModifiers & nsIDOMWindowUtils::MODIFIER_OS) {
result |= mozilla::MODIFIER_OS;
}
return result;
}
NS_IMETHODIMP
nsDOMWindowUtils::SendMouseEvent(const nsAString& aType,
float aX,
@ -680,52 +634,6 @@ nsDOMWindowUtils::SendMouseEventToWindow(const nsAString& aType,
aOptionalArgCount >= 4 ? aIsSynthesized : true);
}
static LayoutDeviceIntPoint
ToWidgetPoint(const CSSPoint& aPoint, const nsPoint& aOffset,
nsPresContext* aPresContext)
{
return LayoutDeviceIntPoint::FromAppUnitsRounded(
CSSPoint::ToAppUnits(aPoint) + aOffset,
aPresContext->AppUnitsPerDevPixel());
}
static inline int16_t
GetButtonsFlagForButton(int32_t aButton)
{
switch (aButton) {
case WidgetMouseEvent::eLeftButton:
return WidgetMouseEvent::eLeftButtonFlag;
case WidgetMouseEvent::eMiddleButton:
return WidgetMouseEvent::eMiddleButtonFlag;
case WidgetMouseEvent::eRightButton:
return WidgetMouseEvent::eRightButtonFlag;
case 4:
return WidgetMouseEvent::e4thButtonFlag;
case 5:
return WidgetMouseEvent::e5thButtonFlag;
default:
NS_ERROR("Button not known.");
return 0;
}
}
nsView*
nsDOMWindowUtils::GetViewToDispatchEvent(nsPresContext* presContext, nsIPresShell** presShell)
{
if (presContext && presShell) {
*presShell = presContext->PresShell();
if (*presShell) {
NS_ADDREF(*presShell);
if (nsViewManager* viewManager = (*presShell)->GetViewManager()) {
if (nsView* view = viewManager->GetRootView()) {
return view;
}
}
}
}
return nullptr;
}
NS_IMETHODIMP
nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType,
float aX,
@ -742,76 +650,10 @@ nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType,
{
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
// get the widget to send the event to
nsPoint offset;
nsCOMPtr<nsIWidget> widget = GetWidget(&offset);
if (!widget)
return NS_ERROR_FAILURE;
int32_t msg;
bool contextMenuKey = false;
if (aType.EqualsLiteral("mousedown"))
msg = NS_MOUSE_BUTTON_DOWN;
else if (aType.EqualsLiteral("mouseup"))
msg = NS_MOUSE_BUTTON_UP;
else if (aType.EqualsLiteral("mousemove"))
msg = NS_MOUSE_MOVE;
else if (aType.EqualsLiteral("mouseover"))
msg = NS_MOUSE_ENTER;
else if (aType.EqualsLiteral("mouseout"))
msg = NS_MOUSE_EXIT;
else if (aType.EqualsLiteral("contextmenu")) {
msg = NS_CONTEXTMENU;
contextMenuKey = (aButton == 0);
} else if (aType.EqualsLiteral("MozMouseHittest"))
msg = NS_MOUSE_MOZHITTEST;
else
return NS_ERROR_FAILURE;
if (aInputSourceArg == nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN) {
aInputSourceArg = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE;
}
WidgetMouseEvent event(true, msg, widget, WidgetMouseEvent::eReal,
contextMenuKey ? WidgetMouseEvent::eContextMenuKey :
WidgetMouseEvent::eNormal);
event.modifiers = GetWidgetModifiers(aModifiers);
event.button = aButton;
event.buttons = GetButtonsFlagForButton(aButton);
event.widget = widget;
event.pressure = aPressure;
event.inputSource = aInputSourceArg;
event.clickCount = aClickCount;
event.time = PR_IntervalNow();
event.mFlags.mIsSynthesizedForTests = aIsSynthesized;
nsPresContext* presContext = GetPresContext();
if (!presContext)
return NS_ERROR_FAILURE;
event.refPoint = ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
event.ignoreRootScrollFrame = aIgnoreRootScrollFrame;
nsEventStatus status = nsEventStatus_eIgnore;
if (aToWindow) {
nsCOMPtr<nsIPresShell> presShell;
nsView* view = GetViewToDispatchEvent(presContext, getter_AddRefs(presShell));
if (!presShell || !view) {
return NS_ERROR_FAILURE;
}
return presShell->HandleEvent(view->GetFrame(), &event, false, &status);
}
if (gfxPrefs::TestEventsAsyncEnabled()) {
status = widget->DispatchInputEvent(&event);
} else {
nsresult rv = widget->DispatchEvent(&event, status);
NS_ENSURE_SUCCESS(rv, rv);
}
if (aPreventDefault) {
*aPreventDefault = (status == nsEventStatus_eConsumeNoDefault);
}
return NS_OK;
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
return nsContentUtils::SendMouseEvent(presShell, aType, aX, aY, aButton,
aClickCount, aModifiers, aIgnoreRootScrollFrame, aPressure,
aInputSourceArg, aToWindow, aPreventDefault, aIsSynthesized);
}
NS_IMETHODIMP
@ -864,9 +706,9 @@ nsDOMWindowUtils::SendPointerEventCommon(const nsAString& aType,
}
WidgetPointerEvent event(true, msg, widget);
event.modifiers = GetWidgetModifiers(aModifiers);
event.modifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
event.button = aButton;
event.buttons = GetButtonsFlagForButton(aButton);
event.buttons = nsContentUtils::GetButtonsFlagForButton(aButton);
event.widget = widget;
event.pressure = aPressure;
event.inputSource = aInputSourceArg;
@ -885,13 +727,13 @@ nsDOMWindowUtils::SendPointerEventCommon(const nsAString& aType,
return NS_ERROR_FAILURE;
}
event.refPoint = ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
event.refPoint = nsContentUtils::ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
event.ignoreRootScrollFrame = aIgnoreRootScrollFrame;
nsEventStatus status;
if (aToWindow) {
nsCOMPtr<nsIPresShell> presShell;
nsView* view = GetViewToDispatchEvent(presContext, getter_AddRefs(presShell));
nsView* view = nsContentUtils::GetViewToDispatchEvent(presContext, getter_AddRefs(presShell));
if (!presShell || !view) {
return NS_ERROR_FAILURE;
}
@ -989,7 +831,7 @@ nsDOMWindowUtils::SendWheelEvent(float aX,
}
WidgetWheelEvent wheelEvent(true, NS_WHEEL_WHEEL, widget);
wheelEvent.modifiers = GetWidgetModifiers(aModifiers);
wheelEvent.modifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
wheelEvent.deltaX = aDeltaX;
wheelEvent.deltaY = aDeltaY;
wheelEvent.deltaZ = aDeltaZ;
@ -1009,7 +851,7 @@ nsDOMWindowUtils::SendWheelEvent(float aX,
nsPresContext* presContext = GetPresContext();
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
wheelEvent.refPoint = ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
wheelEvent.refPoint = nsContentUtils::ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
widget->DispatchAPZAwareEvent(&wheelEvent);
@ -1136,7 +978,7 @@ nsDOMWindowUtils::SendTouchEventCommon(const nsAString& aType,
return NS_ERROR_UNEXPECTED;
}
WidgetTouchEvent event(true, msg, widget);
event.modifiers = GetWidgetModifiers(aModifiers);
event.modifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
event.widget = widget;
event.time = PR_Now();
@ -1147,7 +989,7 @@ nsDOMWindowUtils::SendTouchEventCommon(const nsAString& aType,
event.touches.SetCapacity(aCount);
for (uint32_t i = 0; i < aCount; ++i) {
LayoutDeviceIntPoint pt =
ToWidgetPoint(CSSPoint(aXs[i], aYs[i]), offset, presContext);
nsContentUtils::ToWidgetPoint(CSSPoint(aXs[i], aYs[i]), offset, presContext);
nsRefPtr<Touch> t = new Touch(aIdentifiers[i],
pt,
nsIntPoint(aRxs[i], aRys[i]),
@ -1159,7 +1001,7 @@ nsDOMWindowUtils::SendTouchEventCommon(const nsAString& aType,
nsEventStatus status;
if (aToWindow) {
nsCOMPtr<nsIPresShell> presShell;
nsView* view = GetViewToDispatchEvent(presContext, getter_AddRefs(presShell));
nsView* view = nsContentUtils::GetViewToDispatchEvent(presContext, getter_AddRefs(presShell));
if (!presShell || !view) {
return NS_ERROR_FAILURE;
}
@ -1185,100 +1027,10 @@ nsDOMWindowUtils::SendKeyEvent(const nsAString& aType,
// get the widget to send the event to
nsCOMPtr<nsIWidget> widget = GetWidget();
if (!widget)
return NS_ERROR_FAILURE;
int32_t msg;
if (aType.EqualsLiteral("keydown"))
msg = NS_KEY_DOWN;
else if (aType.EqualsLiteral("keyup"))
msg = NS_KEY_UP;
else if (aType.EqualsLiteral("keypress"))
msg = NS_KEY_PRESS;
else
return NS_ERROR_FAILURE;
WidgetKeyboardEvent event(true, msg, widget);
event.modifiers = GetWidgetModifiers(aModifiers);
if (msg == NS_KEY_PRESS) {
event.keyCode = aCharCode ? 0 : aKeyCode;
event.charCode = aCharCode;
} else {
event.keyCode = aKeyCode;
event.charCode = 0;
}
uint32_t locationFlag = (aAdditionalFlags &
(KEY_FLAG_LOCATION_STANDARD | KEY_FLAG_LOCATION_LEFT |
KEY_FLAG_LOCATION_RIGHT | KEY_FLAG_LOCATION_NUMPAD));
switch (locationFlag) {
case KEY_FLAG_LOCATION_STANDARD:
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
break;
case KEY_FLAG_LOCATION_LEFT:
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
break;
case KEY_FLAG_LOCATION_RIGHT:
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT;
break;
case KEY_FLAG_LOCATION_NUMPAD:
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
break;
default:
if (locationFlag != 0) {
return NS_ERROR_INVALID_ARG;
}
// If location flag isn't set, choose the location from keycode.
switch (aKeyCode) {
case nsIDOMKeyEvent::DOM_VK_NUMPAD0:
case nsIDOMKeyEvent::DOM_VK_NUMPAD1:
case nsIDOMKeyEvent::DOM_VK_NUMPAD2:
case nsIDOMKeyEvent::DOM_VK_NUMPAD3:
case nsIDOMKeyEvent::DOM_VK_NUMPAD4:
case nsIDOMKeyEvent::DOM_VK_NUMPAD5:
case nsIDOMKeyEvent::DOM_VK_NUMPAD6:
case nsIDOMKeyEvent::DOM_VK_NUMPAD7:
case nsIDOMKeyEvent::DOM_VK_NUMPAD8:
case nsIDOMKeyEvent::DOM_VK_NUMPAD9:
case nsIDOMKeyEvent::DOM_VK_MULTIPLY:
case nsIDOMKeyEvent::DOM_VK_ADD:
case nsIDOMKeyEvent::DOM_VK_SEPARATOR:
case nsIDOMKeyEvent::DOM_VK_SUBTRACT:
case nsIDOMKeyEvent::DOM_VK_DECIMAL:
case nsIDOMKeyEvent::DOM_VK_DIVIDE:
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
break;
case nsIDOMKeyEvent::DOM_VK_SHIFT:
case nsIDOMKeyEvent::DOM_VK_CONTROL:
case nsIDOMKeyEvent::DOM_VK_ALT:
case nsIDOMKeyEvent::DOM_VK_META:
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
break;
default:
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
break;
}
break;
}
event.refPoint.x = event.refPoint.y = 0;
event.time = PR_IntervalNow();
if (!(aAdditionalFlags & KEY_FLAG_NOT_SYNTHESIZED_FOR_TESTS)) {
event.mFlags.mIsSynthesizedForTests = true;
}
if (aAdditionalFlags & KEY_FLAG_PREVENT_DEFAULT) {
event.mFlags.mDefaultPrevented = true;
}
nsEventStatus status;
nsresult rv = widget->DispatchEvent(&event, status);
NS_ENSURE_SUCCESS(rv, rv);
*aDefaultActionTaken = (status != nsEventStatus_eConsumeNoDefault);
return NS_OK;
return nsContentUtils::SendKeyEvent(widget, aType, aKeyCode, aCharCode,
aModifiers, aAdditionalFlags,
aDefaultActionTaken);
}
NS_IMETHODIMP
@ -1451,11 +1203,7 @@ nsDOMWindowUtils::GetWidget(nsPoint* aOffset)
nsIDocShell *docShell = window->GetDocShell();
if (docShell) {
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
if (presShell) {
nsIFrame* frame = presShell->GetRootFrame();
if (frame)
return frame->GetView()->GetNearestWidget(aOffset);
}
return nsContentUtils::GetWidget(presShell, aOffset);
}
}
@ -1587,7 +1335,7 @@ nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType,
return NS_ERROR_FAILURE;
WidgetSimpleGestureEvent event(true, msg, widget);
event.modifiers = GetWidgetModifiers(aModifiers);
event.modifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
event.direction = aDirection;
event.delta = aDelta;
event.clickCount = aClickCount;
@ -1597,7 +1345,7 @@ nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType,
if (!presContext)
return NS_ERROR_FAILURE;
event.refPoint = ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
event.refPoint = nsContentUtils::ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
nsEventStatus status;
return widget->DispatchEvent(&event, status);
@ -3386,7 +3134,7 @@ nsDOMWindowUtils::SelectAtPoint(float aX, float aY, uint32_t aSelectBehavior,
nsPoint offset;
nsCOMPtr<nsIWidget> widget = GetWidget(&offset);
LayoutDeviceIntPoint pt =
ToWidgetPoint(CSSPoint(aX, aY), offset, GetPresContext());
nsContentUtils::ToWidgetPoint(CSSPoint(aX, aY), offset, GetPresContext());
nsPoint ptInRoot =
nsLayoutUtils::GetEventCoordinatesRelativeTo(widget, pt, rootFrame);
nsIFrame* targetFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, ptInRoot);

View File

@ -81,8 +81,6 @@ protected:
nsIDocument* GetDocument();
mozilla::layers::LayerTransactionChild* GetLayerTransaction();
nsView* GetViewToDispatchEvent(nsPresContext* presContext, nsIPresShell** presShell);
NS_IMETHOD SendMouseEventCommon(const nsAString& aType,
float aX,
float aY,
@ -129,8 +127,6 @@ protected:
bool aIgnoreRootScrollFrame,
bool aToWindow,
bool* aPreventDefault);
static mozilla::Modifiers GetWidgetModifiers(int32_t aModifiers);
};
#endif

View File

@ -35,6 +35,7 @@
#include "nsDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsCOMArray.h"
#include "nsQueryObject.h"
#include "nsDOMClassInfo.h"
#include "mozilla/Services.h"

View File

@ -44,6 +44,7 @@
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "nsPrintfCString.h"
#include "nsXULAppAPI.h"
#include "nsQueryObject.h"
#include <algorithm>
#ifdef ANDROID

View File

@ -120,6 +120,7 @@
#include "nsIControllerContext.h"
#include "nsGlobalWindowCommands.h"
#include "nsAutoPtr.h"
#include "nsQueryObject.h"
#include "nsContentUtils.h"
#include "nsCSSProps.h"
#include "nsIDOMFileList.h"
@ -501,7 +502,9 @@ public:
private:
~nsGlobalWindowObserver() {}
nsGlobalWindow* mWindow;
// This reference is non-owning and safe because it's cleared by
// nsGlobalWindow::CleanUp().
nsGlobalWindow* MOZ_NON_OWNING_REF mWindow;
};
NS_IMPL_ISUPPORTS(nsGlobalWindowObserver, nsIObserver, nsIInterfaceRequestor)
@ -1143,7 +1146,6 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
mObserver = new nsGlobalWindowObserver(this);
if (mObserver) {
NS_ADDREF(mObserver);
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
if (os) {
// Watch for online/offline status changes so we can fire events. Use
@ -1163,8 +1165,6 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
// remain frozen until they get an inner window, so freeze this
// outer window here.
Freeze();
mObserver = nullptr;
}
// We could have failed the first time through trying
@ -1462,7 +1462,6 @@ nsGlobalWindow::CleanUp()
// Drop its reference to this dying window, in case for some bogus reason
// the object stays around.
mObserver->Forget();
NS_RELEASE(mObserver);
}
if (mNavigator) {

View File

@ -1625,7 +1625,7 @@ protected:
nsRefPtr<nsDOMWindowUtils> mWindowUtils;
nsString mStatus;
nsString mDefaultStatus;
nsGlobalWindowObserver* mObserver; // Inner windows only.
nsRefPtr<nsGlobalWindowObserver> mObserver; // Inner windows only.
nsRefPtr<mozilla::dom::Crypto> mCrypto;
nsRefPtr<mozilla::dom::cache::CacheStorage> mCacheStorage;
nsRefPtr<mozilla::dom::Console> mConsole;

View File

@ -30,6 +30,7 @@
#include "nsUnicharInputStream.h"
#include "nsContentUtils.h"
#include "nsStyleUtil.h"
#include "nsQueryObject.h"
using namespace mozilla;
using namespace mozilla::dom;

View File

@ -23,6 +23,7 @@
#include "nsContentUtils.h"
#include "nsIParserUtils.h"
#include "nsIDocument.h"
#include "nsQueryObject.h"
using namespace mozilla;

View File

@ -14,6 +14,7 @@
#include "nsITelephonyService.h"
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "nsQueryObject.h"
USING_BLUETOOTH_NAMESPACE

View File

@ -0,0 +1,453 @@
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "BluetoothRilListener.h"
#include "BluetoothHfpManager.h"
#include "nsIIccService.h"
#include "nsIMobileConnectionInfo.h"
#include "nsIMobileConnectionService.h"
#include "nsITelephonyService.h"
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "nsQueryObject.h"
USING_BLUETOOTH_NAMESPACE
/**
* IccListener
*/
NS_IMPL_ISUPPORTS(IccListener, nsIIccListener)
NS_IMETHODIMP
IccListener::NotifyIccInfoChanged()
{
// mOwner would be set to nullptr only in the dtor of BluetoothRilListener
NS_ENSURE_TRUE(mOwner, NS_ERROR_FAILURE);
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
NS_ENSURE_TRUE(hfp, NS_ERROR_FAILURE);
hfp->HandleIccInfoChanged(mOwner->mClientId);
return NS_OK;
}
NS_IMETHODIMP
IccListener::NotifyStkCommand(const nsAString & aMessage)
{
return NS_OK;
}
NS_IMETHODIMP
IccListener::NotifyStkSessionEnd()
{
return NS_OK;
}
NS_IMETHODIMP
IccListener::NotifyCardStateChanged()
{
return NS_OK;
}
bool
IccListener::Listen(bool aStart)
{
NS_ENSURE_TRUE(mOwner, false);
nsCOMPtr<nsIIccService> service =
do_GetService(ICC_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(service, false);
nsCOMPtr<nsIIcc> icc;
service->GetIccByServiceId(mOwner->mClientId, getter_AddRefs(icc));
NS_ENSURE_TRUE(icc, false);
nsresult rv;
if (aStart) {
rv = icc->RegisterListener(this);
} else {
rv = icc->UnregisterListener(this);
}
return NS_SUCCEEDED(rv);
}
void
IccListener::SetOwner(BluetoothRilListener *aOwner)
{
mOwner = aOwner;
}
/**
* MobileConnectionListener
*/
NS_IMPL_ISUPPORTS(MobileConnectionListener, nsIMobileConnectionListener)
NS_IMETHODIMP
MobileConnectionListener::NotifyVoiceChanged()
{
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
NS_ENSURE_TRUE(hfp, NS_OK);
hfp->HandleVoiceConnectionChanged(mClientId);
return NS_OK;
}
NS_IMETHODIMP
MobileConnectionListener::NotifyDataChanged()
{
return NS_OK;
}
NS_IMETHODIMP
MobileConnectionListener::NotifyDataError(const nsAString & message)
{
return NS_OK;
}
NS_IMETHODIMP
MobileConnectionListener::NotifyCFStateChanged(uint16_t action,
uint16_t reason,
const nsAString& number,
uint16_t timeSeconds,
uint16_t serviceClass)
{
return NS_OK;
}
NS_IMETHODIMP
MobileConnectionListener::NotifyEmergencyCbModeChanged(bool active,
uint32_t timeoutMs)
{
return NS_OK;
}
NS_IMETHODIMP
MobileConnectionListener::NotifyOtaStatusChanged(const nsAString & status)
{
return NS_OK;
}
NS_IMETHODIMP
MobileConnectionListener::NotifyRadioStateChanged()
{
return NS_OK;
}
NS_IMETHODIMP
MobileConnectionListener::NotifyClirModeChanged(uint32_t aMode)
{
return NS_OK;
}
NS_IMETHODIMP
MobileConnectionListener::NotifyLastKnownNetworkChanged()
{
return NS_OK;
}
NS_IMETHODIMP
MobileConnectionListener::NotifyLastKnownHomeNetworkChanged()
{
return NS_OK;
}
NS_IMETHODIMP
MobileConnectionListener::NotifyNetworkSelectionModeChanged()
{
return NS_OK;
}
bool
MobileConnectionListener::Listen(bool aStart)
{
nsCOMPtr<nsIMobileConnectionService> service =
do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(service, false);
nsCOMPtr<nsIMobileConnection> connection;
service->GetItemByServiceId(mClientId, getter_AddRefs(connection));
NS_ENSURE_TRUE(connection, false);
nsresult rv;
if (aStart) {
rv = connection->RegisterListener(this);
} else {
rv = connection->UnregisterListener(this);
}
return NS_SUCCEEDED(rv);
}
/**
* TelephonyListener Implementation
*/
NS_IMPL_ISUPPORTS(TelephonyListener, nsITelephonyListener)
/**
* @param aSend A boolean indicates whether we need to notify headset or not
*/
nsresult
TelephonyListener::HandleCallInfo(nsITelephonyCallInfo* aInfo, bool aSend)
{
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
NS_ENSURE_TRUE(hfp, NS_ERROR_FAILURE);
uint32_t callIndex;
uint16_t callState;
nsAutoString number;
bool isOutgoing;
bool isConference;
aInfo->GetCallIndex(&callIndex);
aInfo->GetCallState(&callState);
aInfo->GetNumber(number);
aInfo->GetIsOutgoing(&isOutgoing);
aInfo->GetIsConference(&isConference);
hfp->HandleCallStateChanged(callIndex, callState, EmptyString(), number,
isOutgoing, isConference, aSend);
return NS_OK;
}
NS_IMETHODIMP
TelephonyListener::CallStateChanged(nsITelephonyCallInfo* aInfo)
{
return HandleCallInfo(aInfo, true);
}
NS_IMETHODIMP
TelephonyListener::EnumerateCallState(nsITelephonyCallInfo* aInfo)
{
return HandleCallInfo(aInfo, false);
}
NS_IMETHODIMP
TelephonyListener::NotifyError(uint32_t aServiceId,
int32_t aCallIndex,
const nsAString& aError)
{
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
NS_ENSURE_TRUE(hfp, NS_ERROR_FAILURE);
if (aCallIndex > 0) {
// In order to not miss any related call state transition.
// It's possible that 3G network signal lost for unknown reason.
// If a call is released abnormally, NotifyError() will be called,
// instead of CallStateChanged(). We need to reset the call array state
// via setting CALL_STATE_DISCONNECTED
hfp->HandleCallStateChanged(aCallIndex,
nsITelephonyService::CALL_STATE_DISCONNECTED,
aError, EmptyString(), false, false, true);
BT_WARNING("Reset the call state due to call transition ends abnormally");
}
BT_WARNING(NS_ConvertUTF16toUTF8(aError).get());
return NS_OK;
}
NS_IMETHODIMP
TelephonyListener::ConferenceCallStateChanged(uint16_t aCallState)
{
return NS_OK;
}
NS_IMETHODIMP
TelephonyListener::EnumerateCallStateComplete()
{
return NS_OK;
}
NS_IMETHODIMP
TelephonyListener::SupplementaryServiceNotification(uint32_t aServiceId,
int32_t aCallIndex,
uint16_t aNotification)
{
return NS_OK;
}
NS_IMETHODIMP
TelephonyListener::NotifyConferenceError(const nsAString& aName,
const nsAString& aMessage)
{
BT_WARNING(NS_ConvertUTF16toUTF8(aName).get());
BT_WARNING(NS_ConvertUTF16toUTF8(aMessage).get());
return NS_OK;
}
NS_IMETHODIMP
TelephonyListener::NotifyCdmaCallWaiting(uint32_t aServiceId,
const nsAString& aNumber,
uint16_t aNumberPresentation,
const nsAString& aName,
uint16_t aNamePresentation)
{
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
NS_ENSURE_TRUE(hfp, NS_ERROR_FAILURE);
hfp->UpdateSecondNumber(aNumber);
return NS_OK;
}
bool
TelephonyListener::Listen(bool aStart)
{
nsCOMPtr<nsITelephonyService> service =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(service, false);
nsresult rv;
if (aStart) {
rv = service->RegisterListener(this);
} else {
rv = service->UnregisterListener(this);
}
return NS_SUCCEEDED(rv);
}
/**
* BluetoothRilListener
*/
BluetoothRilListener::BluetoothRilListener()
{
nsCOMPtr<nsIMobileConnectionService> service =
do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID);
NS_ENSURE_TRUE_VOID(service);
// Query number of total clients (sim slots)
uint32_t numItems = 0;
if (NS_SUCCEEDED(service->GetNumItems(&numItems))) {
// Init MobileConnectionListener array and IccInfoListener
for (uint32_t i = 0; i < numItems; i++) {
mMobileConnListeners.AppendElement(new MobileConnectionListener(i));
}
}
mTelephonyListener = new TelephonyListener();
mIccListener = new IccListener();
mIccListener->SetOwner(this);
// Probe for available client
SelectClient();
}
BluetoothRilListener::~BluetoothRilListener()
{
mIccListener->SetOwner(nullptr);
}
bool
BluetoothRilListener::Listen(bool aStart)
{
NS_ENSURE_TRUE(ListenMobileConnAndIccInfo(aStart), false);
NS_ENSURE_TRUE(mTelephonyListener->Listen(aStart), false);
return true;
}
void
BluetoothRilListener::SelectClient()
{
// Reset mClientId
mClientId = mMobileConnListeners.Length();
nsCOMPtr<nsIMobileConnectionService> service =
do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID);
NS_ENSURE_TRUE_VOID(service);
for (uint32_t i = 0; i < mMobileConnListeners.Length(); i++) {
nsCOMPtr<nsIMobileConnection> connection;
service->GetItemByServiceId(i, getter_AddRefs(connection));
if (!connection) {
BT_WARNING("%s: Failed to get mobile connection", __FUNCTION__);
continue;
}
nsCOMPtr<nsIMobileConnectionInfo> voiceInfo;
connection->GetVoice(getter_AddRefs(voiceInfo));
if (!voiceInfo) {
BT_WARNING("%s: Failed to get voice connection info", __FUNCTION__);
continue;
}
nsString regState;
voiceInfo->GetState(regState);
if (regState.EqualsLiteral("registered")) {
// Found available client
mClientId = i;
return;
}
}
}
void
BluetoothRilListener::ServiceChanged(uint32_t aClientId, bool aRegistered)
{
// Stop listening
ListenMobileConnAndIccInfo(false);
/**
* aRegistered:
* - TRUE: service becomes registered. We were listening to all clients
* and one of them becomes available. Select it to listen.
* - FALSE: service becomes un-registered. The client we were listening
* becomes unavailable. Select another registered one to listen.
*/
if (aRegistered) {
mClientId = aClientId;
} else {
SelectClient();
}
// Restart listening
ListenMobileConnAndIccInfo(true);
BT_LOGR("%d client %d. new mClientId %d", aRegistered, aClientId,
(mClientId < mMobileConnListeners.Length()) ? mClientId : -1);
}
void
BluetoothRilListener::EnumerateCalls()
{
nsCOMPtr<nsITelephonyService> service =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE_VOID(service);
nsCOMPtr<nsITelephonyListener> listener(
do_QueryObject(mTelephonyListener));
service->EnumerateCalls(listener);
}
bool
BluetoothRilListener::ListenMobileConnAndIccInfo(bool aStart)
{
/**
* mClientId < number of total clients:
* The client with mClientId is available. Start/Stop listening
* mobile connection and icc info of this client only.
*
* mClientId >= number of total clients:
* All clients are unavailable. Start/Stop listening mobile
* connections of all clients.
*/
if (mClientId < mMobileConnListeners.Length()) {
NS_ENSURE_TRUE(mMobileConnListeners[mClientId]->Listen(aStart), false);
NS_ENSURE_TRUE(mIccListener->Listen(aStart), false);
} else {
for (uint32_t i = 0; i < mMobileConnListeners.Length(); i++) {
NS_ENSURE_TRUE(mMobileConnListeners[i]->Listen(aStart), false);
}
}
return true;
}

View File

@ -153,6 +153,7 @@ DBAction::OpenConnection(const QuotaInfo& aQuotaInfo, nsIFile* aDBDir,
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
rv = ss->OpenDatabaseWithFileURL(dbFileUrl, getter_AddRefs(conn));
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
}
rv = db::InitializeConnection(conn);

View File

@ -153,6 +153,7 @@ public:
if (isDir) {
if (leafName.EqualsLiteral("morgue")) {
rv = GetBodyUsage(file, aUsageInfo);
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
} else {
NS_WARNING("Unknown Cache directory found!");
}

View File

@ -23,6 +23,7 @@
#include "nsIAsyncInputStream.h"
#include "nsIAsyncOutputStream.h"
#include "nsIIPCSerializableInputStream.h"
#include "nsQueryObject.h"
#include "nsStreamUtils.h"
#include "nsString.h"
#include "nsURLParsers.h"

View File

@ -9,6 +9,7 @@
#include "CameraPreviewMediaStream.h"
#include "mozilla/dom/CameraManagerBinding.h"
#include "mozilla/dom/File.h"
#include "nsQueryObject.h"
using namespace mozilla;
using namespace mozilla::dom;

View File

@ -19,6 +19,7 @@
#include "CameraPreferences.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "nsQueryObject.h"
using namespace mozilla;
using namespace mozilla::dom;

View File

@ -16,16 +16,18 @@ ElemSizeFromType(GLenum elemType)
case LOCAL_GL_BOOL:
case LOCAL_GL_FLOAT:
case LOCAL_GL_INT:
case LOCAL_GL_INT_SAMPLER_2D:
case LOCAL_GL_INT_SAMPLER_2D_ARRAY:
case LOCAL_GL_INT_SAMPLER_3D:
case LOCAL_GL_INT_SAMPLER_CUBE:
case LOCAL_GL_UNSIGNED_INT:
case LOCAL_GL_SAMPLER_2D:
case LOCAL_GL_SAMPLER_3D:
case LOCAL_GL_SAMPLER_CUBE:
case LOCAL_GL_SAMPLER_2D_SHADOW:
case LOCAL_GL_SAMPLER_2D_ARRAY:
case LOCAL_GL_SAMPLER_2D_ARRAY_SHADOW:
case LOCAL_GL_SAMPLER_2D_SHADOW:
case LOCAL_GL_SAMPLER_CUBE:
case LOCAL_GL_SAMPLER_CUBE_SHADOW:
case LOCAL_GL_INT_SAMPLER_2D:
case LOCAL_GL_INT_SAMPLER_3D:
case LOCAL_GL_INT_SAMPLER_CUBE:
case LOCAL_GL_INT_SAMPLER_2D_ARRAY:
case LOCAL_GL_UNSIGNED_INT_SAMPLER_2D:
case LOCAL_GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
case LOCAL_GL_UNSIGNED_INT_SAMPLER_3D:
@ -35,18 +37,20 @@ ElemSizeFromType(GLenum elemType)
case LOCAL_GL_BOOL_VEC2:
case LOCAL_GL_FLOAT_VEC2:
case LOCAL_GL_INT_VEC2:
case LOCAL_GL_UNSIGNED_INT_VEC2:
return 2;
case LOCAL_GL_BOOL_VEC3:
case LOCAL_GL_FLOAT_VEC3:
case LOCAL_GL_INT_VEC3:
case LOCAL_GL_UNSIGNED_INT_VEC3:
return 3;
case LOCAL_GL_BOOL_VEC4:
case LOCAL_GL_FLOAT_MAT2:
case LOCAL_GL_FLOAT_VEC4:
case LOCAL_GL_INT_VEC4:
case LOCAL_GL_UNSIGNED_INT_VEC4:
case LOCAL_GL_FLOAT_MAT2:
return 4;
case LOCAL_GL_FLOAT_MAT2x3:

View File

@ -213,7 +213,20 @@ WebGLUniformLocation::GetUniform(JSContext* js, WebGLContext* webgl) const
case LOCAL_GL_INT_VEC3:
case LOCAL_GL_INT_VEC4:
case LOCAL_GL_SAMPLER_2D:
case LOCAL_GL_SAMPLER_3D:
case LOCAL_GL_SAMPLER_CUBE:
case LOCAL_GL_SAMPLER_2D_SHADOW:
case LOCAL_GL_SAMPLER_2D_ARRAY:
case LOCAL_GL_SAMPLER_2D_ARRAY_SHADOW:
case LOCAL_GL_SAMPLER_CUBE_SHADOW:
case LOCAL_GL_INT_SAMPLER_2D:
case LOCAL_GL_INT_SAMPLER_3D:
case LOCAL_GL_INT_SAMPLER_CUBE:
case LOCAL_GL_INT_SAMPLER_2D_ARRAY:
case LOCAL_GL_UNSIGNED_INT_SAMPLER_2D:
case LOCAL_GL_UNSIGNED_INT_SAMPLER_3D:
case LOCAL_GL_UNSIGNED_INT_SAMPLER_CUBE:
case LOCAL_GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
{
GLint buffer[kMaxElemSize] = {0};
gl->fGetUniformiv(prog, mLoc, buffer);
@ -260,6 +273,12 @@ WebGLUniformLocation::GetUniform(JSContext* js, WebGLContext* webgl) const
case LOCAL_GL_FLOAT_MAT2:
case LOCAL_GL_FLOAT_MAT3:
case LOCAL_GL_FLOAT_MAT4:
case LOCAL_GL_FLOAT_MAT2x3:
case LOCAL_GL_FLOAT_MAT2x4:
case LOCAL_GL_FLOAT_MAT3x2:
case LOCAL_GL_FLOAT_MAT3x4:
case LOCAL_GL_FLOAT_MAT4x2:
case LOCAL_GL_FLOAT_MAT4x3:
{
GLfloat buffer[16] = {0.0f};
gl->fGetUniformfv(prog, mLoc, buffer);
@ -275,6 +294,25 @@ WebGLUniformLocation::GetUniform(JSContext* js, WebGLContext* webgl) const
return JS::ObjectOrNullValue(obj);
}
case LOCAL_GL_UNSIGNED_INT:
case LOCAL_GL_UNSIGNED_INT_VEC2:
case LOCAL_GL_UNSIGNED_INT_VEC3:
case LOCAL_GL_UNSIGNED_INT_VEC4:
{
GLuint buffer[kMaxElemSize] = {0};
gl->fGetUniformuiv(prog, mLoc, buffer);
if (elemSize == 1)
return JS::DoubleValue(buffer[0]); // This is Double because only Int32 is special cased.
JSObject* obj = dom::Uint32Array::Create(js, webgl, elemSize, buffer);
if (!obj) {
webgl->ErrorOutOfMemory("getUniform: out of memory");
return JS::NullValue();
}
return JS::ObjectOrNullValue(obj);
}
default:
MOZ_CRASH("Invalid elemType.");
}

View File

@ -17,6 +17,7 @@
#include "nsIRunnable.h"
#include "nsISeekableStream.h"
#include "nsThreadUtils.h"
#include "nsQueryObject.h"
#ifdef DEBUG
#include "nsXULAppAPI.h"

View File

@ -9,6 +9,7 @@
#include "mozilla/dom/HTMLFieldSetElement.h"
#include "mozilla/dom/HTMLFieldSetElementBinding.h"
#include "nsContentList.h"
#include "nsQueryObject.h"
NS_IMPL_NS_NEW_HTML_ELEMENT(FieldSet)

View File

@ -30,6 +30,7 @@
#include "nsIMutableArray.h"
#include "nsIFormAutofillContentService.h"
#include "mozilla/BinarySearch.h"
#include "nsQueryObject.h"
// form submission
#include "mozilla/Telemetry.h"

View File

@ -12,6 +12,7 @@
#include "mozilla/dom/HTMLLabelElementBinding.h"
#include "nsFocusManager.h"
#include "nsIDOMMouseEvent.h"
#include "nsQueryObject.h"
// construction, destruction

View File

@ -38,6 +38,7 @@
#include "nsIThreadInternal.h"
#include "nsContentUtils.h"
#include "nsIRequest.h"
#include "nsQueryObject.h"
#include "nsIScriptSecurityManager.h"
#include "nsIXPConnect.h"

View File

@ -17,6 +17,7 @@
#include "nsAttrValueInlines.h"
#include "nsCOMPtr.h"
#include "nsIAtom.h"
#include "nsQueryObject.h"
#include "nsIContentInlines.h"
#include "nsIContentViewer.h"
#include "mozilla/css/StyleRule.h"

View File

@ -50,6 +50,7 @@
#include "nsThreadUtils.h"
#include "ProfilerHelpers.h"
#include "ReportInternalError.h"
#include "nsQueryObject.h"
// Include this last to avoid path problems on Windows.
#include "ActorsChild.h"

View File

@ -41,6 +41,7 @@
#include "mozilla/ipc/BackgroundChild.h"
#include "mozilla/ipc/PBackgroundSharedTypes.h"
#include "nsCOMPtr.h"
#include "nsQueryObject.h"
#include "ProfilerHelpers.h"
#include "ReportInternalError.h"
#include "WorkerPrivate.h"

View File

@ -275,6 +275,9 @@ TabChildBase::HandlePossibleViewportChange(const ScreenIntSize& aOldScreenSize)
Stringify(aOldScreenSize).c_str(), Stringify(mInnerSize).c_str());
nsCOMPtr<nsIDocument> document(GetDocument());
if (!document) {
return false;
}
nsViewportInfo viewportInfo = nsContentUtils::GetViewportInfo(document, mInnerSize);
uint32_t presShellId = 0;
@ -2114,7 +2117,7 @@ bool
TabChild::RecvHandleLongTap(const CSSPoint& aPoint, const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid, const uint64_t& aInputBlockId)
{
if (mGlobal && mTabChildGlobal) {
mAPZEventState->ProcessLongTap(GetDOMWindowUtils(), aPoint, aModifiers, aGuid,
mAPZEventState->ProcessLongTap(GetPresShell(), aPoint, aModifiers, aGuid,
aInputBlockId, GetPresShellResolution());
}
return true;
@ -2165,7 +2168,7 @@ TabChild::RecvMouseEvent(const nsString& aType,
const int32_t& aModifiers,
const bool& aIgnoreRootScrollFrame)
{
APZCCallbackHelper::DispatchMouseEvent(GetDOMWindowUtils(), aType, CSSPoint(aX, aY),
APZCCallbackHelper::DispatchMouseEvent(GetPresShell(), aType, CSSPoint(aX, aY),
aButton, aClickCount, aModifiers, aIgnoreRootScrollFrame, nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN);
return true;
}
@ -2328,7 +2331,7 @@ TabChild::FireContextMenuEvent()
MOZ_ASSERT(mTapHoldTimer && mActivePointerId >= 0);
bool defaultPrevented = APZCCallbackHelper::DispatchMouseEvent(
GetDOMWindowUtils(),
GetPresShell(),
NS_LITERAL_STRING("contextmenu"),
mGestureDownPoint / CSSToLayoutDeviceScale(scale),
2 /* Right button */,
@ -2526,11 +2529,9 @@ TabChild::RecvKeyEvent(const nsString& aType,
const int32_t& aModifiers,
const bool& aPreventDefault)
{
nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils());
NS_ENSURE_TRUE(utils, true);
bool ignored = false;
utils->SendKeyEvent(aType, aKeyCode, aCharCode,
aModifiers, aPreventDefault, &ignored);
nsContentUtils::SendKeyEvent(mWidget, aType, aKeyCode, aCharCode,
aModifiers, aPreventDefault, &ignored);
return true;
}

View File

@ -354,12 +354,16 @@ IsMP4SupportedType(const nsACString& aType,
// For other normal MP4, it still uses current omx decoder.
// Bug 1061034 is a follow-up bug to enable all MP4s with MOZ_FMP4
#ifdef MOZ_OMX_DECODER
return false;
#else
// Use MP4Decoder when blank-decoder is enabled so that we can run EME
// mochitests on B2G platforms. This will be removed once bug 1146729 is
// fixed when we don't need blank-decoder to play mp4 on B2G.
if (!Preferences::GetBool("media.fragmented-mp4.use-blank-decoder", false)) {
return false;
}
#endif
bool haveAAC, haveMP3, haveH264;
return Preferences::GetBool("media.fragmented-mp4.exposed", false) &&
MP4Decoder::CanHandleMediaType(aType, aCodecs, haveAAC, haveH264, haveMP3);
#endif
}
#endif

View File

@ -11,6 +11,7 @@
#include "nsIScriptGlobalObject.h"
#include "nsIPermissionManager.h"
#include "nsPIDOMWindow.h"
#include "nsQueryObject.h"
namespace mozilla {
namespace dom {

View File

@ -12,6 +12,7 @@
#include "nsIStringEnumerator.h"
#include "nsISupportsArray.h"
#include "nsJSUtils.h"
#include "nsQueryObject.h"
#include "nsPIDOMWindow.h"
#include "nsTArray.h"
#include "GetUserMediaRequest.h"

View File

@ -36,10 +36,10 @@ EMEVideoDecoder::GetNodeId()
return mProxy->GetNodeId();
}
GMPUnique<GMPVideoEncodedFrame>::Ptr
GMPUniquePtr<GMPVideoEncodedFrame>
EMEVideoDecoder::CreateFrame(MediaRawData* aSample)
{
GMPUnique<GMPVideoEncodedFrame>::Ptr frame = GMPVideoDecoder::CreateFrame(aSample);
GMPUniquePtr<GMPVideoEncodedFrame> frame = GMPVideoDecoder::CreateFrame(aSample);
if (frame && aSample->mCrypto.mValid) {
static_cast<gmp::GMPVideoEncodedFrameImpl*>(frame.get())->InitCrypto(aSample->mCrypto);
}

View File

@ -50,7 +50,7 @@ public:
private:
virtual void InitTags(nsTArray<nsCString>& aTags) override;
virtual nsCString GetNodeId() override;
virtual GMPUnique<GMPVideoEncodedFrame>::Ptr CreateFrame(MediaRawData* aSample) override;
virtual GMPUniquePtr<GMPVideoEncodedFrame> CreateFrame(MediaRawData* aSample) override;
nsRefPtr<CDMProxy> mProxy;
};

View File

@ -19,7 +19,7 @@ extern bool IsOnGMPThread();
void
VideoCallbackAdapter::Decoded(GMPVideoi420Frame* aDecodedFrame)
{
GMPUnique<GMPVideoi420Frame>::Ptr decodedFrame(aDecodedFrame);
GMPUniquePtr<GMPVideoi420Frame> decodedFrame(aDecodedFrame);
MOZ_ASSERT(IsOnGMPThread());
@ -115,7 +115,7 @@ GMPVideoDecoder::GetNodeId()
return NS_LITERAL_CSTRING("");
}
GMPUnique<GMPVideoEncodedFrame>::Ptr
GMPUniquePtr<GMPVideoEncodedFrame>
GMPVideoDecoder::CreateFrame(MediaRawData* aSample)
{
GMPVideoFrame* ftmp = nullptr;
@ -125,7 +125,7 @@ GMPVideoDecoder::CreateFrame(MediaRawData* aSample)
return nullptr;
}
GMPUnique<GMPVideoEncodedFrame>::Ptr frame(static_cast<GMPVideoEncodedFrame*>(ftmp));
GMPUniquePtr<GMPVideoEncodedFrame> frame(static_cast<GMPVideoEncodedFrame*>(ftmp));
err = frame->CreateEmptyFrame(aSample->mSize);
if (GMP_FAILED(err)) {
mCallback->Error();
@ -248,7 +248,7 @@ GMPVideoDecoder::Input(MediaRawData* aSample)
mAdapter->SetLastStreamOffset(sample->mOffset);
GMPUnique<GMPVideoEncodedFrame>::Ptr frame = CreateFrame(sample);
GMPUniquePtr<GMPVideoEncodedFrame> frame = CreateFrame(sample);
nsTArray<uint8_t> info; // No codec specific per-frame info to pass.
nsresult rv = mGMP->Decode(Move(frame), false, info, 0);
if (NS_FAILED(rv)) {

View File

@ -93,7 +93,7 @@ public:
protected:
virtual void InitTags(nsTArray<nsCString>& aTags);
virtual nsCString GetNodeId();
virtual GMPUnique<GMPVideoEncodedFrame>::Ptr CreateFrame(MediaRawData* aSample);
virtual GMPUniquePtr<GMPVideoEncodedFrame> CreateFrame(MediaRawData* aSample);
private:
class GMPInitDoneRunnable : public nsRunnable

View File

@ -27,13 +27,14 @@ WMFMediaDataDecoder::WMFMediaDataDecoder(MFTManager* aMFTManager,
: mTaskQueue(aTaskQueue)
, mCallback(aCallback)
, mMFTManager(aMFTManager)
, mMonitor("WMFMediaDataDecoder")
, mIsDecodeTaskDispatched(false)
, mIsFlushing(false)
{
MOZ_COUNT_CTOR(WMFMediaDataDecoder);
}
WMFMediaDataDecoder::~WMFMediaDataDecoder()
{
MOZ_COUNT_DTOR(WMFMediaDataDecoder);
}
nsresult
@ -48,11 +49,13 @@ WMFMediaDataDecoder::Init()
nsresult
WMFMediaDataDecoder::Shutdown()
{
DebugOnly<nsresult> rv = mTaskQueue->FlushAndDispatch(
mTaskQueue->Dispatch(
NS_NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessShutdown));
#ifdef DEBUG
if (NS_FAILED(rv)) {
NS_WARNING("WMFMediaDataDecoder::Shutdown() dispatch of task failed!");
{
MonitorAutoLock mon(mMonitor);
// The MP4Reader should have flushed before calling Shutdown().
MOZ_ASSERT(!mIsDecodeTaskDispatched);
}
#endif
return NS_OK;
@ -61,36 +64,73 @@ WMFMediaDataDecoder::Shutdown()
void
WMFMediaDataDecoder::ProcessShutdown()
{
mMFTManager->Shutdown();
mMFTManager = nullptr;
if (mMFTManager) {
mMFTManager->Shutdown();
mMFTManager = nullptr;
}
mDecoder = nullptr;
}
void
WMFMediaDataDecoder::EnsureDecodeTaskDispatched()
{
mMonitor.AssertCurrentThreadOwns();
if (!mIsDecodeTaskDispatched) {
mTaskQueue->Dispatch(
NS_NewRunnableMethod(this,
&WMFMediaDataDecoder::Decode));
mIsDecodeTaskDispatched = true;
}
}
// Inserts data into the decoder's pipeline.
nsresult
WMFMediaDataDecoder::Input(MediaRawData* aSample)
{
mTaskQueue->Dispatch(
NS_NewRunnableMethodWithArg<nsRefPtr<MediaRawData>>(
this,
&WMFMediaDataDecoder::ProcessDecode,
nsRefPtr<MediaRawData>(aSample)));
MonitorAutoLock mon(mMonitor);
mInput.push(aSample);
EnsureDecodeTaskDispatched();
return NS_OK;
}
void
WMFMediaDataDecoder::ProcessDecode(MediaRawData* aSample)
WMFMediaDataDecoder::Decode()
{
HRESULT hr = mMFTManager->Input(aSample);
if (FAILED(hr)) {
NS_WARNING("MFTManager rejected sample");
mCallback->Error();
return;
while (true) {
nsRefPtr<MediaRawData> input;
{
MonitorAutoLock mon(mMonitor);
MOZ_ASSERT(mIsDecodeTaskDispatched);
if (mInput.empty()) {
if (mIsFlushing) {
if (mDecoder) {
mDecoder->Flush();
}
mIsFlushing = false;
}
mIsDecodeTaskDispatched = false;
mon.NotifyAll();
return;
}
input = mInput.front();
mInput.pop();
}
HRESULT hr = mMFTManager->Input(input);
if (FAILED(hr)) {
NS_WARNING("MFTManager rejected sample");
{
MonitorAutoLock mon(mMonitor);
PurgeInputQueue();
}
mCallback->Error();
return;
}
mLastStreamOffset = input->mOffset;
ProcessOutput();
}
mLastStreamOffset = aSample->mOffset;
ProcessOutput();
}
void
@ -108,24 +148,33 @@ WMFMediaDataDecoder::ProcessOutput()
}
} else if (FAILED(hr)) {
NS_WARNING("WMFMediaDataDecoder failed to output data");
{
MonitorAutoLock mon(mMonitor);
PurgeInputQueue();
}
mCallback->Error();
}
}
void
WMFMediaDataDecoder::PurgeInputQueue()
{
mMonitor.AssertCurrentThreadOwns();
while (!mInput.empty()) {
mInput.pop();
}
}
nsresult
WMFMediaDataDecoder::Flush()
{
// Flush the input task queue. This cancels all pending Decode() calls.
// Note this blocks until the task queue finishes its current job, if
// it's executing at all. Note the MP4Reader ignores all output while
// flushing.
mTaskQueue->Flush();
// Order the MFT to flush; drop all internal data.
NS_ENSURE_TRUE(mDecoder, NS_ERROR_FAILURE);
HRESULT hr = mDecoder->Flush();
NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE);
MonitorAutoLock mon(mMonitor);
PurgeInputQueue();
mIsFlushing = true;
EnsureDecodeTaskDispatched();
while (mIsDecodeTaskDispatched || mIsFlushing) {
mon.Wait();
}
return NS_OK;
}

View File

@ -74,9 +74,9 @@ public:
private:
// Called on the task queue. Inserts the sample into the decoder, and
// extracts output if available.
void ProcessDecode(MediaRawData* aSample);
void Decode();
void EnsureDecodeTaskDispatched();
void PurgeInputQueue();
// Called on the task queue. Extracts output if available, and delivers
// it to the reader. Called after ProcessDecode() and ProcessDrain().
@ -97,6 +97,11 @@ private:
// The last offset into the media resource that was passed into Input().
// This is used to approximate the decoder's position in the media resource.
int64_t mLastStreamOffset;
Monitor mMonitor;
std::queue<nsRefPtr<MediaRawData>> mInput;
bool mIsDecodeTaskDispatched;
bool mIsFlushing;
};
} // namespace mozilla

View File

@ -310,6 +310,10 @@ GMPChild::PreLoadLibraries(const std::string& aPluginPath)
{
"d3d9.dll", // Create an `IDirect3D9` to get adapter information
"dxva2.dll", // Get monitor information
"evr.dll", // MFGetStrideForBitmapInfoHeader
"mfh264dec.dll", // H.264 decoder (on Windows Vista)
"mfheaacdec.dll", // AAC decoder (on Windows Vista)
"mfplat.dll", // MFCreateSample, MFCreateAlignedMemoryBuffer, MFCreateMediaType
"msauddecmft.dll", // AAC decoder (on Windows 8)
"msmpeg2adec.dll", // AAC decoder (on Windows 7)
"msmpeg2vdec.dll", // H.264 decoder

View File

@ -18,11 +18,8 @@ struct DestroyPolicy
}
};
// Ideally, this would be a template alias, but GCC 4.6 doesn't support them. See bug 1124021.
template<typename T>
struct GMPUnique {
typedef mozilla::UniquePtr<T, DestroyPolicy<T>> Ptr;
};
using GMPUniquePtr = mozilla::UniquePtr<T, DestroyPolicy<T>>;
} // namespace mozilla

View File

@ -109,7 +109,7 @@ GMPVideoDecoderParent::InitDecode(const GMPVideoCodec& aCodecSettings,
}
nsresult
GMPVideoDecoderParent::Decode(GMPUnique<GMPVideoEncodedFrame>::Ptr aInputFrame,
GMPVideoDecoderParent::Decode(GMPUniquePtr<GMPVideoEncodedFrame> aInputFrame,
bool aMissingFrames,
const nsTArray<uint8_t>& aCodecSpecificInfo,
int64_t aRenderTimeMs)
@ -121,7 +121,7 @@ GMPVideoDecoderParent::Decode(GMPUnique<GMPVideoEncodedFrame>::Ptr aInputFrame,
MOZ_ASSERT(mPlugin->GMPThread() == NS_GetCurrentThread());
GMPUnique<GMPVideoEncodedFrameImpl>::Ptr inputFrameImpl(
GMPUniquePtr<GMPVideoEncodedFrameImpl> inputFrameImpl(
static_cast<GMPVideoEncodedFrameImpl*>(aInputFrame.release()));
// Very rough kill-switch if the plugin stops processing. If it's merely

View File

@ -38,7 +38,7 @@ public:
const nsTArray<uint8_t>& aCodecSpecific,
GMPVideoDecoderCallbackProxy* aCallback,
int32_t aCoreCount) override;
virtual nsresult Decode(GMPUnique<GMPVideoEncodedFrame>::Ptr aInputFrame,
virtual nsresult Decode(GMPUniquePtr<GMPVideoEncodedFrame> aInputFrame,
bool aMissingFrames,
const nsTArray<uint8_t>& aCodecSpecificInfo,
int64_t aRenderTimeMs = -1) override;

View File

@ -38,7 +38,7 @@ public:
const nsTArray<uint8_t>& aCodecSpecific,
GMPVideoDecoderCallbackProxy* aCallback,
int32_t aCoreCount) = 0;
virtual nsresult Decode(mozilla::GMPUnique<GMPVideoEncodedFrame>::Ptr aInputFrame,
virtual nsresult Decode(mozilla::GMPUniquePtr<GMPVideoEncodedFrame> aInputFrame,
bool aMissingFrames,
const nsTArray<uint8_t>& aCodecSpecificInfo,
int64_t aRenderTimeMs = -1) = 0;

View File

@ -126,7 +126,7 @@ GMPVideoEncoderParent::InitEncode(const GMPVideoCodec& aCodecSettings,
}
GMPErr
GMPVideoEncoderParent::Encode(GMPUnique<GMPVideoi420Frame>::Ptr aInputFrame,
GMPVideoEncoderParent::Encode(GMPUniquePtr<GMPVideoi420Frame> aInputFrame,
const nsTArray<uint8_t>& aCodecSpecificInfo,
const nsTArray<GMPVideoFrameType>& aFrameTypes)
{
@ -137,7 +137,7 @@ GMPVideoEncoderParent::Encode(GMPUnique<GMPVideoi420Frame>::Ptr aInputFrame,
MOZ_ASSERT(mPlugin->GMPThread() == NS_GetCurrentThread());
GMPUnique<GMPVideoi420FrameImpl>::Ptr inputFrameImpl(
GMPUniquePtr<GMPVideoi420FrameImpl> inputFrameImpl(
static_cast<GMPVideoi420FrameImpl*>(aInputFrame.release()));
// Very rough kill-switch if the plugin stops processing. If it's merely

View File

@ -39,7 +39,7 @@ public:
GMPVideoEncoderCallbackProxy* aCallback,
int32_t aNumberOfCores,
uint32_t aMaxPayloadSize) override;
virtual GMPErr Encode(GMPUnique<GMPVideoi420Frame>::Ptr aInputFrame,
virtual GMPErr Encode(GMPUniquePtr<GMPVideoi420Frame> aInputFrame,
const nsTArray<uint8_t>& aCodecSpecificInfo,
const nsTArray<GMPVideoFrameType>& aFrameTypes) override;
virtual GMPErr SetChannelParameters(uint32_t aPacketLoss, uint32_t aRTT) override;

View File

@ -40,7 +40,7 @@ public:
GMPVideoEncoderCallbackProxy* aCallback,
int32_t aNumberOfCores,
uint32_t aMaxPayloadSize) = 0;
virtual GMPErr Encode(mozilla::GMPUnique<GMPVideoi420Frame>::Ptr aInputFrame,
virtual GMPErr Encode(mozilla::GMPUniquePtr<GMPVideoi420Frame> aInputFrame,
const nsTArray<uint8_t>& aCodecSpecificInfo,
const nsTArray<GMPVideoFrameType>& aFrameTypes) = 0;
virtual GMPErr SetChannelParameters(uint32_t aPacketLoss, uint32_t aRTT) = 0;

View File

@ -11,6 +11,7 @@
#include "nsGlobalWindow.h"
#include "mozilla/MediaManager.h"
#include "prlog.h"
#include "nsQueryObject.h"
#undef LOG
#if defined(PR_LOGGING)

View File

@ -21,6 +21,7 @@
#include "mozilla/dom/SpeechRecognitionEvent.h"
#include "nsIObserverService.h"
#include "nsServiceManagerUtils.h"
#include "nsQueryObject.h"
#include <algorithm>

View File

@ -664,7 +664,7 @@ ReportExceptionIfPending(JSContext *cx)
}
nsJSObjWrapper::nsJSObjWrapper(NPP npp)
: mJSObj(nullptr), mNpp(npp)
: mJSObj(nullptr), mNpp(npp), mDestroyPending(false)
{
MOZ_COUNT_CTOR(nsJSObjWrapper);
OnWrapperCreated();

View File

@ -72,6 +72,7 @@
#include "prprf.h"
#include "nsThreadUtils.h"
#include "nsIInputStreamTee.h"
#include "nsQueryObject.h"
#include "nsDirectoryServiceDefs.h"
#include "nsAppDirectoryServiceDefs.h"

View File

@ -10,6 +10,7 @@
#include "nsError.h"
#include "nsCOMPtr.h"
#include "nsSVGAttrTearoffTable.h"
#include "nsQueryObject.h"
#include <algorithm>
// See the architecture comment in this file's header.

View File

@ -36,7 +36,9 @@ struct TranslationParams { // Simple translation
float mY;
};
struct PathPointParams { // Point along a path
Path* mPath; // NOTE: Refcounted; need to AddRef/Release.
// Refcounted: need to AddRef/Release. This can't be an nsRefPtr because
// this struct is used inside a union so it can't have a default constructor.
Path* MOZ_OWNING_REF mPath;
float mDistToPoint; // Distance from path start to the point on the path that
// we're interested in.
};

View File

@ -45,6 +45,7 @@
#include "SVGAnimatedPathSegList.h"
#include "SVGContentUtils.h"
#include "nsIFrame.h"
#include "nsQueryObject.h"
#include <stdarg.h>
#include "nsSMILMappedAttribute.h"
#include "SVGMotionSMILAttr.h"

View File

@ -16,6 +16,7 @@
#include "nsStreamUtils.h"
#include "nsNetCID.h"
#include "nsSerializationHelper.h"
#include "nsQueryObject.h"
#include "mozilla/dom/FetchEventBinding.h"
#include "mozilla/dom/PromiseNativeHandler.h"

View File

@ -40,6 +40,7 @@
#include "nsGlobalWindow.h"
#include "nsNetUtil.h"
#include "nsProxyRelease.h"
#include "nsQueryObject.h"
#include "nsTArray.h"
#include "RuntimeService.h"

View File

@ -81,6 +81,7 @@
#include "nsNetUtil.h"
#include "nsPrintfCString.h"
#include "nsProxyRelease.h"
#include "nsQueryObject.h"
#include "nsSandboxFlags.h"
#include "prthread.h"
#include "xpcpublic.h"

View File

@ -6,6 +6,7 @@
#include "mozilla/ArrayUtils.h"
#include "nsCOMPtr.h"
#include "nsQueryObject.h"
#include "nsXBLPrototypeHandler.h"
#include "nsXBLPrototypeBinding.h"
#include "nsContentUtils.h"
@ -23,6 +24,7 @@
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsFocusManager.h"
#include "nsIFormControl.h"
#include "nsIDOMEventListener.h"
#include "nsPIDOMWindow.h"
#include "nsPIWindowRoot.h"
@ -475,34 +477,17 @@ nsXBLPrototypeHandler::DispatchXBLCommand(EventTarget* aTarget, nsIDOMEvent* aEv
nsFocusManager::GetFocusedDescendant(windowToCheck, true, getter_AddRefs(focusedWindow));
}
bool isLink = false;
nsIContent *content = focusedContent;
// If the focus is in an editable region, don't scroll.
if (focusedContent->IsEditable()) {
return NS_OK;
}
// if the focused element is a link then we do want space to
// scroll down. The focused element may be an element in a link,
// we need to check the parent node too. Only do this check if an
// element is focused and has a parent.
if (focusedContent && focusedContent->GetParent()) {
while (content) {
if (content->IsHTMLElement(nsGkAtoms::a)) {
isLink = true;
break;
}
if (content->HasAttr(kNameSpaceID_XLink, nsGkAtoms::type)) {
isLink = content->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
nsGkAtoms::simple, eCaseMatters);
if (isLink) {
break;
}
}
content = content->GetParent();
}
if (!isLink)
// If the focus is in a form control, don't scroll.
for (nsIContent* c = focusedContent; c; c = c->GetParent()) {
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(c);
if (formControl) {
return NS_OK;
}
}
}

View File

@ -4434,13 +4434,11 @@ XULDocument::CachedChromeStreamListener::CachedChromeStreamListener(XULDocument*
: mDocument(aDocument),
mProtoLoaded(aProtoLoaded)
{
NS_ADDREF(mDocument);
}
XULDocument::CachedChromeStreamListener::~CachedChromeStreamListener()
{
NS_RELEASE(mDocument);
}

View File

@ -684,8 +684,8 @@ protected:
class CachedChromeStreamListener : public nsIStreamListener {
protected:
XULDocument* mDocument;
bool mProtoLoaded;
nsRefPtr<XULDocument> mDocument;
bool mProtoLoaded;
virtual ~CachedChromeStreamListener();

View File

@ -93,6 +93,7 @@
#include "nsAttrValueInlines.h"
#include "mozilla/Attributes.h"
#include "nsIController.h"
#include "nsQueryObject.h"
#include <algorithm>
// The XUL doc interface

View File

@ -13,6 +13,7 @@
#include "nsError.h" // for NS_SUCCEEDED, NS_FAILED, etc
#include "nsIPresShell.h" // nsISelectionController constants
#include "nsRange.h" // local var
#include "nsQueryObject.h" // for do_QueryObject
using namespace mozilla;
using namespace mozilla::dom;

View File

@ -11,6 +11,7 @@
#include "nsDebug.h" // for NS_ASSERTION, etc
#include "nsEditor.h" // mEditor
#include "nsError.h" // for NS_OK, etc
#include "nsQueryObject.h" // for do_QueryObject
using namespace mozilla;
using namespace mozilla::dom;

View File

@ -8,6 +8,7 @@
#include "IMETextTxn.h"
#include "nsGkAtoms.h"
#include "mozilla/dom/Selection.h"
#include "nsQueryObject.h"
using namespace mozilla;
using namespace mozilla::dom;

View File

@ -53,6 +53,7 @@
#include "nsRange.h"
#include "nsServiceManagerUtils.h" // for do_GetService
#include "nsString.h" // for nsAutoString
#include "nsQueryObject.h" // for do_QueryObject
#ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
#include "nsContentUtils.h" // for nsContentUtils, etc
#include "nsIBidiKeyboard.h" // for nsIBidiKeyboard

View File

@ -24,6 +24,7 @@
#include "nsIHTMLObjectResizer.h"
#include "nsISupportsImpl.h"
#include "nsLiteralString.h"
#include "nsQueryObject.h"
#include "nsRange.h"
using namespace mozilla;

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<body>
<button>Button</button>
<img src="green.png" usemap="#map">
<map name="map">
<!-- This URL ensures that the link doesn't get clicked, since
mochitests cannot access the outside network. -->
<area shape="rect" coords="0,0,10,10" href="https://youtube.com/">
</map>
<div style="height: 20000px;" tabindex="-1"><hr></div>
</body>
</html>

View File

@ -9,6 +9,7 @@ support-files =
file_bug549262.html
file_bug586662.html
file_bug674770-1.html
file_bug915962.html
file_select_all_without_body.html
green.png
spellcheck.js
@ -137,6 +138,8 @@ skip-if = toolkit == 'android' || e10s
[test_bug832025.html]
[test_bug857487.html]
[test_bug858918.html]
[test_bug915962.html]
skip-if = toolkit == 'android' || e10s
[test_bug966155.html]
skip-if = os != "win"
[test_bug966552.html]

View File

@ -0,0 +1,85 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=915962
-->
<head>
<title>Test for Bug 915962</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=915962">Mozilla Bug 915962</a>
<p id="display"></p>
<div id="content">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 915962 **/
var smoothScrollPref = "general.smoothScroll";
SimpleTest.waitForExplicitFinish();
var win = window.open("file_bug915962.html", "_blank",
"width=600,height=600,scrollbars=yes");
// grab the timer right at the start
var cwu = SpecialPowers.getDOMWindowUtils(win);
function step() {
cwu.advanceTimeAndRefresh(100);
}
SimpleTest.waitForFocus(function() {
SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, startTest);
}, win);
function startTest() {
// Make sure that pressing Space when a tabindex=-1 element is focused
// will scroll the page.
var button = win.document.querySelector("button");
var sc = win.document.querySelector("div");
sc.focus();
is(win.scrollY, 0, "Sanity check");
synthesizeKey(" ", {}, win);
step();
isnot(win.scrollY, 0, "Page is scrolled down");
var oldY = win.scrollY;
synthesizeKey(" ", {shiftKey: true}, win);
step();
ok(win.scrollY < oldY, "Page is scrolled up");
// Make sure that pressing Space when a tabindex=-1 element is focused
// will not scroll the page, and will activate the element.
button.focus();
var clicked = false;
button.onclick = () => clicked = true;
oldY = win.scrollY;
synthesizeKey(" ", {}, win);
step();
ok(win.scrollY <= oldY, "Page is not scrolled down");
ok(clicked, "The button should be clicked");
synthesizeKey("VK_TAB", {}, win);
step();
oldY = win.scrollY;
synthesizeKey(" ", {}, win);
step()
ok(win.scrollY >= oldY, "Page is scrolled down");
win.close();
cwu.restoreNormalRefresh();
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

View File

@ -1222,6 +1222,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
{ (PRFuncPtr*) &mSymbols.fUniform3uiv, { "Uniform3uiv", "Uniform3uivEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform4uiv, { "Uniform4uiv", "Uniform4uivEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetFragDataLocation, { "GetFragDataLocation", "GetFragDataLocationEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetUniformuiv, { "GetUniformuiv", "GetUniformuivEXT", nullptr } },
END_SYMBOLS
};

View File

@ -1421,6 +1421,13 @@ public:
AFTER_GL_CALL;
}
void fGetUniformuiv(GLuint program, GLint location, GLuint* params) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGetUniformuiv);
mSymbols.fGetUniformuiv(program, location, params);
AFTER_GL_CALL;
}
GLint fGetUniformLocation (GLint programObj, const GLchar* name) {
BEFORE_GL_CALL;
GLint retval = mSymbols.fGetUniformLocation(programObj, name);

View File

@ -165,6 +165,8 @@ struct GLContextSymbols
PFNGLGETUNIFORMFVPROC fGetUniformfv;
typedef void (GLAPIENTRY * PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint* params);
PFNGLGETUNIFORMIVPROC fGetUniformiv;
typedef void (GLAPIENTRY * PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint* params);
PFNGLGETUNIFORMUIVPROC fGetUniformuiv;
typedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONPROC) (GLint programObj, const GLchar* name);
PFNGLGETUNIFORMLOCATIONPROC fGetUniformLocation;
typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVPROC) (GLuint, GLenum, GLfloat*);
@ -657,19 +659,19 @@ struct GLContextSymbols
GLint yoffset, GLint zoffset, GLint x,
GLint y, GLsizei width, GLsizei height);
PFNGLCOPYTEXSUBIMAGE3DPROC fCopyTexSubImage3D;
typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3D) (GLenum target, GLint level, GLenum internalformat,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLsizei imageSize, const GLvoid* data);
PFNGLCOMPRESSEDTEXIMAGE3D fCompressedTexImage3D;
typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3D) (GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLsizei imageSize, const GLvoid* data);
PFNGLCOMPRESSEDTEXSUBIMAGE3D fCompressedTexSubImage3D;
typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLsizei imageSize, const GLvoid* data);
PFNGLCOMPRESSEDTEXIMAGE3DPROC fCompressedTexImage3D;
typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLsizei imageSize, const GLvoid* data);
PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC fCompressedTexSubImage3D;
// get_string_indexed
typedef const GLubyte* (GLAPIENTRY * pfnGLGetStringiT)(GLenum name, GLuint index);
pfnGLGetStringiT fGetStringi;
typedef const GLubyte* (GLAPIENTRY * PFNGLGETSTRINGIPROC)(GLenum name, GLuint index);
PFNGLGETSTRINGIPROC fGetStringi;
};
}

View File

@ -433,7 +433,7 @@ APZCCallbackHelper::DispatchSynthesizedMouseEvent(uint32_t aMsg,
}
bool
APZCCallbackHelper::DispatchMouseEvent(const nsCOMPtr<nsIDOMWindowUtils>& aUtils,
APZCCallbackHelper::DispatchMouseEvent(const nsCOMPtr<nsIPresShell>& aPresShell,
const nsString& aType,
const CSSPoint& aPoint,
int32_t aButton,
@ -442,11 +442,12 @@ APZCCallbackHelper::DispatchMouseEvent(const nsCOMPtr<nsIDOMWindowUtils>& aUtils
bool aIgnoreRootScrollFrame,
unsigned short aInputSourceArg)
{
NS_ENSURE_TRUE(aUtils, true);
NS_ENSURE_TRUE(aPresShell, true);
bool defaultPrevented = false;
aUtils->SendMouseEvent(aType, aPoint.x, aPoint.y, aButton, aClickCount, aModifiers,
aIgnoreRootScrollFrame, 0, aInputSourceArg, false, 4, &defaultPrevented);
nsContentUtils::SendMouseEvent(aPresShell, aType, aPoint.x, aPoint.y,
aButton, aClickCount, aModifiers, aIgnoreRootScrollFrame, 0,
aInputSourceArg, false, &defaultPrevented, false);
return defaultPrevented;
}

View File

@ -122,7 +122,7 @@ public:
/* Dispatch a mouse event with the given parameters.
* Return whether or not any listeners have called preventDefault on the event. */
static bool DispatchMouseEvent(const nsCOMPtr<nsIDOMWindowUtils>& aUtils,
static bool DispatchMouseEvent(const nsCOMPtr<nsIPresShell>& aPresShell,
const nsString& aType,
const CSSPoint& aPoint,
int32_t aButton,

View File

@ -190,7 +190,7 @@ APZEventState::ProcessSingleTap(const CSSPoint& aPoint,
}
void
APZEventState::ProcessLongTap(const nsCOMPtr<nsIDOMWindowUtils>& aUtils,
APZEventState::ProcessLongTap(const nsCOMPtr<nsIPresShell>& aPresShell,
const CSSPoint& aPoint,
Modifiers aModifiers,
const ScrollableLayerGuid& aGuid,
@ -211,7 +211,7 @@ APZEventState::ProcessLongTap(const nsCOMPtr<nsIDOMWindowUtils>& aUtils,
// just converts them back to widget format, but that API has many callers,
// including in JS code, so it's not trivial to change.
bool eventHandled =
APZCCallbackHelper::DispatchMouseEvent(aUtils, NS_LITERAL_STRING("contextmenu"),
APZCCallbackHelper::DispatchMouseEvent(aPresShell, NS_LITERAL_STRING("contextmenu"),
APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid, aPresShellResolution),
2, 1, WidgetModifiersToDOMModifiers(aModifiers), true,
nsIDOMMouseEvent::MOZ_SOURCE_TOUCH);

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