зеркало из https://github.com/mozilla/gecko-dev.git
Bug 596300 - Element Attributes dropped when dragging and dropping in DesignMode/ContentEditable sections; r=bzbarsky a=blocking-betaN,1.9.2.11,1.9.1.14
This commit is contained in:
Родитель
a51eb769a7
Коммит
017374cd2f
|
@ -128,6 +128,7 @@
|
|||
#include "plbase64.h"
|
||||
#include "prmem.h"
|
||||
#include "nsStreamUtils.h"
|
||||
#include "nsIPrincipal.h"
|
||||
|
||||
const PRUnichar nbsp = 160;
|
||||
|
||||
|
@ -1303,6 +1304,25 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
|
|||
#ifdef DEBUG_clipboard
|
||||
printf("Got flavor [%s]\n", bestFlavor.get());
|
||||
#endif
|
||||
|
||||
// Try to determine whether we should use a sanitizing fragment sink
|
||||
PRBool isSafe = PR_FALSE;
|
||||
if (aSourceDoc) {
|
||||
nsCOMPtr<nsIDOMDocument> destdomdoc;
|
||||
rv = GetDocument(getter_AddRefs(destdomdoc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDocument> destdoc = do_QueryInterface(destdomdoc);
|
||||
NS_ASSERTION(destdoc, "Where is our destination doc?");
|
||||
nsCOMPtr<nsIDocument> srcdoc = do_QueryInterface(aSourceDoc);
|
||||
NS_ASSERTION(srcdoc, "Where is our source doc?");
|
||||
|
||||
nsIPrincipal* srcPrincipal = srcdoc->NodePrincipal();
|
||||
nsIPrincipal* destPrincipal = destdoc->NodePrincipal();
|
||||
NS_ASSERTION(srcPrincipal && destPrincipal, "How come we don't have a principal?");
|
||||
rv = srcPrincipal->Subsumes(destPrincipal, &isSafe);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (0 == nsCRT::strcmp(bestFlavor, kNativeHTMLMime))
|
||||
{
|
||||
// note cf_html uses utf8, hence use length = len, not len/2 as in flavors below
|
||||
|
@ -1323,7 +1343,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
|
|||
aSourceDoc,
|
||||
aDestinationNode, aDestOffset,
|
||||
aDoDeleteSelection,
|
||||
PR_FALSE);
|
||||
isSafe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1342,7 +1362,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
|
|||
aSourceDoc,
|
||||
aDestinationNode, aDestOffset,
|
||||
aDoDeleteSelection,
|
||||
PR_FALSE);
|
||||
isSafe);
|
||||
}
|
||||
}
|
||||
else if (0 == nsCRT::strcmp(bestFlavor, kUnicodeMime) ||
|
||||
|
@ -1413,7 +1433,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
|
|||
aSourceDoc,
|
||||
aDestinationNode, aDestOffset,
|
||||
aDoDeleteSelection,
|
||||
PR_FALSE);
|
||||
isSafe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1443,7 +1463,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
|
|||
aSourceDoc,
|
||||
aDestinationNode, aDestOffset,
|
||||
aDoDeleteSelection,
|
||||
PR_FALSE);
|
||||
isSafe);
|
||||
PR_Free(base64);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче