diff --git a/accessible/src/atk/nsApplicationAccessibleWrap.cpp b/accessible/src/atk/nsApplicationAccessibleWrap.cpp index 9a3ac4d1c68..d79c65b9c62 100644 --- a/accessible/src/atk/nsApplicationAccessibleWrap.cpp +++ b/accessible/src/atk/nsApplicationAccessibleWrap.cpp @@ -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(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(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(windowAcc)); + + } else { + + // Deattach the dialog accessible + nsAccessible* windowAcc = + reinterpret_cast + (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(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(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; } } diff --git a/accessible/src/atk/nsMaiInterfaceComponent.cpp b/accessible/src/atk/nsMaiInterfaceComponent.cpp index 022422df965..89125219584 100644 --- a/accessible/src/atk/nsMaiInterfaceComponent.cpp +++ b/accessible/src/atk/nsMaiInterfaceComponent.cpp @@ -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) { diff --git a/accessible/src/base/nsCoreUtils.cpp b/accessible/src/base/nsCoreUtils.cpp index bc76f2bbfe1..20c4b03b2fd 100644 --- a/accessible/src/base/nsCoreUtils.cpp +++ b/accessible/src/base/nsCoreUtils.cpp @@ -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 window; domDoc->GetDefaultView(getter_AddRefs(window)); - nsCOMPtr 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; } diff --git a/accessible/src/html/nsHTMLImageAccessible.cpp b/accessible/src/html/nsHTMLImageAccessible.cpp index 7a770b6daac..e2947459fc5 100644 --- a/accessible/src/html/nsHTMLImageAccessible.cpp +++ b/accessible/src/html/nsHTMLImageAccessible.cpp @@ -179,7 +179,7 @@ nsHTMLImageAccessible::DoAction(PRUint8 aIndex) nsIDocument* document = mContent->GetOwnerDoc(); nsCOMPtr piWindow = document->GetWindow(); - nsCOMPtr win(do_QueryInterface(piWindow)); + nsCOMPtr win = do_QueryInterface(piWindow); NS_ENSURE_TRUE(win, NS_ERROR_FAILURE); nsCOMPtr tmp; return win->Open(longDesc, EmptyString(), EmptyString(), diff --git a/accessible/src/html/nsHTMLTableAccessible.cpp b/accessible/src/html/nsHTMLTableAccessible.cpp index 0a921153f2e..2b7c920b8c9 100644 --- a/accessible/src/html/nsHTMLTableAccessible.cpp +++ b/accessible/src/html/nsHTMLTableAccessible.cpp @@ -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 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; } diff --git a/accessible/src/html/nsHyperTextAccessible.cpp b/accessible/src/html/nsHyperTextAccessible.cpp index 51642768673..faa9ca2ff03 100644 --- a/accessible/src/html/nsHyperTextAccessible.cpp +++ b/accessible/src/html/nsHyperTextAccessible.cpp @@ -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" diff --git a/accessible/tests/mochitest/relations/test_general.html b/accessible/tests/mochitest/relations/test_general.html index fd6be43974d..2990e42d80a 100644 --- a/accessible/tests/mochitest/relations/test_general.html +++ b/accessible/tests/mochitest/relations/test_general.html @@ -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 diff --git a/browser/app/profile/extensions/testpilot@labs.mozilla.com/install.rdf.in b/browser/app/profile/extensions/testpilot@labs.mozilla.com/install.rdf.in old mode 100755 new mode 100644 diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 66027caf4e5..e31f36b6aca 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1415,6 +1415,8 @@ function prepareForStartup() { return; } + messageManager.loadFrameScript("chrome://browser/content/content.js", true); + // initialize observers and listeners // and give C++ access to gBrowser gBrowser.init(); diff --git a/browser/base/content/content.js b/browser/base/content/content.js new file mode 100644 index 00000000000..93bf90b1c7c --- /dev/null +++ b/browser/base/content/content.js @@ -0,0 +1,53 @@ +# -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is multi-process front-end code. +# +# The Initial Developer of the Original Code is +# the Mozilla Foundation +# Portions created by the Initial Developer are Copyright (C) 2011 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Felipe Gomes +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +const Cc = Components.classes; +const Ci = Components.interfaces; +const Cu = Components.utils; + +// Bug 671101 - directly using webNavigation in this context +// causes docshells to leak +__defineGetter__("webNavigation", function() { + return docShell.QueryInterface(Ci.nsIWebNavigation); +}); + +addMessageListener("WebNavigation:LoadURI", function(message) { + let flags = message.json.flags || webNavigation.LOAD_FLAGS_NONE; + + webNavigation.loadURI(message.json.uri, flags, null, null, null); +}); diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index e8ff9dcd119..2464be585d2 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -45,6 +45,7 @@ # Justin Dolske # Kathleen Brade # Mark Smith +# Kailas Patil # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or @@ -879,17 +880,12 @@ nsContextMenu.prototype = { saveDocument(this.target.ownerDocument); }, - // Save URL of clicked-on link. - saveLink: function() { + // Helper function to wait for appropriate MIME-type headers and + // then prompt the user with a file picker + saveHelper: function(linkURL, linkText, dialogTitle, bypassCache, doc) { // canonical def in nsURILoader.h const NS_ERROR_SAVE_LINK_AS_TIMEOUT = 0x805d0020; - var doc = this.target.ownerDocument; - urlSecurityCheck(this.linkURL, doc.nodePrincipal); - var linkText = this.linkText(); - var linkURL = this.linkURL; - - // an object to proxy the data through to // nsIExternalHelperAppService.doContent, which will wait for the // appropriate MIME-type headers and then prompt the user with a @@ -941,7 +937,7 @@ nsContextMenu.prototype = { if (aStatusCode == NS_ERROR_SAVE_LINK_AS_TIMEOUT) { // do it the old fashioned way, which will pick the best filename // it can without waiting. - saveURL(linkURL, linkText, null, true, false, doc.documentURIObject); + saveURL(linkURL, linkText, dialogTitle, bypassCache, false, doc.documentURIObject); } if (this.extListener) this.extListener.onStopRequest(aRequest, aContext, aStatusCode); @@ -985,10 +981,19 @@ nsContextMenu.prototype = { // set up a channel to do the saving var ioService = Cc["@mozilla.org/network/io-service;1"]. getService(Ci.nsIIOService); - var channel = ioService.newChannelFromURI(this.getLinkURI()); + var channel = ioService.newChannelFromURI(makeURI(linkURL)); channel.notificationCallbacks = new callbacks(); - channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE | - Ci.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS; + + let flags = Ci.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS; + + if (bypassCache) + flags |= Ci.nsIRequest.LOAD_BYPASS_CACHE; + + if (channel instanceof Ci.nsICachingChannel) + flags |= Ci.nsICachingChannel.LOAD_BYPASS_LOCAL_CACHE_IF_BUSY; + + channel.loadFlags |= flags; + if (channel instanceof Ci.nsIHttpChannel) { channel.referrer = doc.documentURIObject; if (channel instanceof Ci.nsIHttpChannelInternal) @@ -1006,6 +1011,14 @@ nsContextMenu.prototype = { channel.asyncOpen(new saveAsListener(), null); }, + // Save URL of clicked-on link. + saveLink: function() { + var doc = this.target.ownerDocument; + urlSecurityCheck(this.linkURL, doc.nodePrincipal); + + this.saveHelper(this.linkURL, this.linkText(), null, true, doc); + }, + sendLink: function() { // we don't know the title of the link so pass in an empty string MailIntegration.sendMessage( this.linkURL, "" ); @@ -1033,8 +1046,7 @@ nsContextMenu.prototype = { else if (this.onVideo || this.onAudio) { urlSecurityCheck(this.mediaURL, doc.nodePrincipal); var dialogTitle = this.onVideo ? "SaveVideoTitle" : "SaveAudioTitle"; - saveURL(this.mediaURL, null, dialogTitle, false, - false, doc.documentURIObject); + this.saveHelper(this.mediaURL, null, dialogTitle, false, doc); } }, diff --git a/browser/base/content/test/Makefile.in b/browser/base/content/test/Makefile.in index d1284543fbc..37bcad78e7e 100644 --- a/browser/base/content/test/Makefile.in +++ b/browser/base/content/test/Makefile.in @@ -212,6 +212,10 @@ _BROWSER_FILES = \ browser_clearplugindata_noage.html \ browser_popupUI.js \ browser_sanitizeDialog.js \ + browser_save_video.js \ + bug564387.html \ + bug564387_video1.ogv \ + bug564387_video1.ogv^headers^ \ browser_scope.js \ browser_selectTabAtIndex.js \ browser_tab_dragdrop.js \ diff --git a/browser/base/content/test/browser_bug553455.js b/browser/base/content/test/browser_bug553455.js index 42aac1fba10..6a8a3ea9370 100644 --- a/browser/base/content/test/browser_bug553455.js +++ b/browser/base/content/test/browser_bug553455.js @@ -50,7 +50,7 @@ function wait_for_install_dialog(aCallback) { Services.wm.removeListener(this); var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindowInternal); + .getInterface(Ci.nsIDOMWindow); waitForFocus(function() { info("Saw install dialog"); is(domwindow.document.location.href, XPINSTALL_URL, "Should have seen the right window open"); diff --git a/browser/base/content/test/browser_sanitize-download-history.js b/browser/base/content/test/browser_sanitize-download-history.js index 184b966de9a..22904dee487 100644 --- a/browser/base/content/test/browser_sanitize-download-history.js +++ b/browser/base/content/test/browser_sanitize-download-history.js @@ -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); diff --git a/browser/base/content/test/browser_save_video.js b/browser/base/content/test/browser_save_video.js new file mode 100644 index 00000000000..6d58e9461a3 --- /dev/null +++ b/browser/base/content/test/browser_save_video.js @@ -0,0 +1,110 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * TestCase for bug 564387 + * + */ +function test() { + + // --- Testing support library --- + + // Import the toolkit test support library in the scope of the current test. + // This operation also defines the common constants Cc, Ci, Cu, Cr and Cm. + Components.classes["@mozilla.org/moz/jssubscript-loader;1"]. + getService(Components.interfaces.mozIJSSubScriptLoader).loadSubScript( + "chrome://mochitests/content/browser/toolkit/content/tests/browser/common/_loadAll.js", + this); + + // --- Test implementation --- + + const kBaseUrl = + "http://mochi.test:8888/browser/browser/base/content/test/"; + + function pageShown(event) { + if (event.target.location != "about:blank") + testRunner.continueTest(); + } + + function saveVideoAs_TestGenerator() { + // Load Test page + gBrowser.addEventListener("pageshow", pageShown, false); + gBrowser.loadURI(kBaseUrl + "bug564387.html"); + yield; + gBrowser.removeEventListener("pageshow", pageShown, false); + + // Ensure that the window is focused. + SimpleTest.waitForFocus(testRunner.continueTest); + yield; + + try { + // get the video element + var video1 = gBrowser.contentDocument.getElementById("video1"); + + // Synthesize the right click on the context menu, and + // wait for it to be shown + document.addEventListener("popupshown", testRunner.continueTest, false); + EventUtils.synthesizeMouseAtCenter(video1, + { type: "contextmenu", button: 2 }, + gBrowser.contentWindow); + yield; + + // Create the folder the video will be saved into. + var destDir = createTemporarySaveDirectory(); + try { + // Call the appropriate save function defined in contentAreaUtils.js. + mockFilePickerSettings.destDir = destDir; + mockFilePickerSettings.filterIndex = 1; // kSaveAsType_URL + + // register mock file picker object + mockFilePickerRegisterer.register(); + try { + // register mock download progress listener + mockTransferForContinuingRegisterer.register(); + try { + // Select "Save Video As" option from context menu + var saveVideoCommand = document.getElementById("context-savevideo"); + saveVideoCommand.doCommand(); + + // Unregister the popupshown listener + document.removeEventListener("popupshown", + testRunner.continueTest, false); + // Close the context menu + document.getElementById("placesContext").hidePopup(); + + // Wait for the download to finish, and exit if it wasn't successful. + var downloadSuccess = yield; + if (!downloadSuccess) + throw "Unexpected failure in downloading Video file!"; + } + finally { + // unregister download progress listener + mockTransferForContinuingRegisterer.unregister(); + } + } + finally { + // unregister mock file picker object + mockFilePickerRegisterer.unregister(); + } + + // Read the name of the saved file. + var fileName = mockFilePickerResults.selectedFile.leafName; + + is(fileName, "Bug564387-expectedName.ogv", + "Video File Name is correctly retrieved from Content-Disposition http header"); + } + finally { + // Clean up the saved file. + destDir.remove(true); + } + } + finally { + // Replace the current tab with a clean one. + gBrowser.addTab().linkedBrowser.stop(); + gBrowser.removeCurrentTab(); + } + } + + // --- Run the test --- + testRunner.runTest(saveVideoAs_TestGenerator); +} diff --git a/browser/base/content/test/bug564387.html b/browser/base/content/test/bug564387.html new file mode 100644 index 00000000000..51ba4d04bee --- /dev/null +++ b/browser/base/content/test/bug564387.html @@ -0,0 +1,11 @@ + + + + Bug 564387 test + + + Testing for Mozilla Bug: 564387 +
+ + + diff --git a/browser/base/content/test/bug564387_video1.ogv b/browser/base/content/test/bug564387_video1.ogv new file mode 100644 index 00000000000..093158432ac Binary files /dev/null and b/browser/base/content/test/bug564387_video1.ogv differ diff --git a/browser/base/content/test/bug564387_video1.ogv^headers^ b/browser/base/content/test/bug564387_video1.ogv^headers^ new file mode 100644 index 00000000000..f880d0ac3a5 --- /dev/null +++ b/browser/base/content/test/bug564387_video1.ogv^headers^ @@ -0,0 +1,3 @@ +Content-Disposition: filename="Bug564387-expectedName.ogv" +Content-Type: video/ogg + diff --git a/browser/base/jar.mn b/browser/base/jar.mn index ac0f5547e7b..23957e5c54a 100644 --- a/browser/base/jar.mn +++ b/browser/base/jar.mn @@ -29,6 +29,7 @@ browser.jar: * content/browser/browser.js (content/browser.js) * content/browser/browser.xul (content/browser.xul) * content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml) +* content/browser/content.js (content/content.js) * content/browser/fullscreen-video.xhtml (content/fullscreen-video.xhtml) * content/browser/inspector.html (content/inspector.html) * content/browser/scratchpad.xul (content/scratchpad.xul) diff --git a/browser/components/migration/src/nsProfileMigrator.cpp b/browser/components/migration/src/nsProfileMigrator.cpp index 1af56bca0d6..8316f735208 100644 --- a/browser/components/migration/src/nsProfileMigrator.cpp +++ b/browser/components/migration/src/nsProfileMigrator.cpp @@ -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" diff --git a/browser/components/preferences/sync.js b/browser/components/preferences/sync.js index 40e69663443..d479d8564fb 100644 --- a/browser/components/preferences/sync.js +++ b/browser/components/preferences/sync.js @@ -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 diff --git a/browser/components/preferences/sync.xul b/browser/components/preferences/sync.xul index 897c5cef3c6..da6b3506992 100644 --- a/browser/components/preferences/sync.xul +++ b/browser/components/preferences/sync.xul @@ -101,12 +101,12 @@ - - @@ -172,7 +172,7 @@ @@ -197,7 +197,7 @@