This commit is contained in:
Chris Jones 2011-07-15 11:36:22 -07:00
Родитель bd33e7e43e 3d2d4b359c
Коммит 0c9abec3e2
359 изменённых файлов: 5004 добавлений и 2406 удалений

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

@ -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

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

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

@ -435,7 +435,12 @@ let TabView = {
this.sessionRestoreEnabledOnce = true;
// enable session restore
Services.prefs.setIntPref(this.PREF_STARTUP_PAGE, 3);
// enable session restore if necessary
if (Services.prefs.getIntPref(this.PREF_STARTUP_PAGE) != 3) {
Services.prefs.setIntPref(this.PREF_STARTUP_PAGE, 3);
// show banner
this._window.UI.notifySessionRestoreEnabled();
}
}
};

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

@ -191,6 +191,7 @@ function GroupItem(listOfEls, options) {
self.$titleShield.show();
if (self.getTitle())
gTabView.firstUseExperienced = true;
self.save();
})
.focus(function() {
self._unfreezeItemSize();
@ -825,9 +826,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
} else {
// child.removeSubscriber() must be called before child.close(),
// therefore we call child.addSubscriber() if the tab is not removed.
child.addSubscriber(self, "close", function() {
self.remove(child);
});
child.addSubscriber(self, "close", self._onChildClose.bind(self));
}
});
@ -1010,19 +1009,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
item.droppable(false);
item.groupItemData = {};
item.addSubscriber(this, "close", function() {
let count = self._children.length;
let dontArrange = self.expanded || !self.shouldStack(count);
let dontClose = !item.closedManually && gBrowser._numPinnedTabs > 0;
self.remove(item, {dontArrange: dontArrange, dontClose: dontClose});
if (dontArrange)
self._freezeItemSize(count);
if (self._children.length > 0 && self._activeTab)
UI.setActive(self);
});
item.addSubscriber(this, "close", this._onChildClose.bind(this));
item.setParent(this);
if (typeof item.setResizable == 'function')
@ -1050,6 +1037,25 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
}
},
// ----------
// Function: _onChildClose
// Handles "close" events from the group's children.
//
// Parameters:
// tabItem - The tabItem that is closed.
_onChildClose: function GroupItem__onChildClose(tabItem) {
let count = this._children.length;
let dontArrange = this.expanded || !this.shouldStack(count);
let dontClose = !tabItem.closedManually && gBrowser._numPinnedTabs > 0;
this.remove(tabItem, {dontArrange: dontArrange, dontClose: dontClose});
if (dontArrange)
this._freezeItemSize(count);
if (this._children.length > 0 && this._activeTab)
UI.setActive(this);
},
// ----------
// Function: remove
// Removes an item from the groupItem.

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

