Bug 462892 - Add a mIsSynthetic member to nsIDocument r=roc
authorPaul ADENOT <paul@paul.cx>
Tue, 09 Aug 2011 08:35:00 -0400
changeset 74173 1c473f70373b390eed5095ed38238af536eadc9b
parent 74172 682ad2a5f003b837db3d3abd2eedea2010a35a51
child 74174 863ba598a27b169d5f26eb8887d4c2fb70fd33c4
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersroc
bugs462892
milestone8.0a1
Bug 462892 - Add a mIsSynthetic member to nsIDocument r=roc
content/base/public/nsIDocument.h
content/base/src/nsDocument.cpp
content/base/src/nsDocument.h
content/html/document/src/MediaDocument.cpp
dom/interfaces/core/nsIDOMDocument.idl
--- a/content/base/public/nsIDocument.h
+++ b/content/base/public/nsIDocument.h
@@ -1687,16 +1687,20 @@ protected:
   PRPackedBool mHasHadScriptHandlingObject;
 
   // True if we're waiting for a before-paint event.
   PRPackedBool mHavePendingPaint;
 
   // True if we're an SVG document being used as an image.
   PRPackedBool mIsBeingUsedAsImage;
 
+  // True is this document is synthetic : stand alone image, video, audio
+  // file, etc.
+  PRPackedBool mIsSyntheticDocument;
+
   // The document's script global object, the object from which the
   // document can get its script context and scope. This is the
   // *inner* window object.
   nsCOMPtr<nsIScriptGlobalObject> mScriptGlobalObject;
 
   // If mIsStaticDocument is true, mOriginalDocument points to the original
   // document.
   nsCOMPtr<nsIDocument> mOriginalDocument;
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -5915,16 +5915,23 @@ nsDocument::GetXmlStandalone(PRBool *aXm
 
 NS_IMETHODIMP
 nsDocument::SetXmlStandalone(PRBool aXmlStandalone)
 {
   return IsHTML() ? NS_ERROR_DOM_NOT_SUPPORTED_ERR : NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
+nsDocument::GetMozSyntheticDocument(PRBool *aSyntheticDocument)
+{
+  *aSyntheticDocument = mIsSyntheticDocument;
+  return NS_OK;
+}
+
+NS_IMETHODIMP
 nsDocument::GetXmlVersion(nsAString& aXmlVersion)
 {
   if (IsHTML()) {
     SetDOMStringToNull(aXmlVersion);
     return NS_OK;
   }
 
   // If there is no declaration, the value is "1.0".
--- a/content/base/src/nsDocument.h
+++ b/content/base/src/nsDocument.h
@@ -518,17 +518,17 @@ public:
                                      PRBool aReset = PR_TRUE,
                                      nsIContentSink* aContentSink = nsnull) = 0;
 
   virtual void StopDocumentLoad();
 
   virtual void NotifyPossibleTitleChange(PRBool aBoundTitleElement);
 
   virtual void SetDocumentURI(nsIURI* aURI);
-  
+
   /**
    * Set the principal responsible for this document.
    */
   virtual void SetPrincipal(nsIPrincipal *aPrincipal);
 
   /**
    * Get the Content-Type of this document.
    */
--- a/content/html/document/src/MediaDocument.cpp
+++ b/content/html/document/src/MediaDocument.cpp
@@ -145,16 +145,18 @@ MediaDocument::Init()
   // Create a bundle for the localization
   nsCOMPtr<nsIStringBundleService> stringService =
     mozilla::services::GetStringBundleService();
   if (stringService) {
     stringService->CreateBundle(NSMEDIADOCUMENT_PROPERTIES_URI,
                                 getter_AddRefs(mStringBundle));
   }
 
+  mIsSyntheticDocument = PR_TRUE;
+
   return NS_OK;
 }
 
 nsresult
 MediaDocument::StartDocumentLoad(const char*         aCommand,
                                  nsIChannel*         aChannel,
                                  nsILoadGroup*       aLoadGroup,
                                  nsISupports*        aContainer,
--- a/dom/interfaces/core/nsIDOMDocument.idl
+++ b/dom/interfaces/core/nsIDOMDocument.idl
@@ -57,17 +57,17 @@ interface nsIDOMLocation;
  * cannot exist outside the context of a Document, the nsIDOMDocument 
  * interface also contains the factory methods needed to create these 
  * objects.
  *
  * For more information on this interface please see 
  * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
  */
 
-[scriptable, uuid(d53c3d3d-2413-4abc-b54e-11c5c8380776)]
+[scriptable, uuid(10034b87-384e-4e19-902c-c4edafb899be)]
 interface nsIDOMDocument : nsIDOMNode
 {
   readonly attribute nsIDOMDocumentType         doctype;
   readonly attribute nsIDOMDOMImplementation    implementation;
   readonly attribute nsIDOMElement              documentElement;
   nsIDOMElement                 createElement(in DOMString tagName)
                                   raises(DOMException);
   nsIDOMDocumentFragment        createDocumentFragment();
@@ -312,16 +312,22 @@ interface nsIDOMDocument : nsIDOMNode
 
   // Mozilla extensions
   /**
    * @see <https://developer.mozilla.org/en/DOM/document.contentType>
    */
   readonly attribute DOMString      contentType;
 
   /**
+   * True if this document is synthetic : stand alone image, video, audio file,
+   * etc.
+   */
+  readonly attribute boolean        mozSyntheticDocument;
+
+  /**
    * Returns the script element whose script is currently being processed.
    *
    * @see <https://developer.mozilla.org/en/DOM/document.currentScript>
    */
   readonly attribute nsIDOMElement  currentScript;
 
   /**
    * Release the current mouse capture if it is on an element within this