Merge with mozilla-central 95bca70369ef

--HG--
rename : embedding/android/AndroidManifest.xml.in => mobile/android/base/AndroidManifest.xml.in
rename : embedding/android/GeckoApp.java => mobile/android/base/GeckoApp.java
rename : embedding/android/GeckoAppShell.java => mobile/android/base/GeckoAppShell.java
rename : embedding/android/GeckoEvent.java => mobile/android/base/GeckoEvent.java
rename : embedding/android/GeckoSmsManager.java => mobile/android/base/GeckoSmsManager.java
rename : embedding/android/Makefile.in => mobile/android/base/Makefile.in
This commit is contained in:
Doug Turner 2011-11-29 20:58:39 -08:00
Родитель bfc92e15a8 291fb958fa
Коммит 99e7f3124a
586 изменённых файлов: 10068 добавлений и 7471 удалений

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

@ -44,7 +44,8 @@
#include "nsMai.h"
#include "prlink.h"
#include "prenv.h"
#include "nsIPrefBranch.h"
#include "mozilla/Preferences.h"
#include "nsIGConfService.h"
#include "nsIServiceManager.h"
#include "nsAutoPtr.h"
#include "nsAccessibilityService.h"
@ -53,6 +54,8 @@
#include <gtk/gtk.h>
#include <atk/atk.h>
using namespace mozilla;
typedef GType (* AtkGetTypeType) (void);
GType g_atk_hyperlink_impl_type = G_TYPE_INVALID;
static bool sATKChecked = false;
@ -61,10 +64,12 @@ static const char sATKLibName[] = "libatk-1.0.so.0";
static const char sATKHyperlinkImplGetTypeSymbol[] =
"atk_hyperlink_impl_get_type";
static const char sAccEnv [] = "GNOME_ACCESSIBILITY";
static const char sSysPrefService [] =
"@mozilla.org/system-preference-service;1";
static const char sUseSystemPrefsKey[] =
"config.use_system_prefs";
static const char sAccessibilityKey [] =
"config.use_system_prefs.accessibility";
static const char sGconfAccessibilityKey[] =
"/desktop/gnome/interface/accessibility";
/* gail function pointer */
static guint (* gail_add_global_event_listener) (GSignalEmissionHook listener,
@ -625,11 +630,17 @@ nsApplicationAccessibleWrap::Init()
isGnomeATEnabled = !!atoi(envValue);
} else {
//check gconf-2 setting
nsresult rv;
nsCOMPtr<nsIPrefBranch> sysPrefService =
do_GetService(sSysPrefService, &rv);
if (NS_SUCCEEDED(rv) && sysPrefService) {
sysPrefService->GetBoolPref(sAccessibilityKey, &isGnomeATEnabled);
if (Preferences::GetBool(sUseSystemPrefsKey, false)) {
nsresult rv;
nsCOMPtr<nsIGConfService> gconf =
do_GetService(NS_GCONFSERVICE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && gconf) {
gconf->GetBool(NS_LITERAL_CSTRING(sGconfAccessibilityKey),
&isGnomeATEnabled);
}
} else {
isGnomeATEnabled =
Preferences::GetBool(sAccessibilityKey, false);
}
}

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

@ -50,6 +50,7 @@
#include "nsIContentViewer.h"
#include "nsCURILoader.h"
#include "nsDocAccessible.h"
#include "nsHTMLCanvasAccessible.h"
#include "nsHTMLImageMapAccessible.h"
#include "nsHTMLLinkAccessible.h"
#include "nsHTMLSelectAccessible.h"
@ -275,6 +276,16 @@ nsAccessibilityService::CreateHTMLComboboxAccessible(nsIContent* aContent,
return accessible;
}
already_AddRefed<nsAccessible>
nsAccessibilityService::CreateHTMLCanvasAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(aPresShell));
nsAccessible* accessible = new nsHTMLCanvasAccessible(aContent, weakShell);
NS_IF_ADDREF(accessible);
return accessible;
}
already_AddRefed<nsAccessible>
nsAccessibilityService::CreateHTMLImageAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)

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

@ -83,6 +83,8 @@ public:
CreateHTML4ButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
already_AddRefed<nsAccessible>
CreateHTMLCanvasAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLCaptionAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>

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

@ -391,29 +391,25 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
nsINode* targetNode = accessible->GetNode();
#ifdef MOZ_XUL
bool isTree = targetNode->IsElement() &&
targetNode->AsElement()->NodeInfo()->Equals(nsGkAtoms::tree, kNameSpaceID_XUL);
nsRefPtr<nsXULTreeAccessible> treeAcc;
if (targetNode->IsElement() &&
targetNode->AsElement()->NodeInfo()->Equals(nsGkAtoms::tree,
kNameSpaceID_XUL)) {
treeAcc = do_QueryObject(accessible);
if (isTree) {
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(accessible);
NS_ASSERTION(treeAcc,
"Accessible for xul:tree isn't nsXULTreeAccessible.");
if (eventType.EqualsLiteral("TreeViewChanged")) {
treeAcc->TreeViewChanged();
return;
}
if (treeAcc) {
if (eventType.EqualsLiteral("TreeViewChanged")) {
treeAcc->TreeViewChanged();
return;
}
if (eventType.EqualsLiteral("TreeRowCountChanged")) {
HandleTreeRowCountChangedEvent(aDOMEvent, treeAcc);
return;
}
if (eventType.EqualsLiteral("TreeRowCountChanged")) {
HandleTreeRowCountChangedEvent(aDOMEvent, treeAcc);
return;
}
if (eventType.EqualsLiteral("TreeInvalidated")) {
HandleTreeInvalidatedEvent(aDOMEvent, treeAcc);
return;
}
if (eventType.EqualsLiteral("TreeInvalidated")) {
HandleTreeInvalidatedEvent(aDOMEvent, treeAcc);
return;
}
}
#endif
@ -451,18 +447,16 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
return;
}
nsAccessible *treeItemAccessible = nsnull;
nsAccessible* treeItemAcc = nsnull;
#ifdef MOZ_XUL
// If it's a tree element, need the currently selected item
if (isTree) {
treeItemAccessible = accessible->CurrentItem();
if (treeItemAccessible)
accessible = treeItemAccessible;
// If it's a tree element, need the currently selected item.
if (treeAcc) {
treeItemAcc = accessible->CurrentItem();
if (treeItemAcc)
accessible = treeItemAcc;
}
#endif
#ifdef MOZ_XUL
if (treeItemAccessible && eventType.EqualsLiteral("OpenStateChange")) {
if (treeItemAcc && eventType.EqualsLiteral("OpenStateChange")) {
PRUint64 state = accessible->State();
bool isEnabled = (state & states::EXPANDED) != 0;
@ -472,7 +466,7 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
return;
}
if (treeItemAccessible && eventType.EqualsLiteral("select")) {
if (treeItemAcc && eventType.EqualsLiteral("select")) {
// XXX: We shouldn't be based on DOM select event which doesn't provide us
// any context info. We should integrate into nsTreeSelection instead.
// If multiselect tree, we should fire selectionadd or selection removed
@ -491,8 +485,10 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
return;
}
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SELECTION,
treeItemAccessible);
nsRefPtr<AccSelChangeEvent> selChangeEvent =
new AccSelChangeEvent(treeAcc, treeItemAcc,
AccSelChangeEvent::eSelectionAdd);
nsEventShell::FireEvent(selChangeEvent);
return;
}
}

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

@ -50,6 +50,7 @@ LIBXUL_LIBRARY = 1
CPPSRCS = \
nsHTMLCanvasAccessible.cpp \
nsHTMLFormControlAccessible.cpp \
nsHTMLImageAccessible.cpp \
nsHTMLImageMapAccessible.cpp \

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

@ -0,0 +1,52 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsHTMLCanvasAccessible.h"
using namespace mozilla::a11y;
nsHTMLCanvasAccessible::
nsHTMLCanvasAccessible(nsIContent* aContent, nsIWeakReference* aShell) :
nsHyperTextAccessible(aContent, aShell)
{
}
PRUint32
nsHTMLCanvasAccessible::NativeRole()
{
return nsIAccessibleRole::ROLE_CANVAS;
}

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

@ -1,3 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -14,14 +15,11 @@
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Dave Hyatt <hyatt@mozilla.org> (Original Author)
* Jan Varga <varga@ku.sk>
* Scott Johnson <sjohnson@mozilla.com>, Mozilla Corporation
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -37,28 +35,22 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsITreeImageListener_h__
#define nsITreeImageListener_h__
#include "nsHyperTextAccessible.h"
// The interface for our image listener.
// {90586540-2D50-403e-8DCE-981CAA778444}
#define NS_ITREEIMAGELISTENER_IID \
{ 0x90586540, 0x2d50, 0x403e, { 0x8d, 0xce, 0x98, 0x1c, 0xaa, 0x77, 0x84, 0x44 } }
#ifndef _nsHTMLCanvasAccessible_H_
#define _nsHTMLCanvasAccessible_H_
class nsITreeImageListener : public nsISupports
/**
* HTML canvas accessible (html:canvas).
*/
class nsHTMLCanvasAccessible : public nsHyperTextAccessible
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ITREEIMAGELISTENER_IID)
nsHTMLCanvasAccessible(nsIContent* aContent, nsIWeakReference* aShell);
virtual ~nsHTMLCanvasAccessible() { }
NS_IMETHOD AddCell(PRInt32 aIndex, nsITreeColumn* aCol) = 0;
/**
* Clear the internal frame pointer to prevent dereferencing an object
* that no longer exists.
*/
NS_IMETHOD ClearFrame() = 0;
// nsAccessible
virtual PRUint32 NativeRole();
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsITreeImageListener, NS_ITREEIMAGELISTENER_IID)
#endif

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

@ -7,6 +7,7 @@ const ROLE_APPLICATION = nsIAccessibleRole.ROLE_APPLICATION;
const ROLE_APP_ROOT = nsIAccessibleRole.ROLE_APP_ROOT;
const ROLE_AUTOCOMPLETE = nsIAccessibleRole.ROLE_AUTOCOMPLETE;
const ROLE_BUTTONDROPDOWNGRID = nsIAccessibleRole.ROLE_BUTTONDROPDOWNGRID;
const ROLE_CANVAS = nsIAccessibleRole.ROLE_CANVAS;
const ROLE_CAPTION = nsIAccessibleRole.ROLE_CAPTION;
const ROLE_CELL = nsIAccessibleRole.ROLE_CELL;
const ROLE_CHECKBUTTON = nsIAccessibleRole.ROLE_CHECKBUTTON;

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

