Bug 784436 - Part 1: Make some nsIDocShell attributes infallible. r=bz
authorJustin Lebar <justin.lebar@gmail.com>
Wed, 22 Aug 2012 18:27:04 -0700
changeset 105138 bd0bf4b676dabbe74111442391e93ea21d641279
parent 105137 6c7efe05324138b63abb38ed31f32d1000312026
child 105139 eb81ebe55d99f1fa778a20495851ae8373f21f70
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersbz
bugs784436
milestone17.0a1
Bug 784436 - Part 1: Make some nsIDocShell attributes infallible. r=bz
docshell/base/nsDocShell.cpp
docshell/base/nsIDocShell.idl
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -12263,62 +12263,62 @@ nsDocShell::GetFrameType()
 {
     if (mAppId != nsIScriptSecurityManager::NO_APP_ID) {
         return eFrameTypeApp;
     }
 
     return mIsBrowserFrame ? eFrameTypeBrowser : eFrameTypeRegular;
 }
 
-NS_IMETHODIMP
+/* [infallible] */ NS_IMETHODIMP
 nsDocShell::GetIsBrowserElement(bool* aIsBrowser)
 {
     *aIsBrowser = (GetFrameType() == eFrameTypeBrowser);
 
     return NS_OK;
 }
 
-NS_IMETHODIMP
+/* [infallible] */ NS_IMETHODIMP
 nsDocShell::GetIsApp(bool* aIsApp)
 {
     *aIsApp = (GetFrameType() == eFrameTypeApp);
     return NS_OK;
 }
 
-NS_IMETHODIMP
+/* [infallible] */ NS_IMETHODIMP
 nsDocShell::GetIsContentBoundary(bool* aIsContentBoundary)
 {
     switch (GetFrameType()) {
         case eFrameTypeRegular:
             *aIsContentBoundary = false;
             break;
         case eFrameTypeBrowser:
         case eFrameTypeApp:
             *aIsContentBoundary = true;
             break;
     }
 
     return NS_OK;
 }
 
-NS_IMETHODIMP
+/* [infallible] */ NS_IMETHODIMP
 nsDocShell::GetIsInBrowserElement(bool* aIsInBrowserElement)
 {
     *aIsInBrowserElement = (GetInheritedFrameType() == eFrameTypeBrowser);
     return NS_OK;
 }
 
-NS_IMETHODIMP
+/* [infallible] */ NS_IMETHODIMP
 nsDocShell::GetIsInApp(bool* aIsInApp)
 {
     *aIsInApp = (GetInheritedFrameType() == eFrameTypeApp);
     return NS_OK;
 }
 
-NS_IMETHODIMP
+/* [infallible] */ NS_IMETHODIMP
 nsDocShell::GetIsBelowContentBoundary(bool* aIsInContentBoundary)
 {
     switch (GetInheritedFrameType()) {
         case eFrameTypeRegular:
             *aIsInContentBoundary = false;
             break;
         case eFrameTypeBrowser:
         case eFrameTypeApp:
@@ -12334,17 +12334,17 @@ nsDocShell::SetAppId(uint32_t aAppId)
 {
     MOZ_ASSERT(mAppId == nsIScriptSecurityManager::NO_APP_ID);
     MOZ_ASSERT(aAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID);
 
     mAppId = aAppId;
     return NS_OK;
 }
 
-NS_IMETHODIMP
+/* [infallible] */ NS_IMETHODIMP
 nsDocShell::GetAppId(uint32_t* aAppId)
 {
     if (mAppId != nsIScriptSecurityManager::NO_APP_ID) {
         MOZ_ASSERT(GetFrameType() == eFrameTypeApp);
 
         *aAppId = mAppId;
         return NS_OK;
     }
--- a/docshell/base/nsIDocShell.idl
+++ b/docshell/base/nsIDocShell.idl
@@ -584,33 +584,33 @@ interface nsIDocShell : nsISupports
    *
    * This method should not be called more than once.
    */
   void setIsBrowserElement();
 
   /**
    * Returns true iff the docshell is marked as a browser frame.
    */
-  readonly attribute boolean isBrowserElement;
+  [infallible] readonly attribute boolean isBrowserElement;
 
   /**
    * Returns true iif the docshell is marked as an app frame.
    */
-  readonly attribute boolean isApp;
+  [infallible] readonly attribute boolean isApp;
 
   /**
    * Returns true iif the docshell is marked as a type that behaves like a
    * content boundary.
    */
-  readonly attribute boolean isContentBoundary;
+  [infallible] readonly attribute boolean isContentBoundary;
 
   /**
    * Returns true iif the docshell is inside a browser element.
    */
-  readonly attribute boolean isInBrowserElement;
+  [infallible] readonly attribute boolean isInBrowserElement;
 
   /**
    * Returns true iif the docshell is inside an application.  However, it will
    * return false if the docshell is inside a browser element that is inside
    * an application.
    *
    * Note: Do not use this method for permissions checks!  An app may contain
    * an <iframe> pointing at arbitrary web code.  This iframe's docshell will
@@ -620,23 +620,23 @@ interface nsIDocShell : nsISupports
    * (For example, suppose when web content calls API method X, we show a
    * permission prompt, but when "app code" calls method X, we don't.  In this
    * case, it would be /incorrect/ to show the permission prompt if
    * !isInApp().)
    *
    * If you're doing a security check, use the content's principal instead of
    * this method.
    */
-  readonly attribute boolean isInApp;
+  [infallible] readonly attribute boolean isInApp;
 
   /**
    * Returns if the docshell has a docshell that behaves as a content boundary
    * in his parent hierarchy.
    */
-  readonly attribute boolean isBelowContentBoundary;
+  [infallible] readonly attribute boolean isBelowContentBoundary;
 
   /**
    * Set the app id this docshell is associated with. The id has to be a valid
    * app id. If the docshell isn't associated with any app, the value should be
    * nsIScriptSecurityManager::NO_APP_ID. However, this is the default value if
    * nothing is et.
    *
    * This method is [noscript] to reduce the scope. It should be used at very
@@ -645,17 +645,17 @@ interface nsIDocShell : nsISupports
    * Calling setAppId() will mark the frame as an app frame.
    */
   [noscript] void setAppId(in unsigned long appId);
 
   /**
    * Returns the app id of the app the docshell is in. Returns
    * nsIScriptSecurityManager::NO_APP_ID if the docshell is not in an app.
    */
-  readonly attribute unsigned long appId;
+  [infallible] readonly attribute unsigned long appId;
 
   /** 
    * True iff asynchronous panning and zooming is enabled for this
    * docshell.
    */
   readonly attribute bool asyncPanZoomEnabled;
 
   /**