Bug 1058921 - Disable unsafe Window APIs in prerendering; r=jst
authorRoshan Vidyashankar <roshanvid@gmail.com>
Mon, 05 Jan 2015 13:43:43 -0500
changeset 222053 c7fdb9bfb6720d288c3cb13dcf4a7eeb4bb1b2d8
parent 222052 e573fcf6096891655da49bfb170ed62acb3df848
child 222054 4ed5726c356bed3a613c6c567264cdebe89433db
push id28055
push userkwierso@gmail.com
push dateTue, 06 Jan 2015 00:19:38 +0000
treeherdermozilla-central@72d7ae169b09 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs1058921
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1058921 - Disable unsafe Window APIs in prerendering; r=jst
dom/webidl/Window.webidl
--- a/dom/webidl/Window.webidl
+++ b/dom/webidl/Window.webidl
@@ -38,53 +38,53 @@ typedef any Transferable;
   [Throws] readonly attribute History history;
   [Replaceable, Throws] readonly attribute BarProp locationbar;
   [Replaceable, Throws] readonly attribute BarProp menubar;
   [Replaceable, Throws] readonly attribute BarProp personalbar;
   [Replaceable, Throws] readonly attribute BarProp scrollbars;
   [Replaceable, Throws] readonly attribute BarProp statusbar;
   [Replaceable, Throws] readonly attribute BarProp toolbar;
   [Throws] attribute DOMString status;
-  [Throws, CrossOriginCallable] void close();
+  [Throws, CrossOriginCallable, UnsafeInPrerendering] void close();
   [Throws, CrossOriginReadable] readonly attribute boolean closed;
   [Throws] void stop();
-  [Throws, CrossOriginCallable] void focus();
+  [Throws, CrossOriginCallable, UnsafeInPrerendering] void focus();
   [Throws, CrossOriginCallable] void blur();
 
   // other browsing contexts
   [Replaceable, Throws, CrossOriginReadable] readonly attribute WindowProxy frames;
   [Replaceable, CrossOriginReadable] readonly attribute unsigned long length;
   //[Unforgeable, Throws, CrossOriginReadable] readonly attribute WindowProxy top;
   [Unforgeable, Throws, CrossOriginReadable] readonly attribute WindowProxy? top;
   [Throws, CrossOriginReadable] attribute any opener;
   //[Throws] readonly attribute WindowProxy parent;
   [Replaceable, Throws, CrossOriginReadable] readonly attribute WindowProxy? parent;
   [Throws] readonly attribute Element? frameElement;
   //[Throws] WindowProxy open(optional DOMString url = "about:blank", optional DOMString target = "_blank", [TreatNullAs=EmptyString] optional DOMString features = "", optional boolean replace = false);
-  [Throws] WindowProxy? open(optional DOMString url = "", optional DOMString target = "", [TreatNullAs=EmptyString] optional DOMString features = "");
+  [Throws, UnsafeInPrerendering] WindowProxy? open(optional DOMString url = "", optional DOMString target = "", [TreatNullAs=EmptyString] optional DOMString features = "");
   // We think the indexed getter is a bug in the spec, it actually needs to live
   // on the WindowProxy
   //getter WindowProxy (unsigned long index);
   getter object (DOMString name);
 
   // the user agent
   [Throws] readonly attribute Navigator navigator; 
 #ifdef HAVE_SIDEBAR
   [Replaceable, Throws] readonly attribute External external;
 #endif
   [Throws] readonly attribute ApplicationCache applicationCache;
 
   // user prompts
-  [Throws] void alert();
-  [Throws] void alert(DOMString message);
-  [Throws] boolean confirm(optional DOMString message = "");
-  [Throws] DOMString? prompt(optional DOMString message = "", optional DOMString default = "");
-  [Throws] void print();
+  [Throws, UnsafeInPrerendering] void alert();
+  [Throws, UnsafeInPrerendering] void alert(DOMString message);
+  [Throws, UnsafeInPrerendering] boolean confirm(optional DOMString message = "");
+  [Throws, UnsafeInPrerendering] DOMString? prompt(optional DOMString message = "", optional DOMString default = "");
+  [Throws, UnsafeInPrerendering] void print();
   //[Throws] any showModalDialog(DOMString url, optional any argument);
-  [Throws, Func="nsGlobalWindow::IsShowModalDialogEnabled"]
+  [Throws, Func="nsGlobalWindow::IsShowModalDialogEnabled", UnsafeInPrerendering]
   any showModalDialog(DOMString url, optional any argument, optional DOMString options = "");
 
   [Throws, CrossOriginCallable] void postMessage(any message, DOMString targetOrigin, optional sequence<Transferable> transfer);
 
   // also has obsolete members
 };
 Window implements GlobalEventHandlers;
 Window implements WindowEventHandlers;