@ -52,6 +52,7 @@ _TEST_FILES =\
test_aria_imgmap.html \
test_aria_presentation.html \
test_button.xul \
test_canvas.html \
test_combobox.xul \
test_cssoverflow.html \
test_dochierarchy.html \

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

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=495912
-->
<head>
<title>File Input Control tests</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../role.js"></script>
<script type="application/javascript">
function doTest()
{
var accTree = {
role: ROLE_CANVAS,
children: [
]
};
testAccessibleTree("canvas", accTree);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="Expose alternative content in Canvas element to ATs"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=495912">Mozilla Bug 495912</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<canvas id="canvas" tabindex="0">
fallback content.
</canvas>
<script type="text/javascript">
var c=document.getElementById("canvas");
var cxt=c.getContext("2d");
cxt.fillStyle="#005500";
cxt.fillRect(0,0,150,75);
</script>
</body>
</html>

1
aclocal.m4 поставляемый
Просмотреть файл

@ -12,6 +12,7 @@ builtin(include, build/autoconf/codeset.m4)dnl
builtin(include, build/autoconf/altoptions.m4)dnl
builtin(include, build/autoconf/mozprog.m4)dnl
builtin(include, build/autoconf/mozheader.m4)dnl
builtin(include, build/autoconf/mozcommonheader.m4)dnl
builtin(include, build/autoconf/acwinpaths.m4)dnl
builtin(include, build/autoconf/lto.m4)dnl
builtin(include, build/autoconf/gcc-pr49911.m4)dnl

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

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1318359094000">
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1321712096000">
<emItems>
<emItem blockID="i41" id="{99079a25-328f-4bd4-be04-00955acaa0a7}">
<versionRange minVersion="0.1" maxVersion="4.3.1.00" severity="1">
@ -117,6 +117,13 @@
<versionRange minVersion="2.2" maxVersion="2.2">
</versionRange>
</emItem>
<emItem blockID="i45" id="{22119944-ED35-4ab1-910B-E619EA06A115}">
<versionRange minVersion="0.1" maxVersion="7.6.1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="8.0a1" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i3" id="langpack-vi-VN@firefox.mozilla.org">
<versionRange minVersion="2.0" maxVersion="2.0">
</versionRange>

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

@ -3481,7 +3481,6 @@ const BrowserSearch = {
openLinkIn(submission.uri.spec,
useNewTab ? "tab" : "current",
{ postData: submission.postData,
inBackground: false,
relatedToCurrent: true });
},
@ -3951,6 +3950,9 @@ var FullScreen = {
return;
}
if (gFindBarInitialized)
gFindBar.close();
this.showWarning(true);
// Exit DOM full-screen mode upon open, close, or change tab.

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

@ -340,6 +340,9 @@ var MigrationWizard = {
case "safari":
source = "sourceNameSafari";
break;
case "chrome":
source = "sourceNameChrome";
break;
}
// semi-wallpaper for crash when multiple profiles exist, since we haven't initialized mSourceProfile in places

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

@ -79,6 +79,7 @@
#endif
<radio id="opera" label="&importFromOpera.label;" accesskey="&importFromOpera.accesskey;"/>
#endif
<radio id="chrome" label="&importFromChrome.label;" accesskey="&importFromChrome.accesskey;"/>
<radio id="fromfile" label="&importFromHTMLFile.label;" accesskey="&importFromHTMLFile.accesskey;" hidden="true"/>
<radio id="nothing" label="&importFromNothing.label;" accesskey="&importFromNothing.accesskey;" hidden="true"/>
</radiogroup>

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

@ -0,0 +1,2 @@
component {4cec1de4-1671-4fc3-a53e-6c539dc77a26} ChromeProfileMigrator.js
contract @mozilla.org/profile/migrator;1?app=browser&type=chrome {4cec1de4-1671-4fc3-a53e-6c539dc77a26}

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

@ -0,0 +1,532 @@
/* -*- Mode: js; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=2 sts=2 et
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The Original Code is the Browser Profile Migrator.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Makoto Kato <m_kato@ga2.so-net.ne.jp> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
const LOCAL_FILE_CID = "@mozilla.org/file/local;1";
const FILE_INPUT_STREAM_CID = "@mozilla.org/network/file-input-stream;1";
const BUNDLE_MIGRATION = "chrome://browser/locale/migration/migration.properties";
const MIGRATE_ALL = 0x0000;
const MIGRATE_SETTINGS = 0x0001;
const MIGRATE_COOKIES = 0x0002;
const MIGRATE_HISTORY = 0x0004;
const MIGRATE_FORMDATA = 0x0008;
const MIGRATE_PASSWORDS = 0x0010;
const MIGRATE_BOOKMARKS = 0x0020;
const MIGRATE_OTHERDATA = 0x0040;
const S100NS_FROM1601TO1970 = 0x19DB1DED53E8000;
const S100NS_PER_MS = 10;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyGetter(this, "bookmarksSubfolderTitle", function () {
// get "import from google chrome" string for folder
let strbundle =
Services.strings.createBundle(BUNDLE_MIGRATION);
let sourceNameChrome = strbundle.GetStringFromName("sourceNameChrome");
return strbundle.formatStringFromName("importedBookmarksFolder",
[sourceNameChrome],
1);
});
/*
* Convert Chrome time format to Date object
*
* @param aTime
* Chrome time
* @return converted Date object
* @note Google Chrome uses FILETIME / 10 as time.
* FILETIME is based on same structure of Windows.
*/
function chromeTimeToDate(aTime)
{
return new Date((aTime * S100NS_PER_MS - S100NS_FROM1601TO1970 ) / 10000);
}
/*
* Insert bookmark items into specific folder.
*
* @param aFolderId
* id of folder where items will be inserted
* @param aItems
* bookmark items to be inserted
*/
function insertBookmarkItems(aFolderId, aItems)
{
for (let i = 0; i < aItems.length; i++) {
let item = aItems[i];
try {
if (item.type == "url") {
PlacesUtils.bookmarks.insertBookmark(aFolderId,
NetUtil.newURI(item.url),
PlacesUtils.bookmarks.DEFAULT_INDEX,
item.name);
} else if (item.type == "folder") {
let newFolderId =
PlacesUtils.bookmarks.createFolder(aFolderId,
item.name,
PlacesUtils.bookmarks.DEFAULT_INDEX);
insertBookmarkItems(newFolderId, item.children);
}
} catch (e) {
Cu.reportError(e);
}
}
}
function ChromeProfileMigrator()
{
}
ChromeProfileMigrator.prototype = {
_paths: {
bookmarks : null,
cookies : null,
history : null,
prefs : null,
},
_homepageURL : null,
_replaceBookmarks : false,
/*
* Notify to observers to start migration
*
* @param aType
* notification type such as MIGRATE_BOOKMARKS
*/
_notifyStart : function Chrome_notifyStart(aType)
{
Services.obs.notifyObservers(null, "Migration:ItemBeforeMigrate", aType);
this._pendingCount++;
},
/*
* Notify to observers to finish migration for item
* If all items are finished, it sends migration end notification.
*
* @param aType
* notification type such as MIGRATE_BOOKMARKS
*/
_notifyCompleted : function Chrome_notifyIfCompleted(aType)
{
Services.obs.notifyObservers(null, "Migration:ItemAfterMigrate", aType);
if (--this._pendingCount == 0) {
// All items are migrated, so we have to send end notification.
Services.obs.notifyObservers(null, "Migration:Ended", null);
}
},
/*
* Migrating bookmark items
*/
_migrateBookmarks : function Chrome_migrateBookmarks()
{
this._notifyStart(MIGRATE_BOOKMARKS);
try {
PlacesUtils.bookmarks.runInBatchMode({
_self : this,
runBatched : function (aUserData) {
let migrator = this._self;
let file = Cc[LOCAL_FILE_CID].createInstance(Ci.nsILocalFile);
file.initWithPath(migrator._paths.bookmarks);
NetUtil.asyncFetch(file, function(aInputStream, aResultCode) {
if (!Components.isSuccessCode(aResultCode)) {
migrator._notifyCompleted(MIGRATE_BOOKMARKS);
return;
}
// Parse Chrome bookmark file that is JSON format
let bookmarkJSON = NetUtil.readInputStreamToString(aInputStream,
aInputStream.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 parentId = PlacesUtils.toolbarFolderId;
if (!migrator._replaceBookmarks) {
parentId =
PlacesUtils.bookmarks.createFolder(parentId,
bookmarksSubfolderTitle,
PlacesUtils.bookmarks.DEFAULT_INDEX);
}
insertBookmarkItems(parentId, roots.bookmark_bar.children);
}
// Importing bookmark menu items
if (roots.other.children &&
roots.other.children.length > 0) {
// Bookmark menu
let parentId = PlacesUtils.bookmarksMenuFolderId;
if (!migrator._replaceBookmarks) {
parentId =
PlacesUtils.bookmarks.createFolder(parentId,
bookmarksSubfolderTitle,
PlacesUtils.bookmarks.DEFAULT_INDEX);
}
insertBookmarkItems(parentId, roots.other.children);
}
migrator._notifyCompleted(MIGRATE_BOOKMARKS);
});
}
}, null);
} catch (e) {
Cu.reportError(e);
this._notifyCompleted(MIGRATE_BOOKMARKS);
}
},
/*
* Migrating history
*/
_migrateHistory : function Chrome_migrateHistory()
{
this._notifyStart(MIGRATE_HISTORY);
try {
PlacesUtils.history.runInBatchMode({
_self : this,
runBatched : function (aUserData) {
// access sqlite3 database of Chrome's history
let file = Cc[LOCAL_FILE_CID].createInstance(Ci.nsILocalFile);
file.initWithPath(this._self._paths.history);
let dbConn = Services.storage.openUnsharedDatabase(file);
let stmt = dbConn.createAsyncStatement(
"SELECT url, title, last_visit_time, typed_count FROM urls WHERE hidden = 0");
stmt.executeAsync({
_asyncHistory : Cc["@mozilla.org/browser/history;1"]
.getService(Ci.mozIAsyncHistory),
_db : dbConn,
_self : this._self,
handleResult : function(aResults) {
let places = [];
for (let row = aResults.getNextRow(); row; row = aResults.getNextRow()) {
try {
// if having typed_count, we changes transition type to typed.
let transType = PlacesUtils.history.TRANSITION_LINK;
if (row.getResultByName("typed_count") > 0)
transType = PlacesUtils.history.TRANSITION_TYPED;
places.push({
uri: NetUtil.newURI(row.getResultByName("url")),
title: row.getResultByName("title"),
visits: [{
transitionType: transType,
visitDate: chromeTimeToDate(
row.getResultByName(
"last_visit_time")) * 1000,
}],
});
} catch (e) {
Cu.reportError(e);
}
}
try {
this._asyncHistory.updatePlaces(places);
} catch (e) {
Cu.reportError(e);
}
},
handleError : function(aError) {
Cu.reportError("Async statement execution returned with '" +
aError.result + "', '" + aError.message + "'");
},
handleCompletion : function(aReason) {
this._db.asyncClose();
this._self._notifyCompleted(MIGRATE_HISTORY);
}
});
stmt.finalize();
}
}, null);
} catch (e) {
Cu.reportError(e);
this._notifyCompleted(MIGRATE_HISTORY);
}
},
/*
* Migrating cookies
*/
_migrateCookies : function Chrome_migrateCookies()
{
this._notifyStart(MIGRATE_COOKIES);
try {
// Access sqlite3 database of Chrome's cookie
let file = Cc[LOCAL_FILE_CID].createInstance(Ci.nsILocalFile);
file.initWithPath(this._paths.cookies);
let dbConn = Services.storage.openUnsharedDatabase(file);
let stmt = dbConn.createAsyncStatement(
"SELECT host_key, path, name, value, secure, httponly, expires_utc FROM cookies");
stmt.executeAsync({
_db : dbConn,
_self : this,
handleResult : function(aResults) {
for (let row = aResults.getNextRow(); row; row = aResults.getNextRow()) {
let host_key = row.getResultByName("host_key");
if (host_key.match(/^\./)) {
// 1st character of host_key may be ".", so we have to remove it
host_key = host_key.substr(1);
}
try {
let expiresUtc =
chromeTimeToDate(row.getResultByName("expires_utc")) / 1000;
Services.cookies.add(host_key,
row.getResultByName("path"),
row.getResultByName("name"),
row.getResultByName("value"),
row.getResultByName("secure"),
row.getResultByName("httponly"),
false,
parseInt(expiresUtc));
} catch (e) {
Cu.reportError(e);
}
}
},
handleError : function(aError) {
Cu.reportError("Async statement execution returned with '" +
aError.result + "', '" + aError.message + "'");
},
handleCompletion : function(aReason) {
this._db.asyncClose();
this._self._notifyCompleted(MIGRATE_COOKIES);
},
});
stmt.finalize();
} catch (e) {
Cu.reportError(e);
this._notifyCompleted(MIGRATE_COOKIES);
}
},
/*
* nsIBrowserProfileMigrator interface implementation
*/
/*
* Let's migrate all items
*
* @param aItems
* list of data items to migrate. but this is unused.
* @param aStartup
* non-null if called during startup.
* @param aProfile
* this is unused due to single profile support only
*/
migrate : function Chrome_migrate(aItems, aStartup, aProfile)
{
if (aStartup) {
aStartup.doStartup();
this._replaceBookmarks = true;
}
Services.obs.notifyObservers(null, "Migration:Started", null);
// Reset panding count. If this count becomes 0, "Migration:Ended"
// notification is sent
this._pendingCount = 1;
if (aItems & MIGRATE_HISTORY)
this._migrateHistory();
if (aItems & MIGRATE_COOKIES)
this._migrateCookies();
if (aItems & MIGRATE_BOOKMARKS)
this._migrateBookmarks();
if (--this._pendingCount == 0) {
// When async imports are immeditelly completed unfortunately,
// this will be called.
// Usually, this notification is sent by _notifyCompleted()
Services.obs.notifyObservers(null, "Migration:Ended", null);
}
},
/*
* return supported migration types
*
* @param aProfile
* this is unused due to single profile support only
* @param aDoingStartup
* non-null if called during startup.
* @return supported migration types
*/
getMigrateData: function Chrome_getMigrateData(aProfile, aDoingStartup)
{
#ifdef XP_WIN
let chromepath = Services.dirsvc.get("LocalAppData", Ci.nsIFile).path +
"\\Google\\Chrome\\User Data\\Default\\";
#elifdef XP_MACOSX
let chromepath = Services.dirsvc.get("Home", Ci.nsIFile).path +
"/Library/Application Support/Google/Chrome/Default/";
#else
let chromepath = Services.dirsvc.get("Home", Ci.nsIFile).path +
"/.config/google-chrome/Default/";
#endif
let result = 0;
// bookmark and preference are JSON format
try {
let file = Cc[LOCAL_FILE_CID].createInstance(Ci.nsILocalFile);
file.initWithPath(chromepath + "Bookmarks");
if (file.exists()) {
this._paths.bookmarks = file.path
result += MIGRATE_BOOKMARKS;
}
} catch (e) {
Cu.reportError(e);
}
if (!this._paths.prefs)
this._paths.prefs = chromepath + "Preferences";
// history and cookies are SQLite database
try {
let file = Cc[LOCAL_FILE_CID].createInstance(Ci.nsILocalFile);
file.initWithPath(chromepath + "History");
if (file.exists()) {
this._paths.history = file.path
result += MIGRATE_HISTORY;
}
} catch (e) {
Cu.reportError(e);
}
try {
let file = Cc[LOCAL_FILE_CID].createInstance(Ci.nsILocalFile);
file.initWithPath(chromepath + "Cookies");
if (file.exists()) {
this._paths.cookies = file.path
result += MIGRATE_COOKIES;
}
} catch (e) {
Cu.reportError(e);
}
return result;
},
/*
* Whether we support migration of Chrome
*
* @return true if supported
*/
sourceExists: function Chrome_sourceExists()
{
let result = this.getMigrateData(null, false);
return result != 0;
},
// Although Chrome supports multi-profiles, there is no way
// to get profile lists.
sourceHasMultipleProfiles: false,
sourceProfiles: null,
/*
* Return home page URL
*
* @return home page URL
*/
sourceHomePageURL: function Chrome_sourceHomePageURL()
{
try {
if (this._homepageURL)
return this._homepageURL;
if (!this._paths.prefs)
this.getMigrateData(null, false);
// XXX reading and parsing JSON is synchronous.
let file = Cc[LOCAL_FILE_CID].createInstance(Ci.nsILocalFile);
file.initWithPath(this._paths.prefs);
let fstream = Cc[FILE_INPUT_STREAM_CID].
createInstance(Ci.nsIFileInputStream);
fstream.init(file, -1, 0, 0);
this._homepageURL = JSON.parse(
NetUtil.readInputStreamToString(fstream, fstream.available(),
{ charset: "UTF-8" })).homepage;
return this._homepageURL;
} catch (e) {
Cu.reportError(e);
}
return "";
},
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIBrowserProfileMigrator
]),
classDescription: "Chrome Profile Migrator",
contractID: "@mozilla.org/profile/migrator;1?app=browser&type=chrome",
classID: Components.ID("{4cec1de4-1671-4fc3-a53e-6c539dc77a26}")
};
const NSGetFactory = XPCOMUtils.generateNSGetFactory([ChromeProfileMigrator]);

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

