From 5e04905dff027e44fcaf9e88c36d3d7e3c657d02 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Mon, 26 Jan 2009 20:46:56 +1300 Subject: [PATCH] Backed out accidentally committed 192d50641f83 --HG-- extra : rebase_source : 0a574802c654de30fc3c0dd68b3492a8d6cc4209 --- .../html/content/src/nsHTMLMediaElement.cpp | 14 ++ .../tests/test_selection_move_commands.xul | 13 +- editor/libeditor/html/nsHTMLEditRules.cpp | 19 +- layout/generic/test/Makefile.in | 2 +- ..._delete.xul => test_backspace_delete.html} | 175 +++++++----------- 5 files changed, 94 insertions(+), 129 deletions(-) rename layout/generic/test/{test_backspace_delete.xul => test_backspace_delete.html} (50%) diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp index aa93eedbdfa..c0f4ac82b8c 100644 --- a/content/html/content/src/nsHTMLMediaElement.cpp +++ b/content/html/content/src/nsHTMLMediaElement.cpp @@ -259,6 +259,20 @@ NS_IMETHODIMP nsHTMLMediaElement::Load() mChannel = nsnull; } + PRInt16 shouldLoad = nsIContentPolicy::ACCEPT; + rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_MEDIA, + uri, + NodePrincipal(), + this, + EmptyCString(), // mime type + nsnull, // extra + &shouldLoad, + nsContentUtils::GetContentPolicy(), + nsContentUtils::GetSecurityManager()); + if (NS_FAILED(rv) || NS_CP_REJECTED(shouldLoad)) { + return NS_ERROR_CONTENT_BLOCKED; + } + rv = NS_NewChannel(getter_AddRefs(mChannel), uri, nsnull, diff --git a/editor/libeditor/base/tests/test_selection_move_commands.xul b/editor/libeditor/base/tests/test_selection_move_commands.xul index a016240c325..fae1c310c0a 100644 --- a/editor/libeditor/base/tests/test_selection_move_commands.xul +++ b/editor/libeditor/base/tests/test_selection_move_commands.xul @@ -10,6 +10,17 @@ diff --git a/editor/libeditor/html/nsHTMLEditRules.cpp b/editor/libeditor/html/nsHTMLEditRules.cpp index 482b4f3905d..d71fbacafcd 100644 --- a/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/editor/libeditor/html/nsHTMLEditRules.cpp @@ -1948,24 +1948,10 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection, if (NS_FAILED(res)) return res; if (*aCancel) return NS_OK; - res = mHTMLEditor->ExtendSelectionForDelete(aSelection, &aAction); - NS_ENSURE_SUCCESS(res, res); - // We should delete nothing. if (aAction == nsIEditor::eNone) return NS_OK; - // ExtendSelectionForDelete() may have changed the selection, update it - res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(startNode), &startOffset); - if (NS_FAILED(res)) return res; - if (!startNode) return NS_ERROR_FAILURE; - - res = aSelection->GetIsCollapsed(&bCollapsed); - if (NS_FAILED(res)) return res; - } - - if (bCollapsed) - { // what's in the direction we are deleting? nsWSRunObject wsObj(mHTMLEditor, startNode, startOffset); nsCOMPtr visNode; @@ -2010,6 +1996,9 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection, } else { + res = mHTMLEditor->ExtendSelectionForDelete(aSelection, &aAction); + NS_ENSURE_SUCCESS(res, res); + nsCOMPtr range; res = aSelection->GetRangeAt(0, getter_AddRefs(range)); NS_ENSURE_SUCCESS(res, res); @@ -2026,8 +2015,6 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection, NS_ASSERTION(container == visNode, "selection end not in visNode"); #endif - res = range->GetStartOffset(&so); - NS_ENSURE_SUCCESS(res, res); res = range->GetEndOffset(&eo); NS_ENSURE_SUCCESS(res, res); } diff --git a/layout/generic/test/Makefile.in b/layout/generic/test/Makefile.in index 220baaeb873..8abda98b2ed 100644 --- a/layout/generic/test/Makefile.in +++ b/layout/generic/test/Makefile.in @@ -68,7 +68,7 @@ _TEST_FILES = test_bug288789.html \ test_bug469613.xul \ test_character_movement.html \ test_word_movement.html \ - test_backspace_delete.xul \ + test_backspace_delete.html \ $(NULL) libs:: $(_TEST_FILES) diff --git a/layout/generic/test/test_backspace_delete.xul b/layout/generic/test/test_backspace_delete.html similarity index 50% rename from layout/generic/test/test_backspace_delete.xul rename to layout/generic/test/test_backspace_delete.html index e9cef09d9f7..ef2a9c3d8c3 100644 --- a/layout/generic/test/test_backspace_delete.xul +++ b/layout/generic/test/test_backspace_delete.html @@ -1,63 +1,62 @@ - - - - - - + + + + Test BackSpace/Delete Keys + + + + + + + +

+
+
+
+

Catch-all +

+
-
-
-Mozilla Bug 462188
-

- -
 
-