@@ -163,20 +163,20 @@ partial interface Window {
   //[SameObject]
   [Throws] readonly attribute Screen screen;
 
   // browsing context
   //[Throws] void moveTo(double x, double y);
   //[Throws] void moveBy(double x, double y);
   //[Throws] void resizeTo(double x, double y);
   //[Throws] void resizeBy(double x, double y);
-  [Throws] void moveTo(long x, long y);
-  [Throws] void moveBy(long x, long y);
-  [Throws] void resizeTo(long x, long y);
-  [Throws] void resizeBy(long x, long y);
+  [Throws, UnsafeInPrerendering] void moveTo(long x, long y);
+  [Throws, UnsafeInPrerendering] void moveBy(long x, long y);
+  [Throws, UnsafeInPrerendering] void resizeTo(long x, long y);
+  [Throws, UnsafeInPrerendering] void resizeBy(long x, long y);
 
   // viewport
   //[Throws] readonly attribute double innerWidth;
   //[Throws] readonly attribute double innerHeight;
   [Throws] attribute long innerWidth;
   [Throws] attribute long innerHeight;
 
   // viewport scrolling
@@ -281,59 +281,59 @@ partial interface Window {
   /**
    * Method for scrolling this window by a number of pages.
    */
   void                      scrollByPages(long numPages, optional ScrollOptions options);
 
   /**
    * Method for sizing this window to the content in the window.
    */
-  [Throws] void             sizeToContent();
+  [Throws, UnsafeInPrerendering] void             sizeToContent();
 
   // XXX Shouldn't this be in nsIDOMChromeWindow?
   [ChromeOnly, Replaceable, Throws] readonly attribute MozControllers controllers;
 
   [ChromeOnly, Throws] readonly attribute Element? realFrameElement;
 
   [Throws] readonly attribute float               mozInnerScreenX;
   [Throws] readonly attribute float               mozInnerScreenY;
   [Throws] readonly attribute float               devicePixelRatio;
 
   /* The maximum offset that the window can be scrolled to
      (i.e., the document width/height minus the scrollport width/height) */
   [Replaceable, Throws] readonly attribute long   scrollMaxX;
   [Replaceable, Throws] readonly attribute long   scrollMaxY;
 
-  [Throws] attribute boolean                            fullScreen;
+  [Throws, UnsafeInPrerendering] attribute boolean            fullScreen;
 
-  [Throws, ChromeOnly] void             back();
-  [Throws, ChromeOnly] void             forward();
-  [Throws, ChromeOnly] void             home();
+  [Throws, ChromeOnly, UnsafeInPrerendering] void             back();
+  [Throws, ChromeOnly, UnsafeInPrerendering] void             forward();
+  [Throws, ChromeOnly, UnsafeInPrerendering] void             home();
 
   // XXX Should this be in nsIDOMChromeWindow?
   void                      updateCommands(DOMString action,
                                            optional Selection? sel = null,
                                            optional short reason = 0);
 
   /* Find in page.
    * @param str: the search pattern
    * @param caseSensitive: is the search caseSensitive
    * @param backwards: should we search backwards
    * @param wrapAround: should we wrap the search
    * @param wholeWord: should we search only for whole words
    * @param searchInFrames: should we search through all frames
    * @param showDialog: should we show the Find dialog
    */
-  [Throws] boolean          find(optional DOMString str = "",
-                                 optional boolean caseSensitive = false,
-                                 optional boolean backwards = false,
-                                 optional boolean wrapAround = false,
-                                 optional boolean wholeWord = false,
-                                 optional boolean searchInFrames = false,
-                                 optional boolean showDialog = false);
+  [Throws, UnsafeInPrerendering] boolean    find(optional DOMString str = "",
+                                                 optional boolean caseSensitive = false,
+                                                 optional boolean backwards = false,
+                                                 optional boolean wrapAround = false,
+                                                 optional boolean wholeWord = false,
+                                                 optional boolean searchInFrames = false,
+                                                 optional boolean showDialog = false);
 
   /**
    * Returns the number of times this document for this window has
    * been painted to the screen.
    */
   [Throws] readonly attribute unsigned long long mozPaintCount;
 
   /**
@@ -368,20 +368,20 @@ partial interface Window {
   void                      setResizable(boolean resizable);
 
   /**
    * This is the scriptable version of
    * nsIDOMWindow::openDialog() that takes 3 optional
    * arguments, plus any additional arguments are passed on as
    * arguments on the dialog's window object (window.arguments).
    */
-  [Throws, ChromeOnly] WindowProxy? openDialog(optional DOMString url = "",
-                                               optional DOMString name = "",
-                                               optional DOMString options = "",
-                                               any... extraArguments);
+  [Throws, ChromeOnly, UnsafeInPrerendering] WindowProxy? openDialog(optional DOMString url = "",
+                                                                   optional DOMString name = "",
+                                                                   optional DOMString options = "",
+                                                                   any... extraArguments);
 
   [Replaceable, Throws] readonly attribute object? content;
 
   [ChromeOnly, Throws] readonly attribute object? __content;
 
   [Throws, ChromeOnly] any getInterface(IID iid);
 };
 
@@ -429,21 +429,21 @@ interface ChromeWindow {
   void                      getAttention();
 
   [Throws, Func="nsGlobalWindow::IsChromeWindow"]
   void                      getAttentionWithCycleCount(long aCycleCount);
 
   [Throws, Func="nsGlobalWindow::IsChromeWindow"]
   void                      setCursor(DOMString cursor);
 
-  [Throws, Func="nsGlobalWindow::IsChromeWindow"]
+  [Throws, Func="nsGlobalWindow::IsChromeWindow", UnsafeInPrerendering]
   void                      maximize();
-  [Throws, Func="nsGlobalWindow::IsChromeWindow"]
+  [Throws, Func="nsGlobalWindow::IsChromeWindow", UnsafeInPrerendering]
   void                      minimize();
-  [Throws, Func="nsGlobalWindow::IsChromeWindow"]
+  [Throws, Func="nsGlobalWindow::IsChromeWindow", UnsafeInPrerendering]
   void                      restore();
 
   /**
    * Notify a default button is loaded on a dialog or a wizard.
    * defaultButton is the default button.
    */
   [Throws, Func="nsGlobalWindow::IsChromeWindow"]
   void notifyDefaultButtonLoaded(Element defaultButton);