Bug 1320801 - Part 3: Switch from ShouldResistFingerprinting to ResistFingerprinting (use the caller type, not the document principal) in nsGlobalWindow's orientation getter. r=bkelly, a=jcristau
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 22 Dec 2016 11:05:54 -0800
changeset 353712 cbc9396c381bc6e173788b989f9e821b019b5a6a
parent 353711 fe78462dc771e3a21cf87ec23428f80eae60f3c2
child 353713 e0b56aa9856f12f3c33fe7b68dd7a949550e0718
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly, jcristau
bugs1320801
milestone52.0a2
Bug 1320801 - Part 3: Switch from ShouldResistFingerprinting to ResistFingerprinting (use the caller type, not the document principal) in nsGlobalWindow's orientation getter. r=bkelly, a=jcristau
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
dom/webidl/Window.webidl
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -14642,19 +14642,19 @@ nsGlobalModalWindow::SetReturnValue(nsIV
 bool
 nsGlobalWindow::IsModalContentWindow(JSContext* aCx, JSObject* aGlobal)
 {
   return xpc::WindowOrNull(aGlobal)->IsModalContentWindow();
 }
 
 #if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
 int16_t
-nsGlobalWindow::Orientation() const
-{
-  return nsContentUtils::ShouldResistFingerprinting(mDocShell) ?
+nsGlobalWindow::Orientation(CallerType aCallerType) const
+{
+  return nsContentUtils::ResistFingerprinting(aCallerType) ?
            0 : WindowOrientationObserver::OrientationAngle();
 }
 #endif
 
 Console*
 nsGlobalWindow::GetConsole(ErrorResult& aRv)
 {
   MOZ_RELEASE_ASSERT(IsInnerWindow());
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -905,17 +905,17 @@ public:
                 bool aForceNoOpener,
                 nsPIDOMWindowOuter **_retval) override;
   mozilla::dom::Navigator* GetNavigator(mozilla::ErrorResult& aError);
   nsIDOMNavigator* GetNavigator() override;
   nsIDOMOfflineResourceList* GetApplicationCache(mozilla::ErrorResult& aError);
   already_AddRefed<nsIDOMOfflineResourceList> GetApplicationCache() override;
 
 #if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
-  int16_t Orientation() const;
+  int16_t Orientation(mozilla::dom::CallerType aCallerType) const;
 #endif
 
   mozilla::dom::Console* GetConsole(mozilla::ErrorResult& aRv);
 
   // https://w3c.github.io/webappsec-secure-contexts/#dom-window-issecurecontext
   bool IsSecureContext() const;
 
   void GetSidebar(mozilla::dom::OwningExternalOrWindowProxy& aResult,
--- a/dom/webidl/Window.webidl
+++ b/dom/webidl/Window.webidl
@@ -384,16 +384,17 @@ partial interface Window {
 
 Window implements TouchEventHandlers;
 
 Window implements OnErrorEventHandlerForWindow;
 
 #if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
 // https://compat.spec.whatwg.org/#windoworientation-interface
 partial interface Window {
+  [NeedsCallerType]
   readonly attribute short orientation;
            attribute EventHandler onorientationchange;
 };
 #endif
 
 #ifdef HAVE_SIDEBAR
 // Mozilla extension
 partial interface Window {