merge mozilla-central to fx-team

This commit is contained in:
Tim Taubert 2011-07-17 04:53:34 +02:00
Родитель a44682fbf0 882c6cc528
Коммит 17370a85dd
402 изменённых файлов: 5865 добавлений и 2872 удалений

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

@ -55,7 +55,7 @@
typedef GType (* AtkGetTypeType) (void);
GType g_atk_hyperlink_impl_type = G_TYPE_INVALID;
static PRBool sATKChecked = PR_FALSE;
static bool sATKChecked = false;
static PRLibrary *sATKLib = nsnull;
static const char sATKLibName[] = "libatk-1.0.so.0";
static const char sATKHyperlinkImplGetTypeSymbol[] =
@ -100,8 +100,8 @@ static void insert_hf(gpointer key, gpointer value, gpointer data);
static gint mai_key_snooper(GtkWidget *the_widget, GdkEventKey *event,
gpointer func_data);
static GHashTable *listener_list = NULL;
static gint listener_idx = 1;
static GHashTable* sListener_list = NULL;
static gint sListener_idx = 1;
#define MAI_TYPE_UTIL (mai_util_get_type ())
#define MAI_UTIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
@ -115,8 +115,12 @@ static gint listener_idx = 1;
#define MAI_UTIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
MAI_TYPE_UTIL, MaiUtilClass))
static GHashTable *key_listener_list = NULL;
static guint key_snooper_id = 0;
static GHashTable* sKey_listener_list = NULL;
static guint sKey_snooper_id = 0;
static GQuark sQuark_gecko_acc_obj = g_quark_from_static_string("GeckoAccObj");
static bool sToplevel_event_hook_added = false;
static gulong sToplevel_show_hook = 0;
static gulong sToplevel_hide_hook = 0;
G_BEGIN_DECLS
typedef void (*GnomeAccessibilityInit) (void);
@ -223,7 +227,10 @@ window_added (AtkObject *atk_obj,
guint index,
AtkObject *child)
{
guint id = g_signal_lookup ("create", MAI_TYPE_ATK_OBJECT);
if (!IS_MAI_OBJECT(child))
return;
static guint id = g_signal_lookup ("create", MAI_TYPE_ATK_OBJECT);
g_signal_emit (child, id, 0);
}
@ -232,7 +239,10 @@ window_removed (AtkObject *atk_obj,
guint index,
AtkObject *child)
{
guint id = g_signal_lookup ("destroy", MAI_TYPE_ATK_OBJECT);
if (!IS_MAI_OBJECT(child))
return;
static guint id = g_signal_lookup ("destroy", MAI_TYPE_ATK_OBJECT);
g_signal_emit (child, id, 0);
}
@ -264,8 +274,8 @@ mai_util_class_init(MaiUtilClass *klass)
atk_class->get_toolkit_name = mai_util_get_toolkit_name;
atk_class->get_toolkit_version = mai_util_get_toolkit_version;
listener_list = g_hash_table_new_full(g_int_hash, g_int_equal, NULL,
_listener_info_destroy);
sListener_list = g_hash_table_new_full(g_int_hash, g_int_equal, NULL,
_listener_info_destroy);
// Keep track of added/removed windows.
AtkObject *root = atk_get_root ();
g_signal_connect (root, "children-changed::add", (GCallback) window_added, NULL);
@ -289,7 +299,7 @@ mai_util_add_global_event_listener(GSignalEmissionHook listener,
gail_listenerid =
gail_add_global_event_listener(listener, event_type);
}
rc = add_listener (listener, "MaiAtkObject", split_string[1],
event_type, gail_listenerid);
}
@ -310,14 +320,14 @@ mai_util_remove_global_event_listener(guint remove_listener)
gint tmp_idx = remove_listener;
listener_info = (MaiUtilListenerInfo *)
g_hash_table_lookup(listener_list, &tmp_idx);
g_hash_table_lookup(sListener_list, &tmp_idx);
if (listener_info != NULL) {
if (gail_remove_global_event_listener &&
listener_info->gail_listenerid) {
gail_remove_global_event_listener(listener_info->gail_listenerid);
}
/* Hook id of 0 and signal id of 0 are invalid */
if (listener_info->hook_id != 0 && listener_info->signal_id != 0) {
/* Remove the emission hook */
@ -325,7 +335,7 @@ mai_util_remove_global_event_listener(guint remove_listener)
listener_info->hook_id);
/* Remove the element from the hash */
g_hash_table_remove(listener_list, &tmp_idx);
g_hash_table_remove(sListener_list, &tmp_idx);
}
else {
g_warning("Invalid listener hook_id %ld or signal_id %d\n",
@ -366,14 +376,14 @@ atk_key_event_from_gdk_event_key (GdkEventKey *key)
event->state = key->state;
event->keyval = key->keyval;
event->length = key->length;
if (key->string && key->string [0] &&
if (key->string && key->string [0] &&
(key->state & GDK_CONTROL_MASK ||
g_unichar_isgraph (g_utf8_get_char (key->string)))) {
event->string = key->string;
}
else if (key->type == GDK_KEY_PRESS ||
key->type == GDK_KEY_RELEASE) {
event->string = gdk_keyval_name (key->keyval);
event->string = gdk_keyval_name (key->keyval);
}
event->keycode = key->hardware_keycode;
event->timestamp = key->time;
@ -409,9 +419,9 @@ mai_key_snooper(GtkWidget *the_widget, GdkEventKey *event, gpointer func_data)
MaiKeyEventInfo *info = g_new0(MaiKeyEventInfo, 1);
gint consumed = 0;
if (key_listener_list) {
if (sKey_listener_list) {
GHashTable *new_hash = g_hash_table_new(NULL, NULL);
g_hash_table_foreach (key_listener_list, insert_hf, new_hash);
g_hash_table_foreach (sKey_listener_list, insert_hf, new_hash);
info->key_event = atk_key_event_from_gdk_event_key (event);
info->func_data = func_data;
consumed = g_hash_table_foreach_steal (new_hash, notify_hf, info);
@ -430,13 +440,13 @@ mai_util_add_key_event_listener (AtkKeySnoopFunc listener,
static guint key=0;
if (!key_listener_list) {
key_listener_list = g_hash_table_new(NULL, NULL);
key_snooper_id = gtk_key_snooper_install(mai_key_snooper, data);
if (!sKey_listener_list) {
sKey_listener_list = g_hash_table_new(NULL, NULL);
sKey_snooper_id = gtk_key_snooper_install(mai_key_snooper, data);
}
AtkKeySnoopFuncPointer atkKeySnoop;
atkKeySnoop.func_ptr = listener;
g_hash_table_insert(key_listener_list, GUINT_TO_POINTER (key++),
g_hash_table_insert(sKey_listener_list, GUINT_TO_POINTER (key++),
atkKeySnoop.data);
return key;
}
@ -444,15 +454,15 @@ mai_util_add_key_event_listener (AtkKeySnoopFunc listener,
static void
mai_util_remove_key_event_listener (guint remove_listener)
{
if (!key_listener_list) {
if (!sKey_listener_list) {
// atk-bridge is initialized with gail (e.g. yelp)
// try gail_remove_key_event_listener
return gail_remove_key_event_listener(remove_listener);
}
g_hash_table_remove(key_listener_list, GUINT_TO_POINTER (remove_listener));
if (g_hash_table_size(key_listener_list) == 0) {
gtk_key_snooper_remove(key_snooper_id);
g_hash_table_remove(sKey_listener_list, GUINT_TO_POINTER (remove_listener));
if (g_hash_table_size(sKey_listener_list) == 0) {
gtk_key_snooper_remove(sKey_snooper_id);
}
}
@ -512,11 +522,11 @@ add_listener (GSignalEmissionHook listener,
if (signal_id > 0) {
MaiUtilListenerInfo *listener_info;
rc = listener_idx;
rc = sListener_idx;
listener_info = (MaiUtilListenerInfo *)
g_malloc(sizeof(MaiUtilListenerInfo));
listener_info->key = listener_idx;
listener_info->key = sListener_idx;
listener_info->hook_id =
g_signal_add_emission_hook(signal_id, 0, listener,
g_strdup(hook_data),
@ -524,9 +534,9 @@ add_listener (GSignalEmissionHook listener,
listener_info->signal_id = signal_id;
listener_info->gail_listenerid = gail_listenerid;
g_hash_table_insert(listener_list, &(listener_info->key),
g_hash_table_insert(sListener_list, &(listener_info->key),
listener_info);
listener_idx++;
sListener_idx++;
}
else {
g_warning("Invalid signal type %s\n", signal);
@ -554,6 +564,49 @@ nsApplicationAccessibleWrap::~nsApplicationAccessibleWrap()
nsAccessibleWrap::ShutdownAtkObject();
}
static gboolean
toplevel_event_watcher(GSignalInvocationHint* ihint,
guint n_param_values,
const GValue* param_values,
gpointer data)
{
if (nsAccessibilityService::IsShutdown())
return TRUE;
GObject* object = reinterpret_cast<GObject*>(g_value_get_object(param_values));
if (!GTK_IS_WINDOW(object))
return TRUE;
AtkObject* child = gtk_widget_get_accessible(GTK_WIDGET(object));
// GTK native dialog
if (!IS_MAI_OBJECT(child) &&
(atk_object_get_role(child) == ATK_ROLE_DIALOG)) {
if (data == reinterpret_cast<gpointer>(nsIAccessibleEvent::EVENT_SHOW)) {
// Attach the dialog accessible to app accessible tree
nsAccessible* windowAcc = GetAccService()->AddNativeRootAccessible(child);
g_object_set_qdata(G_OBJECT(child), sQuark_gecko_acc_obj,
reinterpret_cast<gpointer>(windowAcc));
} else {
// Deattach the dialog accessible
nsAccessible* windowAcc =
reinterpret_cast<nsAccessible*>
(g_object_get_qdata(G_OBJECT(child), sQuark_gecko_acc_obj));
if (windowAcc) {
GetAccService()->RemoveNativeRootAccessible(windowAcc);
g_object_set_qdata(G_OBJECT(child), sQuark_gecko_acc_obj, NULL);
}
}
}
return TRUE;
}
PRBool
nsApplicationAccessibleWrap::Init()
{
@ -602,6 +655,18 @@ nsApplicationAccessibleWrap::Init()
}
else
MAI_LOG_DEBUG(("Fail to load lib: %s\n", sAtkBridge.libName));
if (!sToplevel_event_hook_added) {
sToplevel_event_hook_added = true;
sToplevel_show_hook =
g_signal_add_emission_hook(g_signal_lookup("show", GTK_TYPE_WINDOW),
0, toplevel_event_watcher,
reinterpret_cast<gpointer>(nsIAccessibleEvent::EVENT_SHOW), NULL);
sToplevel_hide_hook =
g_signal_add_emission_hook(g_signal_lookup("hide", GTK_TYPE_WINDOW),
0, toplevel_event_watcher,
reinterpret_cast<gpointer>(nsIAccessibleEvent::EVENT_HIDE), NULL);
}
}
return nsApplicationAccessible::Init();
@ -610,6 +675,14 @@ nsApplicationAccessibleWrap::Init()
void
nsApplicationAccessibleWrap::Unload()
{
if (sToplevel_event_hook_added) {
sToplevel_event_hook_added = false;
g_signal_remove_emission_hook(g_signal_lookup("show", GTK_TYPE_WINDOW),
sToplevel_show_hook);
g_signal_remove_emission_hook(g_signal_lookup("hide", GTK_TYPE_WINDOW),
sToplevel_hide_hook);
}
if (sAtkBridge.lib) {
// Do not shutdown/unload atk-bridge,
// an exit function registered will take care of it
@ -671,7 +744,7 @@ gboolean fireRootAccessibleAddedCB(gpointer data)
g_object_unref(eventData->app_accessible);
g_object_unref(eventData->root_accessible);
free(data);
return FALSE;
}
@ -741,7 +814,7 @@ nsApplicationAccessibleWrap::PreCreate()
AtkSocketAccessible::g_atk_socket_embed;
}
}
sATKChecked = PR_TRUE;
sATKChecked = true;
}
}

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

@ -43,11 +43,6 @@
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsIDOMDocument.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDocShellTreeItem.h"
#include "nsIInterfaceRequestorUtils.h"
void
componentInterfaceInitCB(AtkComponentIface *aIface)
{

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

@ -46,9 +46,8 @@
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMRange.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMWindow.h"
#include "nsIDOMXULElement.h"
#include "nsIDocShell.h"
#include "nsIContentViewer.h"
@ -427,12 +426,11 @@ nsCoreUtils::GetScreenCoordsForWindow(nsINode *aNode)
nsCOMPtr<nsIDOMWindow> window;
domDoc->GetDefaultView(getter_AddRefs(window));
nsCOMPtr<nsIDOMWindowInternal> windowInter(do_QueryInterface(window));
if (!windowInter)
if (!window)
return coords;
windowInter->GetScreenX(&coords.x);
windowInter->GetScreenY(&coords.y);
window->GetScreenX(&coords.x);
window->GetScreenY(&coords.y);
return coords;
}

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

@ -179,7 +179,7 @@ nsHTMLImageAccessible::DoAction(PRUint8 aIndex)
nsIDocument* document = mContent->GetOwnerDoc();
nsCOMPtr<nsPIDOMWindow> piWindow = document->GetWindow();
nsCOMPtr<nsIDOMWindowInternal> win(do_QueryInterface(piWindow));
nsCOMPtr<nsIDOMWindow> win = do_QueryInterface(piWindow);
NS_ENSURE_TRUE(win, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMWindow> tmp;
return win->Open(longDesc, EmptyString(), EmptyString(),

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

@ -511,7 +511,7 @@ nsHTMLTableAccessible::GetRelationByType(PRUint32 aRelationType,
aRelation);
NS_ENSURE_SUCCESS(rv, rv);
if (aRelationType == nsIAccessibleRelation::RELATION_DESCRIBED_BY)
if (aRelationType == nsIAccessibleRelation::RELATION_LABELLED_BY)
return nsRelUtils::AddTarget(aRelationType, aRelation, Caption());
return NS_OK;
@ -1528,11 +1528,8 @@ nsHTMLCaptionAccessible::GetRelationByType(PRUint32 aRelationType,
aRelation);
NS_ENSURE_SUCCESS(rv, rv);
if (aRelationType == nsIAccessibleRelation::RELATION_DESCRIPTION_FOR) {
nsCOMPtr<nsIAccessible> accParent;
GetParent(getter_AddRefs(accParent));
return nsRelUtils::AddTarget(aRelationType, aRelation, accParent);
}
if (aRelationType == nsIAccessibleRelation::RELATION_LABEL_FOR)
return nsRelUtils::AddTarget(aRelationType, aRelation, GetParent());
return NS_OK;
}

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

@ -49,10 +49,8 @@
#include "nsContentCID.h"
#include "nsIDOMCharacterData.h"
#include "nsIDOMDocument.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMRange.h"
#include "nsIDOMNSRange.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMXULDocument.h"
#include "nsIEditingSession.h"
#include "nsIEditor.h"

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

@ -102,8 +102,8 @@
// 'described by'/'description for' relation for html:table and
// html:caption
testRelation("caption", RELATION_DESCRIPTION_FOR, "table");
testRelation("table", RELATION_DESCRIBED_BY, "caption");
testRelation("caption", RELATION_LABEL_FOR, "table");
testRelation("table", RELATION_LABELLED_BY, "caption");
// 'labelled by'/'label for' relation for html:fieldset and
// html:legend

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

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

@ -1415,6 +1415,8 @@ function prepareForStartup() {
return;
}
messageManager.loadFrameScript("chrome://browser/content/content.js", true);
// initialize observers and listeners
// and give C++ access to gBrowser
gBrowser.init();

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

@ -0,0 +1,53 @@
# -*- Mode: javascript; 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 multi-process front-end code.
#
# 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):
# Felipe Gomes <felipc@gmail.com>
#
# 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;
// Bug 671101 - directly using webNavigation in this context
// causes docshells to leak
__defineGetter__("webNavigation", function() {
return docShell.QueryInterface(Ci.nsIWebNavigation);
});
addMessageListener("WebNavigation:LoadURI", function(message) {
let flags = message.json.flags || webNavigation.LOAD_FLAGS_NONE;
webNavigation.loadURI(message.json.uri, flags, null, null, null);
});

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

@ -45,6 +45,7 @@
# Justin Dolske <dolske@mozilla.com>
# Kathleen Brade <brade@pearlcrescent.com>
# Mark Smith <mcs@pearlcrescent.com>
# Kailas Patil <patilkr24@gmail.com>
#
# 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
@ -879,17 +880,12 @@ nsContextMenu.prototype = {
saveDocument(this.target.ownerDocument);
},
// Save URL of clicked-on link.
saveLink: function() {
// Helper function to wait for appropriate MIME-type headers and
// then prompt the user with a file picker
saveHelper: function(linkURL, linkText, dialogTitle, bypassCache, doc) {
// canonical def in nsURILoader.h
const NS_ERROR_SAVE_LINK_AS_TIMEOUT = 0x805d0020;
var doc = this.target.ownerDocument;
urlSecurityCheck(this.linkURL, doc.nodePrincipal);
var linkText = this.linkText();
var linkURL = this.linkURL;
// an object to proxy the data through to
// nsIExternalHelperAppService.doContent, which will wait for the
// appropriate MIME-type headers and then prompt the user with a
@ -941,7 +937,7 @@ nsContextMenu.prototype = {
if (aStatusCode == NS_ERROR_SAVE_LINK_AS_TIMEOUT) {
// do it the old fashioned way, which will pick the best filename
// it can without waiting.
saveURL(linkURL, linkText, null, true, false, doc.documentURIObject);
saveURL(linkURL, linkText, dialogTitle, bypassCache, false, doc.documentURIObject);
}
if (this.extListener)
this.extListener.onStopRequest(aRequest, aContext, aStatusCode);
@ -985,10 +981,19 @@ nsContextMenu.prototype = {
// set up a channel to do the saving
var ioService = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var channel = ioService.newChannelFromURI(this.getLinkURI());
var channel = ioService.newChannelFromURI(makeURI(linkURL));
channel.notificationCallbacks = new callbacks();
channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE |
Ci.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS;
let flags = Ci.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS;
if (bypassCache)
flags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
if (channel instanceof Ci.nsICachingChannel)
flags |= Ci.nsICachingChannel.LOAD_BYPASS_LOCAL_CACHE_IF_BUSY;
channel.loadFlags |= flags;
if (channel instanceof Ci.nsIHttpChannel) {
channel.referrer = doc.documentURIObject;
if (channel instanceof Ci.nsIHttpChannelInternal)
@ -1006,6 +1011,14 @@ nsContextMenu.prototype = {
channel.asyncOpen(new saveAsListener(), null);
},
// Save URL of clicked-on link.
saveLink: function() {
var doc = this.target.ownerDocument;
urlSecurityCheck(this.linkURL, doc.nodePrincipal);
this.saveHelper(this.linkURL, this.linkText(), null, true, doc);
},
sendLink: function() {
// we don't know the title of the link so pass in an empty string
MailIntegration.sendMessage( this.linkURL, "" );
@ -1033,8 +1046,7 @@ nsContextMenu.prototype = {
else if (this.onVideo || this.onAudio) {
urlSecurityCheck(this.mediaURL, doc.nodePrincipal);
var dialogTitle = this.onVideo ? "SaveVideoTitle" : "SaveAudioTitle";
saveURL(this.mediaURL, null, dialogTitle, false,
false, doc.documentURIObject);
this.saveHelper(this.mediaURL, null, dialogTitle, false, doc);
}
},

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

@ -212,6 +212,10 @@ _BROWSER_FILES = \
browser_clearplugindata_noage.html \
browser_popupUI.js \
browser_sanitizeDialog.js \
browser_save_video.js \
bug564387.html \
bug564387_video1.ogv \
bug564387_video1.ogv^headers^ \
browser_scope.js \
browser_selectTabAtIndex.js \
browser_tab_dragdrop.js \

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

@ -50,7 +50,7 @@ function wait_for_install_dialog(aCallback) {
Services.wm.removeListener(this);
var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowInternal);
.getInterface(Ci.nsIDOMWindow);
waitForFocus(function() {
info("Saw install dialog");
is(domwindow.document.location.href, XPINSTALL_URL, "Should have seen the right window open");

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

@ -141,7 +141,7 @@ function test()
// Close the UI if necessary
let win = Services.ww.getWindowByName("Sanatize", null);
if (win && (win instanceof Ci.nsIDOMWindowInternal))
if (win && (win instanceof Ci.nsIDOMWindow))
win.close();
// Start the test when the sanitize window loads
@ -154,7 +154,7 @@ function test()
// Let the methods that run onload finish before we test
let doTest = function() setTimeout(function() {
let win = Services.ww.getWindowByName("Sanitize", null)
.QueryInterface(Ci.nsIDOMWindowInternal);
.QueryInterface(Ci.nsIDOMWindow);
for (let i = 0; i < tests.length; i++)
tests[i](win);

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

@ -0,0 +1,110 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* TestCase for bug 564387
* <https://bugzilla.mozilla.org/show_bug.cgi?id=564387>
*/
function test() {
// --- Testing support library ---
// Import the toolkit test support library in the scope of the current test.
// This operation also defines the common constants Cc, Ci, Cu, Cr and Cm.
Components.classes["@mozilla.org/moz/jssubscript-loader;1"].
getService(Components.interfaces.mozIJSSubScriptLoader).loadSubScript(
"chrome://mochitests/content/browser/toolkit/content/tests/browser/common/_loadAll.js",
this);
// --- Test implementation ---
const kBaseUrl =
"http://mochi.test:8888/browser/browser/base/content/test/";
function pageShown(event) {
if (event.target.location != "about:blank")
testRunner.continueTest();
}
function saveVideoAs_TestGenerator() {
// Load Test page
gBrowser.addEventListener("pageshow", pageShown, false);
gBrowser.loadURI(kBaseUrl + "bug564387.html");
yield;
gBrowser.removeEventListener("pageshow", pageShown, false);
// Ensure that the window is focused.
SimpleTest.waitForFocus(testRunner.continueTest);
yield;
try {
// get the video element
var video1 = gBrowser.contentDocument.getElementById("video1");
// Synthesize the right click on the context menu, and
// wait for it to be shown
document.addEventListener("popupshown", testRunner.continueTest, false);
EventUtils.synthesizeMouseAtCenter(video1,
{ type: "contextmenu", button: 2 },
gBrowser.contentWindow);
yield;
// Create the folder the video will be saved into.
var destDir = createTemporarySaveDirectory();
try {
// Call the appropriate save function defined in contentAreaUtils.js.
mockFilePickerSettings.destDir = destDir;
mockFilePickerSettings.filterIndex = 1; // kSaveAsType_URL
// register mock file picker object
mockFilePickerRegisterer.register();
try {
// register mock download progress listener
mockTransferForContinuingRegisterer.register();
try {
// Select "Save Video As" option from context menu
var saveVideoCommand = document.getElementById("context-savevideo");
saveVideoCommand.doCommand();
// Unregister the popupshown listener
document.removeEventListener("popupshown",
testRunner.continueTest, false);
// Close the context menu
document.getElementById("placesContext").hidePopup();
// Wait for the download to finish, and exit if it wasn't successful.
var downloadSuccess = yield;
if (!downloadSuccess)
throw "Unexpected failure in downloading Video file!";
}
finally {
// unregister download progress listener
mockTransferForContinuingRegisterer.unregister();
}
}
finally {
// unregister mock file picker object
mockFilePickerRegisterer.unregister();
}
// Read the name of the saved file.
var fileName = mockFilePickerResults.selectedFile.leafName;
is(fileName, "Bug564387-expectedName.ogv",
"Video File Name is correctly retrieved from Content-Disposition http header");
}
finally {
// Clean up the saved file.
destDir.remove(true);
}
}
finally {
// Replace the current tab with a clean one.
gBrowser.addTab().linkedBrowser.stop();
gBrowser.removeCurrentTab();
}
}
// --- Run the test ---
testRunner.runTest(saveVideoAs_TestGenerator);
}

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

@ -0,0 +1,11 @@
<html>
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=564387 -->
<head>
<title> Bug 564387 test</title>
</head>
<body>
Testing for Mozilla Bug: 564387
<br>
<video src="bug564387_video1.ogv" id="video1"> </video>
</body>
</html>

Двоичные данные
browser/base/content/test/bug564387_video1.ogv Normal file

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

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

@ -0,0 +1,3 @@
Content-Disposition: filename="Bug564387-expectedName.ogv"
Content-Type: video/ogg

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

@ -29,6 +29,7 @@ browser.jar:
* content/browser/browser.js (content/browser.js)
* content/browser/browser.xul (content/browser.xul)
* content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml)
* content/browser/content.js (content/content.js)
* content/browser/fullscreen-video.xhtml (content/fullscreen-video.xhtml)
* content/browser/inspector.html (content/inspector.html)
* content/browser/scratchpad.xul (content/scratchpad.xul)

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

@ -39,7 +39,7 @@
#include "nsIBrowserProfileMigrator.h"
#include "nsIComponentManager.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMWindow.h"
#include "nsILocalFile.h"
#include "nsIObserverService.h"
#include "nsIProperties.h"

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

@ -114,10 +114,10 @@ let gSyncPane = {
Services.prompt.BUTTON_POS_1_DEFAULT;
let buttonChoice =
Services.prompt.confirmEx(window,
this._stringBundle.GetStringFromName("stopUsingAccount.title"),
this._stringBundle.GetStringFromName("differentAccount.label"),
this._stringBundle.GetStringFromName("syncUnlink.title"),
this._stringBundle.GetStringFromName("syncUnlink.label"),
flags,
this._stringBundle.GetStringFromName("differentAccountConfirm.label"),
this._stringBundle.GetStringFromName("syncUnlinkConfirm.label"),
null, null, null, {});
// If the user selects cancel, just bail

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

@ -101,12 +101,12 @@
<menuitem label="&viewQuota.label;"
oncommand="gSyncPane.openQuotaDialog();"/>
<menuseparator/>
<menuitem label="&changePassword.label;"
<menuitem label="&changePassword2.label;"
oncommand="gSyncUtils.changePassword();"/>
<menuitem label="&mySyncKey.label;"
oncommand="gSyncUtils.resetPassphrase();"/>
<menuseparator/>
<menuitem label="&resetSync.label;"
<menuitem label="&resetSync2.label;"
oncommand="gSyncPane.resetSync();"/>
</menupopup>
</button>
@ -172,7 +172,7 @@
<hbox>
<label class="text-link"
onclick="gSyncPane.startOver(true); return false;"
value="&deactivateDevice.label;"/>
value="&unlinkDevice.label;"/>
</hbox>
</groupbox>
<hbox id="tosPP" pack="center">
@ -197,7 +197,7 @@
</hbox>
<label class="text-link"
onclick="gSyncPane.startOver(true); return false;"
value="&deactivateDevice.label;"/>
value="&unlinkDevice.label;"/>
</vbox>
</deck>
</prefpane>

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

@ -295,7 +295,7 @@ function addWindowListener(aURL, aCallback) {
Services.wm.removeListener(this);
var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowInternal);
.getInterface(Ci.nsIDOMWindow);
waitForFocus(function() {
is(domwindow.document.location.href, aURL, "should have seen the right window open");
domwindow.close();

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

@ -43,11 +43,11 @@
* - and allows to restore everything into one window.
*/
[scriptable, uuid(e7bb7828-0e32-4995-a848-4aa35df603c7)]
[scriptable, uuid(170c6857-7f71-46ce-bc9b-185723b1c3a8)]
interface nsISessionStartup: nsISupports
{
// Get session state as string
readonly attribute AString state;
// Get session state
readonly attribute jsval state;
/**
* Determine if session should be restored

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

@ -89,7 +89,7 @@ function SessionStartup() {
SessionStartup.prototype = {
// the state to restore at startup
_iniString: null,
_initialState: null,
_sessionType: Ci.nsISessionStartup.NO_SESSION,
/* ........ Global Event Handlers .............. */
@ -121,31 +121,30 @@ SessionStartup.prototype = {
return;
// get string containing session state
this._iniString = this._readStateFile(sessionFile);
if (!this._iniString)
let iniString = this._readStateFile(sessionFile);
if (!iniString)
return;
// parse the session state into a JS object
let initialState;
try {
// remove unneeded braces (added for compatibility with Firefox 2.0 and 3.0)
if (this._iniString.charAt(0) == '(')
this._iniString = this._iniString.slice(1, -1);
if (iniString.charAt(0) == '(')
iniString = iniString.slice(1, -1);
try {
initialState = JSON.parse(this._iniString);
this._initialState = JSON.parse(iniString);
}
catch (exJSON) {
var s = new Cu.Sandbox("about:blank");
initialState = Cu.evalInSandbox("(" + this._iniString + ")", s);
this._iniString = JSON.stringify(initialState);
this._initialState = Cu.evalInSandbox("(" + iniString + ")", s);
}
}
catch (ex) { debug("The session file is invalid: " + ex); }
let resumeFromCrash = prefBranch.getBoolPref("sessionstore.resume_from_crash");
let lastSessionCrashed =
initialState && initialState.session && initialState.session.state &&
initialState.session.state == STATE_RUNNING_STR;
this._initialState && this._initialState.session &&
this._initialState.session.state &&
this._initialState.session.state == STATE_RUNNING_STR;
// Report shutdown success via telemetry. Shortcoming here are
// being-killed-by-OS-shutdown-logic, shutdown freezing after
@ -158,17 +157,17 @@ SessionStartup.prototype = {
this._sessionType = Ci.nsISessionStartup.RECOVER_SESSION;
else if (!lastSessionCrashed && doResumeSession)
this._sessionType = Ci.nsISessionStartup.RESUME_SESSION;
else if (initialState)
else if (this._initialState)
this._sessionType = Ci.nsISessionStartup.DEFER_SESSION;
else
this._iniString = null; // reset the state string
this._initialState = null; // reset the state
// wait for the first browser window to open
// Don't reset the initial window's default args (i.e. the home page(s))
// if all stored tabs are pinned.
if (this.doRestore() &&
(!initialState.windows ||
!initialState.windows.every(function (win)
(!this._initialState.windows ||
!this._initialState.windows.every(function (win)
win.tabs.every(function (tab) tab.pinned))))
Services.obs.addObserver(this, "domwindowopened", true);
@ -204,8 +203,8 @@ SessionStartup.prototype = {
break;
case "sessionstore-windows-restored":
Services.obs.removeObserver(this, "sessionstore-windows-restored");
// free _iniString after nsSessionStore is done with it
this._iniString = null;
// free _initialState after nsSessionStore is done with it
this._initialState = null;
this._sessionType = Ci.nsISessionStartup.NO_SESSION;
break;
}
@ -254,7 +253,7 @@ SessionStartup.prototype = {
* Get the session state as a string
*/
get state() {
return this._iniString;
return this._initialState;
},
/**

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

@ -304,33 +304,31 @@ SessionStoreService.prototype = {
this._sessionFileBackup.append("sessionstore.bak");
// get string containing session state
var iniString;
var ss = Cc["@mozilla.org/browser/sessionstartup;1"].
getService(Ci.nsISessionStartup);
try {
if (ss.doRestore() ||
ss.sessionType == Ci.nsISessionStartup.DEFER_SESSION)
iniString = ss.state;
this._initialState = ss.state;
}
catch(ex) { dump(ex + "\n"); } // no state to restore, which is ok
if (iniString) {
if (this._initialState) {
try {
// If we're doing a DEFERRED session, then we want to pull pinned tabs
// out so they can be restored.
if (ss.sessionType == Ci.nsISessionStartup.DEFER_SESSION) {
let [iniState, remainingState] = this._prepDataForDeferredRestore(iniString);
let [iniState, remainingState] = this._prepDataForDeferredRestore(this._initialState);
// If we have a iniState with windows, that means that we have windows
// with app tabs to restore.
if (iniState.windows.length)
this._initialState = iniState;
else
this._initialState = null;
if (remainingState.windows.length)
this._lastSessionState = remainingState;
}
else {
// parse the session state into JS objects
this._initialState = JSON.parse(iniString);
let lastSessionCrashed =
this._initialState.session && this._initialState.session.state &&
this._initialState.session.state == STATE_RUNNING_STR;
@ -342,7 +340,7 @@ SessionStoreService.prototype = {
// replace the crashed session with a restore-page-only session
let pageData = {
url: "about:sessionrestore",
formdata: { "#sessionData": iniString }
formdata: { "#sessionData": JSON.stringify(this._initialState) }
};
this._initialState = { windows: [{ tabs: [{ entries: [pageData] }] }] };
}
@ -811,7 +809,7 @@ SessionStoreService.prototype = {
// We'll cheat a little bit and reuse _prepDataForDeferredRestore
// even though it wasn't built exactly for this.
let [appTabsState, normalTabsState] =
this._prepDataForDeferredRestore(JSON.stringify({ windows: [closedWindowState] }));
this._prepDataForDeferredRestore({ windows: [closedWindowState] });
// These are our pinned tabs, which we should restore
if (appTabsState.windows.length) {
@ -3794,12 +3792,11 @@ SessionStoreService.prototype = {
* this._lastSessionState and will be kept in case the user explicitly wants
* to restore the previous session (publicly exposed as restoreLastSession).
*
* @param stateString
* The state string, presumably from nsISessionStartup.state
* @param state
* The state, presumably from nsISessionStartup.state
* @returns [defaultState, state]
*/
_prepDataForDeferredRestore: function sss__prepDataForDeferredRestore(stateString) {
let state = JSON.parse(stateString);
_prepDataForDeferredRestore: function sss__prepDataForDeferredRestore(state) {
let defaultState = { windows: [], selectedWindow: 1 };
state.selectedWindow = state.selectedWindow || 1;

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

@ -129,7 +129,7 @@ function test() {
}
function getCanvas(width, height) {
let win = window.QueryInterface(Ci.nsIDOMWindowInternal);
let win = window.QueryInterface(Ci.nsIDOMWindow);
let doc = win.document;
let canvas = doc.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
canvas.width = width;

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

@ -222,7 +222,7 @@ BrowserTab.prototype = {
if (!(aEvent.originalTarget instanceof Ci.nsIDOMDocument))
return;
if (aEvent.originalTarget.defaultView instanceof Ci.nsIDOMWindowInternal &&
if (aEvent.originalTarget.defaultView instanceof Ci.nsIDOMWindow &&
aEvent.originalTarget.defaultView.frameElement)
return;
}

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

@ -34,7 +34,7 @@ WindowOpenListener.prototype = {
this.window = window;
this.domwindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowInternal);
.getInterface(Ci.nsIDOMWindow);
this.domwindow.addEventListener("load", this, false);
},

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

@ -111,6 +111,6 @@ offlinepermissionstitle=Offline Data
# %2$S = unit (MB, KB, etc.)
actualCacheSize=Your cache is currently using %1$S %2$S of disk space
stopUsingAccount.title=Do you want to stop using this account?
differentAccount.label=This will reset all of your Sync account information and preferences.
differentAccountConfirm.label=Reset All Information
syncUnlink.title=Do you want to unlink your device?
syncUnlink.label=This device will no longer be associated with your Sync account. All of your personal data, both on this device and in your Sync account, will remain intact.
syncUnlinkConfirm.label=Unlink

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

@ -13,9 +13,10 @@
<!ENTITY manageAccount.label "Manage Account">
<!ENTITY manageAccount.accesskey "A">
<!ENTITY viewQuota.label "View Quota">
<!ENTITY changePassword.label "Change Password">
<!ENTITY changePassword2.label "Change Password">
<!ENTITY mySyncKey.label "My Sync Key">
<!ENTITY resetSync.label "Reset Sync">
<!ENTITY resetSync2.label "Reset Sync…">
<!ENTITY addDevice.label "Add a Device">
<!ENTITY syncMy.label "Sync My">
@ -33,7 +34,7 @@
<!-- Device Settings -->
<!ENTITY syncComputerName.label "Computer Name:">
<!ENTITY syncComputerName.accesskey "c">
<!ENTITY deactivateDevice.label "Deactivate This Device">
<!ENTITY unlinkDevice.label "Unlink This Device">
<!-- Footer stuff -->
<!ENTITY prefs.tosLink.label "Terms of Service">

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

@ -416,6 +416,9 @@ int do_relocation_section(Elf *elf, unsigned int rel_type, unsigned int rel_type
int entry_sz = (elf->getClass() == ELFCLASS32) ? 4 : 8;
for (typename std::vector<Rel_Type>::iterator i = section->rels.begin();
i != section->rels.end(); i++) {
// We don't need to keep R_*_NONE relocations
if (!ELF32_R_TYPE(i->r_info))
continue;
ElfSection *section = elf->getSectionAt(i->r_offset);
// __cxa_pure_virtual is a function used in vtables to point at pure
// virtual methods. The __cxa_pure_virtual function usually abort()s.

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

@ -2712,7 +2712,7 @@ nsScriptSecurityManager::CheckConfirmDialog(JSContext* cx, nsIPrincipal* aPrinci
nsIScriptContext *scriptContext = GetScriptContext(cx);
if (scriptContext)
{
nsCOMPtr<nsIDOMWindowInternal> domWin =
nsCOMPtr<nsIDOMWindow> domWin =
do_QueryInterface(scriptContext->GetGlobalObject());
if (domWin)
domWin->GetPrompter(getter_AddRefs(prompter));

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

@ -64,7 +64,7 @@
#include "nsIDOMElement.h"
#include "nsIDOMLocation.h"
#include "nsIDOMWindowCollection.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMWindow.h"
#include "nsIIOService.h"
#include "nsIJARProtocolHandler.h"
#include "nsIObserverService.h"
@ -351,7 +351,7 @@ nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURI, nsIURI* *aResult)
// theme stuff
static void FlushSkinBindingsForWindow(nsIDOMWindowInternal* aWindow)
static void FlushSkinBindingsForWindow(nsIDOMWindow* aWindow)
{
// Get the DOM document.
nsCOMPtr<nsIDOMDocument> domDocument;
@ -383,7 +383,7 @@ NS_IMETHODIMP nsChromeRegistry::RefreshSkins()
nsCOMPtr<nsISupports> protoWindow;
windowEnumerator->GetNext(getter_AddRefs(protoWindow));
if (protoWindow) {
nsCOMPtr<nsIDOMWindowInternal> domWindow = do_QueryInterface(protoWindow);
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(protoWindow);
if (domWindow)
FlushSkinBindingsForWindow(domWindow);
}
@ -398,7 +398,7 @@ NS_IMETHODIMP nsChromeRegistry::RefreshSkins()
nsCOMPtr<nsISupports> protoWindow;
windowEnumerator->GetNext(getter_AddRefs(protoWindow));
if (protoWindow) {
nsCOMPtr<nsIDOMWindowInternal> domWindow = do_QueryInterface(protoWindow);
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(protoWindow);
if (domWindow)
RefreshWindow(domWindow);
}
@ -428,7 +428,7 @@ static PRBool IsChromeURI(nsIURI* aURI)
}
// XXXbsmedberg: move this to windowmediator
nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow)
nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindow* aWindow)
{
// Deal with our subframes first.
nsCOMPtr<nsIDOMWindowCollection> frames;
@ -439,8 +439,7 @@ nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow)
for (j = 0; j < length; j++) {
nsCOMPtr<nsIDOMWindow> childWin;
frames->Item(j, getter_AddRefs(childWin));
nsCOMPtr<nsIDOMWindowInternal> childInt(do_QueryInterface(childWin));
RefreshWindow(childInt);
RefreshWindow(childWin);
}
nsresult rv;
@ -568,8 +567,7 @@ nsChromeRegistry::ReloadChrome()
nsCOMPtr<nsISupports> protoWindow;
rv = windowEnumerator->GetNext(getter_AddRefs(protoWindow));
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIDOMWindowInternal> domWindow =
do_QueryInterface(protoWindow);
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(protoWindow);
if (domWindow) {
nsCOMPtr<nsIDOMLocation> location;
domWindow->GetLocation(getter_AddRefs(location));

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

@ -63,7 +63,7 @@
#include "mozilla/Omnijar.h"
class nsIDOMWindowInternal;
class nsIDOMWindow;
class nsIURL;
// The chrome registry is actually split between nsChromeRegistryChrome and
@ -130,7 +130,7 @@ protected:
nsresult SelectLocaleFromPref(nsIPrefBranch* prefs);
static nsresult RefreshWindow(nsIDOMWindowInternal* aWindow);
static nsresult RefreshWindow(nsIDOMWindow* aWindow);
static nsresult GetProviderAndPath(nsIURL* aChromeURL,
nsACString& aProvider, nsACString& aPath);

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

@ -123,7 +123,7 @@ CAIRO_VERSION=1.10
PANGO_VERSION=1.14.0
GTK2_VERSION=2.10.0
WINDRES_VERSION=2.14.90
W32API_VERSION=3.8
W32API_VERSION=3.14
GNOMEVFS_VERSION=2.0
GNOMEUI_VERSION=2.2.0
GCONF_VERSION=1.2.1
@ -317,6 +317,12 @@ case "$target" in
if test -e "$android_ndk/sources/cxx-stl/stlport/libs/armeabi-v7a/libstlport_static.a" ; then
STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/stlport/libs/armeabi-v7a/ -lstlport_static"
elif test -e "$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/armeabi-v7a/libstlport_static.a" ; then
STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
STLPORT_LDFLAGS="-L$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/armeabi-v7a -lstlport_static"
elif test "$target" != "arm-android-eabi"; then
dnl fail if we're not building with NDKr4
AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
fi
CPPFLAGS="-I$android_platform/usr/include $STLPORT_CPPFLAGS $CPPFLAGS"
@ -870,8 +876,7 @@ EOF
AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
fi
# Server 2003 is the highest version supported
MOZ_WINSDK_MAXVER=0x05020000
MOZ_WINSDK_MAXVER=0x06010000
fi # !GNU_CC
AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
@ -7465,12 +7470,20 @@ else
WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
else
MOZ_MEMORY_LDFLAGS='-MANIFEST:NO -LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
if test -z "$MOZ_DEBUG"; then
WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
else
WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
fi
dnl Look for a broken crtdll.obj
WIN32_CRTDLL_FULLPATH=`lib -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
lib -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
if grep -q '__imp__?free' crtdll.obj; then
MOZ_MEMORY_LDFLAGS='-MANIFEST:NO -LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
else
MOZ_MEMORY_LDFLAGS='$(DIST)/../memory/jemalloc/jemalloc.lib'
fi
rm crtdll.obj
fi
dnl Also pass this to NSPR/NSS
DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"

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

@ -66,7 +66,7 @@
#include "nsIContentViewer.h"
#include "nsIAtom.h"
#include "nsGkAtoms.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMWindow.h"
#include "nsIPrincipal.h"
#include "nsIScriptGlobalObject.h"
#include "nsNetCID.h"
@ -515,7 +515,7 @@ nsContentSink::ProcessHeaderData(nsIAtom* aHeader, const nsAString& aValue,
NS_ENSURE_TRUE(codebaseURI, rv);
nsCOMPtr<nsIPrompt> prompt;
nsCOMPtr<nsIDOMWindowInternal> window (do_QueryInterface(mDocument->GetScriptGlobalObject()));
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(mDocument->GetScriptGlobalObject());
if (window) {
window->GetPrompter(getter_AddRefs(prompt));
}

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

@ -2324,6 +2324,7 @@ nsContentUtils::LoadImage(nsIURI* aURI, nsIDocument* aLoadingDocument,
return imgLoader->LoadImage(aURI, /* uri to load */
documentURI, /* initialDocumentURI */
aReferrer, /* referrer */
aLoadingPrincipal, /* loading principal */
loadGroup, /* loadgroup */
aObserver, /* imgIDecoderObserver */
aLoadingDocument, /* uniquification key */

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

@ -116,7 +116,7 @@
#include "nsIScriptSecurityManager.h"
#include "nsIPrincipal.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMWindow.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMElement.h"
#include "nsFocusManager.h"
@ -5095,7 +5095,7 @@ nsDocument::GetLocation(nsIDOMLocation **_retval)
NS_ENSURE_ARG_POINTER(_retval);
*_retval = nsnull;
nsCOMPtr<nsIDOMWindowInternal> w(do_QueryInterface(mScriptGlobalObject));
nsCOMPtr<nsIDOMWindow> w = do_QueryInterface(mScriptGlobalObject);
if (!w) {
return NS_OK;
@ -5108,8 +5108,7 @@ Element*
nsIDocument::GetHtmlElement()
{
Element* rootElement = GetRootElement();
if (rootElement && rootElement->Tag() == nsGkAtoms::html &&
rootElement->IsHTML())
if (rootElement && rootElement->IsHTML(nsGkAtoms::html))
return rootElement;
return nsnull;
}

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

@ -1331,7 +1331,7 @@ nsIContent*
nsIContent::GetEditingHost()
{
// If this isn't editable, return NULL.
NS_ENSURE_TRUE(HasFlag(NODE_IS_EDITABLE), nsnull);
NS_ENSURE_TRUE(IsEditableInternal(), nsnull);
nsIDocument* doc = GetCurrentDoc();
NS_ENSURE_TRUE(doc, nsnull);

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

@ -256,6 +256,7 @@ GK_ATOM(copy, "copy")
GK_ATOM(copyOf, "copy-of")
GK_ATOM(count, "count")
GK_ATOM(crop, "crop")
GK_ATOM(crossOrigin, "crossOrigin")
GK_ATOM(curpos, "curpos")
GK_ATOM(current, "current")
GK_ATOM(currentloop, "currentloop")

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

@ -719,13 +719,21 @@ nsImageLoadingContent::LoadImage(nsIURI* aNewURI,
return NS_OK;
}
nsLoadFlags loadFlags = aLoadFlags;
PRInt32 corsmode = GetCORSMode();
if (corsmode == nsImageLoadingContent::CORS_ANONYMOUS) {
loadFlags |= imgILoader::LOAD_CORS_ANONYMOUS;
} else if (corsmode == nsImageLoadingContent::CORS_USE_CREDENTIALS) {
loadFlags |= imgILoader::LOAD_CORS_USE_CREDENTIALS;
}
// Not blocked. Do the load.
nsCOMPtr<imgIRequest>& req = PrepareNextRequest();
nsresult rv;
rv = nsContentUtils::LoadImage(aNewURI, aDocument,
aDocument->NodePrincipal(),
aDocument->GetDocumentURI(),
this, aLoadFlags,
this, loadFlags,
getter_AddRefs(req));
if (NS_SUCCEEDED(rv)) {
TrackImage(req);
@ -1086,3 +1094,8 @@ nsImageLoadingContent::CreateStaticImageClone(nsImageLoadingContent* aDest) cons
aDest->mSuppressed = mSuppressed;
}
nsImageLoadingContent::CORSMode
nsImageLoadingContent::GetCORSMode()
{
return CORS_NONE;
}

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

@ -69,6 +69,25 @@ public:
NS_DECL_IMGIDECODEROBSERVER
NS_DECL_NSIIMAGELOADINGCONTENT
enum CORSMode {
/**
* The default of not using CORS to validate cross-origin loads.
*/
CORS_NONE,
/**
* Validate cross-site loads using CORS, but do not send any credentials
* (cookies, HTTP auth logins, etc) along with the request.
*/
CORS_ANONYMOUS,
/**
* Validate cross-site loads using CORS, and send credentials such as cookies
* and HTTP auth logins along with the request.
*/
CORS_USE_CREDENTIALS
};
protected:
/**
* LoadImage is called by subclasses when the appropriate
@ -159,6 +178,12 @@ protected:
// current one. See the comment for mBlockingOnload for more information.
void SetBlockingOnload(PRBool aBlocking);
/**
* Returns the CORS mode that will be used for all future image loads. The
* default implementation returns CORS_NONE unconditionally.
*/
virtual CORSMode GetCORSMode();
private:
/**
* Struct used to manage the image observers.

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

@ -53,6 +53,7 @@
#include "nsIDOMMutationEvent.h"
#include "nsXULElement.h"
#include "nsIDOMSVGStylable.h"
#include "nsContentUtils.h"
namespace css = mozilla::css;

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

@ -3560,25 +3560,32 @@ WebGLContext::DOMElementToImageSurface(nsIDOMElement *imageOrCanvas,
return NS_ERROR_FAILURE;
}
// Bug 656277 - Prevent loading WebGL textures from cross-domain images
// We disallow loading cross-domain images that have not been validated
// with CORS as WebGL textures. The reason for doing that is that timing
// attacks on WebGL shaders are able to retrieve approximations of the
// pixel values in WebGL textures; see bug 655987.
//
// We disallow loading cross-domain images as WebGL textures. The reason for doing that
// is that timing attacks on WebGL shaders are able to retrieve approximations of the pixel values
// in WebGL textures, see bug 655987.
//
// To prevent a loophole where a Canvas2D would be used as a proxy to load cross-domain textures,
// we also disallow loading textures from write-only Canvas2D's.
// To prevent a loophole where a Canvas2D would be used as a proxy to load
// cross-domain textures, we also disallow loading textures from write-only
// Canvas2D's.
// part 1: check that the DOM element is same-origin.
// part 1: check that the DOM element is same-origin, or has otherwise been
// validated for cross-domain use.
// if res.mPrincipal == null, no need for the origin check. See DoDrawImageSecurityCheck.
// this case happens in the mochitest for images served from mochi.test:8888
if (res.mPrincipal) {
PRBool subsumes;
nsresult rv = HTMLCanvasElement()->NodePrincipal()->Subsumes(res.mPrincipal, &subsumes);
if (NS_FAILED(rv) || !subsumes) {
LogMessageIfVerbose("It is forbidden to load a WebGL texture from a cross-domain element. "
"See https://developer.mozilla.org/en/WebGL/Cross-Domain_Textures");
return NS_ERROR_DOM_SECURITY_ERR;
PRInt32 corsmode;
if (!res.mImageRequest || NS_FAILED(res.mImageRequest->GetCORSMode(&corsmode))) {
corsmode = imgIRequest::CORS_NONE;
}
if (corsmode == imgIRequest::CORS_NONE) {
LogMessageIfVerbose("It is forbidden to load a WebGL texture from a cross-domain element that has not been validated with CORS. "
"See https://developer.mozilla.org/en/WebGL/Cross-Domain_Textures");
return NS_ERROR_DOM_SECURITY_ERR;
}
}
}

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

@ -52,3 +52,4 @@ DOMCI_DATA(WebGLFramebuffer, void)
DOMCI_DATA(WebGLRenderbuffer, void)
DOMCI_DATA(WebGLUniformLocation, void)
DOMCI_DATA(WebGLActiveInfo, void)
DOMCI_DATA(WebGLExtension, void)

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

@ -827,12 +827,17 @@ protected:
/* This is an RAII based class that can be used as a drawtarget for
* operations that need a shadow drawn. It will automatically provide a
* temporary target when needed, and if so blend it back with a shadow.
*
* aBounds specifies the bounds of the drawing operation that will be
* drawn to the target, it is given in device space! This function will
* change aBounds to incorporate shadow bounds. If this is NULL the drawing
* operation will be assumed to cover an infinite rect.
*/
class AdjustedTarget
{
public:
AdjustedTarget(nsCanvasRenderingContext2DAzure *ctx,
const mgfx::Rect *aBounds = nsnull)
mgfx::Rect *aBounds = nsnull)
: mCtx(nsnull)
{
if (!ctx->NeedToDrawShadow()) {
@ -850,48 +855,43 @@ protected:
}
Matrix transform = mCtx->mTarget->GetTransform();
if (!aBounds) {
mTempSize = IntSize(ctx->mWidth, ctx->mHeight);
// We need to enlarge an possibly offset our temporary surface
// so that things outside of the canvas may cast shadows.
if (state.shadowOffset.x > 0) {
mTempSize.width += state.shadowOffset.x;
mSurfOffset.x = -state.shadowOffset.x;
transform._31 += state.shadowOffset.x;
} else {
mTempSize.width -= state.shadowOffset.x;
}
if (state.shadowOffset.y > 0) {
mTempSize.height += state.shadowOffset.y;
mSurfOffset.y = -state.shadowOffset.y;
transform._32 += state.shadowOffset.y;
} else {
mTempSize.height -= state.shadowOffset.y;
}
mTempRect = mgfx::Rect(0, 0, ctx->mWidth, ctx->mHeight);
if (mSigma > 0) {
float blurRadius = mSigma * 3;
mSurfOffset.x -= blurRadius;
mSurfOffset.y -= blurRadius;
mTempSize.width += blurRadius;
mTempSize.height += blurRadius;
transform._31 += blurRadius;
transform._32 += blurRadius;
}
} // XXX - Implement aBounds path! See bug 666452.
Float blurRadius = mSigma * 3;
// We need to enlarge and possibly offset our temporary surface
// so that things outside of the canvas may cast shadows.
mTempRect.Inflate(Margin(blurRadius + NS_MAX<Float>(state.shadowOffset.x, 0),
blurRadius + NS_MAX<Float>(state.shadowOffset.y, 0),
blurRadius + NS_MAX<Float>(-state.shadowOffset.x, 0),
blurRadius + NS_MAX<Float>(-state.shadowOffset.y, 0)));
if (aBounds) {
// We actually include the bounds of the shadow blur, this makes it
// easier to execute the actual blur on hardware, and shouldn't affect
// the amount of pixels that need to be touched.
aBounds->Inflate(Margin(blurRadius, blurRadius,
blurRadius, blurRadius));
mTempRect = mTempRect.Intersect(*aBounds);
}
mTempRect.ScaleRoundOut(1.0f);
transform._31 -= mTempRect.x;
transform._32 -= mTempRect.y;
mTarget =
mCtx->mTarget->CreateSimilarDrawTarget(mTempSize,
FORMAT_B8G8R8A8);
mTarget->SetTransform(transform);
mCtx->mTarget->CreateSimilarDrawTarget(IntSize(int32_t(mTempRect.width), int32_t(mTempRect.height)),
FORMAT_B8G8R8A8);
if (!mTarget) {
// XXX - Deal with the situation where our temp size is too big to
// fit in a texture.
mTarget = ctx->mTarget;
mCtx = nsnull;
} else {
mTarget->SetTransform(transform);
}
}
@ -903,7 +903,7 @@ protected:
RefPtr<SourceSurface> snapshot = mTarget->Snapshot();
mCtx->mTarget->DrawSurfaceWithShadow(snapshot, mSurfOffset,
mCtx->mTarget->DrawSurfaceWithShadow(snapshot, mTempRect.TopLeft(),
Color::FromABGR(mCtx->CurrentState().shadowColor),
mCtx->CurrentState().shadowOffset, mSigma,
mCtx->CurrentState().op);
@ -918,8 +918,7 @@ protected:
RefPtr<DrawTarget> mTarget;
nsCanvasRenderingContext2DAzure *mCtx;
Float mSigma;
IntSize mTempSize;
Point mSurfOffset;
mgfx::Rect mTempRect;
};
nsAutoTArray<ContextState, 3> mStyleStack;
@ -2114,9 +2113,17 @@ nsCanvasRenderingContext2DAzure::FillRect(float x, float y, float w, float h)
}
}
AdjustedTarget(this)->FillRect(mgfx::Rect(x, y, w, h),
GeneralPattern().ForStyle(this, STYLE_FILL, mTarget),
DrawOptions(state.globalAlpha, UsedOperation()));
mgfx::Rect bounds;
if (NeedToDrawShadow()) {
bounds = mgfx::Rect(x, y, w, h);
bounds = mTarget->GetTransform().TransformBounds(bounds);
}
AdjustedTarget(this, bounds.IsEmpty() ? nsnull : &bounds)->
FillRect(mgfx::Rect(x, y, w, h),
GeneralPattern().ForStyle(this, STYLE_FILL, mTarget),
DrawOptions(state.globalAlpha, UsedOperation()));
return RedrawUser(gfxRect(x, y, w, h));
}
@ -2130,6 +2137,14 @@ nsCanvasRenderingContext2DAzure::StrokeRect(float x, float y, float w, float h)
const ContextState &state = CurrentState();
mgfx::Rect bounds;
if (NeedToDrawShadow()) {
bounds = mgfx::Rect(x - state.lineWidth / 2.0f, y - state.lineWidth / 2.0f,
w + state.lineWidth, h + state.lineWidth);
bounds = mTarget->GetTransform().TransformBounds(bounds);
}
if (!w && !h) {
return NS_OK;
} else if (!h) {
@ -2137,7 +2152,7 @@ nsCanvasRenderingContext2DAzure::StrokeRect(float x, float y, float w, float h)
if (state.lineJoin == JOIN_ROUND) {
cap = CAP_ROUND;
}
AdjustedTarget(this)->
AdjustedTarget(this, bounds.IsEmpty() ? nsnull : &bounds)->
StrokeLine(Point(x, y), Point(x + w, y),
GeneralPattern().ForStyle(this, STYLE_STROKE, mTarget),
StrokeOptions(state.lineWidth, state.lineJoin,
@ -2152,7 +2167,7 @@ nsCanvasRenderingContext2DAzure::StrokeRect(float x, float y, float w, float h)
if (state.lineJoin == JOIN_ROUND) {
cap = CAP_ROUND;
}
AdjustedTarget(this)->
AdjustedTarget(this, bounds.IsEmpty() ? nsnull : &bounds)->
StrokeLine(Point(x, y), Point(x, y + h),
GeneralPattern().ForStyle(this, STYLE_STROKE, mTarget),
StrokeOptions(state.lineWidth, state.lineJoin,
@ -2164,7 +2179,7 @@ nsCanvasRenderingContext2DAzure::StrokeRect(float x, float y, float w, float h)
return NS_OK;
}
AdjustedTarget(this)->
AdjustedTarget(this, bounds.IsEmpty() ? nsnull : &bounds)->
StrokeRect(mgfx::Rect(x, y, w, h),
GeneralPattern().ForStyle(this, STYLE_STROKE, mTarget),
StrokeOptions(state.lineWidth, state.lineJoin,
@ -2214,7 +2229,13 @@ nsCanvasRenderingContext2DAzure::Fill()
return NS_OK;
}
AdjustedTarget(this)->
mgfx::Rect bounds;
if (NeedToDrawShadow()) {
bounds = mPath->GetBounds(mTarget->GetTransform());
}
AdjustedTarget(this, bounds.IsEmpty() ? nsnull : &bounds)->
Fill(mPath, GeneralPattern().ForStyle(this, STYLE_FILL, mTarget),
DrawOptions(CurrentState().globalAlpha, UsedOperation()));
@ -2232,14 +2253,20 @@ nsCanvasRenderingContext2DAzure::Stroke()
const ContextState &state = CurrentState();
AdjustedTarget(this)->
StrokeOptions strokeOptions(state.lineWidth, state.lineJoin,
state.lineCap, state.miterLimit,
state.dash.Length(), state.dash.Elements(),
state.dashOffset);
mgfx::Rect bounds;
if (NeedToDrawShadow()) {
bounds =
mPath->GetStrokedBounds(strokeOptions, mTarget->GetTransform());
}
AdjustedTarget(this, bounds.IsEmpty() ? nsnull : &bounds)->
Stroke(mPath, GeneralPattern().ForStyle(this, STYLE_STROKE, mTarget),
StrokeOptions(state.lineWidth, state.lineJoin,
state.lineCap, state.miterLimit,
state.dash.Length(),
state.dash.Elements(),
state.dashOffset),
DrawOptions(state.globalAlpha, UsedOperation()));
strokeOptions, DrawOptions(state.globalAlpha, UsedOperation()));
return Redraw();
}
@ -3757,7 +3784,14 @@ nsCanvasRenderingContext2DAzure::DrawImage(nsIDOMElement *imgElt, float a1,
else
filter = mgfx::FILTER_POINT;
AdjustedTarget(this)->
mgfx::Rect bounds;
if (NeedToDrawShadow()) {
bounds = mgfx::Rect(dx, dy, dw, dh);
bounds = mTarget->GetTransform().TransformBounds(bounds);
}
AdjustedTarget(this, bounds.IsEmpty() ? nsnull : &bounds)->
DrawSurface(srcSurf,
mgfx::Rect(dx, dy, dw, dh),
mgfx::Rect(sx, sy, sw, sh),

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

@ -56,4 +56,5 @@ libs:: $(_TEST_FILES)
$(TAR) -cf - -C $(srcdir) \
resources \
conformance \
crossorigin \
| $(TAR) -xf - -C $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)

Двоичные данные
content/canvas/test/webgl/crossorigin/image-allow-credentials.png Normal file

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

После

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

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

@ -0,0 +1,2 @@
Access-Control-Allow-Origin: http://mochi.test:8888
Access-Control-Allow-Credentials: true

Двоичные данные
content/canvas/test/webgl/crossorigin/image-allow-star.png Normal file

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

После

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

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

@ -0,0 +1 @@
Access-Control-Allow-Origin: *

Двоичные данные
content/canvas/test/webgl/crossorigin/image.png Normal file

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

После

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

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

@ -0,0 +1,137 @@
<!DOCTYPE HTML>
<title>WebGL cross-origin textures test</title>
<script src="/MochiKit/MochiKit.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<body>
<canvas id="canvas" style="border: none;" width="100" height="100">
<p class="fallback"> FAIL (fallback content) </p>
</canvas>
<script>
SimpleTest.waitForExplicitFinish();
const SECURITY_ERR = 0x805303e8;
const OK = 0;
var gl;
var number_of_tests_live = 0;
var all_tests_started = false;
function nameForErrorCode(code) {
switch(code) {
case OK: return "no error";
case SECURITY_ERR: return "security error";
}
return "unexpected error (" + code + ")";
}
function verifyError(actual_error, expected_error, message) {
ok(actual_error == expected_error,
message + ": expected " + nameForErrorCode(expected_error)
+ ", got " + nameForErrorCode(actual_error));
}
function testTexture(url, crossOriginAttribute, expected_result) {
number_of_tests_live++;
var image = new Image();
if (crossOriginAttribute != "leave-default-crossOrigin-attribute")
image.crossOrigin = crossOriginAttribute;
function testDone() {
number_of_tests_live--;
if (number_of_tests_live == 0 && all_tests_started)
SimpleTest.finish();
}
image.onload = function() {
var tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, tex);
var actual_result = OK;
try {
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
} catch(e) {
actual_result = e.result;
}
verifyError(actual_result, expected_result, "texImage2D on " + url + " with crossOrigin=" + image.crossOrigin);
testDone();
};
image.onerror = function(event) {
ok(expected_result != OK, "Got an error but expected OK!");
testDone();
}
image.src = url;
}
MochiKit.DOM.addLoadEvent(function () {
var canvas = document.getElementById("canvas");
try {
gl = canvas.getContext("experimental-webgl");
} catch (e) {
SimpleTest.finish();
return;
}
testTexture("http://mochi.test:8888/tests/content/canvas/test/webgl/crossorigin/image.png",
"leave-default-crossOrigin-attribute",
OK);
testTexture("http://mochi.test:8888/tests/content/canvas/test/webgl/crossorigin/image.png",
"",
OK);
testTexture("http://example.com/tests/content/canvas/test/webgl/crossorigin/image.png",
"leave-default-crossOrigin-attribute",
SECURITY_ERR);
testTexture("http://example.com/tests/content/canvas/test/webgl/crossorigin/image.png",
"",
SECURITY_ERR);
testTexture("http://example.com/tests/content/canvas/test/webgl/crossorigin/image-allow-star.png",
"leave-default-crossOrigin-attribute",
SECURITY_ERR);
testTexture("http://example.com/tests/content/canvas/test/webgl/crossorigin/image-allow-star.png",
"",
SECURITY_ERR);
testTexture("http://example.com/tests/content/canvas/test/webgl/crossorigin/image-allow-star.png",
"anonymous",
OK);
testTexture("http://example.com/tests/content/canvas/test/webgl/crossorigin/image-allow-star.png",
"use-credentials",
SECURITY_ERR);
testTexture("http://example.com/tests/content/canvas/test/webgl/crossorigin/image-allow-credentials.png",
"leave-default-crossOrigin-attribute",
SECURITY_ERR);
testTexture("http://example.com/tests/content/canvas/test/webgl/crossorigin/image-allow-credentials.png",
"",
SECURITY_ERR);
testTexture("http://example.com/tests/content/canvas/test/webgl/crossorigin/image-allow-credentials.png",
"anonymous",
OK);
testTexture("http://example.com/tests/content/canvas/test/webgl/crossorigin/image-allow-credentials.png",
"use-credentials",
OK);
// Test that bad values for crossorigin="..." are interpreted as default.
testTexture("http://mochi.test:8888/tests/content/canvas/test/webgl/crossorigin/image.png",
"foobar",
OK);
testTexture("http://example.com/tests/content/canvas/test/webgl/crossorigin/image.png",
"foobar",
SECURITY_ERR);
testTexture("http://example.com/tests/content/canvas/test/webgl/crossorigin/image-allow-star.png",
"foobar",
SECURITY_ERR);
testTexture("http://example.com/tests/content/canvas/test/webgl/crossorigin/image-allow-credentials.png",
"foobar",
SECURITY_ERR);
all_tests_started = true;
});
</script>

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

@ -43,7 +43,7 @@
#include "nsDOMUIEvent.h"
#include "nsIPresShell.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMWindow.h"
#include "nsIDOMNode.h"
#include "nsIContent.h"
#include "nsContentUtils.h"
@ -95,7 +95,7 @@ nsDOMUIEvent::nsDOMUIEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent)
nsCOMPtr<nsISupports> container = mPresContext->GetContainer();
if (container)
{
nsCOMPtr<nsIDOMWindowInternal> window = do_GetInterface(container);
nsCOMPtr<nsIDOMWindow> window = do_GetInterface(container);
if (window)
mView = do_QueryInterface(window);
}

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

@ -65,19 +65,7 @@
#include "nsIComboboxControlFrame.h"
#include "nsIScrollableFrame.h"
#include "nsIDOMNSHTMLElement.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLLabelElement.h"
#include "nsIDOMHTMLSelectElement.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMHTMLAreaElement.h"
#include "nsIDOMHTMLButtonElement.h"
#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIDOMHTMLMapElement.h"
#include "nsIDOMHTMLBodyElement.h"
#include "nsIDOMXULControlElement.h"
#include "nsIDOMXULTextboxElement.h"
#include "nsINameSpaceManager.h"
#include "nsIBaseWindow.h"
#include "nsIView.h"
@ -85,7 +73,6 @@
#include "nsISelection.h"
#include "nsFrameSelection.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMWindowInternal.h"
#include "nsPIDOMWindow.h"
#include "nsPIWindowRoot.h"
#include "nsIEnumerator.h"
@ -116,7 +103,6 @@
#include "nsDOMDragEvent.h"
#include "nsIDOMNSEditableElement.h"
#include "nsIDOMRange.h"
#include "nsCaret.h"
#include "nsILookAndFeel.h"
#include "nsWidgetsCID.h"
@ -218,7 +204,7 @@ PrintDocTree(nsIDocShellTreeItem* aParentItem, int aLevel)
if (cv)
cv->GetDOMDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
nsCOMPtr<nsIDOMWindowInternal> domwin = doc ? doc->GetWindow() : nsnull;
nsCOMPtr<nsIDOMWindow> domwin = doc ? doc->GetWindow() : nsnull;
nsIURI* uri = doc ? doc->GetDocumentURI() : nsnull;
printf("DS %p Type %s Cnt %d Doc %p DW %p EM %p%c",
@ -1212,42 +1198,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
nsMouseScrollEvent* msEvent = static_cast<nsMouseScrollEvent*>(aEvent);
PRBool useSysNumLines = UseSystemScrollSettingFor(msEvent);
PRInt32 action = GetWheelActionFor(msEvent);
if (!useSysNumLines) {
// If the scroll event's delta isn't to our liking, we can
// override it with the "numlines" parameter. There are two
// things we can do:
//
// (1) Pick a different number. Instead of scrolling 3
// lines ("delta" in Gtk2), we would scroll 1 line.
// (2) Swap directions. Instead of scrolling down, scroll up.
//
// For the first item, the magnitude of the parameter is
// used instead of the magnitude of the delta. For the
// second item, if the parameter is negative we swap
// directions.
PRInt32 numLines = GetScrollLinesFor(msEvent);
PRBool swapDirs = (numLines < 0);
PRInt32 userSize = swapDirs ? -numLines : numLines;
PRBool deltaUp = (msEvent->delta < 0);
if (swapDirs) {
deltaUp = !deltaUp;
}
msEvent->delta = deltaUp ? -userSize : userSize;
}
if ((useSysNumLines &&
(msEvent->scrollFlags & nsMouseScrollEvent::kIsFullPage)) ||
action == MOUSE_SCROLL_PAGE) {
msEvent->delta = (msEvent->delta > 0)
? PRInt32(nsIDOMNSUIEvent::SCROLL_PAGE_DOWN)
: PRInt32(nsIDOMNSUIEvent::SCROLL_PAGE_UP);
}
msEvent->delta = ComputeWheelDeltaFor(msEvent);
}
break;
case NS_MOUSE_PIXEL_SCROLL:
@ -2421,7 +2372,7 @@ nsEventStateManager::GetMarkupDocumentViewer(nsIMarkupDocumentViewer** aMv)
nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(focusedWindow);
if(!ourWindow) return NS_ERROR_FAILURE;
nsIDOMWindowInternal *rootWindow = ourWindow->GetPrivateRoot();
nsIDOMWindow *rootWindow = ourWindow->GetPrivateRoot();
if(!rootWindow) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMWindow> contentWindow;
@ -2634,6 +2585,45 @@ nsEventStateManager::SendPixelScrollEvent(nsIFrame* aTargetFrame,
nsEventDispatcher::Dispatch(targetContent, aPresContext, &event, nsnull, aStatus);
}
PRInt32
nsEventStateManager::ComputeWheelDeltaFor(nsMouseScrollEvent* aMouseEvent)
{
PRInt32 delta = aMouseEvent->delta;
PRBool useSysNumLines = UseSystemScrollSettingFor(aMouseEvent);
if (!useSysNumLines) {
// If the scroll event's delta isn't to our liking, we can
// override it with the "numlines" parameter. There are two
// things we can do:
//
// (1) Pick a different number. Instead of scrolling 3
// lines ("delta" in Gtk2), we would scroll 1 line.
// (2) Swap directions. Instead of scrolling down, scroll up.
//
// For the first item, the magnitude of the parameter is
// used instead of the magnitude of the delta. For the
// second item, if the parameter is negative we swap
// directions.
PRInt32 numLines = GetScrollLinesFor(aMouseEvent);
PRBool swapDirs = (numLines < 0);
PRInt32 userSize = swapDirs ? -numLines : numLines;
PRBool deltaUp = (delta < 0);
if (swapDirs) {
deltaUp = !deltaUp;
}
delta = deltaUp ? -userSize : userSize;
}
if (ComputeWheelActionFor(aMouseEvent, useSysNumLines) == MOUSE_SCROLL_PAGE) {
delta = (delta > 0) ? PRInt32(nsIDOMNSUIEvent::SCROLL_PAGE_DOWN) :
PRInt32(nsIDOMNSUIEvent::SCROLL_PAGE_UP);
}
return delta;
}
PRInt32
nsEventStateManager::ComputeWheelActionFor(nsMouseScrollEvent* aMouseEvent,
PRBool aUseSystemSettings)
@ -2819,6 +2809,21 @@ nsEventStateManager::DoScrollText(nsIFrame* aTargetFrame,
// pixel scrolling amout for high resolution scrolling.
aQueryEvent->mReply.mComputedScrollAmount = numLines;
switch (aScrollQuantity) {
case nsIScrollableFrame::LINES:
aQueryEvent->mReply.mComputedScrollAction =
nsQueryContentEvent::SCROLL_ACTION_LINE;
break;
case nsIScrollableFrame::PAGES:
aQueryEvent->mReply.mComputedScrollAction =
nsQueryContentEvent::SCROLL_ACTION_PAGE;
break;
default:
aQueryEvent->mReply.mComputedScrollAction =
nsQueryContentEvent::SCROLL_ACTION_NONE;
break;
}
aQueryEvent->mSucceeded = PR_TRUE;
return NS_OK;
}
@ -4767,35 +4772,41 @@ void
nsEventStateManager::DoQueryScrollTargetInfo(nsQueryContentEvent* aEvent,
nsIFrame* aTargetFrame)
{
nsMouseScrollEvent* msEvent = aEvent->mInput.mMouseScrollEvent;
// Don't modify the test event which in mInput.
nsMouseScrollEvent msEvent(
NS_IS_TRUSTED_EVENT(aEvent->mInput.mMouseScrollEvent),
aEvent->mInput.mMouseScrollEvent->message,
aEvent->mInput.mMouseScrollEvent->widget);
// Don't use high resolution scrolling when user customize the scrolling
// speed.
if (!UseSystemScrollSettingFor(msEvent)) {
return;
}
msEvent.isShift = aEvent->mInput.mMouseScrollEvent->isShift;
msEvent.isControl = aEvent->mInput.mMouseScrollEvent->isControl;
msEvent.isAlt = aEvent->mInput.mMouseScrollEvent->isAlt;
msEvent.isMeta = aEvent->mInput.mMouseScrollEvent->isMeta;
msEvent.scrollFlags = aEvent->mInput.mMouseScrollEvent->scrollFlags;
msEvent.delta = ComputeWheelDeltaFor(aEvent->mInput.mMouseScrollEvent);
msEvent.scrollOverflow = aEvent->mInput.mMouseScrollEvent->scrollOverflow;
PRBool useSystemSettings = UseSystemScrollSettingFor(&msEvent);
nsIScrollableFrame::ScrollUnit unit;
PRBool allowOverrideSystemSettings;
switch (ComputeWheelActionFor(msEvent, PR_TRUE)) {
switch (ComputeWheelActionFor(&msEvent, useSystemSettings)) {
case MOUSE_SCROLL_N_LINES:
unit = nsIScrollableFrame::LINES;
allowOverrideSystemSettings = PR_TRUE;
allowOverrideSystemSettings = useSystemSettings;
break;
case MOUSE_SCROLL_PAGE:
unit = nsIScrollableFrame::PAGES;
allowOverrideSystemSettings = PR_FALSE;
break;
case MOUSE_SCROLL_PIXELS:
unit = nsIScrollableFrame::DEVICE_PIXELS;
allowOverrideSystemSettings = PR_FALSE;
default:
// Don't use high resolution scrolling when the action doesn't scroll
// contents.
return;
}
DoScrollText(aTargetFrame, msEvent, unit,
DoScrollText(aTargetFrame, &msEvent, unit,
allowOverrideSystemSettings, aEvent);
}

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

@ -330,6 +330,12 @@ protected:
nsresult GetMarkupDocumentViewer(nsIMarkupDocumentViewer** aMv);
nsresult ChangeTextSize(PRInt32 change);
nsresult ChangeFullZoom(PRInt32 change);
/**
* Computes actual delta value used for scrolling. If user customized the
* scrolling speed and/or direction, this would return the customized value.
* Otherwise, it would return the original delta value of aMouseEvent.
*/
PRInt32 ComputeWheelDeltaFor(nsMouseScrollEvent* aMouseEvent);
/**
* Computes the action for the aMouseEvent with prefs. The result is
* MOUSE_SCROLL_N_LINES, MOUSE_SCROLL_PAGE, MOUSE_SCROLL_HISTORY,

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

@ -41,14 +41,14 @@
#include "nsISupports.idl"
interface nsIDOMHTMLFormElement;
interface nsIDOMWindowInternal;
interface nsIDOMWindow;
interface nsIURI;
interface nsIArray;
[scriptable, uuid(0b3cc84d-25d2-448e-ae71-746ee6e41c2d)]
[scriptable, uuid(534ab795-6a99-4195-bfab-cfdd7836657d)]
interface nsIFormSubmitObserver: nsISupports
{
void notify(in nsIDOMHTMLFormElement formNode, in nsIDOMWindowInternal window, in nsIURI actionURL, out boolean cancelSubmit);
void notify(in nsIDOMHTMLFormElement formNode, in nsIDOMWindow window, in nsIURI actionURL, out boolean cancelSubmit);
void notifyInvalidSubmit(in nsIDOMHTMLFormElement formNode,
in nsIArray invalidElements);

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

@ -45,7 +45,6 @@
#include "nsIJSNativeInitializer.h"
#include "nsSize.h"
#include "nsIDocument.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMDocument.h"
#include "nsIScriptContext.h"
#include "nsIURL.h"
@ -108,6 +107,9 @@ public:
// override from nsGenericHTMLElement
NS_IMETHOD GetDraggable(PRBool* aDraggable);
// override from nsImageLoadingContent
nsImageLoadingContent::CORSMode GetCORSMode();
// nsIJSNativeInitializer
NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* aContext,
JSObject* aObj, PRUint32 argc, jsval* argv);
@ -225,6 +227,17 @@ NS_IMPL_URI_ATTR(nsHTMLImageElement, Src, src)
NS_IMPL_STRING_ATTR(nsHTMLImageElement, UseMap, usemap)
NS_IMPL_INT_ATTR(nsHTMLImageElement, Vspace, vspace)
static const nsAttrValue::EnumTable kCrossOriginTable[] = {
{ "", nsImageLoadingContent::CORS_NONE },
{ "anonymous", nsImageLoadingContent::CORS_ANONYMOUS },
{ "use-credentials", nsImageLoadingContent::CORS_USE_CREDENTIALS },
{ 0 }
};
// Default crossOrigin mode is CORS_NONE.
static const nsAttrValue::EnumTable* kCrossOriginDefault = &kCrossOriginTable[0];
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLImageElement, CrossOrigin, crossOrigin, kCrossOriginDefault->tag)
NS_IMETHODIMP
nsHTMLImageElement::GetDraggable(PRBool* aDraggable)
{
@ -338,6 +351,9 @@ nsHTMLImageElement::ParseAttribute(PRInt32 aNamespaceID,
if (aAttribute == nsGkAtoms::align) {
return ParseAlignValue(aValue, aResult);
}
if (aAttribute == nsGkAtoms::crossOrigin) {
return aResult.ParseEnumValue(aValue, kCrossOriginTable, PR_FALSE);
}
if (ParseImageAttribute(aAttribute, aValue, aResult)) {
return PR_TRUE;
}
@ -633,3 +649,16 @@ nsHTMLImageElement::CopyInnerTo(nsGenericElement* aDest) const
}
return nsGenericHTMLElement::CopyInnerTo(aDest);
}
nsImageLoadingContent::CORSMode
nsHTMLImageElement::GetCORSMode()
{
nsImageLoadingContent::CORSMode ret = nsImageLoadingContent::CORS_NONE;
const nsAttrValue* value = GetParsedAttr(nsGkAtoms::crossOrigin);
if (value && value->Type() == nsAttrValue::eEnum) {
ret = (nsImageLoadingContent::CORSMode) value->GetEnumValue();
}
return ret;
}

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

@ -37,6 +37,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsHTMLInputElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsITextControlElement.h"
#include "nsIDOMNSEditableElement.h"
@ -111,7 +113,6 @@
// input type=image
#include "nsImageLoadingContent.h"
#include "nsIDOMWindowInternal.h"
#include "mozAutoDocUpdate.h"
#include "nsContentCreatorFunctions.h"
@ -125,8 +126,6 @@
#include "jsapi.h"
#include "jscntxt.h"
#include "nsHTMLInputElement.h"
using namespace mozilla::dom;
// XXX align=left, hspace, vspace, border? other nav4 attrs
@ -268,7 +267,7 @@ AsyncClickHandler::Run()
{
nsresult rv;
// Get parent nsIDOMWindowInternal object.
// Get parent nsPIDOMWindow object.
nsCOMPtr<nsIDocument> doc = mInput->GetOwnerDoc();
if (!doc)
return NS_ERROR_FAILURE;

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

@ -399,7 +399,7 @@ NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement)
NS_IMPL_URI_ATTR(nsHTMLMediaElement, Src, src)
NS_IMPL_BOOL_ATTR(nsHTMLMediaElement, Controls, controls)
NS_IMPL_BOOL_ATTR(nsHTMLMediaElement, Autoplay, autoplay)
NS_IMPL_STRING_ATTR(nsHTMLMediaElement, Preload, preload)
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLMediaElement, Preload, preload, NULL)
/* readonly attribute nsIDOMHTMLMediaElement mozAutoplayEnabled; */
NS_IMETHODIMP nsHTMLMediaElement::GetMozAutoplayEnabled(PRBool *aAutoplayEnabled)

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

@ -268,12 +268,13 @@ _TEST_FILES = \
test_bug583514.html \
test_bug514437.html \
test_bug560112.html \
test_bug586786.html \
test_bug649134.html \
test_bug658746.html \
test_bug659596.html \
test_bug659743.xml \
test_bug660663.html \
test_bug586786.html \
test_bug666666.html \
test_restore_from_parser_fragment.html \
$(NULL)

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

@ -0,0 +1,33 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=666666
-->
<head>
<title>Test for Bug 666666</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="reflect.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=666666">Mozilla Bug 666666</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 666666 **/
["audio", "video"].forEach(function(element) {
reflectLimitedEnumerated({
element: document.createElement(element),
attribute: "preload",
validValues: ["none", "metadata", "auto"],
invalidValues: ["cheesecake", ""]
});
});
</script>
</pre>
</body>
</html>

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

@ -1528,7 +1528,7 @@ nsHTMLDocument::Open(const nsAString& aContentTypeOrUrl,
// When called with 3 or more arguments, document.open() calls window.open().
if (aOptionalArgCount > 2) {
nsCOMPtr<nsIDOMWindowInternal> window = GetWindowInternal();
nsCOMPtr<nsIDOMWindow> window = GetWindowInternal();
if (!window) {
return NS_OK;
}

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

@ -939,7 +939,7 @@ nsresult nsOggReader::SeekInBufferedRange(PRInt64 aTarget,
const nsTArray<SeekRange>& aRanges,
const SeekRange& aRange)
{
LOG(PR_LOG_DEBUG, ("%p Seeking in buffered data to %lldms using bisection search", mDecoder, aTarget));
LOG(PR_LOG_DEBUG, ("%p Seeking in buffered data to %lld using bisection search", mDecoder, aTarget));
// We know the exact byte range in which the target must lie. It must
// be buffered in the media cache. Seek there.
@ -983,23 +983,12 @@ nsresult nsOggReader::SeekInBufferedRange(PRInt64 aTarget,
return res;
}
PRBool nsOggReader::CanDecodeToTarget(PRInt64 aTarget,
PRInt64 aCurrentTime)
{
// We can decode to the target if the target is no further than the
// maximum keyframe offset ahead of the current playback position, if
// we have video, or SEEK_DECODE_MARGIN if we don't have video.
PRInt64 margin = HasVideo() ? mTheoraState->MaxKeyframeOffset() : SEEK_DECODE_MARGIN;
return aTarget >= aCurrentTime &&
aTarget - aCurrentTime < margin;
}
nsresult nsOggReader::SeekInUnbuffered(PRInt64 aTarget,
PRInt64 aStartTime,
PRInt64 aEndTime,
const nsTArray<SeekRange>& aRanges)
{
LOG(PR_LOG_DEBUG, ("%p Seeking in unbuffered data to %lldms using bisection search", mDecoder, aTarget));
LOG(PR_LOG_DEBUG, ("%p Seeking in unbuffered data to %lld using bisection search", mDecoder, aTarget));
// If we've got an active Theora bitstream, determine the maximum possible
// time in usecs which a keyframe could be before a given interframe. We
@ -1030,7 +1019,7 @@ nsresult nsOggReader::Seek(PRInt64 aTarget,
PRInt64 aCurrentTime)
{
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
LOG(PR_LOG_DEBUG, ("%p About to seek to %lldms", mDecoder, aTarget));
LOG(PR_LOG_DEBUG, ("%p About to seek to %lld", mDecoder, aTarget));
nsresult res;
nsMediaStream* stream = mDecoder->GetCurrentStream();
NS_ENSURE_TRUE(stream != nsnull, NS_ERROR_FAILURE);
@ -1050,9 +1039,6 @@ nsresult nsOggReader::Seek(PRInt64 aTarget,
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDecoder->UpdatePlaybackPosition(aStartTime);
}
} else if (CanDecodeToTarget(aTarget, aCurrentTime)) {
LOG(PR_LOG_DEBUG, ("%p Seek target (%lld) is close to current time (%lld), "
"will just decode to it", mDecoder, aCurrentTime, aTarget));
} else {
IndexedSeekResult sres = SeekToKeyframeUsingIndex(aTarget);
NS_ENSURE_TRUE(sres != SEEK_FATAL_ERROR, NS_ERROR_FAILURE);
@ -1381,7 +1367,7 @@ nsresult nsOggReader::SeekBisection(PRInt64 aTarget,
break;
}
SEEK_LOG(PR_LOG_DEBUG, ("Time at offset %lld is %lldms", guess, granuleTime));
SEEK_LOG(PR_LOG_DEBUG, ("Time at offset %lld is %lld", guess, granuleTime));
if (granuleTime < seekTarget && granuleTime > seekLowerBound) {
// We're within the fuzzy region in which we want to terminate the search.
res = stream->Seek(nsISeekableStream::NS_SEEK_SET, pageOffset);
@ -1401,7 +1387,8 @@ nsresult nsOggReader::SeekBisection(PRInt64 aTarget,
endTime = granuleTime;
} else if (granuleTime < seekTarget) {
// Landed before seek target.
NS_ASSERTION(pageOffset > startOffset, "offset_start must increase");
NS_ASSERTION(pageOffset >= startOffset + startLength,
"Bisection point should be at or after end of first page in interval");
startOffset = pageOffset;
startLength = pageLength;
startTime = granuleTime;

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

@ -89,13 +89,6 @@ private:
return mSkeletonState != 0 && mSkeletonState->mActive;
}
// Returns PR_TRUE if we should decode up to the seek target rather than
// seeking to the target using a bisection search or index-assisted seek.
// We should do this if the seek target (aTarget, in usecs), lies not too far
// ahead of the current playback position (aCurrentTime, in usecs).
PRBool CanDecodeToTarget(PRInt64 aTarget,
PRInt64 aCurrentTime);
// Seeks to the keyframe preceeding the target time using available
// keyframe indexes.
enum IndexedSeekResult {

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

@ -750,31 +750,19 @@ PRBool nsWebMReader::DecodeVideoFrame(PRBool &aKeyframeSkip,
return PR_TRUE;
}
PRBool nsWebMReader::CanDecodeToTarget(PRInt64 aTarget,
PRInt64 aCurrentTime)
{
return aTarget >= aCurrentTime &&
aTarget - aCurrentTime < SEEK_DECODE_MARGIN;
}
nsresult nsWebMReader::Seek(PRInt64 aTarget, PRInt64 aStartTime, PRInt64 aEndTime,
PRInt64 aCurrentTime)
{
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
LOG(PR_LOG_DEBUG, ("%p About to seek to %lldms", mDecoder, aTarget));
if (CanDecodeToTarget(aTarget, aCurrentTime)) {
LOG(PR_LOG_DEBUG, ("%p Seek target (%lld) is close to current time (%lld), "
"will just decode to it", mDecoder, aCurrentTime, aTarget));
} else {
if (NS_FAILED(ResetDecode())) {
return NS_ERROR_FAILURE;
}
PRUint32 trackToSeek = mHasVideo ? mVideoTrack : mAudioTrack;
int r = nestegg_track_seek(mContext, trackToSeek, aTarget * NS_PER_USEC);
if (r != 0) {
return NS_ERROR_FAILURE;
}
if (NS_FAILED(ResetDecode())) {
return NS_ERROR_FAILURE;
}
PRUint32 trackToSeek = mHasVideo ? mVideoTrack : mAudioTrack;
int r = nestegg_track_seek(mContext, trackToSeek, aTarget * NS_PER_USEC);
if (r != 0) {
return NS_ERROR_FAILURE;
}
return DecodeToTarget(aTarget);
}

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

@ -190,12 +190,6 @@ private:
// reading metadata or destruction of the reader itself.
void Cleanup();
// Returns PR_TRUE if we should decode up to the seek target rather than
// seeking to the target using an index-assisted seek. We should do this
// if the seek target (aTarget, in usecs), lies not too far ahead of the
// current playback position (aCurrentTime, in usecs).
PRBool CanDecodeToTarget(PRInt64 aTarget, PRInt64 aCurrentTime);
private:
// libnestegg context for webm container. Access on state machine thread
// or decoder thread only.

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

@ -62,7 +62,7 @@ nsDOMTimeEvent::nsDOMTimeEvent(nsPresContext* aPresContext, nsEvent* aEvent)
if (mPresContext) {
nsCOMPtr<nsISupports> container = mPresContext->GetContainer();
if (container) {
nsCOMPtr<nsIDOMWindowInternal> window = do_GetInterface(container);
nsCOMPtr<nsIDOMWindow> window = do_GetInterface(container);
if (window) {
mView = do_QueryInterface(window);
}

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

@ -314,9 +314,7 @@ ParseAccessKey(const nsAString& aSpec, nsSMILTimeValueSpecParams& aResult)
const PRUnichar*
GetTokenEnd(const nsAString& aStr, PRBool aBreakOnDot)
{
const PRUnichar* start;
const PRUnichar* tokenEnd;
start = tokenEnd = aStr.BeginReading();
const PRUnichar* tokenEnd = aStr.BeginReading();
const PRUnichar* const end = aStr.EndReading();
PRBool escape = PR_FALSE;
while (tokenEnd != end) {

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

@ -53,6 +53,9 @@
#include "plstr.h"
#include "prtime.h"
#include "nsString.h"
#include "mozilla/AutoRestore.h"
using namespace mozilla;
//----------------------------------------------------------------------
// Helper class: InstanceTimeComparator
@ -1915,13 +1918,12 @@ nsSMILTimedElement::UpdateCurrentInterval(PRBool aForceChangeNotice)
// the chain broken in a sensible and predictable manner, so if we're hitting
// this assertion we need to work out how to detect the case that's causing
// it. In release builds, just bail out before we overflow the stack.
AutoRestore<PRUint16> depthRestorer(mUpdateIntervalRecursionDepth);
if (++mUpdateIntervalRecursionDepth > sMaxUpdateIntervalRecursionDepth) {
NS_ABORT_IF_FALSE(PR_FALSE,
"Update current interval recursion depth exceeded threshold");
return;
}
// NO EARLY RETURNS ALLOWED AFTER THIS POINT! (If we need one, then switch
// mUpdateIntervalRecursionDepth to use an auto incrementer/decrementer.)
// If the interval is active the begin time is fixed.
const nsSMILInstanceTime* beginTime = mElementState == STATE_ACTIVE
@ -1981,8 +1983,6 @@ nsSMILTimedElement::UpdateCurrentInterval(PRBool aForceChangeNotice)
ResetCurrentInterval();
}
}
--mUpdateIntervalRecursionDepth;
}
void

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

@ -69,10 +69,6 @@
command="cmd_redo"/>
<handler event="keypress" key="a" modifiers="alt"
command="cmd_selectAll"/>
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
</handlers>
</binding>
@ -157,10 +153,6 @@
command="cmd_redo"/>
<handler event="keypress" key="a" modifiers="alt"
command="cmd_selectAll"/>
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
</handlers>
</binding>
@ -182,10 +174,6 @@
<handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop" />
<handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom" />
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
<handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious" />
<handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext" />
<handler event="keypress" keycode="VK_LEFT" modifiers="control,shift" command="cmd_selectWordPrevious" />
@ -240,10 +228,6 @@
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
<handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
<handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/>
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
</handlers>
</binding>
</bindings>

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

@ -13,7 +13,6 @@
command="cmd_redo"/>
<handler event="keypress" key="z" modifiers="accel,shift" command="cmd_redo"/>
<handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
</handlers>
</binding>
@ -26,10 +25,6 @@
command="cmd_redo"/>
<handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
<handler event="keypress" key="z" modifiers="accel,shift" command="cmd_redo"/>
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
</handlers>
</binding>
@ -51,10 +46,6 @@
<handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop" />
<handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom" />
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
<handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious" />
<handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext" />
<handler event="keypress" keycode="VK_LEFT" modifiers="control,shift" command="cmd_selectWordPrevious" />
@ -76,10 +67,6 @@
<handler event="keypress" key="z" modifiers="accel,shift" command="cmd_redo"/>
<handler event="keypress" key="y" modifiers="accel" command="cmd_redo"/>
<handler event="keypress" key="a" modifiers="alt" command="cmd_selectAll"/>
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
</handlers>
</binding>
</bindings>

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

@ -65,7 +65,7 @@
#include "nsIDOMNSEvent.h"
#include "nsPIDOMWindow.h"
#include "nsPIWindowRoot.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMWindow.h"
#include "nsIServiceManager.h"
#include "nsIScriptError.h"
#include "nsXPIDLString.h"
@ -570,7 +570,7 @@ nsXBLPrototypeHandler::GetController(nsIDOMEventTarget* aTarget)
}
if (!controllers) {
nsCOMPtr<nsIDOMWindowInternal> domWindow(do_QueryInterface(aTarget));
nsCOMPtr<nsIDOMWindow> domWindow(do_QueryInterface(aTarget));
if (domWindow)
domWindow->GetControllers(getter_AddRefs(controllers));
}

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

@ -54,7 +54,6 @@
#include "nsINativeKeyBindings.h"
#include "nsIController.h"
#include "nsIControllers.h"
#include "nsIDOMWindowInternal.h"
#include "nsFocusManager.h"
#include "nsPIWindowRoot.h"
#include "nsIURI.h"

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

@ -80,7 +80,6 @@
#include "nsUnicharUtils.h"
#include "nsICookieService.h"
#include "nsIPrompt.h"
#include "nsIDOMWindowInternal.h"
#include "nsIChannel.h"
#include "nsIPrincipal.h"
#include "nsXMLPrettyPrinter.h"

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

@ -57,7 +57,7 @@
#include "nsXULPopupManager.h"
#include "nsEventStateManager.h"
#include "nsIScriptContext.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMWindow.h"
#include "nsIDOMXULDocument.h"
#include "nsIDocument.h"
#include "nsIDOMNSUIEvent.h"

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

@ -70,7 +70,7 @@ interface nsICommandController : nsISupports
/*
An API for registering commands in groups, to allow for
updating via nsIDOMWindowInternal::UpdateCommands.
updating via nsIDOMWindow::UpdateCommands.
*/
interface nsISimpleEnumerator;

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

@ -50,7 +50,7 @@
#include "nsIDOMXULDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMWindow.h"
#include "nsIDOMXULElement.h"
#include "nsIDocument.h"
#include "nsPresContext.h"

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

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* ***** BEGIN LICENSE BLOCK *****
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** 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
@ -44,7 +43,7 @@
#include "nsXPIDLString.h"
#include "nsDocShellCID.h"
#include "nsIWebNavigationInfo.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMWindow.h"
#include "nsAutoPtr.h"
#include "nsIHttpChannel.h"
#include "nsIScriptSecurityManager.h"
@ -158,7 +157,7 @@ nsDSURIContentListener::DoContent(const char* aContentType,
}
if (loadFlags & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI) {
nsCOMPtr<nsIDOMWindowInternal> domWindow = do_GetInterface(static_cast<nsIDocShell*>(mDocShell));
nsCOMPtr<nsIDOMWindow> domWindow = do_GetInterface(static_cast<nsIDocShell*>(mDocShell));
NS_ENSURE_TRUE(domWindow, NS_ERROR_FAILURE);
domWindow->Focus();
}

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

@ -53,7 +53,6 @@
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMStorageObsolete.h"
#include "nsIDOMStorage.h"
#include "nsPIDOMStorage.h"
#include "nsIDocumentViewer.h"
@ -71,7 +70,7 @@
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIDOMChromeWindow.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMWindow.h"
#include "nsIWebBrowserChrome.h"
#include "nsPoint.h"
#include "nsGfxCIID.h"
@ -175,9 +174,6 @@
#include "nsIMultiPartChannel.h"
#include "nsIWyciwygChannel.h"
// The following are for bug #13871: Prevent frameset spoofing
#include "nsIHTMLDocument.h"
// For reporting errors with the console service.
// These can go away if error reporting is propagated up past nsDocShell.
#include "nsIConsoleService.h"
@ -923,8 +919,7 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID & aIID, void **aSink)
NS_SUCCEEDED(EnsureScriptEnvironment())) {
*aSink = mScriptGlobal;
}
else if ((aIID.Equals(NS_GET_IID(nsIDOMWindowInternal)) ||
aIID.Equals(NS_GET_IID(nsPIDOMWindow)) ||
else if ((aIID.Equals(NS_GET_IID(nsPIDOMWindow)) ||
aIID.Equals(NS_GET_IID(nsIDOMWindow))) &&
NS_SUCCEEDED(EnsureScriptEnvironment())) {
return mScriptGlobal->QueryInterface(aIID, aSink);
@ -2776,15 +2771,14 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
return PR_FALSE;
}
nsCOMPtr<nsIDOMWindow> targetWindow(do_GetInterface(aTargetItem));
nsCOMPtr<nsIDOMWindowInternal> targetInternal(do_QueryInterface(targetWindow));
if (!targetInternal) {
nsCOMPtr<nsIDOMWindow> targetWindow = do_GetInterface(aTargetItem);
if (!targetWindow) {
NS_ERROR("This should not happen, really");
return PR_FALSE;
}
nsCOMPtr<nsIDOMWindowInternal> targetOpener;
targetInternal->GetOpener(getter_AddRefs(targetOpener));
nsCOMPtr<nsIDOMWindow> targetOpener;
targetWindow->GetOpener(getter_AddRefs(targetOpener));
nsCOMPtr<nsIWebNavigation> openerWebNav(do_GetInterface(targetOpener));
nsCOMPtr<nsIDocShellTreeItem> openerItem(do_QueryInterface(openerWebNav));
@ -2798,8 +2792,7 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
static PRBool
ItemIsActive(nsIDocShellTreeItem *aItem)
{
nsCOMPtr<nsIDOMWindow> tmp(do_GetInterface(aItem));
nsCOMPtr<nsIDOMWindowInternal> window(do_QueryInterface(tmp));
nsCOMPtr<nsIDOMWindow> window(do_GetInterface(aItem));
if (window) {
PRBool isClosed;
@ -2989,7 +2982,7 @@ PrintDocTree(nsIDocShellTreeItem * aParentNode, int aLevel)
parentAsDocShell->GetPresContext(getter_AddRefs(presContext));
nsIDocument *doc = presShell->GetDocument();
nsCOMPtr<nsIDOMWindowInternal> domwin(doc->GetWindow());
nsCOMPtr<nsIDOMWindow> domwin(doc->GetWindow());
nsCOMPtr<nsIWidget> widget;
nsIViewManager* vm = presShell->GetViewManager();
@ -8234,7 +8227,7 @@ nsDocShell::InternalLoad(nsIURI * aURI,
PRBool isNewWindow = PR_FALSE;
if (!targetDocShell) {
nsCOMPtr<nsIDOMWindowInternal> win =
nsCOMPtr<nsIDOMWindow> win =
do_GetInterface(GetAsSupports(this));
NS_ENSURE_TRUE(win, NS_ERROR_NOT_AVAILABLE);
@ -8290,7 +8283,7 @@ nsDocShell::InternalLoad(nsIURI * aURI,
// So, the best we can do, is to tear down the new window
// that was just created!
//
nsCOMPtr<nsIDOMWindowInternal> domWin =
nsCOMPtr<nsIDOMWindow> domWin =
do_GetInterface(targetDocShell);
if (domWin) {
domWin->Close();

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

@ -40,7 +40,7 @@
#include "nsISupports.idl"
#include "nsIPrintSettings.idl"
interface nsIDOMWindowInternal;
interface nsIDOMWindow;
interface nsIWebProgressListener;
%{ C++
@ -53,17 +53,16 @@ interface nsIWebProgressListener;
* The nsIDocShellFile
*/
[scriptable, uuid(6317f32c-9bc7-11d3-bccc-0060b0fc76bd)]
[scriptable, uuid(1b373597-6132-49f7-940e-6ff62fca5d35)]
interface nsIContentViewerFile : nsISupports
{
/* readonly attribute boolean printable; */
readonly attribute boolean printable;
[noscript] void print(in boolean aSilent,
in FILE aDebugFile,
in nsIPrintSettings aPrintSettings);
[noscript] void printWithParent(in nsIDOMWindowInternal aParentWin,
[noscript] void printWithParent(in nsIDOMWindow aParentWin,
in nsIPrintSettings aThePrintSettings,
in nsIWebProgressListener aWPListener);

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

@ -36,16 +36,17 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsBarProps.h"
#include "nsCOMPtr.h"
#include "nscore.h"
#include "nsBarProps.h"
#include "nsGlobalWindow.h"
#include "nsStyleConsts.h"
#include "nsIDocShell.h"
#include "nsIScriptSecurityManager.h"
#include "nsIScrollable.h"
#include "nsIWebBrowserChrome.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMWindow.h"
#include "nsDOMClassInfo.h"
//

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

@ -114,7 +114,7 @@
#include "nsIDOMMimeTypeArray.h"
#include "nsIDOMMimeType.h"
#include "nsIDOMLocation.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMWindow.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMJSWindow.h"
#include "nsIDOMWindowCollection.h"
@ -2392,9 +2392,7 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance)
DOM_CLASSINFO_MAP_END
@ -2402,9 +2400,7 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
DOM_CLASSINFO_MAP_END
}
@ -2413,18 +2409,14 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance)
DOM_CLASSINFO_MAP_END
} else {
DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
DOM_CLASSINFO_MAP_END
}
}
@ -3143,10 +3135,8 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ChromeWindow, nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMChromeWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
DOM_CLASSINFO_MAP_END
@ -4038,9 +4028,7 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ModalContentWindow, nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMModalContentWindow)
DOM_CLASSINFO_MAP_END
@ -5571,7 +5559,7 @@ nsWindowSH::SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSString *val = ::JS_ValueToString(cx, *vp);
NS_ENSURE_TRUE(val, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIDOMWindowInternal> window(do_QueryWrappedNative(wrapper));
nsCOMPtr<nsIDOMWindow> window = do_QueryWrappedNative(wrapper);
NS_ENSURE_TRUE(window, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIDOMLocation> location;
@ -6915,7 +6903,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
jsval v;
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
rv = WrapNative(cx, wrapperObj, child_win,
&NS_GET_IID(nsIDOMWindowInternal), PR_TRUE, &v,
&NS_GET_IID(nsIDOMWindow), PR_TRUE, &v,
getter_AddRefs(holder));
NS_ENSURE_SUCCESS(rv, rv);

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

@ -1343,14 +1343,12 @@ DOMCI_DATA(Window, nsGlobalWindow)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindow)
// Make sure this matches the cast in nsGlobalWindow::FromWrapper()
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIScriptGlobalObject)
NS_INTERFACE_MAP_ENTRY(nsIDOMWindowInternal)
NS_INTERFACE_MAP_ENTRY(nsIDOMWindow)
NS_INTERFACE_MAP_ENTRY(nsIDOMJSWindow)
NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObject)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(nsPIDOMWindow)
NS_INTERFACE_MAP_ENTRY(nsIDOMStorageWindow)
NS_INTERFACE_MAP_ENTRY(nsIDOMStorageIndexedDB)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
@ -1839,8 +1837,6 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
return NS_ERROR_UNEXPECTED;
}
nsresult rv = NS_OK;
nsCOMPtr<nsIDocument> oldDoc(do_QueryInterface(mDocument));
nsIScriptContext *scx = GetContextInternal();
@ -1859,9 +1855,9 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
// Get our private root. If it is equal to us, then we need to
// attach our global key bindings that handles browser scrolling
// and other browser commands.
nsIDOMWindowInternal *internal = nsGlobalWindow::GetPrivateRoot();
nsIDOMWindow* privateRoot = nsGlobalWindow::GetPrivateRoot();
if (internal == static_cast<nsIDOMWindowInternal *>(this)) {
if (privateRoot == static_cast<nsIDOMWindow*>(this)) {
nsCOMPtr<nsIXBLService> xblService = do_GetService("@mozilla.org/xbl;1");
if (xblService) {
xblService->AttachGlobalKeyHandler(mChromeEventHandler);
@ -1884,6 +1880,8 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
oldPrincipal = oldDoc->NodePrincipal();
}
nsresult rv = NS_OK;
// Drop our reference to the navigator object unless we're reusing
// the existing inner window or the new document is from the same
// origin as the old document.
@ -2477,7 +2475,7 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell)
}
void
nsGlobalWindow::SetOpenerWindow(nsIDOMWindowInternal* aOpener,
nsGlobalWindow::SetOpenerWindow(nsIDOMWindow* aOpener,
PRBool aOriginalOpener)
{
FORWARD_TO_OUTER_VOID(SetOpenerWindow, (aOpener, aOriginalOpener));
@ -2912,26 +2910,22 @@ nsGlobalWindow::GetDocument(nsIDOMDocument** aDocument)
return NS_OK;
}
//*****************************************************************************
// nsGlobalWindow::nsIDOMWindowInternal
//*****************************************************************************
NS_IMETHODIMP
nsGlobalWindow::GetWindow(nsIDOMWindowInternal** aWindow)
nsGlobalWindow::GetWindow(nsIDOMWindow** aWindow)
{
FORWARD_TO_OUTER(GetWindow, (aWindow), NS_ERROR_NOT_INITIALIZED);
*aWindow = static_cast<nsIDOMWindowInternal *>(this);
*aWindow = static_cast<nsIDOMWindow*>(this);
NS_ADDREF(*aWindow);
return NS_OK;
}
NS_IMETHODIMP
nsGlobalWindow::GetSelf(nsIDOMWindowInternal** aWindow)
nsGlobalWindow::GetSelf(nsIDOMWindow** aWindow)
{
FORWARD_TO_OUTER(GetSelf, (aWindow), NS_ERROR_NOT_INITIALIZED);
*aWindow = static_cast<nsIDOMWindowInternal *>(this);
*aWindow = static_cast<nsIDOMWindow*>(this);
NS_ADDREF(*aWindow);
return NS_OK;
}
@ -3042,7 +3036,7 @@ nsGlobalWindow::GetParent(nsIDOMWindow** aParent)
NS_ERROR_FAILURE);
}
else {
*aParent = static_cast<nsIDOMWindowInternal *>(this);
*aParent = static_cast<nsIDOMWindow*>(this);
NS_ADDREF(*aParent);
}
return NS_OK;
@ -3104,7 +3098,7 @@ nsGlobalWindow::GetContent(nsIDOMWindow** aContent)
treeOwner->GetPrimaryContentShell(getter_AddRefs(primaryContent));
}
nsCOMPtr<nsIDOMWindowInternal> domWindow(do_GetInterface(primaryContent));
nsCOMPtr<nsIDOMWindow> domWindow(do_GetInterface(primaryContent));
NS_IF_ADDREF(*aContent = domWindow);
return NS_OK;
@ -3361,7 +3355,7 @@ nsGlobalWindow::GetControllers(nsIControllers** aResult)
}
NS_IMETHODIMP
nsGlobalWindow::GetOpener(nsIDOMWindowInternal** aOpener)
nsGlobalWindow::GetOpener(nsIDOMWindow** aOpener)
{
FORWARD_TO_OUTER(GetOpener, (aOpener), NS_ERROR_NOT_INITIALIZED);
@ -3413,7 +3407,7 @@ nsGlobalWindow::GetOpener(nsIDOMWindowInternal** aOpener)
}
NS_IMETHODIMP
nsGlobalWindow::SetOpener(nsIDOMWindowInternal* aOpener)
nsGlobalWindow::SetOpener(nsIDOMWindow* aOpener)
{
// check if we were called from a privileged chrome script.
// If not, opener is settable only to null.
@ -4304,7 +4298,7 @@ nsGlobalWindow::DispatchCustomEvent(const char *aEventName)
PRBool defaultActionEnabled = PR_TRUE;
nsCOMPtr<nsIDocument> doc(do_QueryInterface(mDocument));
nsContentUtils::DispatchTrustedEvent(doc,
static_cast<nsIScriptGlobalObject*>(this),
GetOuterWindow(),
NS_ConvertASCIItoUTF16(aEventName),
PR_TRUE, PR_TRUE, &defaultActionEnabled);
@ -4404,7 +4398,7 @@ nsGlobalWindow::SetFullScreen(PRBool aFullScreen)
nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryInterface(mDocShell);
nsCOMPtr<nsIDocShellTreeItem> rootItem;
treeItem->GetRootTreeItem(getter_AddRefs(rootItem));
nsCOMPtr<nsIDOMWindowInternal> window = do_GetInterface(rootItem);
nsCOMPtr<nsIDOMWindow> window = do_GetInterface(rootItem);
if (!window)
return NS_ERROR_FAILURE;
if (rootItem != treeItem)
@ -4459,7 +4453,7 @@ nsGlobalWindow::GetFullScreen(PRBool* aFullScreen)
nsCOMPtr<nsIDocShellTreeItem> rootItem;
treeItem->GetRootTreeItem(getter_AddRefs(rootItem));
if (rootItem != treeItem) {
nsCOMPtr<nsIDOMWindowInternal> window = do_GetInterface(rootItem);
nsCOMPtr<nsIDOMWindow> window = do_GetInterface(rootItem);
if (window)
return window->GetFullScreen(aFullScreen);
}
@ -4929,9 +4923,9 @@ nsGlobalWindow::Focus()
return NS_OK;
}
nsIDOMWindowInternal *caller =
static_cast<nsIDOMWindowInternal*>(nsContentUtils::GetWindowFromCaller());
nsCOMPtr<nsIDOMWindowInternal> opener;
nsIDOMWindow *caller =
static_cast<nsIDOMWindow*>(nsContentUtils::GetWindowFromCaller());
nsCOMPtr<nsIDOMWindow> opener;
GetOpener(getter_AddRefs(opener));
// Enforce dom.disable_window_flip (for non-chrome), but still allow the
@ -4977,7 +4971,7 @@ nsGlobalWindow::Focus()
PRInt32 itemType = nsIDocShellTreeItem::typeContent;
treeItem->GetItemType(&itemType);
if (itemType == nsIDocShellTreeItem::typeChrome &&
GetPrivateRoot() == static_cast<nsIDOMWindowInternal*>(this) &&
GetPrivateRoot() == static_cast<nsIDOMWindow*>(this) &&
mDocument) {
nsCOMPtr<nsIDocument> doc(do_QueryInterface(mDocument));
NS_ASSERTION(doc, "Bogus doc?");
@ -5395,7 +5389,7 @@ nsGlobalWindow::GetWindowRoot(nsIDOMEventTarget **aWindowRoot)
already_AddRefed<nsPIWindowRoot>
nsGlobalWindow::GetTopWindowRoot()
{
nsIDOMWindowInternal *rootWindow = GetPrivateRoot();
nsIDOMWindow *rootWindow = GetPrivateRoot();
nsCOMPtr<nsPIDOMWindow> piWin(do_QueryInterface(rootWindow));
if (!piWin)
return nsnull;
@ -7154,7 +7148,7 @@ nsGlobalWindow::Find(const nsAString& aStr, PRBool aCaseSensitive,
nsCOMPtr<nsIWindowMediator> windowMediator =
do_GetService(NS_WINDOWMEDIATOR_CONTRACTID);
nsCOMPtr<nsIDOMWindowInternal> findDialog;
nsCOMPtr<nsIDOMWindow> findDialog;
if (windowMediator) {
windowMediator->GetMostRecentWindow(NS_LITERAL_STRING("findInPage").get(),
@ -7460,9 +7454,9 @@ nsGlobalWindow::ActivateOrDeactivate(PRBool aActivate)
}
// Get the top level widget's nsGlobalWindow
nsCOMPtr<nsIDOMWindowInternal> topLevelWindow;
nsCOMPtr<nsIDOMWindow> topLevelWindow;
if (topLevelWidget == mainWidget) {
topLevelWindow = static_cast<nsIDOMWindowInternal*>(this);
topLevelWindow = static_cast<nsIDOMWindow*>(this);
} else {
// This is a workaround for the following problem:
// When a window with an open sheet loses focus, only the sheet window
@ -8027,10 +8021,6 @@ nsGlobalWindow::GetComputedStyle(nsIDOMElement* aElt,
return NS_OK;
}
//*****************************************************************************
// nsGlobalWindow::nsIDOMStorageWindow
//*****************************************************************************
NS_IMETHODIMP
nsGlobalWindow::GetSessionStorage(nsIDOMStorage ** aSessionStorage)
{
@ -8583,24 +8573,19 @@ nsGlobalWindow::FireDelayedDOMEvents()
// nsGlobalWindow: Window Control Functions
//*****************************************************************************
nsIDOMWindowInternal *
nsIDOMWindow *
nsGlobalWindow::GetParentInternal()
{
FORWARD_TO_OUTER(GetParentInternal, (), nsnull);
nsIDOMWindowInternal *parentInternal = nsnull;
nsCOMPtr<nsIDOMWindow> parent;
GetParent(getter_AddRefs(parent));
if (parent && parent != static_cast<nsIDOMWindow *>(this)) {
nsCOMPtr<nsIDOMWindowInternal> tmp(do_QueryInterface(parent));
NS_ASSERTION(parent, "Huh, parent not an nsIDOMWindowInternal?");
parentInternal = tmp;
return parent;
}
return parentInternal;
return NULL;
}
// static
@ -8732,7 +8717,7 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
// Push a null JSContext here so that the window watcher won't screw us
// up. We do NOT want this case looking at the JS context on the stack
// when searching. Compare comments on
// nsIDOMWindowInternal::OpenWindow and nsIWindowWatcher::OpenWindow.
// nsIDOMWindow::OpenWindow and nsIWindowWatcher::OpenWindow.
nsCOMPtr<nsIJSContextStack> stack;
if (!aContentModal) {

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

@ -67,7 +67,6 @@
#include "nsIDOMNavigatorGeolocation.h"
#include "nsIDOMNavigatorDesktopNotification.h"
#include "nsIDOMLocation.h"
#include "nsIDOMWindowInternal.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIDOMJSWindow.h"
@ -97,7 +96,6 @@
#include "prclist.h"
#include "nsIDOMStorageObsolete.h"
#include "nsIDOMStorageList.h"
#include "nsIDOMStorageWindow.h"
#include "nsIDOMStorageEvent.h"
#include "nsIDOMStorageIndexedDB.h"
#include "nsIDOMOfflineResourceList.h"
@ -276,7 +274,6 @@ class nsGlobalWindow : public nsPIDOMWindow,
public nsIDOMJSWindow,
public nsIScriptObjectPrincipal,
public nsIDOMEventTarget,
public nsIDOMStorageWindow,
public nsIDOMStorageIndexedDB,
public nsSupportsWeakReference,
public nsIInterfaceRequestor,
@ -325,9 +322,6 @@ public:
// nsIDOMWindow
NS_DECL_NSIDOMWINDOW
// nsIDOMWindowInternal
NS_DECL_NSIDOMWINDOWINTERNAL
// nsIDOMWindowPerformance
NS_DECL_NSIDOMWINDOWPERFORMANCE
@ -370,12 +364,12 @@ public:
nsISupports *aState,
PRBool aForceReuseInnerWindow);
void DispatchDOMWindowCreated();
virtual NS_HIDDEN_(void) SetOpenerWindow(nsIDOMWindowInternal *aOpener,
virtual NS_HIDDEN_(void) SetOpenerWindow(nsIDOMWindow* aOpener,
PRBool aOriginalOpener);
virtual NS_HIDDEN_(void) EnsureSizeUpToDate();
virtual NS_HIDDEN_(nsIDOMWindow *) EnterModalState();
virtual NS_HIDDEN_(void) LeaveModalState(nsIDOMWindow *aWindow);
virtual NS_HIDDEN_(nsIDOMWindow*) EnterModalState();
virtual NS_HIDDEN_(void) LeaveModalState(nsIDOMWindow* aWindow);
virtual NS_HIDDEN_(PRBool) CanClose();
virtual NS_HIDDEN_(nsresult) ForceClose();
@ -385,8 +379,8 @@ public:
virtual NS_HIDDEN_(void) UpdateTouchState();
virtual NS_HIDDEN_(PRBool) DispatchCustomEvent(const char *aEventName);
// nsIDOMStorageWindow
NS_DECL_NSIDOMSTORAGEWINDOW
// nsIDOMStorageIndexedDB
NS_DECL_NSIDOMSTORAGEINDEXEDDB
// nsIInterfaceRequestor
NS_DECL_NSIINTERFACEREQUESTOR
@ -582,7 +576,7 @@ protected:
nsresult DefineArgumentsProperty(nsIArray *aArguments);
// Get the parent, returns null if this is a toplevel window
nsIDOMWindowInternal *GetParentInternal();
nsIDOMWindow* GetParentInternal();
// popup tracking
PRBool IsPopupSpamWindow()

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

@ -37,10 +37,10 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsHistory.h"
#include "nsCOMPtr.h"
#include "nscore.h"
#include "nsHistory.h"
#include "nsIDOMWindowInternal.h"
#include "nsPIDOMWindow.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDOMDocument.h"

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

@ -40,11 +40,11 @@
#ifndef nsPIDOMWindow_h__
#define nsPIDOMWindow_h__
#include "nsISupports.h"
#include "nsIDOMWindow.h"
#include "nsIDOMLocation.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIDOMElement.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMDocument.h"
#include "nsCOMPtr.h"
@ -80,10 +80,10 @@ class nsIArray;
class nsPIWindowRoot;
#define NS_PIDOMWINDOW_IID \
{ 0xa595249b, 0x1e74, 0x467e, \
{ 0x92, 0x56, 0x58, 0xff, 0x07, 0x1b, 0xc2, 0x96 } }
{ 0x1bfacc26, 0xad77, 0x42bb, \
{ 0xb9, 0xbb, 0xa0, 0x19, 0xc8, 0x27, 0x5c, 0x0e } }
class nsPIDOMWindow : public nsIDOMWindowInternal
class nsPIDOMWindow : public nsIDOMWindow
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_PIDOMWINDOW_IID)
@ -396,7 +396,7 @@ public:
* SetOpenerWindow is called. It might never be true, of course, if the
* window does not have an opener when it's created.
*/
virtual void SetOpenerWindow(nsIDOMWindowInternal *aOpener,
virtual void SetOpenerWindow(nsIDOMWindow* aOpener,
PRBool aOriginalOpener) = 0;
virtual void EnsureSizeUpToDate() = 0;

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

@ -40,7 +40,6 @@
#include "nsCOMPtr.h"
#include "nsWindowRoot.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMWindow.h"
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsEventListenerManager.h"
@ -48,10 +47,8 @@
#include "nsLayoutCID.h"
#include "nsContentCID.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMWindowInternal.h"
#include "nsString.h"
#include "nsEventDispatcher.h"
#include "nsIProgrammingLanguage.h"
#include "nsGUIEvent.h"
#include "nsGlobalWindow.h"
#include "nsFocusManager.h"
@ -244,7 +241,7 @@ nsWindowRoot::GetControllers(nsIControllers** aResult)
return focusedWindow->GetControllers(aResult);
}
else {
nsCOMPtr<nsIDOMWindowInternal> domWindow = do_QueryInterface(focusedWindow);
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(focusedWindow);
if (domWindow)
return domWindow->GetControllers(aResult);
}
@ -274,7 +271,7 @@ nsWindowRoot::GetControllerForCommand(const char * aCommand,
nsCOMPtr<nsPIDOMWindow> focusedWindow;
nsFocusManager::GetFocusedDescendant(mWindow, PR_TRUE, getter_AddRefs(focusedWindow));
while (focusedWindow) {
nsCOMPtr<nsIDOMWindowInternal> domWindow(do_QueryInterface(focusedWindow));
nsCOMPtr<nsIDOMWindow> domWindow(do_QueryInterface(focusedWindow));
nsCOMPtr<nsIControllers> controllers2;
domWindow->GetControllers(getter_AddRefs(controllers2));
@ -291,7 +288,7 @@ nsWindowRoot::GetControllerForCommand(const char * aCommand,
nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(focusedWindow);
nsGlobalWindow *win =
static_cast<nsGlobalWindow *>
(static_cast<nsIDOMWindowInternal *>(piWindow));
(static_cast<nsIDOMWindow*>(piWindow));
focusedWindow = win->GetPrivateParent();
}

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

@ -74,7 +74,6 @@ XPIDLSRCS = \
nsIDOMPlugin.idl \
nsIDOMPluginArray.idl \
nsIDOMScreen.idl \
nsIDOMWindowInternal.idl \
nsIDOMJSWindow.idl \
nsIDOMModalContentWindow.idl \
nsIDOMChromeWindow.idl \

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

@ -76,7 +76,6 @@ interface nsIDOMMediaList;
// Base
interface nsIDOMWindow;
interface nsIDOMWindowInternal;
interface nsIDOMWindowCollection;
interface nsIDOMPlugin;
interface nsIDOMPluginArray;

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

@ -77,9 +77,9 @@ interface nsIDOMJSWindow : nsISupports
void disableExternalCapture();
/**
* This is the scriptable version of nsIDOMWindowInternal::open()
* This is the scriptable version of nsIDOMWindow::open()
* that takes 3 optional arguments. Its binary name is OpenJS to
* avoid colliding with nsIDOMWindowInternal::open(), which has the
* avoid colliding with nsIDOMWindow::open(), which has the
* same signature. The reason we can't have that collision is that
* the implementation needs to know whether it was called from JS or
* not.
@ -92,7 +92,7 @@ interface nsIDOMJSWindow : nsISupports
/**
* This is the scriptable version of
* nsIDOMWindowInternal::openDialog() that takes 3 optional
* nsIDOMWindow::openDialog() that takes 3 optional
* arguments, plus any additional arguments are passed on as
* arguments on the dialog's window object (window.arguments).
*/

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

@ -22,6 +22,8 @@
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
* Johnny Stenback <jst@netscape.com>
* Neil Deakin <enndeakin@sympatico.ca>
* Ms2ger <ms2ger@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -39,8 +41,29 @@
#include "domstubs.idl"
%{ C++
#include "jspubtd.h"
%}
interface nsIAnimationFrameListener;
interface nsIControllers;
interface nsIDOMBlob;
interface nsIDOMLocation;
interface nsIDOMMediaQueryList;
interface nsIDOMOfflineResourceList;
interface nsIDOMPerformance;
interface nsIDOMStorage;
interface nsIDOMStorageList;
interface nsIPrompt;
interface nsISelection;
interface nsIVariant;
[scriptable, uuid(8fc58f56-f769-4368-a098-edd08550cf1a)]
interface nsIDOMMozURLProperty : nsISupports
{
DOMString createObjectURL(in nsIDOMBlob blob);
void revokeObjectURL(in DOMString URL);
};
/**
* The nsIDOMWindow interface is the primary interface for a DOM
@ -51,9 +74,15 @@ interface nsISelection;
* @see <http://www.whatwg.org/html/#window>
*/
[scriptable, uuid(90fec5b7-c58b-463f-a147-f91b6b104a96)]
[scriptable, uuid(972cb379-6bdc-4544-8b46-8d721e12e906)]
interface nsIDOMWindow : nsISupports
{
// the current browsing context
readonly attribute nsIDOMWindow window;
/* [replaceable] self */
readonly attribute nsIDOMWindow self;
/**
* Accessor for the document in this window.
*/
@ -66,6 +95,21 @@ interface nsIDOMWindow : nsISupports
*/
attribute DOMString name;
/* The setter that takes a string argument needs to be special cased! */
readonly attribute nsIDOMLocation location;
readonly attribute nsIDOMHistory history;
/* [replaceable] locationbar */
readonly attribute nsIDOMBarProp locationbar;
/* [replaceable] menubar */
readonly attribute nsIDOMBarProp menubar;
/* [replaceable] personalbar */
readonly attribute nsIDOMBarProp personalbar;
/**
* Accessor for the object that controls whether or not scrollbars
* are shown in this window.
@ -74,6 +118,25 @@ interface nsIDOMWindow : nsISupports
*/
readonly attribute nsIDOMBarProp scrollbars;
/* [replaceable] statusbar */
readonly attribute nsIDOMBarProp statusbar;
/* [replaceable] toolbar */
readonly attribute nsIDOMBarProp toolbar;
/* [replaceable] */
attribute DOMString status;
void close();
void stop();
void focus();
void blur();
// other browsing contexts
/* [replaceable] length */
readonly attribute unsigned long length;
/**
* Accessor for the root of this hierarchy of windows. This root may
* be the window itself if there is no parent, or if the parent is
@ -83,6 +146,8 @@ interface nsIDOMWindow : nsISupports
* This property is "replaceable" in JavaScript */
readonly attribute nsIDOMWindow top;
attribute nsIDOMWindow opener;
/**
* Accessor for this window's parent window, or the window itself if
* there is no parent, or if the parent is of different type
@ -90,13 +155,94 @@ interface nsIDOMWindow : nsISupports
*/
readonly attribute nsIDOMWindow parent;
readonly attribute nsIDOMElement frameElement;
// the user agent
readonly attribute nsIDOMNavigator navigator;
/**
* Get the application cache object for this window.
*/
readonly attribute nsIDOMOfflineResourceList applicationCache;
// user prompts
void alert(in DOMString text);
boolean confirm(in DOMString text);
// prompt() should return a null string if cancel is pressed
DOMString prompt([optional] in DOMString aMessage,
[optional] in DOMString aInitial);
void print();
nsIVariant showModalDialog(in DOMString aURI,
[optional] in nsIVariant aArgs,
[optional] in DOMString aOptions);
// cross-document messaging
/**
* Implements a safe message-passing system which can cross same-origin
* boundaries.
*
* This method, when called, causes a MessageEvent to be asynchronously
* dispatched at the primary document for the window upon which this method is
* called. (Note that the postMessage property on windows is allAccess and
* thus is readable cross-origin.) The dispatched event will have message as
* its data, the calling context's window as its source, and an origin
* determined by the calling context's main document URI. The targetOrigin
* argument specifies a URI and is used to restrict the message to be sent
* only when the target window has the same origin as targetOrigin (since,
* when the sender and the target have different origins, neither can read the
* location of the other).
*
* @see <http://www.whatwg.org/html/#dom-window-postmessage>
*/
[implicit_jscontext, binaryname(PostMessageMoz)]
void postMessage(in jsval message, in DOMString targetOrigin);
// WindowBase64
// Ascii base64 data to binary data and vice versa...
DOMString atob(in DOMString aAsciiString);
DOMString btoa(in DOMString aBase64Data);
// WindowSessionStorage
/**
* Session storage for the current browsing context.
*/
readonly attribute nsIDOMStorage sessionStorage;
// WindowLocalStorage
/**
* Local storage for the current browsing context.
*/
readonly attribute nsIDOMStorage localStorage;
// DOM Range
/**
* Method for accessing this window's selection object.
*/
nsISelection getSelection();
// CSSOM-View
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-window-interface
nsIDOMMediaQueryList matchMedia(in DOMString media_query_list);
readonly attribute nsIDOMScreen screen;
// viewport
attribute long innerWidth;
attribute long innerHeight;
// viewport scrolling
/**
* Accessor for the current x scroll position in this window in
* pixels.
@ -105,6 +251,9 @@ interface nsIDOMWindow : nsISupports
*/
readonly attribute long scrollX;
/* The offset in pixels by which the window is scrolled */
readonly attribute long pageXOffset;
/**
* Accessor for the current y scroll position in this window in
* pixels.
@ -113,6 +262,11 @@ interface nsIDOMWindow : nsISupports
*/
readonly attribute long scrollY;
/* The offset in pixels by which the window is scrolled */
readonly attribute long pageYOffset;
void scroll(in long xScroll, in long yScroll);
/**
* Method for scrolling this window to an absolute pixel offset.
*/
@ -125,11 +279,11 @@ interface nsIDOMWindow : nsISupports
void scrollBy(in long xScrollDif, in long yScrollDif);
// DOM Range
/**
* Method for accessing this window's selection object.
*/
nsISelection getSelection();
// client
attribute long screenX;
attribute long screenY;
attribute long outerWidth;
attribute long outerHeight;
// CSSOM
@ -177,4 +331,120 @@ interface nsIDOMWindow : nsISupports
* Method for sizing this window to the content in the window.
*/
void sizeToContent();
/* [replaceable] content */
readonly attribute nsIDOMWindow content;
/* [replaceable] prompter */
[noscript] readonly attribute nsIPrompt prompter;
readonly attribute boolean closed;
// http://wiki.whatwg.org/wiki/Crypto
readonly attribute nsIDOMCrypto crypto;
readonly attribute nsIDOMPkcs11 pkcs11;
// XXX Shouldn't this be in nsIDOMChromeWindow?
/* [replaceable] controllers */
readonly attribute nsIControllers controllers;
attribute DOMString defaultStatus;
readonly attribute float mozInnerScreenX;
readonly attribute float mozInnerScreenY;
/* The maximum offset that the window can be scrolled to
(i.e., the document width/height minus the scrollport width/height) */
readonly attribute long scrollMaxX;
readonly attribute long scrollMaxY;
attribute boolean fullScreen;
void back();
void forward();
void home();
void moveTo(in long xPos, in long yPos);
void moveBy(in long xDif, in long yDif);
void resizeTo(in long width, in long height);
void resizeBy(in long widthDif, in long heightDif);
/**
* Open a new window with this one as the parent. This method will
* NOT examine the JS stack for purposes of determining a caller.
* This window will be used for security checks during the search by
* name and the default character set on the newly opened window
* will just be the default character set of this window.
*/
[noscript] nsIDOMWindow open(in DOMString url, in DOMString name,
in DOMString options);
/**
* This method works like open except that aExtraArgument gets
* converted into the array window.arguments in JS, if
* aExtraArgument is a nsISupportsArray then the individual items in
* the array are inserted into window.arguments, and primitive
* nsISupports (nsISupportsPrimitives) types are converted to native
* JS types when possible.
*/
[noscript] nsIDOMWindow openDialog(in DOMString url, in DOMString name,
in DOMString options,
in nsISupports aExtraArgument);
// XXX Should this be in nsIDOMChromeWindow?
void updateCommands(in DOMString action);
/* Find in page.
* @param str: the search pattern
* @param caseSensitive: is the search caseSensitive
* @param backwards: should we search backwards
* @param wrapAround: should we wrap the search
* @param wholeWord: should we search only for whole words
* @param searchInFrames: should we search through all frames
* @param showDialog: should we show the Find dialog
*/
boolean find([optional] in DOMString str,
[optional] in boolean caseSensitive,
[optional] in boolean backwards,
[optional] in boolean wrapAround,
[optional] in boolean wholeWord,
[optional] in boolean searchInFrames,
[optional] in boolean showDialog);
/**
* Returns the number of times this document for this window has
* been painted to the screen.
*/
readonly attribute unsigned long long mozPaintCount;
/**
* Request a refresh of this browser window.
*
* @see <http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html>
*/
void
mozRequestAnimationFrame([optional] in nsIAnimationFrameListener aListener);
/**
* The current animation start time in milliseconds since the epoch.
*/
readonly attribute long long mozAnimationStartTime;
/**
* @see <http://dev.w3.org/2006/webapi/FileAPI/#creating-revoking>
*/
readonly attribute nsIDOMMozURLProperty URL;
/**
* Global storage, accessible by domain.
*/
readonly attribute nsIDOMStorageList globalStorage;
};
[scriptable, uuid(2146c906-57f7-486c-a1b4-8cdb57ef577f)]
interface nsIDOMWindowPerformance : nsISupports
{
/**
* A namespace to hold performance related data and statistics.
*/
readonly attribute nsIDOMPerformance performance;
};

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

@ -1,266 +0,0 @@
/* -*- Mode: IDL; 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
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
* Johnny Stenback <jst@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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 "nsIDOMWindow.idl"
%{ C++
#include "jspubtd.h"
%}
interface nsIPrompt;
interface nsIControllers;
interface nsIDOMLocation;
interface nsIDOMPerformance;
interface nsIVariant;
interface nsIAnimationFrameListener;
interface nsIDOMMediaQueryList;
interface nsIDOMBlob;
[scriptable, uuid(8fc58f56-f769-4368-a098-edd08550cf1a)]
interface nsIDOMMozURLProperty : nsISupports
{
DOMString createObjectURL(in nsIDOMBlob blob);
void revokeObjectURL(in DOMString URL);
};
[scriptable, uuid(7fec9403-7562-4ae0-8d9b-0735f0a55d7d)]
interface nsIDOMWindowInternal : nsIDOMWindow
{
readonly attribute nsIDOMWindowInternal window;
/* [replaceable] self */
readonly attribute nsIDOMWindowInternal self;
readonly attribute nsIDOMNavigator navigator;
readonly attribute nsIDOMScreen screen;
readonly attribute nsIDOMHistory history;
/* [replaceable] content */
readonly attribute nsIDOMWindow content;
/* [replaceable] prompter */
[noscript] readonly attribute nsIPrompt prompter;
/* [replaceable] menubar */
readonly attribute nsIDOMBarProp menubar;
/* [replaceable] toolbar */
readonly attribute nsIDOMBarProp toolbar;
/* [replaceable] locationbar */
readonly attribute nsIDOMBarProp locationbar;
/* [replaceable] personalbar */
readonly attribute nsIDOMBarProp personalbar;
/* [replaceable] statusbar */
readonly attribute nsIDOMBarProp statusbar;
readonly attribute boolean closed;
readonly attribute nsIDOMCrypto crypto;
readonly attribute nsIDOMPkcs11 pkcs11;
// XXX Shouldn't this be in nsIDOMChromeWindow?
/* [replaceable] controllers */
readonly attribute nsIControllers controllers;
attribute nsIDOMWindowInternal opener;
/* [replaceable] */
attribute DOMString status;
attribute DOMString defaultStatus;
// XXX: The setter that takes a string argument needs to be special
// cased!
readonly attribute nsIDOMLocation location;
/* [replaceable] */
attribute long innerWidth;
attribute long innerHeight;
attribute long outerWidth;
attribute long outerHeight;
attribute long screenX;
attribute long screenY;
readonly attribute float mozInnerScreenX;
readonly attribute float mozInnerScreenY;
/* The offset in pixels by which the window is scrolled */
readonly attribute long pageXOffset;
readonly attribute long pageYOffset;
/* The maximum offset that the window can be scrolled to
(i.e., the document width/height minus the scrollport width/height) */
readonly attribute long scrollMaxX;
readonly attribute long scrollMaxY;
/* [replaceable] length */
readonly attribute unsigned long length;
attribute boolean fullScreen;
void alert(in DOMString text);
boolean confirm(in DOMString text);
// prompt() should return a null string if cancel is pressed
DOMString prompt([optional] in DOMString aMessage,
[optional] in DOMString aInitial);
void focus();
void blur();
void back();
void forward();
void home();
void stop();
void print();
void moveTo(in long xPos, in long yPos);
void moveBy(in long xDif, in long yDif);
void resizeTo(in long width, in long height);
void resizeBy(in long widthDif, in long heightDif);
void scroll(in long xScroll, in long yScroll);
/**
* Open a new window with this one as the parent. This method will
* NOT examine the JS stack for purposes of determining a caller.
* This window will be used for security checks during the search by
* name and the default character set on the newly opened window
* will just be the default character set of this window.
*/
[noscript] nsIDOMWindow open(in DOMString url, in DOMString name,
in DOMString options);
/**
* This method works like open except that aExtraArgument gets
* converted into the array window.arguments in JS, if
* aExtraArgument is a nsISupportsArray then the individual items in
* the array are inserted into window.arguments, and primitive
* nsISupports (nsISupportsPrimitives) types are converted to native
* JS types when possible.
*/
[noscript] nsIDOMWindow openDialog(in DOMString url, in DOMString name,
in DOMString options,
in nsISupports aExtraArgument);
void close();
// XXX Should this be in nsIDOMChromeWindow?
void updateCommands(in DOMString action);
/* Find in page.
* @param str: the search pattern
* @param caseSensitive: is the search caseSensitive
* @param backwards: should we search backwards
* @param wrapAround: should we wrap the search
* @param wholeWord: should we search only for whole words
* @param searchInFrames: should we search through all frames
* @param showDialog: should we show the Find dialog
*/
boolean find([optional] in DOMString str,
[optional] in boolean caseSensitive,
[optional] in boolean backwards,
[optional] in boolean wrapAround,
[optional] in boolean wholeWord,
[optional] in boolean searchInFrames,
[optional] in boolean showDialog);
// Ascii base64 data to binary data and vice versa...
DOMString atob(in DOMString aAsciiString);
DOMString btoa(in DOMString aBase64Data);
readonly attribute nsIDOMElement frameElement;
nsIVariant showModalDialog(in DOMString aURI,
[optional] in nsIVariant aArgs,
[optional] in DOMString aOptions);
/**
* Implements a safe message-passing system which can cross same-origin
* boundaries.
*
* This method, when called, causes a MessageEvent to be asynchronously
* dispatched at the primary document for the window upon which this method is
* called. (Note that the postMessage property on windows is allAccess and
* thus is readable cross-origin.) The dispatched event will have message as
* its data, the calling context's window as its source, and an origin
* determined by the calling context's main document URI. The targetOrigin
* argument specifies a URI and is used to restrict the message to be sent
* only when the target window has the same origin as targetOrigin (since,
* when the sender and the target have different origins, neither can read the
* location of the other).
*
* See the WHATWG HTML5 specification, section 6.4, for more details.
*/
[implicit_jscontext, binaryname(PostMessageMoz)]
void postMessage(in jsval message, in DOMString targetOrigin);
/**
* Returns the number of times this document for this window has
* been painted to the screen.
*/
readonly attribute unsigned long long mozPaintCount;
/**
* Request a refresh of this browser window.
*/
void
mozRequestAnimationFrame([optional] in nsIAnimationFrameListener aListener);
/**
* The current animation start time in milliseconds since the epoch.
*/
readonly attribute long long mozAnimationStartTime;
/**
* http://dev.w3.org/csswg/cssom-view/#extensions-to-the-window-interface
*/
nsIDOMMediaQueryList matchMedia(in DOMString media_query_list);
readonly attribute nsIDOMMozURLProperty URL;
};
[scriptable, uuid(2146c906-57f7-486c-a1b4-8cdb57ef577f)]
interface nsIDOMWindowPerformance : nsISupports
{
/**
* A namespace to hold performance related data and statistics.
*/
readonly attribute nsIDOMPerformance performance;
};

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

@ -50,11 +50,12 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(4bedb0a0-f901-4c61-a93a-a43c1b7674d4)]
[scriptable, uuid(ce760602-0528-493d-966d-65d4ee52347d)]
interface nsIDOMHTMLImageElement : nsIDOMHTMLElement
{
attribute DOMString alt;
attribute DOMString src;
attribute DOMString crossOrigin;
attribute DOMString useMap;
attribute boolean isMap;
attribute unsigned long width;

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

@ -63,7 +63,6 @@ SDK_XPIDLSRCS = \
nsIDOMStorageItem.idl \
nsIDOMStorageIndexedDB.idl \
nsIDOMStorageList.idl \
nsIDOMStorageWindow.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -1,76 +0,0 @@
/* -*- Mode: IDL; 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
* Neil Deakin <enndeakin@sympatico.ca>
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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 "domstubs.idl"
/**
* Interface for a client side storage. See
* http://www.whatwg.org/specs/web-apps/current-work/#scs-client-side and
* http://www.w3.org/TR/IndexedDB/ for more information.
*
* Allows access to contextual storage areas.
*/
interface nsIDOMStorageObsolete;
interface nsIDOMStorage;
interface nsIDOMStorageList;
interface nsIIDBFactory;
[scriptable, uuid(b6f6efd8-1bdc-43af-b8ef-6685d6260931)]
interface nsIDOMStorageWindow : nsISupports
{
/**
* Session storage for the current browsing context.
*/
readonly attribute nsIDOMStorage sessionStorage;
/**
* Global storage, accessible by domain.
*/
readonly attribute nsIDOMStorageList globalStorage;
/**
* Local storage for the current browsing context.
*/
readonly attribute nsIDOMStorage localStorage;
/**
* Indexed Databases for the current browsing context.
* NOTE: mozIndexedDB should be removed post-2.0. Bug 623316.
*/
[noscript] readonly attribute nsIIDBFactory mozIndexedDB;
};

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

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: sw=4 ts=4 et : */
/* vim: set sw=4 ts=4 et : */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

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

@ -0,0 +1,47 @@
/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* ***** 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 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):
* Brad Lassey <blassey@mozilla.com>
*
* 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 "nsHapticFeedback.h"
NS_IMPL_ISUPPORTS1(nsHapticFeedback, nsIHapticFeedback)
NS_IMETHODIMP
nsHapticFeedback::PerformSimpleAction(PRInt32 aType)
{
// Todo
return NS_OK;
}

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

@ -0,0 +1,45 @@
/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* ***** 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 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):
* Brad Lassey <blassey@mozilla.com>
*
* 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 "nsIHapticFeedback.h"
class nsHapticFeedback : public nsIHapticFeedback
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIHAPTICFEEDBACK
};

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