@ -67,5 +67,13 @@ CPPSRCS += nsSafariProfileMigrator.cpp \
$(NULL)
endif
EXTRA_PP_COMPONENTS = \
ChromeProfileMigrator.js \
$(NULL)
EXTRA_COMPONENTS = \
BrowserProfileMigrators.manifest \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -163,6 +163,7 @@ NS_IMPL_ISUPPORTS1(nsProfileMigrator, nsIProfileMigrator)
#define INTERNAL_NAME_IEXPLORE "iexplore"
#define INTERNAL_NAME_MOZILLA_SUITE "apprunner"
#define INTERNAL_NAME_OPERA "opera"
#define INTERNAL_NAME_CHROME "chrome"
#endif
nsresult
@ -246,6 +247,10 @@ nsProfileMigrator::GetDefaultBrowserMigratorKey(nsACString& aKey,
aKey = "opera";
return NS_OK;
}
else if (internalName.LowerCaseEqualsLiteral(INTERNAL_NAME_CHROME)) {
aKey = "chrome";
return NS_OK;
}
#else
bool exists = false;
@ -262,6 +267,7 @@ nsProfileMigrator::GetDefaultBrowserMigratorKey(nsACString& aKey,
CHECK_MIGRATOR("safari");
#endif
CHECK_MIGRATOR("opera");
CHECK_MIGRATOR("chrome");
#undef CHECK_MIGRATOR
#endif

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

@ -447,7 +447,6 @@ PlacesController.prototype = {
* "tagChild" node is a child of a tag
* "folder" node is a folder
* "query" node is a query
* "dynamiccontainer" node is a dynamic container
* "separator" node is a separator line
* "host" node is a host
*
@ -490,9 +489,6 @@ PlacesController.prototype = {
}
}
break;
case Ci.nsINavHistoryResultNode.RESULT_TYPE_DYNAMIC_CONTAINER:
nodeData["dynamiccontainer"] = true;
break;
case Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER:
case Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT:
nodeData["folder"] = true;

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

@ -1,8 +1,8 @@
ac_add_options --enable-debug
ac_add_options --enable-trace-malloc
CC=/tools/gcc-4.5-0moz2/bin/gcc
CXX=/tools/gcc-4.5-0moz2/bin/g++
. $topsrcdir/build/unix/mozconfig.linux
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat

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

@ -3,5 +3,5 @@ ac_add_options --enable-official-branding
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
CC=/tools/gcc-4.5-0moz2/bin/gcc
CXX=/tools/gcc-4.5-0moz2/bin/g++
. $topsrcdir/build/unix/mozconfig.linux

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

@ -5,8 +5,8 @@ ac_add_options --enable-codesighs
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics
CC=/tools/gcc-4.5-0moz2/bin/gcc
CXX=/tools/gcc-4.5-0moz2/bin/g++
. $topsrcdir/build/unix/mozconfig.linux
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat

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

@ -1,8 +1,8 @@
ac_add_options --enable-update-packaging
ac_add_options --enable-codesighs
CC=/tools/gcc-4.5-0moz2/bin/gcc
CXX=/tools/gcc-4.5-0moz2/bin/g++
. $topsrcdir/build/unix/mozconfig.linux
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat

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

@ -2,8 +2,8 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-official-branding
CC=/tools/gcc-4.5-0moz2/bin/gcc
CXX=/tools/gcc-4.5-0moz2/bin/g++
. $topsrcdir/build/unix/mozconfig.linux
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat

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

@ -9,8 +9,8 @@ ac_add_options --disable-updater
ac_add_options --prefix=$PREFIX
ac_add_options --libdir=$LIBDIR
CC=/tools/gcc-4.5-0moz2/bin/gcc
CXX=/tools/gcc-4.5-0moz2/bin/g++
. $topsrcdir/build/unix/mozconfig.linux
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat

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

@ -1,8 +1,8 @@
ac_add_options --enable-debug
ac_add_options --enable-trace-malloc
CC=/tools/gcc-4.5-0moz2/bin/gcc
CXX=/tools/gcc-4.5-0moz2/bin/g++
. $topsrcdir/build/unix/mozconfig.linux
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat

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

@ -3,5 +3,5 @@ ac_add_options --enable-official-branding
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
CC=/tools/gcc-4.5-0moz2/bin/gcc
CXX=/tools/gcc-4.5-0moz2/bin/g++
. $topsrcdir/build/unix/mozconfig.linux

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

@ -5,8 +5,8 @@ ac_add_options --enable-codesighs
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics
CC=/tools/gcc-4.5-0moz2/bin/gcc
CXX=/tools/gcc-4.5-0moz2/bin/g++
. $topsrcdir/build/unix/mozconfig.linux
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat

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

@ -2,8 +2,8 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-official-branding
CC=/tools/gcc-4.5-0moz2/bin/gcc
CXX=/tools/gcc-4.5-0moz2/bin/g++
. $topsrcdir/build/unix/mozconfig.linux
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat

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

@ -9,8 +9,8 @@ ac_add_options --disable-updater
ac_add_options --prefix=$PREFIX
ac_add_options --libdir=$LIBDIR
CC=/tools/gcc-4.5-0moz2/bin/gcc
CXX=/tools/gcc-4.5-0moz2/bin/g++
. $topsrcdir/build/unix/mozconfig.linux
# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat

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

@ -148,6 +148,7 @@
@BINPATH@/components/dom_json.xpt
@BINPATH@/components/dom_range.xpt
@BINPATH@/components/dom_sidebar.xpt
@BINPATH@/components/dom_sms.xpt
@BINPATH@/components/dom_storage.xpt
@BINPATH@/components/dom_stylesheets.xpt
@BINPATH@/components/dom_threads.xpt
@ -356,6 +357,8 @@
@BINPATH@/components/contentSecurityPolicy.js
@BINPATH@/components/contentAreaDropListener.manifest
@BINPATH@/components/contentAreaDropListener.js
@BINPATH@/components/BrowserProfileMigrators.manifest
@BINPATH@/components/ChromeProfileMigrator.js
#ifdef XP_MACOSX
@BINPATH@/components/libalerts_s.dylib
#endif

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

@ -314,6 +314,7 @@ searchplugins/atlas-sk.src
searchplugins/baidu.gif
searchplugins/baidu.png
searchplugins/baidu.src
searchplugins/bluu.xml
searchplugins/bok-NO.gif
searchplugins/bok-NO.png
searchplugins/bok-NO.src

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

@ -15,6 +15,8 @@
<!ENTITY importFromOpera.accesskey "O">
<!ENTITY importFromSafari.label "Safari">
<!ENTITY importFromSafari.accesskey "S">
<!ENTITY importFromChrome.label "Chrome">
<!ENTITY importFromChrome.accesskey "C">
<!ENTITY importFromHTMLFile.label "From an HTML File">
<!ENTITY importFromHTMLFile.accesskey "F">

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

@ -5,6 +5,7 @@ sourceNameIE=Internet Explorer
sourceNameSeamonkey=Netscape 6/7/Mozilla
sourceNameOpera=Opera
sourceNameSafari=Safari
sourceNameChrome=Google Chrome
importedBookmarksFolder=From %S
importedSearchURLsFolder=Keyword Searches (From %S)
@ -21,34 +22,41 @@ importedOperaSearchUrls=Keyword Searches (From Opera)
1_opera=Preferences
1_seamonkey=Preferences
1_safari=Preferences
1_chrome=Preferences
2_ie=Cookies
2_opera=Cookies
2_seamonkey=Cookies
2_safari=Cookies
2_chrome=Cookies
4_ie=Browsing History
4_opera=Browsing History
4_seamonkey=Browsing History
4_safari=Browsing History
4_chrome=Browsing History
8_ie=Saved Form History
8_opera=Saved Form History
8_seamonkey=Saved Form History
8_safari=Saved Form History
8_chrome=Saved Form History
16_ie=Saved Passwords
16_opera=Saved Passwords
16_seamonkey=Saved Passwords
16_safari=Saved Passwords
16_chrome=Saved Passwords
32_ie=Favorites
32_opera=Bookmarks
32_seamonkey=Bookmarks
32_safari=Bookmarks
32_chrome=Bookmarks
64_ie=Other Data
64_opera=Other Data
64_seamonkey=Other Data
64_safari=Other Data
64_chrome=Other Data

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

@ -222,7 +222,7 @@ menuitem.bookmark-item {
}
.bookmark-item[query][tagContainer] {
list-style-image: url("chrome://mozapps/skin/places/tagContainerIcon.png");
list-style-image: url("chrome://browser/skin/places/tag.png");
}
.bookmark-item[query][dayContainer] {

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

До

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

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

До

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

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

До

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

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

До

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

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

@ -39,10 +39,10 @@ browser.jar:
skin/classic/browser/urlbar-arrow.png
skin/classic/browser/feeds/feedIcon.png (feeds/feedIcon.png)
skin/classic/browser/feeds/feedIcon16.png (feeds/feedIcon16.png)
skin/classic/browser/feeds/videoFeedIcon.png (feeds/videoFeedIcon.png)
skin/classic/browser/feeds/videoFeedIcon16.png (feeds/videoFeedIcon16.png)
skin/classic/browser/feeds/audioFeedIcon.png (feeds/audioFeedIcon.png)
skin/classic/browser/feeds/audioFeedIcon16.png (feeds/audioFeedIcon16.png)
skin/classic/browser/feeds/videoFeedIcon.png (feeds/feedIcon.png)
skin/classic/browser/feeds/videoFeedIcon16.png (feeds/feedIcon16.png)
skin/classic/browser/feeds/audioFeedIcon.png (feeds/feedIcon.png)
skin/classic/browser/feeds/audioFeedIcon16.png (feeds/feedIcon16.png)
skin/classic/browser/feeds/subscribe.css (feeds/subscribe.css)
skin/classic/browser/feeds/subscribe-ui.css (feeds/subscribe-ui.css)
skin/classic/browser/places/bookmarksMenu.png (places/bookmarksMenu.png)

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

@ -77,7 +77,7 @@ treechildren::-moz-tree-image(query, OrganizerQuery_Downloads) {
treechildren::-moz-tree-image(title, query, tagContainer),
treechildren::-moz-tree-image(query, OrganizerQuery_Tags) {
list-style-image: url("chrome://mozapps/skin/places/tagContainerIcon.png");
list-style-image: url("chrome://browser/skin/places/tag.png");
}
/* calendar icon for folders grouping items by date */

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

@ -88,6 +88,17 @@
padding: 2px 4px;
}
/* Because of -moz-box-align: center above, separators will be invisible unless
we set their min-height. See bug 583510 for more information. */
toolbarseparator {
min-height: 22px;
}
/* We need more height when toolbar buttons show both icon and text. */
toolbar[mode="full"] toolbarseparator {
min-height: 36px;
}
#nav-bar {
padding-bottom: 4px !important;
}
@ -231,7 +242,7 @@ toolbarbutton.bookmark-item > menupopup {
}
.bookmark-item[query][tagContainer] {
list-style-image: url("chrome://mozapps/skin/places/tagContainerIcon.png");
list-style-image: url("chrome://browser/skin/places/tag.png");
}
.bookmark-item[query][dayContainer] {
@ -1902,6 +1913,7 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
}
.tabbrowser-tab[selected="true"] {
color: #000;
z-index: 1;
position: relative;
}

Двоичные данные
browser/themes/pinstripe/feeds/audioFeedIcon.png

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

До

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

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

До

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

Двоичные данные
browser/themes/pinstripe/feeds/videoFeedIcon.png

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

До

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

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

До

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

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

@ -51,10 +51,10 @@ browser.jar:
skin/classic/browser/feeds/subscribe-ui.css (feeds/subscribe-ui.css)
skin/classic/browser/feeds/feedIcon.png (feeds/feedIcon.png)
skin/classic/browser/feeds/feedIcon16.png (feeds/feedIcon16.png)
skin/classic/browser/feeds/videoFeedIcon.png (feeds/videoFeedIcon.png)
skin/classic/browser/feeds/videoFeedIcon16.png (feeds/videoFeedIcon16.png)
skin/classic/browser/feeds/audioFeedIcon.png (feeds/audioFeedIcon.png)
skin/classic/browser/feeds/audioFeedIcon16.png (feeds/audioFeedIcon16.png)
skin/classic/browser/feeds/videoFeedIcon.png (feeds/feedIcon.png)
skin/classic/browser/feeds/videoFeedIcon16.png (feeds/feedIcon16.png)
skin/classic/browser/feeds/audioFeedIcon.png (feeds/feedIcon.png)
skin/classic/browser/feeds/audioFeedIcon16.png (feeds/feedIcon16.png)
skin/classic/browser/setDesktopBackground.css
skin/classic/browser/inspector.css
skin/classic/browser/monitor.png

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

@ -2,12 +2,6 @@
/* Sidebars */
.sidebar-placesTree {
background-color: transparent !important;
-moz-appearance: none !important;
border: none !important;
}
#bookmarksPanel,
#history-panel,
#sidebar-search-container {
@ -150,7 +144,7 @@ treechildren::-moz-tree-image(query, OrganizerQuery_Downloads) {
treechildren::-moz-tree-image(title, query, tagContainer),
treechildren::-moz-tree-image(query, OrganizerQuery_Tags) {
list-style-image: url("chrome://mozapps/skin/places/tagContainerIcon.png");
list-style-image: url("chrome://browser/skin/places/tag.png");
}
/* calendar icon for folders grouping items by date */

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

До

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

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

@ -621,7 +621,7 @@ menuitem.bookmark-item {
}
.bookmark-item[query][tagContainer] {
list-style-image: url("chrome://mozapps/skin/places/tagContainerIcon.png");
list-style-image: url("chrome://browser/skin/places/tag.png");
-moz-image-region: auto;
}

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

До

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

Двоичные данные
browser/themes/winstripe/feeds/audioFeedIcon.png

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

До

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

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

До

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

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

До

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

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

До

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

Двоичные данные
browser/themes/winstripe/feeds/videoFeedIcon.png

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

До

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

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

До

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

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

До

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

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

@ -6,7 +6,7 @@ browser.jar:
skin/classic/browser/sanitizeDialog.css (sanitizeDialog.css)
* skin/classic/browser/aboutPrivateBrowsing.css (aboutPrivateBrowsing.css)
* skin/classic/browser/aboutSessionRestore.css (aboutSessionRestore.css)
skin/classic/browser/aboutSessionRestore-window-icon.png (aboutSessionRestore-window-icon.png)
skin/classic/browser/aboutSessionRestore-window-icon.png (preferences/application.png)
skin/classic/browser/aboutCertError.css (aboutCertError.css)
#ifdef MOZ_SERVICES_SYNC
skin/classic/browser/aboutSyncTabs.css
@ -51,10 +51,10 @@ browser.jar:
skin/classic/browser/urlbar-history-dropmarker.png
skin/classic/browser/feeds/feedIcon.png (feeds/feedIcon.png)
skin/classic/browser/feeds/feedIcon16.png (feeds/feedIcon16.png)
skin/classic/browser/feeds/audioFeedIcon.png (feeds/audioFeedIcon.png)
skin/classic/browser/feeds/audioFeedIcon16.png (feeds/audioFeedIcon16.png)
skin/classic/browser/feeds/videoFeedIcon.png (feeds/videoFeedIcon.png)
skin/classic/browser/feeds/videoFeedIcon16.png (feeds/videoFeedIcon16.png)
skin/classic/browser/feeds/audioFeedIcon.png (feeds/feedIcon.png)
skin/classic/browser/feeds/audioFeedIcon16.png (feeds/feedIcon16.png)
skin/classic/browser/feeds/videoFeedIcon.png (feeds/feedIcon.png)
skin/classic/browser/feeds/videoFeedIcon16.png (feeds/feedIcon16.png)
skin/classic/browser/feeds/subscribe.css (feeds/subscribe.css)
skin/classic/browser/feeds/subscribe-ui.css (feeds/subscribe-ui.css)
skin/classic/browser/inspector.css
@ -204,10 +204,10 @@ browser.jar:
skin/classic/aero/browser/urlbar-history-dropmarker.png
skin/classic/aero/browser/feeds/feedIcon.png (feeds/feedIcon-aero.png)
skin/classic/aero/browser/feeds/feedIcon16.png (feeds/feedIcon16-aero.png)
skin/classic/aero/browser/feeds/audioFeedIcon.png (feeds/audioFeedIcon-aero.png)
skin/classic/aero/browser/feeds/audioFeedIcon16.png (feeds/audioFeedIcon16-aero.png)
skin/classic/aero/browser/feeds/videoFeedIcon.png (feeds/videoFeedIcon-aero.png)
skin/classic/aero/browser/feeds/videoFeedIcon16.png (feeds/videoFeedIcon16-aero.png)
skin/classic/aero/browser/feeds/audioFeedIcon.png (feeds/feedIcon-aero.png)
skin/classic/aero/browser/feeds/audioFeedIcon16.png (feeds/feedIcon16-aero.png)
skin/classic/aero/browser/feeds/videoFeedIcon.png (feeds/feedIcon-aero.png)
skin/classic/aero/browser/feeds/videoFeedIcon16.png (feeds/feedIcon16-aero.png)
skin/classic/aero/browser/feeds/subscribe.css (feeds/subscribe.css)
skin/classic/aero/browser/feeds/subscribe-ui.css (feeds/subscribe-ui.css)
skin/classic/aero/browser/inspector.css
@ -228,7 +228,7 @@ browser.jar:
skin/classic/aero/browser/places/history.png (places/history-aero.png)
skin/classic/aero/browser/places/allBookmarks.png (places/allBookmarks-aero.png)
skin/classic/aero/browser/places/unsortedBookmarks.png (places/unsortedBookmarks-aero.png)
skin/classic/aero/browser/places/searching_16.png (places/searching_16-aero.png)
skin/classic/aero/browser/places/searching_16.png (places/searching_16.png)
skin/classic/aero/browser/places/downloads.png (places/downloads.png)
skin/classic/aero/browser/preferences/alwaysAsk.png (preferences/alwaysAsk-aero.png)
skin/classic/aero/browser/preferences/application.png (preferences/application-aero.png)
@ -237,7 +237,6 @@ browser.jar:
#ifdef MOZ_SERVICES_SYNC
skin/classic/aero/browser/preferences/Options-sync.png (preferences/Options-sync.png)
#endif
skin/classic/aero/browser/preferences/plugin.png (preferences/plugin-aero.png)
skin/classic/aero/browser/preferences/saveFile.png (preferences/saveFile-aero.png)
* skin/classic/aero/browser/preferences/preferences.css (preferences/preferences.css)
skin/classic/aero/browser/preferences/applications.css (preferences/applications.css)

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

@ -81,7 +81,7 @@ treechildren::-moz-tree-image(title, query) {
treechildren::-moz-tree-image(title, query, tagContainer),
treechildren::-moz-tree-image(query, OrganizerQuery_Tags) {
list-style-image: url("chrome://mozapps/skin/places/tagContainerIcon.png");
list-style-image: url("chrome://browser/skin/places/tag.png");
-moz-image-region: auto;
}

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

До

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

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

До

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

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

@ -0,0 +1,41 @@
dnl ***** BEGIN LICENSE BLOCK *****
dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
dnl
dnl The contents of this file are subject to the Mozilla Public License Version
dnl 1.1 (the "License"); you may not use this file except in compliance with
dnl the License. You may obtain a copy of the License at
dnl http://www.mozilla.org/MPL/
dnl
dnl Software distributed under the License is distributed on an "AS IS" basis,
dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
dnl for the specific language governing rights and limitations under the
dnl License.
dnl
dnl The Original Code is mozilla.org code.
dnl
dnl The Initial Developer of the Original Code is the
dnl Mozilla Foundation <http://www.mozilla.org>
dnl
dnl Portions created by the Initial Developer are Copyright (C) 2009
dnl the Initial Developer. All Rights Reserved.
dnl
dnl
dnl Alternatively, the contents of this file may be used under the terms of
dnl either of the GNU General Public License Version 2 or later (the "GPL"),
dnl or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
dnl in which case the provisions of the GPL or the LGPL are applicable instead
dnl of those above. If you wish to allow use of your version of this file only
dnl under the terms of either the GPL or the LGPL, and not to allow others to
dnl use your version of this file under the terms of the MPL, indicate your
dnl decision by deleting the provisions above and replace them with the notice
dnl and other provisions required by the GPL or the LGPL. If you do not delete
dnl the provisions above, a recipient may use your version of this file under
dnl the terms of any one of the MPL, the GPL or the LGPL.
dnl
dnl ***** END LICENSE BLOCK *****
AC_DEFUN(MOZ_CHECK_COMMON_HEADERS,
MOZ_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h sys/bitypes.h \
memory.h unistd.h gnu/libc-version.h nl_types.h malloc.h \
X11/XKBlib.h io.h cpuid.h)
)

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

@ -36,13 +36,14 @@ dnl the terms of any one of the MPL, the GPL or the LGPL.
dnl
dnl ***** END LICENSE BLOCK *****
dnl MOZ_CHECK_HEADER(HEADER-FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl MOZ_CHECK_HEADER(HEADER-FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
AC_DEFUN([MOZ_CHECK_HEADER],
[ dnl Do the transliteration at runtime so arg 1 can be a shell variable.
ac_safe=`echo "$1" | sed 'y%./+-%__p_%'`
AC_MSG_CHECKING([for $1])
AC_CACHE_VAL(ac_cv_header_$ac_safe,
[ AC_TRY_COMPILE([#include <$1>], ,
[ AC_TRY_COMPILE([$4
#include <$1>], ,
eval "ac_cv_header_$ac_safe=yes",
eval "ac_cv_header_$ac_safe=no") ])
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
@ -54,12 +55,12 @@ AC_DEFUN([MOZ_CHECK_HEADER],
fi
])
dnl MOZ_CHECK_HEADERS(HEADER-FILE... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl MOZ_CHECK_HEADERS(HEADER-FILE... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
AC_DEFUN([MOZ_CHECK_HEADERS],
[ for ac_hdr in $1
do
MOZ_CHECK_HEADER($ac_hdr,
[ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
AC_DEFINE_UNQUOTED($ac_tr_hdr) $2], $3)
AC_DEFINE_UNQUOTED($ac_tr_hdr) $2], $3, [$4])
done
])

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

@ -0,0 +1,2 @@
CC=/tools/gcc-4.5-0moz2/bin/gcc
CXX=/tools/gcc-4.5-0moz2/bin/g++

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

@ -119,7 +119,6 @@ MOZ_CALLGRIND = @MOZ_CALLGRIND@
MOZ_VTUNE = @MOZ_VTUNE@
MOZ_ETW = @MOZ_ETW@
MOZ_TRACE_JSCALLS = @MOZ_TRACE_JSCALLS@
MOZ_TRACEVIS = @MOZ_TRACEVIS@
DEHYDRA_PATH = @DEHYDRA_PATH@
NS_TRACE_MALLOC = @NS_TRACE_MALLOC@

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

@ -3409,12 +3409,7 @@ freebsd*|openbsd*)
CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
;;
esac
MOZ_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
MOZ_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
MOZ_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
MOZ_CHECK_HEADERS(malloc.h)
MOZ_CHECK_HEADERS(X11/XKBlib.h)
MOZ_CHECK_HEADERS(io.h)
MOZ_CHECK_COMMON_HEADERS
dnl These are all the places some variant of statfs can be hiding.
MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
@ -5936,12 +5931,11 @@ if test "$MOZ_XTF"; then
fi
dnl ========================================================
dnl Pref extensions (autoconfig and system-pref)
dnl Pref extensions (autoconfig)
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(pref-extensions,
[ --disable-pref-extensions
Disable pref extensions such as autoconfig and
system-pref],
Disable pref extensions such as autoconfig],
MOZ_PREF_EXTENSIONS=,
MOZ_PREF_EXTENSIONS=1 )
@ -7327,17 +7321,6 @@ if test -n "$MOZ_TRACE_JSCALLS"; then
AC_DEFINE(MOZ_TRACE_JSCALLS)
fi
dnl ========================================================
dnl = Use TraceVis
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(tracevis,
[ --enable-tracevis Enable TraceVis tracing tool (default=no)],
MOZ_TRACEVIS=1,
MOZ_TRACEVIS= )
if test -n "$MOZ_TRACEVIS"; then
AC_DEFINE(MOZ_TRACEVIS)
fi
dnl ========================================================
dnl = Use incremental GC
dnl ========================================================
@ -8762,8 +8745,8 @@ if test "$USE_FC_FREETYPE"; then
if test "$COMPILE_ENVIRONMENT"; then
_SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
AC_CHECK_HEADERS(fontconfig/fcfreetype.h, ,
[AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
[AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
CPPFLAGS="$_SAVE_CPPFLAGS"
else
AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)

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

@ -1290,11 +1290,6 @@ public:
static void TraceWrapper(nsWrapperCache* aCache, TraceCallback aCallback,
void *aClosure);
/**
* Convert nsIContent::IME_STATUS_* to nsIWidget::IME_STATUS_*
*/
static PRUint32 GetWidgetStatusFromIMEStatus(PRUint32 aState);
/*
* Notify when the first XUL menu is opened and when the all XUL menus are
* closed. At opening, aInstalling should be TRUE, otherwise, it should be

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

@ -46,8 +46,8 @@ class nsDOMAttributeMap;
class nsIContent;
#define NS_IATTRIBUTE_IID \
{ 0xf809b623, 0x5b1e, 0x4121, \
{ 0xb8, 0x9d, 0x19, 0x24, 0x7b, 0x70, 0x77, 0x08 } }
{ 0x536167ae, 0x8a9c, 0x4712, \
{ 0x8b, 0x61, 0x3, 0x43, 0xf6, 0xbc, 0x64, 0x75 } }
class nsIAttribute : public nsINode
{

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

@ -63,8 +63,11 @@ class nsIDOMCSSStyleDeclaration;
namespace mozilla {
namespace css {
class StyleRule;
}
}
} // namespace css
namespace widget {
struct IMEState;
} // namespace widget
} // namespace mozilla
enum nsLinkState {
eLinkState_Unknown = 0,
@ -75,8 +78,8 @@ enum nsLinkState {
// IID for the nsIContent interface
#define NS_ICONTENT_IID \
{ 0xb651e0a7, 0x1471, 0x49cc, \
{ 0xb4, 0xe1, 0xc2, 0xca, 0x01, 0xfe, 0xb7, 0x80 } }
{ 0xed40a3e5, 0xd7ed, 0x473e, \
{ 0x85, 0xe3, 0x82, 0xc3, 0xf0, 0x41, 0xdb, 0x52 } }
/**
* A node of content in a document's content model. This interface
@ -84,6 +87,8 @@ enum nsLinkState {
*/
class nsIContent : public nsINode {
public:
typedef mozilla::widget::IMEState IMEState;
#ifdef MOZILLA_INTERNAL_API
// If you're using the external API, the only thing you can know about
// nsIContent is that it exists with an IID
@ -604,40 +609,18 @@ public:
* Get desired IME state for the content.
*
* @return The desired IME status for the content.
* This is a combination of IME_STATUS_* flags,
* controlling what happens to IME when the content takes focus.
* If this is IME_STATUS_NONE, IME remains in its current state.
* IME_STATUS_ENABLE and IME_STATUS_DISABLE must not be set
* together; likewise IME_STATUS_OPEN and IME_STATUS_CLOSE must
* not be set together.
* If you return IME_STATUS_DISABLE, you should not set the
* OPEN or CLOSE flag; that way, when IME is next enabled,
* the previous OPEN/CLOSE state will be restored (unless the newly
* focused content specifies the OPEN/CLOSE state by setting the OPEN
* or CLOSE flag with the ENABLE flag).
* IME_STATUS_PASSWORD should be returned only from password editor,
* this value has a special meaning. It is used as alternative of
* IME_STATUS_DISABLED.
* IME_STATUS_PLUGIN should be returned only when plug-in has focus.
* When a plug-in is focused content, we should send native events
* directly. Because we don't process some native events, but they may
* be needed by the plug-in.
* This is a combination of an IME enabled value and
* an IME open value of widget::IMEState.
* If you return DISABLED, you should not set the OPEN and CLOSE
* value.
* PASSWORD should be returned only from password editor, this value
* has a special meaning. It is used as alternative of DISABLED.
* PLUGIN should be returned only when plug-in has focus. When a
* plug-in is focused content, we should send native events directly.
* Because we don't process some native events, but they may be needed
* by the plug-in.
*/
enum {
IME_STATUS_NONE = 0x0000,
IME_STATUS_ENABLE = 0x0001,
IME_STATUS_DISABLE = 0x0002,
IME_STATUS_PASSWORD = 0x0004,
IME_STATUS_PLUGIN = 0x0008,
IME_STATUS_OPEN = 0x0010,
IME_STATUS_CLOSE = 0x0020
};
enum {
IME_STATUS_MASK_ENABLED = IME_STATUS_ENABLE | IME_STATUS_DISABLE |
IME_STATUS_PASSWORD | IME_STATUS_PLUGIN,
IME_STATUS_MASK_OPENED = IME_STATUS_OPEN | IME_STATUS_CLOSE
};
virtual PRUint32 GetDesiredIMEState();
virtual IMEState GetDesiredIMEState();
/**
* Gets content node with the binding (or native code, possibly on the

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

@ -41,7 +41,7 @@ interface nsIDOMEventListener;
interface nsIDOMBlob;
interface nsIDOMFileError;
[scriptable, builtinclass, uuid(fc316500-87c4-411e-ab75-dd62468f4174)]
[scriptable, builtinclass, uuid(d158de26-904e-4731-b42c-8b3a4d172703)]
interface nsIDOMFileReader : nsIDOMEventTarget
{
[implicit_jscontext]

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

@ -64,7 +64,7 @@
#include "nsSMILAnimationController.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDocumentEncoder.h"
#include "nsIAnimationFrameListener.h"
#include "nsIFrameRequestCallback.h"
#include "nsEventStates.h"
#include "nsIStructuredCloneContainer.h"
#include "nsIBFCacheEntry.h"
@ -124,8 +124,8 @@ class Element;
} // namespace mozilla
#define NS_IDOCUMENT_IID \
{ 0x184e0a3c, 0x1899, 0x417d, \
{ 0xbf, 0xf4, 0x5a, 0x15, 0xe6, 0xe8, 0xaa, 0x94 } }
{ 0x3b78f6, 0x6dc5, 0x44c6, \
{ 0xbc, 0x28, 0x60, 0x2a, 0xb2, 0x4f, 0xfb, 0x7b } }
// Flag for AddStyleSheet().
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
@ -1518,18 +1518,14 @@ public:
*/
virtual Element* LookupImageElement(const nsAString& aElementId) = 0;
void ScheduleBeforePaintEvent(nsIAnimationFrameListener* aListener);
void BeforePaintEventFiring()
{
mHavePendingPaint = false;
}
void ScheduleFrameRequestCallback(nsIFrameRequestCallback* aCallback);
typedef nsTArray< nsCOMPtr<nsIAnimationFrameListener> > AnimationListenerList;
typedef nsTArray< nsCOMPtr<nsIFrameRequestCallback> > FrameRequestCallbackList;
/**
* Put this documents animation frame listeners into the provided
* Put this document's frame request callbacks into the provided
* list, and forget about them.
*/
void TakeAnimationFrameListeners(AnimationListenerList& aListeners);
void TakeFrameRequestCallbacks(FrameRequestCallbackList& aCallbacks);
// This returns true when the document tree is being teared down.
bool InUnlinkOrDeletion() { return mInUnlinkOrDeletion; }
@ -1746,9 +1742,6 @@ protected:
// True if document has ever had script handling object.
bool mHasHadScriptHandlingObject;
// True if we're waiting for a before-paint event.
bool mHavePendingPaint;
// True if we're an SVG document being used as an image.
bool mIsBeingUsedAsImage;
@ -1812,7 +1805,7 @@ protected:
nsCOMPtr<nsIDocumentEncoder> mCachedEncoder;
AnimationListenerList mAnimationFrameListeners;
FrameRequestCallbackList mFrameRequestCallbacks;
// This object allows us to evict ourself from the back/forward cache. The
// pointer is non-null iff we're currently in the bfcache.

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

@ -288,8 +288,8 @@ private:
// IID for the nsINode interface
#define NS_INODE_IID \
{ 0x20d16be2, 0x3c58, 0x4099, \
{ 0xbf, 0xa6, 0xd0, 0xe7, 0x6b, 0xb1, 0x3d, 0xc5 } }
{ 0xd026d280, 0x5b25, 0x41c0, \
{ 0x92, 0xcf, 0x6, 0xf6, 0xf, 0xb, 0x9a, 0xfe } }
/**
* An internal interface that abstracts some DOMNode-related parts that both
@ -728,6 +728,7 @@ public:
*/
NS_DECL_NSIDOMEVENTTARGET
using nsIDOMEventTarget::AddEventListener;
using nsIDOMEventTarget::AddSystemEventListener;
/**
* Adds a mutation observer to be notified when this node, or any of its

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

@ -53,7 +53,7 @@ interface nsIDOMBlob;
#include "jsapi.h"
%}
[scriptable, builtinclass, uuid(dea238a1-240f-45f4-9f07-7769bc69eb76)]
[scriptable, builtinclass, uuid(e2b59e48-3655-4429-a94c-b4332c346ba2)]
interface nsIXMLHttpRequestEventTarget : nsIDOMEventTarget {
// event handler attributes
attribute nsIDOMEventListener onabort;
@ -64,7 +64,7 @@ interface nsIXMLHttpRequestEventTarget : nsIDOMEventTarget {
attribute nsIDOMEventListener onloadend;
};
[scriptable, builtinclass, uuid(09ff3682-7759-4441-a765-f70e1a1fabcf)]
[scriptable, builtinclass, uuid(db9357fc-edf7-42b2-aab2-c24ab19ece20)]
interface nsIXMLHttpRequestUpload : nsIXMLHttpRequestEventTarget {
// for future use
};

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

@ -51,6 +51,9 @@
#include "nsISHContainer.h"
#include "nsIWindowWatcher.h"
#include "mozilla/Services.h"
#include "nsIXULWindow.h"
#include "nsIAppShellService.h"
#include "nsAppShellCID.h"
static bool sInited = 0;
PRUint32 nsCCUncollectableMarker::sGeneration = 0;
@ -231,6 +234,19 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
MarkWindowList(windowList);
}
nsCOMPtr<nsIAppShellService> appShell =
do_GetService(NS_APPSHELLSERVICE_CONTRACTID);
if (appShell) {
nsCOMPtr<nsIXULWindow> hw;
appShell->GetHiddenWindow(getter_AddRefs(hw));
if (hw) {
nsCOMPtr<nsIDocShell> shell;
hw->GetDocShell(getter_AddRefs(shell));
nsCOMPtr<nsIDocShellTreeNode> shellTreeNode = do_QueryInterface(shell);
MarkDocShell(shellTreeNode);
}
}
return NS_OK;
}

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

@ -212,6 +212,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
using namespace mozilla::dom;
using namespace mozilla::layers;
using namespace mozilla::widget;
using namespace mozilla;
const char kLoadAsData[] = "loadAsData";
@ -4026,25 +4027,6 @@ nsContentUtils::DropJSObjects(void* aScriptObjectHolder)
return rv;
}
/* static */
PRUint32
nsContentUtils::GetWidgetStatusFromIMEStatus(PRUint32 aState)
{
switch (aState & nsIContent::IME_STATUS_MASK_ENABLED) {
case nsIContent::IME_STATUS_DISABLE:
return nsIWidget::IME_STATUS_DISABLED;
case nsIContent::IME_STATUS_ENABLE:
return nsIWidget::IME_STATUS_ENABLED;
case nsIContent::IME_STATUS_PASSWORD:
return nsIWidget::IME_STATUS_PASSWORD;
case nsIContent::IME_STATUS_PLUGIN:
return nsIWidget::IME_STATUS_PLUGIN;
default:
NS_ERROR("The given state doesn't have valid enable state");
return nsIWidget::IME_STATUS_ENABLED;
}
}
/* static */
void
nsContentUtils::NotifyInstalledMenuKeyboardListener(bool aInstalling)

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

@ -1881,9 +1881,9 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(mCatalogSheets)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(mPreloadingImages)
for (PRUint32 i = 0; i < tmp->mAnimationFrameListeners.Length(); ++i) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mAnimationFrameListeners[i]");
cb.NoteXPCOMChild(tmp->mAnimationFrameListeners[i]);
for (PRUint32 i = 0; i < tmp->mFrameRequestCallbacks.Length(); ++i) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mFrameRequestCallbacks[i]");
cb.NoteXPCOMChild(tmp->mFrameRequestCallbacks[i]);
}
// Traverse animation components
@ -1951,7 +1951,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
tmp->mSubDocuments = nsnull;
}
tmp->mAnimationFrameListeners.Clear();
tmp->mFrameRequestCallbacks.Clear();
tmp->mRadioGroups.Clear();
@ -3214,19 +3214,16 @@ nsDocument::MaybeRescheduleAnimationFrameNotifications()
}
nsRefreshDriver* rd = mPresShell->GetPresContext()->RefreshDriver();
if (mHavePendingPaint) {
rd->ScheduleBeforePaintEvent(this);
}
if (!mAnimationFrameListeners.IsEmpty()) {
rd->ScheduleAnimationFrameListeners(this);
if (!mFrameRequestCallbacks.IsEmpty()) {
rd->ScheduleFrameRequestCallbacks(this);
}
}
void
nsIDocument::TakeAnimationFrameListeners(AnimationListenerList& aListeners)
nsIDocument::TakeFrameRequestCallbacks(FrameRequestCallbackList& aCallbacks)
{
aListeners.AppendElements(mAnimationFrameListeners);
mAnimationFrameListeners.Clear();
aCallbacks.AppendElements(mFrameRequestCallbacks);
mFrameRequestCallbacks.Clear();
}
void
@ -3243,12 +3240,9 @@ nsDocument::DeleteShell()
void
nsDocument::RevokeAnimationFrameNotifications()
{
if (mHavePendingPaint) {
mPresShell->GetPresContext()->RefreshDriver()->RevokeBeforePaintEvent(this);
}
if (!mAnimationFrameListeners.IsEmpty()) {
if (!mFrameRequestCallbacks.IsEmpty()) {
mPresShell->GetPresContext()->RefreshDriver()->
RevokeAnimationFrameListeners(this);
RevokeFrameRequestCallbacks(this);
}
}
@ -8074,30 +8068,14 @@ nsIDocument::CreateStaticClone(nsISupports* aCloneContainer)
}
void
nsIDocument::ScheduleBeforePaintEvent(nsIAnimationFrameListener* aListener)
nsIDocument::ScheduleFrameRequestCallback(nsIFrameRequestCallback* aCallback)
{
if (aListener) {
bool alreadyRegistered = !mAnimationFrameListeners.IsEmpty();
if (mAnimationFrameListeners.AppendElement(aListener) &&
!alreadyRegistered && mPresShell && IsEventHandlingEnabled()) {
mPresShell->GetPresContext()->RefreshDriver()->
ScheduleAnimationFrameListeners(this);
}
return;
bool alreadyRegistered = !mFrameRequestCallbacks.IsEmpty();
if (mFrameRequestCallbacks.AppendElement(aCallback) &&
!alreadyRegistered && mPresShell && IsEventHandlingEnabled()) {
mPresShell->GetPresContext()->RefreshDriver()->
ScheduleFrameRequestCallbacks(this);
}
if (!mHavePendingPaint) {
// We don't want to use GetShell() here, because we want to schedule the
// paint even if we're frozen. Either we'll get unfrozen and then the
// event will fire, or we'll quietly go away at some point.
mHavePendingPaint =
!mPresShell ||
!IsEventHandlingEnabled() ||
mPresShell->GetPresContext()->RefreshDriver()->
ScheduleBeforePaintEvent(this);
}
}
nsresult

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

@ -109,6 +109,7 @@
#include "nsIDOMEventListener.h"
#include "nsIWebNavigation.h"
#include "nsIBaseWindow.h"
#include "nsIWidget.h"
#include "jsapi.h"
@ -1096,6 +1097,28 @@ nsINode::AddEventListener(const nsAString& aType,
return NS_OK;
}
NS_IMETHODIMP
nsINode::AddSystemEventListener(const nsAString& aType,
nsIDOMEventListener *aListener,
bool aUseCapture,
bool aWantsUntrusted,
PRUint8 aOptionalArgc)
{
NS_ASSERTION(!aWantsUntrusted || aOptionalArgc > 1,
"Won't check if this is chrome, you want to set "
"aWantsUntrusted to false or make the aWantsUntrusted "
"explicit by making aOptionalArgc non-zero.");
if (!aWantsUntrusted &&
(aOptionalArgc < 2 &&
!nsContentUtils::IsChromeDoc(OwnerDoc()))) {
aWantsUntrusted = true;
}
return NS_AddSystemEventListener(this, aType, aListener, aUseCapture,
aWantsUntrusted);
}
NS_IMETHODIMP
nsINode::RemoveEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
@ -1108,6 +1131,8 @@ nsINode::RemoveEventListener(const nsAString& aType,
return NS_OK;
}
NS_IMPL_REMOVE_SYSTEM_EVENT_LISTENER(nsINode)
nsresult
nsINode::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
{
@ -1339,11 +1364,11 @@ nsIContent::GetFlattenedTreeParent() const
return parent;
}
PRUint32
nsIContent::IMEState
nsIContent::GetDesiredIMEState()
{
if (!IsEditableInternal()) {
return IME_STATUS_DISABLE;
return IMEState(IMEState::DISABLED);
}
// NOTE: The content for independent editors (e.g., input[type=text],
// textarea) must override this method, so, we don't need to worry about
@ -1356,26 +1381,23 @@ nsIContent::GetDesiredIMEState()
}
nsIDocument* doc = GetCurrentDoc();
if (!doc) {
return IME_STATUS_DISABLE;
return IMEState(IMEState::DISABLED);
}
nsIPresShell* ps = doc->GetShell();
if (!ps) {
return IME_STATUS_DISABLE;
return IMEState(IMEState::DISABLED);
}
nsPresContext* pc = ps->GetPresContext();
if (!pc) {
return IME_STATUS_DISABLE;
return IMEState(IMEState::DISABLED);
}
nsIEditor* editor = GetHTMLEditor(pc);
nsCOMPtr<nsIEditorIMESupport> imeEditor = do_QueryInterface(editor);
if (!imeEditor) {
return IME_STATUS_DISABLE;
return IMEState(IMEState::DISABLED);
}
// Use "enable" for the default value because IME is disabled unexpectedly,
// it makes serious a11y problem.
PRUint32 state = IME_STATUS_ENABLE;
nsresult rv = imeEditor->GetPreferredIMEState(&state);
NS_ENSURE_SUCCESS(rv, IME_STATUS_ENABLE);
IMEState state;
imeEditor->GetPreferredIMEState(&state);
return state;
}

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

@ -311,7 +311,7 @@ nsInProcessTabChildGlobal::InitTabChildGlobal()
JS_SetNativeStackQuota(cx, 128 * sizeof(size_t) * 1024);
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_JIT | JSOPTION_PRIVATE_IS_NSISUPPORTS);
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_PRIVATE_IS_NSISUPPORTS);
JS_SetVersion(cx, JSVERSION_LATEST);
JS_SetErrorReporter(cx, ContentScriptErrorReporter);

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

@ -884,7 +884,7 @@ NS_IMETHODIMP nsXMLHttpRequest::GetResponseText(nsAString& aResponseText)
// We only decode text lazily if we're also parsing to a doc.
// Also, if we've decoded all current data already, then no need to decode
// more.
if (IsWaitingForHTMLCharset() || !mResponseXML ||
if (!mResponseXML ||
mResponseBodyDecodedPos == mResponseBody.Length()) {
aResponseText = mResponseText;
return NS_OK;
@ -1473,16 +1473,6 @@ nsXMLHttpRequest::IsSystemXHR()
return !!nsContentUtils::IsSystemPrincipal(mPrincipal);
}
bool
nsXMLHttpRequest::IsWaitingForHTMLCharset()
{
if (!mIsHtml || !mResponseXML) {
return false;
}
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mResponseXML);
return doc->GetDocumentCharacterSetSource() < kCharsetFromDocTypeDefault;
}
nsresult
nsXMLHttpRequest::CheckChannelForCrossSiteRequest(nsIChannel* aChannel)
{
@ -1928,7 +1918,13 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
nsCAutoString type;
channel->GetContentType(type);
if (type.EqualsLiteral("text/html")) {
if ((mResponseType == XML_HTTP_RESPONSE_TYPE_DOCUMENT) &&
type.EqualsLiteral("text/html")) {
// HTML parsing is only supported for responseType == "document" to
// avoid running the parser and, worse, populating responseXML for
// legacy users of XHR who use responseType == "" for retrieving the
// responseText of text/html resources. This legacy case is so common
// that it's not useful to emit a warning about it.
if (!(mState & XML_HTTP_REQUEST_ASYNC)) {
// We don't make cool new features available in the bad synchronous
// mode. The synchronous mode is for legacy only.
@ -3138,13 +3134,11 @@ nsXMLHttpRequest::MaybeDispatchProgressEvents(bool aFinalProgress)
mLoadTotal = mLoadTransferred;
mLoadLengthComputable = true;
}
if (aFinalProgress || !IsWaitingForHTMLCharset()) {
mInLoadProgressEvent = true;
DispatchProgressEvent(this, NS_LITERAL_STRING(PROGRESS_STR),
true, mLoadLengthComputable, mLoadTransferred,
mLoadTotal, mLoadTransferred, mLoadTotal);
mInLoadProgressEvent = false;
}
mInLoadProgressEvent = true;
DispatchProgressEvent(this, NS_LITERAL_STRING(PROGRESS_STR),
true, mLoadLengthComputable, mLoadTransferred,
mLoadTotal, mLoadTransferred, mLoadTotal);
mInLoadProgressEvent = false;
if (mResponseType == XML_HTTP_RESPONSE_TYPE_CHUNKED_TEXT ||
mResponseType == XML_HTTP_RESPONSE_TYPE_CHUNKED_ARRAYBUFFER) {
mResponseBody.Truncate();

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

@ -236,8 +236,6 @@ protected:
bool IsSystemXHR();
bool IsWaitingForHTMLCharset();
void ChangeStateToDone();
/**

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

@ -510,7 +510,6 @@ _TEST_FILES2 = \
file_html_in_xhr2.html \
file_html_in_xhr3.html \
file_html_in_xhr.sjs \
file_html_in_xhr_slow.sjs \
test_bug664916.html \
test_bug666604.html \
test_bug675121.html \

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

@ -1,24 +0,0 @@
var timer;
function handleRequest(request, response)
{
var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
.createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
converter.charset = "windows-1251";
var stream = converter.convertToInputStream("\u042E");
var out = response.bodyOutputStream;
response.setHeader("Cache-Control", "no-cache", false);
response.setHeader("Content-Type", "text/html", false);
out.writeFrom(stream, 1);
var firstPart = "<meta charset='windows";
out.write(firstPart, firstPart.length);
out.flush();
response.processAsync();
timer = Components.classes["@mozilla.org/timer;1"]
.createInstance(Components.interfaces.nsITimer);
timer.initWithCallback(function() {
response.write("-1251'>");
response.finish();
}, 500, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
}

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

@ -29,7 +29,12 @@ function runTest() {
ok(this.responseXML, "Should have gotten responseXML");
is(this.responseXML.characterSet, "windows-1251", "Wrong character encoding");
is(this.responseXML.documentElement.firstChild.data, " \u042E ", "Decoded using the wrong encoding.");
is(this.responseText.indexOf("\u042E"), 27, "Bad responseText");
try {
this.responseText;
ok(false, "responseText access should have thrown.");
} catch (e) {
is(e.code, 11, "Should have thrown INVALID_STATE_ERR.");
}
is(this.responseXML.getElementsByTagName("div").length, 1, "There should be one div.");
ok(!this.responseXML.documentElement.hasAttribute("data-fail"), "Should not have a data-fail attribute.");
var scripts = this.responseXML.getElementsByTagName("script");
@ -44,27 +49,21 @@ function runTest() {
}
}
xhr.open("GET", "file_html_in_xhr.html", true);
xhr.responseType = "document";
xhr.send();
}
function continueAfterReport() {
ok(!document.documentElement.hasAttribute("data-fail"), "Should not have a data-fail attribute on mochitest doc.");
xhr = new XMLHttpRequest();
xhr.onprogress = function() {
ok(this.responseText, "Got falsy responseText");
if (this.responseText) {
ok(this.responseText.length, "Got zero-length responseText");
if (this.responseText.length) {
is(this.responseText.charCodeAt(0), 0x042E, "Wrong character encoding for slow text");
}
}
}
xhr.onreadystatechange = function() {
if (this.readyState == 4) {
is(this.responseText.indexOf("\u042E"), -1, "Honored meta in default mode.");
is(this.responseText.indexOf("\uFFFD"), 29, "Honored meta in default mode 2.");
is(this.responseXML, null, "responseXML should be null for HTML in the default mode");
testNonParsingText();
}
}
xhr.open("GET", "file_html_in_xhr_slow.sjs");
xhr.open("GET", "file_html_in_xhr2.html");
xhr.send();
}

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

@ -1087,9 +1087,10 @@ public:
}
bool HasImageInfoAt(size_t level, size_t face) const {
return level <= mMaxLevelWithCustomImages &&
face < mFacesCount &&
ImageInfoAt(level, 0).mIsDefined;
CheckedUint32 checked_index = CheckedUint32(level) * mFacesCount + face;
return checked_index.valid() &&
checked_index.value() < mImageInfos.Length() &&
ImageInfoAt(level, face).mIsDefined;
}
static size_t FaceForTarget(WebGLenum target) {

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

@ -144,4 +144,6 @@ nsresult
NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsInputEvent *aEvent);
nsresult
NS_NewDOMCustomEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, nsEvent* aEvent);
nsresult
NS_NewDOMSmsEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, nsEvent* aEvent);
#endif // nsIPrivateDOMEvent_h__

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

@ -103,6 +103,8 @@ nsDOMEventTargetHelper::RemoveEventListener(const nsAString& aType,
return NS_OK;
}
NS_IMPL_REMOVE_SYSTEM_EVENT_LISTENER(nsDOMEventTargetHelper)
NS_IMETHODIMP
nsDOMEventTargetHelper::AddEventListener(const nsAString& aType,
nsIDOMEventListener *aListener,
@ -130,6 +132,31 @@ nsDOMEventTargetHelper::AddEventListener(const nsAString& aType,
return NS_OK;
}
NS_IMETHODIMP
nsDOMEventTargetHelper::AddSystemEventListener(const nsAString& aType,
nsIDOMEventListener *aListener,
bool aUseCapture,
bool aWantsUntrusted,
PRUint8 aOptionalArgc)
{
NS_ASSERTION(!aWantsUntrusted || aOptionalArgc > 1,
"Won't check if this is chrome, you want to set "
"aWantsUntrusted to false or make the aWantsUntrusted "
"explicit by making aOptionalArgc non-zero.");
if (aOptionalArgc < 2) {
nsresult rv;
nsIScriptContext* context = GetContextForEventHandlers(&rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocument> doc =
nsContentUtils::GetDocumentFromScriptContext(context);
aWantsUntrusted = doc && !nsContentUtils::IsChromeDoc(doc);
}
return NS_AddSystemEventListener(this, aType, aListener, aUseCapture,
aWantsUntrusted);
}
NS_IMETHODIMP
nsDOMEventTargetHelper::DispatchEvent(nsIDOMEvent* aEvent, bool* aRetVal)
{

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

@ -904,6 +904,8 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext,
return NS_NewDOMHashChangeEvent(aDOMEvent, aPresContext, nsnull);
if (aEventType.LowerCaseEqualsLiteral("customevent"))
return NS_NewDOMCustomEvent(aDOMEvent, aPresContext, nsnull);
if (aEventType.LowerCaseEqualsLiteral("mozsmsevent"))
return NS_NewDOMSmsEvent(aDOMEvent, aPresContext, nsnull);
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}

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

@ -405,7 +405,7 @@ nsEventListenerManager::SetJSEventListener(nsIScriptContext *aContext,
if (!ls) {
// If we didn't find a script listener or no listeners existed
// create and add a new one.
nsCOMPtr<nsIDOMEventListener> scriptListener;
nsCOMPtr<nsIJSEventListener> scriptListener;
rv = NS_NewJSEventListener(aContext, aScopeObject, mTarget, aName,
aHandler, getter_AddRefs(scriptListener));
if (NS_SUCCEEDED(rv)) {
@ -701,10 +701,8 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
// Bind it
nsScriptObjectHolder boundHandler(context);
context->BindCompiledEventHandler(mTarget, listener->GetEventScope(),
handler, boundHandler);
listener->SetHandler(
static_cast<JSObject*>(
static_cast<void*>(boundHandler)));
handler.getObject(), boundHandler);
listener->SetHandler(boundHandler.getObject());
}
return result;

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

@ -63,7 +63,8 @@ class nsCxPusher;
class nsIEventListenerInfo;
class nsIDocument;
typedef struct {
struct nsListenerStruct
{
nsRefPtr<nsIDOMEventListener> mListener;
PRUint32 mEventType;
nsCOMPtr<nsIAtom> mTypeAtom;
@ -74,7 +75,14 @@ typedef struct {
return (mFlags & NS_PRIV_EVENT_FLAG_SCRIPT) ?
static_cast<nsIJSEventListener *>(mListener.get()) : nsnull;
}
} nsListenerStruct;
~nsListenerStruct()
{
if ((mFlags & NS_PRIV_EVENT_FLAG_SCRIPT) && mListener) {
static_cast<nsIJSEventListener*>(mListener.get())->Disconnect();
}
}
};
/*
* Event listener manager
@ -318,4 +326,26 @@ protected:
static PRUint32 sCreatedCount;
};
/**
* NS_AddSystemEventListener() is a helper function for implementing
* nsIDOMEventTarget::AddSystemEventListener().
*/
inline nsresult
NS_AddSystemEventListener(nsIDOMEventTarget* aTarget,
const nsAString& aType,
nsIDOMEventListener *aListener,
bool aUseCapture,
bool aWantsUntrusted)
{
nsEventListenerManager* listenerManager = aTarget->GetListenerManager(true);
NS_ENSURE_STATE(listenerManager);
PRUint32 flags = NS_EVENT_FLAG_SYSTEM_EVENT;
flags |= aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE;
if (aWantsUntrusted) {
flags |= NS_PRIV_EVENT_UNTRUSTED_PERMITTED;
}
listenerManager->AddEventListenerByType(aListener, aType, flags);
return NS_OK;
}
#endif // nsEventListenerManager_h__

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

@ -40,7 +40,6 @@
#include "nsIMEStateManager.h"
#include "nsCOMPtr.h"
#include "nsIWidget.h"
#include "nsIViewManager.h"
#include "nsIPresShell.h"
#include "nsISupports.h"
@ -51,6 +50,8 @@
#include "nsIDocument.h"
#include "nsPresContext.h"
#include "nsIDOMWindow.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMNSEvent.h"
#include "nsContentUtils.h"
#include "nsINode.h"
#include "nsIFrame.h"
@ -68,6 +69,8 @@
#include "nsIForm.h"
#include "nsHTMLFormElement.h"
using namespace mozilla::widget;
/******************************************************************/
/* nsIMEStateManager */
/******************************************************************/
@ -87,8 +90,10 @@ nsIMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext)
return NS_OK;
nsCOMPtr<nsIWidget> widget = GetWidget(sPresContext);
if (widget) {
PRUint32 newState = GetNewIMEState(sPresContext, nsnull);
SetIMEState(newState, nsnull, widget, IMEContext::FOCUS_REMOVED);
IMEState newState = GetNewIMEState(sPresContext, nsnull);
InputContextAction action(InputContextAction::CAUSE_UNKNOWN,
InputContextAction::LOST_FOCUS);
SetIMEState(newState, nsnull, widget, action);
}
sContent = nsnull;
sPresContext = nsnull;
@ -112,8 +117,10 @@ nsIMEStateManager::OnRemoveContent(nsPresContext* aPresContext,
nsresult rv = widget->CancelIMEComposition();
if (NS_FAILED(rv))
widget->ResetInputState();
PRUint32 newState = GetNewIMEState(sPresContext, nsnull);
SetIMEState(newState, nsnull, widget, IMEContext::FOCUS_REMOVED);
IMEState newState = GetNewIMEState(sPresContext, nsnull);
InputContextAction action(InputContextAction::CAUSE_UNKNOWN,
InputContextAction::LOST_FOCUS);
SetIMEState(newState, nsnull, widget, action);
}
sContent = nsnull;
@ -125,7 +132,16 @@ nsIMEStateManager::OnRemoveContent(nsPresContext* aPresContext,
nsresult
nsIMEStateManager::OnChangeFocus(nsPresContext* aPresContext,
nsIContent* aContent,
PRUint32 aReason)
InputContextAction::Cause aCause)
{
InputContextAction action(aCause);
return OnChangeFocusInternal(aPresContext, aContent, action);
}
nsresult
nsIMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
nsIContent* aContent,
InputContextAction aAction)
{
NS_ENSURE_ARG_POINTER(aPresContext);
@ -157,25 +173,22 @@ nsIMEStateManager::OnChangeFocus(nsPresContext* aPresContext,
}
}
PRUint32 newState = GetNewIMEState(aPresContext, aContent);
IMEState newState = GetNewIMEState(aPresContext, aContent);
if (aPresContext == sPresContext && aContent == sContent) {
// actual focus isn't changing, but if IME enabled state is changing,
// we should do it.
PRUint32 newEnabledState = newState & nsIContent::IME_STATUS_MASK_ENABLED;
if (newEnabledState == 0) {
// the enabled state isn't changing, we should do nothing.
return NS_OK;
}
IMEContext context;
if (!widget || NS_FAILED(widget->GetInputMode(context))) {
// this platform doesn't support IME controlling
return NS_OK;
}
if (context.mStatus ==
nsContentUtils::GetWidgetStatusFromIMEStatus(newEnabledState)) {
InputContext context = widget->GetInputContext();
if (context.mIMEState.mEnabled == newState.mEnabled) {
// the enabled state isn't changing.
return NS_OK;
}
aAction.mFocusChange = InputContextAction::FOCUS_NOT_CHANGED;
} else if (aAction.mFocusChange == InputContextAction::FOCUS_NOT_CHANGED) {
// If aContent isn't null or aContent is null but editable, somebody gets
// focus.
bool gotFocus = aContent || (newState.mEnabled == IMEState::ENABLED);
aAction.mFocusChange =
gotFocus ? InputContextAction::GOT_FOCUS : InputContextAction::LOST_FOCUS;
}
// Current IME transaction should commit
@ -189,10 +202,8 @@ nsIMEStateManager::OnChangeFocus(nsPresContext* aPresContext,
oldWidget->ResetInputState();
}
if (newState != nsIContent::IME_STATUS_NONE) {
// Update IME state for new focus widget
SetIMEState(newState, aContent, widget, aReason);
}
// Update IME state for new focus widget
SetIMEState(newState, aContent, widget, aAction);
sPresContext = aPresContext;
sContent = aContent;
@ -205,19 +216,60 @@ nsIMEStateManager::OnInstalledMenuKeyboardListener(bool aInstalling)
{
sInstalledMenuKeyboardListener = aInstalling;
PRUint32 reason = aInstalling ? IMEContext::FOCUS_MOVED_TO_MENU
: IMEContext::FOCUS_MOVED_FROM_MENU;
OnChangeFocus(sPresContext, sContent, reason);
InputContextAction action(InputContextAction::CAUSE_UNKNOWN,
aInstalling ? InputContextAction::MENU_GOT_PSEUDO_FOCUS :
InputContextAction::MENU_LOST_PSEUDO_FOCUS);
OnChangeFocusInternal(sPresContext, sContent, action);
}
void
nsIMEStateManager::UpdateIMEState(PRUint32 aNewIMEState, nsIContent* aContent)
nsIMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
nsIContent* aContent,
nsIDOMMouseEvent* aMouseEvent)
{
if (sPresContext != aPresContext || sContent != aContent) {
return;
}
nsCOMPtr<nsIWidget> widget = GetWidget(aPresContext);
NS_ENSURE_TRUE(widget, );
bool isTrusted;
nsCOMPtr<nsIDOMNSEvent> NSEvent = do_QueryInterface(aMouseEvent);
nsresult rv = NSEvent->GetIsTrusted(&isTrusted);
NS_ENSURE_SUCCESS(rv, );
if (!isTrusted) {
return; // ignore untrusted event.
}
PRUint16 button;
rv = aMouseEvent->GetButton(&button);
NS_ENSURE_SUCCESS(rv, );
if (button != 0) {
return; // not a left click event.
}
PRInt32 clickCount;
rv = aMouseEvent->GetDetail(&clickCount);
NS_ENSURE_SUCCESS(rv, );
if (clickCount != 1) {
return; // should notify only first click event.
}
InputContextAction action(InputContextAction::CAUSE_MOUSE,
InputContextAction::FOCUS_NOT_CHANGED);
IMEState newState = GetNewIMEState(aPresContext, aContent);
SetIMEState(newState, aContent, widget, action);
}
void
nsIMEStateManager::UpdateIMEState(const IMEState &aNewIMEState,
nsIContent* aContent)
{
if (!sPresContext) {
NS_WARNING("ISM doesn't know which editor has focus");
return;
}
NS_PRECONDITION(aNewIMEState != 0, "aNewIMEState doesn't specify new state.");
nsCOMPtr<nsIWidget> widget = GetWidget(sPresContext);
if (!widget) {
NS_WARNING("focused widget is not found");
@ -225,43 +277,41 @@ nsIMEStateManager::UpdateIMEState(PRUint32 aNewIMEState, nsIContent* aContent)
}
// Don't update IME state when enabled state isn't actually changed.
IMEContext context;
nsresult rv = widget->GetInputMode(context);
if (NS_FAILED(rv)) {
return; // This platform doesn't support controling the IME state.
}
PRUint32 newEnabledState = aNewIMEState & nsIContent::IME_STATUS_MASK_ENABLED;
if (context.mStatus ==
nsContentUtils::GetWidgetStatusFromIMEStatus(newEnabledState)) {
InputContext context = widget->GetInputContext();
if (context.mIMEState.mEnabled == aNewIMEState.mEnabled) {
return;
}
// commit current composition
widget->ResetInputState();
SetIMEState(aNewIMEState, aContent, widget, IMEContext::EDITOR_STATE_MODIFIED);
InputContextAction action(InputContextAction::CAUSE_UNKNOWN,
InputContextAction::FOCUS_NOT_CHANGED);
SetIMEState(aNewIMEState, aContent, widget, action);
}
PRUint32
IMEState
nsIMEStateManager::GetNewIMEState(nsPresContext* aPresContext,
nsIContent* aContent)
{
// On Printing or Print Preview, we don't need IME.
if (aPresContext->Type() == nsPresContext::eContext_PrintPreview ||
aPresContext->Type() == nsPresContext::eContext_Print) {
return nsIContent::IME_STATUS_DISABLE;
return IMEState(IMEState::DISABLED);
}
if (sInstalledMenuKeyboardListener)
return nsIContent::IME_STATUS_DISABLE;
if (sInstalledMenuKeyboardListener) {
return IMEState(IMEState::DISABLED);
}
if (!aContent) {
// Even if there are no focused content, the focused document might be
// editable, such case is design mode.
nsIDocument* doc = aPresContext->Document();
if (doc && doc->HasFlag(NODE_IS_EDITABLE))
return nsIContent::IME_STATUS_ENABLE;
return nsIContent::IME_STATUS_DISABLE;
if (doc && doc->HasFlag(NODE_IS_EDITABLE)) {
return IMEState(IMEState::ENABLED);
}
return IMEState(IMEState::DISABLED);
}
return aContent->GetDesiredIMEState();
@ -290,65 +340,62 @@ private:
};
void
nsIMEStateManager::SetIMEState(PRUint32 aState,
nsIMEStateManager::SetIMEState(const IMEState &aState,
nsIContent* aContent,
nsIWidget* aWidget,
PRUint32 aReason)
InputContextAction aAction)
{
if (aState & nsIContent::IME_STATUS_MASK_ENABLED) {
if (!aWidget)
return;
NS_ENSURE_TRUE(aWidget, );
PRUint32 state = nsContentUtils::GetWidgetStatusFromIMEStatus(aState);
IMEContext context;
context.mStatus = state;
if (aContent && aContent->GetNameSpaceID() == kNameSpaceID_XHTML &&
(aContent->Tag() == nsGkAtoms::input ||
aContent->Tag() == nsGkAtoms::textarea)) {
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type,
context.mHTMLInputType);
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::moz_action_hint,
context.mActionHint);
InputContext oldContext = aWidget->GetInputContext();
// if we don't have an action hint and return won't submit the form use "next"
if (context.mActionHint.IsEmpty() && aContent->Tag() == nsGkAtoms::input) {
bool willSubmit = false;
nsCOMPtr<nsIFormControl> control(do_QueryInterface(aContent));
mozilla::dom::Element* formElement = control->GetFormElement();
nsCOMPtr<nsIForm> form;
if (control) {
// is this a form and does it have a default submit element?
if ((form = do_QueryInterface(formElement)) && form->GetDefaultSubmitElement()) {
willSubmit = true;
// is this an html form and does it only have a single text input element?
} else if (formElement && formElement->Tag() == nsGkAtoms::form && formElement->IsHTML() &&
static_cast<nsHTMLFormElement*>(formElement)->HasSingleTextControl()) {
willSubmit = true;
}
InputContext context;
context.mIMEState = aState;
if (aContent && aContent->GetNameSpaceID() == kNameSpaceID_XHTML &&
(aContent->Tag() == nsGkAtoms::input ||
aContent->Tag() == nsGkAtoms::textarea)) {
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type,
context.mHTMLInputType);
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::moz_action_hint,
context.mActionHint);
// if we don't have an action hint and return won't submit the form use "next"
if (context.mActionHint.IsEmpty() && aContent->Tag() == nsGkAtoms::input) {
bool willSubmit = false;
nsCOMPtr<nsIFormControl> control(do_QueryInterface(aContent));
mozilla::dom::Element* formElement = control->GetFormElement();
nsCOMPtr<nsIForm> form;
if (control) {
// is this a form and does it have a default submit element?
if ((form = do_QueryInterface(formElement)) && form->GetDefaultSubmitElement()) {
willSubmit = true;
// is this an html form and does it only have a single text input element?
} else if (formElement && formElement->Tag() == nsGkAtoms::form && formElement->IsHTML() &&
static_cast<nsHTMLFormElement*>(formElement)->HasSingleTextControl()) {
willSubmit = true;
}
context.mActionHint.Assign(willSubmit ? control->GetType() == NS_FORM_INPUT_SEARCH
? NS_LITERAL_STRING("search")
: NS_LITERAL_STRING("go")
: formElement
? NS_LITERAL_STRING("next")
: EmptyString());
}
context.mActionHint.Assign(willSubmit ? control->GetType() == NS_FORM_INPUT_SEARCH
? NS_LITERAL_STRING("search")
: NS_LITERAL_STRING("go")
: formElement
? NS_LITERAL_STRING("next")
: EmptyString());
}
if (XRE_GetProcessType() == GeckoProcessType_Content) {
context.mReason = aReason | IMEContext::FOCUS_FROM_CONTENT_PROCESS;
} else {
context.mReason = aReason;
}
aWidget->SetInputMode(context);
nsContentUtils::AddScriptRunner(new IMEEnabledStateChangedEvent(state));
}
if (aState & nsIContent::IME_STATUS_MASK_OPENED) {
bool open = !!(aState & nsIContent::IME_STATUS_OPEN);
aWidget->SetIMEOpenState(open);
// XXX I think that we should use nsContentUtils::IsCallerChrome() instead
// of the process type.
if (aAction.mCause == InputContextAction::CAUSE_UNKNOWN &&
XRE_GetProcessType() != GeckoProcessType_Content) {
aAction.mCause = InputContextAction::CAUSE_UNKNOWN_CHROME;
}
aWidget->SetInputContext(context, aAction);
if (oldContext.mIMEState.mEnabled != context.mIMEState.mEnabled) {
nsContentUtils::AddScriptRunner(
new IMEEnabledStateChangedEvent(context.mIMEState.mEnabled));
}
}

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

@ -40,11 +40,12 @@
#define nsIMEStateManager_h__
#include "nscore.h"
#include "nsIWidget.h"
class nsIContent;
class nsIDOMMouseEvent;
class nsPIDOMWindow;
class nsPresContext;
class nsIWidget;
class nsTextStateManager;
class nsISelection;
@ -54,13 +55,23 @@ class nsISelection;
class nsIMEStateManager
{
protected:
typedef mozilla::widget::IMEState IMEState;
typedef mozilla::widget::InputContext InputContext;
typedef mozilla::widget::InputContextAction InputContextAction;
public:
static nsresult OnDestroyPresContext(nsPresContext* aPresContext);
static nsresult OnRemoveContent(nsPresContext* aPresContext,
nsIContent* aContent);
/**
* OnChangeFocus() should be called when focused content is changed or
* IME enabled state is changed. If focus isn't actually changed and IME
* enabled state isn't changed, this will do nothing.
*/
static nsresult OnChangeFocus(nsPresContext* aPresContext,
nsIContent* aContent,
PRUint32 aReason);
InputContextAction::Cause aCause);
static void OnInstalledMenuKeyboardListener(bool aInstalling);
// These two methods manage focus and selection/text observers.
@ -85,14 +96,27 @@ public:
// isn't changed by the new state, this method does nothing.
// Note that this method changes the IME state of the active element in the
// widget. So, the caller must have focus.
// aNewIMEState must have an enabled state of nsIContent::IME_STATUS_*.
// And optionally, it can have an open state of nsIContent::IME_STATUS_*.
static void UpdateIMEState(PRUint32 aNewIMEState, nsIContent* aContent);
static void UpdateIMEState(const IMEState &aNewIMEState,
nsIContent* aContent);
// This method is called when user clicked in an editor.
// aContent must be:
// If the editor is for <input> or <textarea>, the element.
// If the editor is for contenteditable, the active editinghost.
// If the editor is for designMode, NULL.
static void OnClickInEditor(nsPresContext* aPresContext,
nsIContent* aContent,
nsIDOMMouseEvent* aMouseEvent);
protected:
static void SetIMEState(PRUint32 aState, nsIContent* aContent,
nsIWidget* aWidget, PRUint32 aReason);
static PRUint32 GetNewIMEState(nsPresContext* aPresContext,
static nsresult OnChangeFocusInternal(nsPresContext* aPresContext,
nsIContent* aContent,
InputContextAction aAction);
static void SetIMEState(const IMEState &aState,
nsIContent* aContent,
nsIWidget* aWidget,
InputContextAction aAction);
static IMEState GetNewIMEState(nsPresContext* aPresContext,
nsIContent* aContent);
static nsIWidget* GetWidget(nsPresContext* aPresContext);

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

@ -370,21 +370,38 @@ protected:
/**
* Initialize a decoder as a clone of an existing decoder in another
* element.
* mLoadingSrc must already be set.
*/
nsresult InitializeDecoderAsClone(nsMediaDecoder* aOriginal);
/**
* Initialize a decoder to load the given channel. The decoder's stream
* listener is returned via aListener.
* mLoadingSrc must already be set.
*/
nsresult InitializeDecoderForChannel(nsIChannel *aChannel,
nsIStreamListener **aListener);
/**
* Finish setting up the decoder after Load() has been called on it.
* Called by InitializeDecoderForChannel/InitializeDecoderAsClone.
*/
nsresult FinishDecoderSetup(nsMediaDecoder* aDecoder);
/**
* Call this after setting up mLoadingSrc and mDecoder.
*/
void AddMediaElementToURITable();
/**
* Call this before clearing mLoadingSrc.
*/
void RemoveMediaElementFromURITable();
/**
* Call this to find a media element with the same NodePrincipal and mLoadingSrc
* set to aURI, and with a decoder on which Load() has been called.
*/
nsHTMLMediaElement* LookupMediaElementURITable(nsIURI* aURI);
/**
* Execute the initial steps of the load algorithm that ensure existing
* loads are aborted, the element is emptied, and a new load ID is
@ -431,7 +448,7 @@ protected:
/**
* The resource-fetch algorithm step of the load algorithm.
*/
nsresult LoadResource(nsIURI* aURI);
nsresult LoadResource();
/**
* Selects the next <source> child from which to load a resource. Called
@ -492,11 +509,11 @@ protected:
};
/**
* Suspends the load of resource at aURI, so that it can be resumed later
* Suspends the load of mLoadingSrc, so that it can be resumed later
* by ResumeLoad(). This is called when we have a media with a 'preload'
* attribute value of 'none', during the resource selection algorithm.
*/
void SuspendLoad(nsIURI* aURI);
void SuspendLoad();
/**
* Resumes a previously suspended load (suspended by SuspendLoad(uri)).
@ -535,6 +552,7 @@ protected:
*/
void ProcessMediaFragmentURI();
// The current decoder. Load() has been called on this decoder.
nsRefPtr<nsMediaDecoder> mDecoder;
// A reference to the ImageContainer which contains the current frame
@ -597,11 +615,11 @@ protected:
// Current audio sample rate.
PRUint32 mRate;
// URI of the resource we're attempting to load. When the decoder is
// successfully initialized, we rely on it to record the URI we're playing,
// and clear mLoadingSrc. This stores the value we return in the currentSrc
// attribute until the decoder is initialized. Use GetCurrentSrc() to access
// the currentSrc attribute.
// URI of the resource we're attempting to load. This stores the value we
// return in the currentSrc attribute. Use GetCurrentSrc() to access the
// currentSrc attribute.
// This is always the original URL we're trying to load --- before
// redirects etc.
nsCOMPtr<nsIURI> mLoadingSrc;
// Stores the current preload action for this element. Initially set to

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

@ -71,6 +71,7 @@
#include "nsIScrollableFrame.h"
#include "nsIView.h"
#include "nsIViewManager.h"
#include "nsIWidget.h"
#include "nsRange.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
@ -2652,7 +2653,7 @@ nsGenericHTMLFormElement::GetForm(nsIDOMHTMLFormElement** aForm)
return NS_OK;
}
PRUint32
nsIContent::IMEState
nsGenericHTMLFormElement::GetDesiredIMEState()
{
nsCOMPtr<nsIEditor> editor = nsnull;
@ -2662,7 +2663,7 @@ nsGenericHTMLFormElement::GetDesiredIMEState()
nsCOMPtr<nsIEditorIMESupport> imeEditor = do_QueryInterface(editor);
if (!imeEditor)
return nsGenericHTMLElement::GetDesiredIMEState();
PRUint32 state;
IMEState state;
rv = imeEditor->GetPreferredIMEState(&state);
if (NS_FAILED(rv))
return nsGenericHTMLElement::GetDesiredIMEState();

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

@ -884,7 +884,7 @@ public:
bool aCompileEventHandlers);
virtual void UnbindFromTree(bool aDeep = true,
bool aNullParent = true);
virtual PRUint32 GetDesiredIMEState();
virtual IMEState GetDesiredIMEState();
virtual nsEventStates IntrinsicState() const;
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);

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

@ -506,14 +506,14 @@ nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
jsid propid = JS_IdArrayGet(cx, props, i);
jsval propname, propval;
if (!JS_IdToValue(cx, propid, &propname) ||
!JS_GetPropertyById(cx, opts, propid, &propval))
{
!JS_GetPropertyById(cx, opts, propid, &propval)) {
continue;
}
JSString *propnameString = JS_ValueToString(cx, propname);
nsDependentJSString pstr;
if (!propnameString || !pstr.init(cx, propnameString)) {
JS_DestroyIdArray(cx, props);
mCurrentContext = nsnull;
return NS_ERROR_FAILURE;
}
@ -528,6 +528,7 @@ nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
JSString *propvalString = JS_ValueToString(cx, propval);
nsDependentJSString vstr;
if (!propvalString || !vstr.init(cx, propvalString)) {
JS_DestroyIdArray(cx, props);
mCurrentContext = nsnull;
return NS_ERROR_FAILURE;
}
@ -535,6 +536,7 @@ nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
contextProps->SetPropertyAsAString(pstr, vstr);
}
}
JS_DestroyIdArray(cx, props);
}
}

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

@ -89,6 +89,7 @@
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMNotifyAudioAvailableEvent.h"
#include "nsMediaFragmentURIParser.h"
#include "nsURIHashKey.h"
#ifdef MOZ_OGG
#include "nsOggDecoder.h"
@ -479,11 +480,14 @@ void nsHTMLMediaElement::AbortExistingLoads()
mCurrentLoadID++;
bool fireTimeUpdate = false;
if (mDecoder) {
RemoveMediaElementFromURITable();
fireTimeUpdate = mDecoder->GetCurrentTime() != 0.0;
mDecoder->Shutdown();
mDecoder = nsnull;
}
mLoadingSrc = nsnull;
if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_LOADING ||
mNetworkState == nsIDOMHTMLMediaElement::NETWORK_IDLE)
@ -497,6 +501,7 @@ void nsHTMLMediaElement::AbortExistingLoads()
mIsLoadingFromSourceChildren = false;
mSuspendedAfterFirstFrame = false;
mAllowSuspendAfterFirstFrame = true;
mLoadIsSuspended = false;
mSourcePointer = nsnull;
// TODO: The playback rate must be set to the default playback rate.
@ -648,12 +653,12 @@ void nsHTMLMediaElement::SelectResource()
if (mPreloadAction == nsHTMLMediaElement::PRELOAD_NONE) {
// preload:none media, suspend the load here before we make any
// network requests.
SuspendLoad(uri);
SuspendLoad();
mIsRunningSelectResource = false;
return;
}
rv = LoadResource(uri);
rv = LoadResource();
if (NS_SUCCEEDED(rv)) {
mIsRunningSelectResource = false;
return;
@ -750,11 +755,11 @@ void nsHTMLMediaElement::LoadFromSourceChildren()
if (mPreloadAction == nsHTMLMediaElement::PRELOAD_NONE) {
// preload:none media, suspend the load here before we make any
// network requests.
SuspendLoad(uri);
SuspendLoad();
return;
}
if (NS_SUCCEEDED(LoadResource(uri))) {
if (NS_SUCCEEDED(LoadResource())) {
return;
}
@ -764,7 +769,7 @@ void nsHTMLMediaElement::LoadFromSourceChildren()
NS_NOTREACHED("Execution should not reach here!");
}
void nsHTMLMediaElement::SuspendLoad(nsIURI* aURI)
void nsHTMLMediaElement::SuspendLoad()
{
mLoadIsSuspended = true;
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_IDLE;
@ -775,20 +780,19 @@ void nsHTMLMediaElement::SuspendLoad(nsIURI* aURI)
void nsHTMLMediaElement::ResumeLoad(PreloadAction aAction)
{
NS_ASSERTION(mLoadIsSuspended, "Can only resume preload if halted for one");
nsCOMPtr<nsIURI> uri = mLoadingSrc;
mLoadIsSuspended = false;
mPreloadAction = aAction;
ChangeDelayLoadStatus(true);
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_LOADING;
if (!mIsLoadingFromSourceChildren) {
// We were loading from the element's src attribute.
if (NS_FAILED(LoadResource(uri))) {
if (NS_FAILED(LoadResource())) {
NoSupportedMediaSourceError();
}
} else {
// We were loading from a child <source> element. Try to resume the
// load of that child, and if that fails, try the next child.
if (NS_FAILED(LoadResource(uri))) {
if (NS_FAILED(LoadResource())) {
LoadFromSourceChildren();
}
}
@ -873,7 +877,7 @@ void nsHTMLMediaElement::UpdatePreloadAction()
}
}
nsresult nsHTMLMediaElement::LoadResource(nsIURI* aURI)
nsresult nsHTMLMediaElement::LoadResource()
{
NS_ASSERTION(mDelayingLoadEvent,
"Should delay load event (if in document) during load");
@ -890,9 +894,17 @@ nsresult nsHTMLMediaElement::LoadResource(nsIURI* aURI)
mChannel = nsnull;
}
nsHTMLMediaElement* other = LookupMediaElementURITable(mLoadingSrc);
if (other) {
// Clone it.
nsresult rv = InitializeDecoderAsClone(other->mDecoder);
if (NS_SUCCEEDED(rv))
return rv;
}
PRInt16 shouldLoad = nsIContentPolicy::ACCEPT;
nsresult rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_MEDIA,
aURI,
mLoadingSrc,
NodePrincipal(),
static_cast<nsGenericElement*>(this),
EmptyCString(), // mime type
@ -920,7 +932,7 @@ nsresult nsHTMLMediaElement::LoadResource(nsIURI* aURI)
}
nsCOMPtr<nsIChannel> channel;
rv = NS_NewChannel(getter_AddRefs(channel),
aURI,
mLoadingSrc,
nsnull,
loadGroup,
nsnull,
@ -949,7 +961,7 @@ nsresult nsHTMLMediaElement::LoadResource(nsIURI* aURI)
} else {
rv = nsContentUtils::GetSecurityManager()->
CheckLoadURIWithPrincipal(NodePrincipal(),
aURI,
mLoadingSrc,
nsIScriptSecurityManager::STANDARD);
listener = loadListener;
}
@ -991,9 +1003,11 @@ nsresult nsHTMLMediaElement::LoadWithChannel(nsIChannel *aChannel,
AbortExistingLoads();
ChangeDelayLoadStatus(true);
nsresult rv = aChannel->GetOriginalURI(getter_AddRefs(mLoadingSrc));
NS_ENSURE_SUCCESS(rv, rv);
nsresult rv = InitializeDecoderForChannel(aChannel, aListener);
ChangeDelayLoadStatus(true);
rv = InitializeDecoderForChannel(aChannel, aListener);
if (NS_FAILED(rv)) {
ChangeDelayLoadStatus(false);
return rv;
@ -1017,6 +1031,7 @@ NS_IMETHODIMP nsHTMLMediaElement::MozLoadFrom(nsIDOMHTMLMediaElement* aOther)
ChangeDelayLoadStatus(true);
mLoadingSrc = other->mLoadingSrc;
nsresult rv = InitializeDecoderAsClone(other->mDecoder);
if (NS_FAILED(rv)) {
ChangeDelayLoadStatus(false);
@ -1241,6 +1256,76 @@ NS_IMETHODIMP nsHTMLMediaElement::SetMuted(bool aMuted)
return NS_OK;
}
class MediaElementSetForURI : public nsURIHashKey {
public:
MediaElementSetForURI(const nsIURI* aKey) : nsURIHashKey(aKey) {}
MediaElementSetForURI(const MediaElementSetForURI& toCopy)
: nsURIHashKey(toCopy), mElements(toCopy.mElements) {}
nsTArray<nsHTMLMediaElement*> mElements;
};
typedef nsTHashtable<MediaElementSetForURI> MediaElementURITable;
// Elements in this table must have non-null mDecoder and mLoadingSrc, and those
// can't change while the element is in the table. The table is keyed by
// the element's mLoadingSrc. Each entry has a list of all elements with the
// same mLoadingSrc.
static MediaElementURITable* gElementTable;
void
nsHTMLMediaElement::AddMediaElementToURITable()
{
NS_ASSERTION(mDecoder && mDecoder->GetStream(), "Call this only with decoder Load called");
if (!gElementTable) {
gElementTable = new MediaElementURITable();
gElementTable->Init();
}
MediaElementSetForURI* entry = gElementTable->PutEntry(mLoadingSrc);
entry->mElements.AppendElement(this);
}
void
nsHTMLMediaElement::RemoveMediaElementFromURITable()
{
NS_ASSERTION(mDecoder, "Don't call this without decoder!");
NS_ASSERTION(mLoadingSrc, "Can't have decoder without source!");
if (!gElementTable)
return;
MediaElementSetForURI* entry = gElementTable->GetEntry(mLoadingSrc);
if (!entry)
return;
entry->mElements.RemoveElement(this);
if (entry->mElements.IsEmpty()) {
gElementTable->RemoveEntry(mLoadingSrc);
if (gElementTable->Count() == 0) {
delete gElementTable;
gElementTable = nsnull;
}
}
}
nsHTMLMediaElement*
nsHTMLMediaElement::LookupMediaElementURITable(nsIURI* aURI)
{
if (!gElementTable)
return nsnull;
MediaElementSetForURI* entry = gElementTable->GetEntry(aURI);
if (!entry)
return nsnull;
for (PRUint32 i = 0; i < entry->mElements.Length(); ++i) {
nsHTMLMediaElement* elem = entry->mElements[i];
bool equal;
// Look for elements that have the same principal.
// XXX when we implement crossorigin for video, we'll also need to check
// for the same crossorigin mode here. Ditto for anything else that could
// cause us to send different headers.
if (NS_SUCCEEDED(elem->NodePrincipal()->Equals(NodePrincipal(), &equal)) && equal) {
NS_ASSERTION(elem->mDecoder && elem->mDecoder->GetStream(), "Decoder gone");
return elem;
}
}
return nsnull;
}
nsHTMLMediaElement::nsHTMLMediaElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLElement(aNodeInfo),
mCurrentLoadID(0),
@ -1297,16 +1382,14 @@ nsHTMLMediaElement::~nsHTMLMediaElement()
UnregisterFreezableElement();
if (mDecoder) {
RemoveMediaElementFromURITable();
mDecoder->Shutdown();
mDecoder = nsnull;
}
if (mChannel) {
mChannel->Cancel(NS_BINDING_ABORTED);
mChannel = nsnull;
}
if (mAudioStream) {
mAudioStream->Shutdown();
mAudioStream = nsnull;
}
}
@ -1347,9 +1430,13 @@ NS_IMETHODIMP nsHTMLMediaElement::Play()
if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
nsresult rv = Load();
NS_ENSURE_SUCCESS(rv, rv);
} else if (mLoadIsSuspended) {
}
if (mLoadIsSuspended) {
ResumeLoad(PRELOAD_ENOUGH);
} else if (mDecoder) {
}
// Even if we just did Load() or ResumeLoad(), we could already have a decoder
// here if we managed to clone an existing decoder.
if (mDecoder) {
if (mDecoder->IsEnded()) {
SetCurrentTime(0);
}
@ -1811,7 +1898,9 @@ nsHTMLMediaElement::CreateDecoder(const nsACString& aType)
nsresult nsHTMLMediaElement::InitializeDecoderAsClone(nsMediaDecoder* aOriginal)
{
nsMediaStream* originalStream = aOriginal->GetCurrentStream();
NS_ASSERTION(mLoadingSrc, "mLoadingSrc must already be set");
nsMediaStream* originalStream = aOriginal->GetStream();
if (!originalStream)
return NS_ERROR_FAILURE;
nsRefPtr<nsMediaDecoder> decoder = aOriginal->Clone();
@ -1848,6 +1937,8 @@ nsresult nsHTMLMediaElement::InitializeDecoderAsClone(nsMediaDecoder* aOriginal)
nsresult nsHTMLMediaElement::InitializeDecoderForChannel(nsIChannel *aChannel,
nsIStreamListener **aListener)
{
NS_ASSERTION(mLoadingSrc, "mLoadingSrc must already be set");
nsCAutoString mimeType;
aChannel->GetContentType(mimeType);
@ -1878,10 +1969,10 @@ nsresult nsHTMLMediaElement::InitializeDecoderForChannel(nsIChannel *aChannel,
nsresult nsHTMLMediaElement::FinishDecoderSetup(nsMediaDecoder* aDecoder)
{
mDecoder = aDecoder;
NS_ASSERTION(mLoadingSrc, "mLoadingSrc set up");
// Decoder has assumed ownership responsibility for remembering the URI.
mLoadingSrc = nsnull;
mDecoder = aDecoder;
AddMediaElementToURITable();
// Force a same-origin check before allowing events for this media resource.
mMediaSecurityVerified = false;
@ -2019,9 +2110,11 @@ void nsHTMLMediaElement::NetworkError()
void nsHTMLMediaElement::DecodeError()
{
if (mDecoder) {
RemoveMediaElementFromURITable();
mDecoder->Shutdown();
mDecoder = nsnull;
}
mLoadingSrc = nsnull;
if (mIsLoadingFromSourceChildren) {
mError = nsnull;
if (mSourceLoadCandidate) {
@ -2669,13 +2762,10 @@ void nsHTMLMediaElement::FireTimeUpdate(bool aPeriodic)
void nsHTMLMediaElement::GetCurrentSpec(nsCString& aString)
{
if (mDecoder) {
nsMediaStream* stream = mDecoder->GetCurrentStream();
if (stream) {
stream->URI()->GetSpec(aString);
}
} else if (mLoadingSrc) {
if (mLoadingSrc) {
mLoadingSrc->GetSpec(aString);
} else {
aString.Truncate();
}
}

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

@ -52,6 +52,7 @@
#include "nsIObjectFrame.h"
#include "nsNPAPIPluginInstance.h"
#include "nsIConstraintValidation.h"
#include "nsIWidget.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -116,7 +117,7 @@ public:
bool aNotify);
virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, PRInt32 *aTabIndex);
virtual PRUint32 GetDesiredIMEState();
virtual IMEState GetDesiredIMEState();
// Overriden nsIFormControl methods
NS_IMETHOD_(PRUint32) GetType() const
@ -376,11 +377,11 @@ nsHTMLObjectElement::IsHTMLFocusable(bool aWithMouse,
return false;
}
PRUint32
nsIContent::IMEState
nsHTMLObjectElement::GetDesiredIMEState()
{
if (Type() == eType_Plugin) {
return nsIContent::IME_STATUS_PLUGIN;
return IMEState(IMEState::PLUGIN);
}
return nsGenericHTMLFormElement::GetDesiredIMEState();

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

@ -50,6 +50,7 @@
#include "nsIDOMGetSVGDocument.h"
#include "nsIDOMSVGDocument.h"
#include "nsIScriptError.h"
#include "nsIWidget.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -119,7 +120,7 @@ public:
bool aNotify);
virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, PRInt32 *aTabIndex);
virtual PRUint32 GetDesiredIMEState();
virtual IMEState GetDesiredIMEState();
virtual void DoneAddingChildren(bool aHaveNotified);
virtual bool IsDoneAddingChildren();
@ -365,11 +366,11 @@ nsHTMLSharedObjectElement::IsHTMLFocusable(bool aWithMouse,
return nsGenericHTMLElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex);
}
PRUint32
nsIContent::IMEState
nsHTMLSharedObjectElement::GetDesiredIMEState()
{
if (Type() == eType_Plugin) {
return nsIContent::IME_STATUS_PLUGIN;
return IMEState(IMEState::PLUGIN);
}
return nsGenericHTMLElement::GetDesiredIMEState();

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