@ -178,6 +178,20 @@ body {
position: absolute;
}
.banner {
left: 0;
bottom: 0;
right: 0;
padding: 10px 0;
position: absolute;
z-index: 1000060;
background: #000;
color: #fff;
opacity: 0;
text-align: center;
font-weight: 700;
}
/* Resizable
----------------------------------*/
.resizer {

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

@ -135,6 +135,10 @@ let UI = {
// Used to keep track of allowed browser keys.
_browserKeys: null,
// Variable: _browserKeysWithShift
// Used to keep track of allowed browser keys with Shift key combination.
_browserKeysWithShift: null,
// Variable: ignoreKeypressForSearch
// Used to prevent keypress being handled after quitting search mode.
ignoreKeypressForSearch: false,
@ -973,11 +977,15 @@ let UI = {
"selectAll", "find"
].forEach(function(key) {
let element = gWindow.document.getElementById("key_" + key);
keys[key] = element.getAttribute("key").toLocaleLowerCase().charCodeAt(0);
let code = element.getAttribute("key").toLocaleLowerCase().charCodeAt(0);
keys[code] = key;
});
this._browserKeys = keys;
// for key combinations with shift key, the charCode of upper case letters
// are different to the lower case ones so need to handle them differently.
keys = {};
// The lower case letters are passed to processBrowserKeys() even with shift
// key when stimulating a key press using EventUtils.synthesizeKey() so need
// to handle both upper and lower cases here.
[
#ifdef XP_UNIX
"redo",
@ -986,11 +994,10 @@ let UI = {
"privatebrowsing"
].forEach(function(key) {
let element = gWindow.document.getElementById("key_" + key);
keys[key] = element.getAttribute("key").toLocaleUpperCase().charCodeAt(0);
let code = element.getAttribute("key").toLocaleLowerCase().charCodeAt(0);
keys[code] = key;
});
delete this._browserKeys;
this._browserKeys = keys;
this._browserKeysWithShift = keys;
},
// ----------
@ -1022,44 +1029,25 @@ let UI = {
#endif
let preventDefault = true;
if (evt.shiftKey) {
switch (evt.charCode) {
case self._browserKeys.tabview:
// when a user presses ctrl+shift+key, upper case letter charCode
// is passed to processBrowserKeys() so converting back to lower
// case charCode before doing the check
let lowercaseCharCode =
String.fromCharCode(evt.charCode).toLocaleLowerCase().charCodeAt(0);
if (lowercaseCharCode in self._browserKeysWithShift) {
let key = self._browserKeysWithShift[lowercaseCharCode];
if (key == "tabview")
self.exit();
break;
#ifdef XP_UNIX
case self._browserKeys.redo:
#endif
case self._browserKeys.closeWindow:
case self._browserKeys.undoCloseTab:
case self._browserKeys.undoCloseWindow:
case self._browserKeys.privatebrowsing:
else
preventDefault = false;
break;
}
} else {
switch (evt.charCode) {
case self._browserKeys.find:
if (evt.charCode in self._browserKeys) {
let key = self._browserKeys[evt.charCode];
if (key == "find")
self.enableSearch();
break;
#ifdef XP_UNIX
case self._browserKeys.quitApplication:
#else
case self._browserKeys.redo:
#endif
#ifdef XP_MACOSX
case self._browserKeys.preferencesCmdMac:
case self._browserKeys.minimizeWindow:
case self._browserKeys.hideThisAppCmdMac:
#endif
case self._browserKeys.newNavigator:
case self._browserKeys.newNavigatorTab:
case self._browserKeys.undo:
case self._browserKeys.cut:
case self._browserKeys.copy:
case self._browserKeys.paste:
case self._browserKeys.selectAll:
else
preventDefault = false;
break;
}
}
if (preventDefault) {
@ -1568,6 +1556,35 @@ let UI = {
url = gFavIconService.getFaviconImageForPage(tab.linkedBrowser.currentURI).spec;
return url;
},
// ----------
// Function: notifySessionRestoreEnabled
// Notify the user that session restore has been automatically enabled
// by showing a banner that expects no user interaction. It fades out after
// some seconds.
notifySessionRestoreEnabled: function UI_notifySessionRestoreEnabled() {
let brandBundle = gWindow.document.getElementById("bundle_brand");
let brandShortName = brandBundle.getString("brandShortName");
let notificationText = tabviewBundle.formatStringFromName(
"tabview.notification.sessionStore", [brandShortName], 1);
let banner = iQ("<div>")
.text(notificationText)
.addClass("banner")
.appendTo("body");
let onFadeOut = function () {
banner.remove();
};
let onFadeIn = function () {
setTimeout(function () {
banner.animate({opacity: 0}, {duration: 1500, complete: onFadeOut});
}, 5000);
};
banner.animate({opacity: 0.7}, {duration: 1500, complete: onFadeIn});
}
};

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

@ -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);

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

@ -110,7 +110,6 @@ _BROWSER_FILES = \
browser_tabview_bug625195.js \
browser_tabview_bug625269.js \
browser_tabview_bug625424.js \
browser_tabview_bug625666.js \
browser_tabview_bug626368.js \
browser_tabview_bug626525.js \
browser_tabview_bug626791.js \

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

@ -3,124 +3,78 @@
function test() {
waitForExplicitFinish();
window.addEventListener("tabviewshown", onTabViewWindowLoaded, false);
if (TabView.isVisible())
onTabViewWindowLoaded();
else
TabView.show();
showTabView(onTabViewShown);
}
function onTabViewWindowLoaded() {
window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false);
let contentWindow = document.getElementById("tab-view").contentWindow;
function onTabViewShown() {
let contentWindow = TabView.getContentWindow();
let [originalTab] = gBrowser.visibleTabs;
ok(TabView.isVisible(), "Tab View is visible");
is(contentWindow.GroupItems.groupItems.length, 1, "There is only one group");
let currentActiveGroup = contentWindow.GroupItems.getActiveGroupItem();
// set double click interval to negative so quick drag and drop doesn't
// trigger the double click code.
let origDBlClickInterval = contentWindow.UI.DBLCLICK_INTERVAL;
contentWindow.UI.DBLCLICK_INTERVAL = -1;
let endGame = function() {
contentWindow.UI.reset();
contentWindow.UI.DBLCLICK_INTERVAL = origDBlClickInterval;
let onTabViewHidden = function() {
window.removeEventListener("tabviewhidden", onTabViewHidden, false);
ok(!TabView.isVisible(), "TabView is shown");
finish();
};
window.addEventListener("tabviewhidden", onTabViewHidden, false);
ok(TabView.isVisible(), "TabView is shown");
gBrowser.selectedTab = originalTab;
TabView.hide();
}
let part1 = function() {
// move down 20 so we're far enough away from the top.
checkSnap(currentActiveGroup, 0, 20, contentWindow, function(snapped){
ok(!snapped,"Move away from the edge");
// Just pick it up and drop it.
checkSnap(currentActiveGroup, 0, 0, contentWindow, function(snapped){
ok(!snapped,"Just pick it up and drop it");
checkSnap(currentActiveGroup, 0, 1, contentWindow, function(snapped){
ok(snapped,"Drag one pixel: should snap");
checkSnap(currentActiveGroup, 0, 5, contentWindow, function(snapped){
ok(!snapped,"Moving five pixels: shouldn't snap");
endGame();
});
});
});
hideTabView(function () {
ok(!TabView.isVisible(), "TabView is hidden");
finish();
});
}
// we need to stop the setBounds() css animation or else the test will
// fail in single-mode because the group is newly created "ontabshown".
let $container = contentWindow.iQ(currentActiveGroup.container);
$container.css("-moz-transition-property", "none");
currentActiveGroup.setPosition(40, 40, true);
currentActiveGroup.arrange({animate: false});
part1();
// move down 20 so we're far enough away from the top.
checkSnap(currentActiveGroup, 0, 20, contentWindow, function(snapped){
is(currentActiveGroup.getBounds().top, 60, "group.top is 60px");
ok(!snapped,"Move away from the edge");
// Just pick it up and drop it.
checkSnap(currentActiveGroup, 0, 0, contentWindow, function(snapped){
is(currentActiveGroup.getBounds().top, 60, "group.top is 60px");
ok(!snapped,"Just pick it up and drop it");
checkSnap(currentActiveGroup, 0, 1, contentWindow, function(snapped){
is(currentActiveGroup.getBounds().top, 60, "group.top is 60px");
ok(snapped,"Drag one pixel: should snap");
checkSnap(currentActiveGroup, 0, 5, contentWindow, function(snapped){
is(currentActiveGroup.getBounds().top, 65, "group.top is 65px");
ok(!snapped,"Moving five pixels: shouldn't snap");
endGame();
});
});
});
});
}
function simulateDragDrop(tabItem, offsetX, offsetY, contentWindow) {
// enter drag mode
let dataTransfer;
function simulateDragDrop(item, offsetX, offsetY, contentWindow) {
let target = item.container;
EventUtils.synthesizeMouse(
tabItem.container, 1, 1, { type: "mousedown" }, contentWindow);
let event = contentWindow.document.createEvent("DragEvents");
event.initDragEvent(
"dragenter", true, true, contentWindow, 0, 0, 0, 0, 0,
false, false, false, false, 1, null, dataTransfer);
tabItem.container.dispatchEvent(event);
// drag over
if (offsetX || offsetY) {
let Ci = Components.interfaces;
let utils = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
let rect = tabItem.getBounds();
for (let i = 1; i <= 5; i++) {
let left = rect.left + 1 + Math.round(i * offsetX / 5);
let top = rect.top + 1 + Math.round(i * offsetY / 5);
utils.sendMouseEvent("mousemove", left, top, 0, 1, 0);
}
event = contentWindow.document.createEvent("DragEvents");
event.initDragEvent(
"dragover", true, true, contentWindow, 0, 0, 0, 0, 0,
false, false, false, false, 0, null, dataTransfer);
tabItem.container.dispatchEvent(event);
}
// drop
EventUtils.synthesizeMouse(
tabItem.container, 0, 0, { type: "mouseup" }, contentWindow);
event = contentWindow.document.createEvent("DragEvents");
event.initDragEvent(
"drop", true, true, contentWindow, 0, 0, 0, 0, 0,
false, false, false, false, 0, null, dataTransfer);
tabItem.container.dispatchEvent(event);
EventUtils.synthesizeMouse(target, 1, 1, {type: "mousedown"}, contentWindow);
EventUtils.synthesizeMouse(target, 1 + offsetX, 1 + offsetY, {type: "mousemove"}, contentWindow);
EventUtils.synthesizeMouse(target, 1, 1, {type: "mouseup"}, contentWindow);
}
function checkSnap(item, offsetX, offsetY, contentWindow, callback) {
let firstTop = item.getBounds().top;
let firstLeft = item.getBounds().left;
let onDrop = function() {
let snapped = false;
item.container.removeEventListener('drop', onDrop, false);
if (item.getBounds().top != firstTop + offsetY)
snapped = true;
if (item.getBounds().left != firstLeft + offsetX)
snapped = true;
callback(snapped);
};
item.container.addEventListener('drop', onDrop, false);
simulateDragDrop(item, offsetX, offsetY, contentWindow);
let snapped = false;
if (item.getBounds().top != firstTop + offsetY)
snapped = true;
if (item.getBounds().left != firstLeft + offsetX)
snapped = true;
callback(snapped);
}

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

@ -17,7 +17,7 @@ function test1() {
ok(!TabView.isVisible(), "Tab View is not visible");
showTabView(test2);
});
EventUtils.synthesizeKey("E", { accelKey: true, shiftKey: true }, contentWindow);
EventUtils.synthesizeKey("e", { accelKey: true, shiftKey: true }, contentWindow);
}
function test2() {
@ -58,7 +58,7 @@ function test4() {
executeSoon(function() {
is(gBrowser.tabs.length, 1, "There is one tab after removing one");
EventUtils.synthesizeKey("T", { accelKey: true, shiftKey: true }, contentWindow);
EventUtils.synthesizeKey("t", { accelKey: true, shiftKey: true }, contentWindow);
is(gBrowser.tabs.length, 2, "There are two tabs after restoring one");
gBrowser.tabs[0].linkedBrowser.loadURI("about:blank");
@ -96,7 +96,7 @@ function test9() {
function test10() {
is(gBrowser.tabs.length, 1, "There is one tab before cmd/ctrl + shift + a is pressed");
// it would open about:addons on a new tab if it passes through the white list.
EventUtils.synthesizeKey("A", { accelKey: true, shiftKey: true }, contentWindow);
EventUtils.synthesizeKey("a", { accelKey: true, shiftKey: true }, contentWindow);
executeSoon(function() {
is(gBrowser.tabs.length, 1, "There is still one tab after cmd/ctrl + shift + a is pressed");

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

@ -11,6 +11,8 @@ function test() {
let assertWindowTitle = function (win, title) {
let browser = win.gBrowser.tabs[0].linkedBrowser;
let winTitle = win.gBrowser.getWindowTitleForBrowser(browser);
info('window title is: "' + winTitle + '"');
is(winTitle.indexOf(title), 0, "title starts with '" + title + "'");
};

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

@ -57,5 +57,5 @@ function toggleTabViewTest(contentWindow) {
}
contentWindow.addEventListener("tabviewhidden", onTabViewHidden, false);
// Use keyboard shortcut to toggle back to browser view
EventUtils.synthesizeKey("E", { accelKey: true, shiftKey: true });
EventUtils.synthesizeKey("e", { accelKey: true, shiftKey: true });
}

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

@ -28,7 +28,7 @@ function onTabViewWindowLoaded() {
// verify that the keyboard combo works (this is the crux of bug 595518)
// Prepare the key combo
window.addEventListener("tabviewshown", onTabViewShown, false);
EventUtils.synthesizeKey("E", { accelKey: true, shiftKey: true }, contentWindow);
EventUtils.synthesizeKey("e", { accelKey: true, shiftKey: true }, contentWindow);
}
let onTabViewShown = function() {

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

@ -41,7 +41,7 @@ function onTabViewWindowLoaded() {
// the appropriate group would get selected when the key
// combination is pressed
executeSoon(function() {
EventUtils.synthesizeKey("E", {accelKey : true, shiftKey: true}, contentWindow);
EventUtils.synthesizeKey("e", {accelKey : true, shiftKey: true}, contentWindow);
});
});

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

@ -78,8 +78,8 @@ function part2(win) {
finish();
}, false);
// show tabview
EventUtils.synthesizeKey("E", { accelKey: true, shiftKey: true }, win);
EventUtils.synthesizeKey("e", { accelKey: true, shiftKey: true }, win);
// hide tabview
EventUtils.synthesizeKey("E", { accelKey: true, shiftKey: true }, win);
EventUtils.synthesizeKey("e", { accelKey: true, shiftKey: true }, win);
})
}

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

@ -1,49 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let cw;
let getTabItemAspect = function (tabItem) {
let bounds = cw.iQ('.thumb', tabItem.container).bounds();
let padding = cw.TabItems.tabItemPadding;
return (bounds.height + padding.y) / (bounds.width + padding.x);
}
let getAspectRange = function () {
let aspect = cw.TabItems.tabAspect;
let variance = aspect / 100 * 1.5;
return new cw.Range(aspect - variance, aspect + variance);
}
waitForExplicitFinish();
newWindowWithTabView(function (win) {
registerCleanupFunction(function () win.close());
cw = win.TabView.getContentWindow();
// prepare orphan tab
let tabItem = win.gBrowser.tabs[0]._tabViewTabItem;
tabItem.parent.remove(tabItem, {immediately: true});
tabItem.setBounds(new cw.Rect(20, 20, 200, 165), true);
let bounds = tabItem.getBounds();
// prepare group item
let box = new cw.Rect(20, 300, 400, 200);
let groupItem = new cw.GroupItem([], {bounds: box, immediately: true});
groupItem.setBounds(new cw.Rect(20, 100, 400, 200));
groupItem.pushAway(true);
let newBounds = tabItem.getBounds();
ok(newBounds.width < bounds.width, "The new width of item is smaller than the old one.");
ok(newBounds.height < bounds.height, "The new height of item is smaller than the old one.");
let aspectRange = getAspectRange();
let aspect = getTabItemAspect(tabItem);
ok(aspectRange.contains(aspect), "orphaned tabItem's aspect is correct");
finish();
});
}

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

@ -30,6 +30,16 @@ function test() {
assertBoolPref(TabView.PREF_RESTORE_ENABLED_ONCE, enabledOnce);
};
let assertNotificationBannerVisible = function (win) {
let cw = win.TabView.getContentWindow();
is(cw.iQ(".banner").length, 1, "notification banner is visible");
};
let assertNotificationBannerNotVisible = function (win) {
let cw = win.TabView.getContentWindow();
is(cw.iQ(".banner").length, 0, "notification banner is not visible");
};
let next = function () {
if (tests.length == 0) {
waitForFocus(finish);
@ -52,6 +62,7 @@ function test() {
setPreferences(1, true, false);
newWindowWithTabView(function (win) {
assertNotificationBannerVisible(win);
assertPreferences(3, true, true);
win.close();
@ -72,10 +83,12 @@ function test() {
setPreferences(1, false, false);
newWindowWithTabView(function (win) {
assertNotificationBannerNotVisible(win);
assertPreferences(1, false, false);
win.TabView.firstUseExperienced = true;
assertNotificationBannerVisible(win);
assertPreferences(3, true, true);
win.close();
@ -94,6 +107,7 @@ function test() {
setPreferences(3, true, false);
newWindowWithTabView(function (win) {
assertNotificationBannerNotVisible(win);
assertPreferences(3, true, true);
win.close();
@ -111,6 +125,7 @@ function test() {
setPreferences(3, true, true);
newWindowWithTabView(function (win) {
assertNotificationBannerNotVisible(win);
assertPreferences(3, true, true);
win.close();
@ -129,6 +144,7 @@ function test() {
setPreferences(1, true, true);
newWindowWithTabView(function (win) {
assertNotificationBannerNotVisible(win);
assertPreferences(1, true, true);
win.close();

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

@ -28,7 +28,7 @@ function test() {
newWin.document.getElementById("menu_tabview").doCommand();
}, function() {
testMethodToHideAndShowTabView(function() {
EventUtils.synthesizeKey("E", { accelKey: true, shiftKey: true }, newWin);
EventUtils.synthesizeKey("e", { accelKey: true, shiftKey: true }, newWin);
}, finish);
});
});

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

@ -83,9 +83,11 @@ function newWindowWithTabView(shownCallback, loadCallback, width, height) {
",width=" + winWidth);
whenWindowLoaded(win, function () {
if (typeof loadCallback == "function")
if (loadCallback)
loadCallback(win);
});
whenDelayedStartupFinished(win, function () {
showTabView(function () shownCallback(win), win);
});
}

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

@ -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();

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

@ -289,6 +289,7 @@ var treeView = {
isSeparator: function(idx) { return false; },
isSorted: function() { return false; },
isEditable: function(idx, column) { return false; },
canDrop: function(idx, orientation, dt) { return false; },
getLevel: function(idx) { return this.isContainer(idx) ? 0 : 1; },
getParentIndex: function(idx) {

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

@ -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) {
@ -2222,8 +2220,14 @@ SessionStoreService.prototype = {
if (!aWindow._hosts)
return;
for (var [host, isPinned] in Iterator(aWindow._hosts)) {
var list = CookieSvc.getCookiesFromHost(host);
while (list.hasMoreElements()) {
let list;
try {
list = CookieSvc.getCookiesFromHost(host);
}
catch (ex) {
debug("getCookiesFromHost failed. Host: " + host);
}
while (list && list.hasMoreElements()) {
var cookie = list.getNext().QueryInterface(Ci.nsICookie2);
// aWindow._hosts will only have hosts with the right privacy rules,
// so there is no need to do anything special with this call to
@ -2952,8 +2956,11 @@ SessionStoreService.prototype = {
// so we can just set the URL to null.
browser.__SS_restore_data = { url: null };
browser.__SS_restore_tab = aTab;
if (didStartLoad)
browser.stop();
didStartLoad = true;
browser.loadURI(tabData.userTypedValue, null, null, true);
browser.loadURIWithFlags(tabData.userTypedValue,
Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP);
}
}
@ -3785,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">

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

@ -2,3 +2,4 @@ tabview.groupItem.newTabButton=New tab
tabview.groupItem.defaultName=Name this tab group…
tabview.groupItem.undoCloseGroup=Undo Close Group
tabview.search.otherWindowTabs=Tabs from other windows
tabview.notification.sessionStore=Tabs and groups will automatically be restored the next time you start %S.

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

@ -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);

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

@ -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"

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

@ -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)

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

@ -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;
}

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

@ -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

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