mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 720b3adb1df5 (bug 1137681) since this need to be out too on a CLOSED TREE
This commit is contained in:
parent
8c62f5c4a0
commit
86da605994
@ -28,7 +28,6 @@
|
||||
#include "mozilla/StartupTimeline.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "Navigator.h"
|
||||
#include "URIUtils.h"
|
||||
|
||||
#include "nsIContent.h"
|
||||
@ -3129,38 +3128,6 @@ nsDocShell::NameEquals(const char16_t* aName, bool* aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetCustomUserAgent(nsAString& aCustomUserAgent)
|
||||
{
|
||||
aCustomUserAgent = mCustomUserAgent;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetCustomUserAgent(const nsAString& aCustomUserAgent)
|
||||
{
|
||||
mCustomUserAgent = aCustomUserAgent;
|
||||
RefPtr<nsGlobalWindow> win = mScriptGlobal ?
|
||||
mScriptGlobal->GetCurrentInnerWindowInternal() : nullptr;
|
||||
if (win) {
|
||||
ErrorResult ignored;
|
||||
Navigator* navigator = win->GetNavigator(ignored);
|
||||
ignored.SuppressException();
|
||||
if (navigator) {
|
||||
navigator->ClearUserAgentCache();
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t childCount = mChildList.Length();
|
||||
for (uint32_t i = 0; i < childCount; ++i) {
|
||||
nsCOMPtr<nsIDocShell> childShell = do_QueryInterface(ChildAt(i));
|
||||
if (childShell) {
|
||||
childShell->SetCustomUserAgent(aCustomUserAgent);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* virtual */ int32_t
|
||||
nsDocShell::ItemType()
|
||||
{
|
||||
@ -3288,7 +3255,6 @@ nsDocShell::SetDocLoaderParent(nsDocLoader* aParent)
|
||||
// If parent is another docshell, we inherit all their flags for
|
||||
// allowing plugins, scripting etc.
|
||||
bool value;
|
||||
nsString customUserAgent;
|
||||
nsCOMPtr<nsIDocShell> parentAsDocShell(do_QueryInterface(parent));
|
||||
if (parentAsDocShell) {
|
||||
if (mAllowPlugins && NS_SUCCEEDED(parentAsDocShell->GetAllowPlugins(&value))) {
|
||||
@ -3318,10 +3284,6 @@ nsDocShell::SetDocLoaderParent(nsDocLoader* aParent)
|
||||
if (parentAsDocShell->GetIsPrerendered()) {
|
||||
SetIsPrerendered(true);
|
||||
}
|
||||
if (NS_SUCCEEDED(parentAsDocShell->GetCustomUserAgent(customUserAgent)) &&
|
||||
!customUserAgent.IsEmpty()) {
|
||||
SetCustomUserAgent(customUserAgent);
|
||||
}
|
||||
if (NS_FAILED(parentAsDocShell->GetAllowDNSPrefetch(&value))) {
|
||||
value = false;
|
||||
}
|
||||
|
@ -787,7 +787,6 @@ protected:
|
||||
nsIntRect mBounds;
|
||||
nsString mName;
|
||||
nsString mTitle;
|
||||
nsString mCustomUserAgent;
|
||||
|
||||
/**
|
||||
* Content-Type Hint of the most-recently initiated load. Used for
|
||||
|
@ -43,7 +43,7 @@ interface nsITabParent;
|
||||
|
||||
typedef unsigned long nsLoadFlags;
|
||||
|
||||
[scriptable, builtinclass, uuid(bc3524bd-023c-4fc8-ace1-472bc999fb12)]
|
||||
[scriptable, builtinclass, uuid(63adb599-6dc9-4746-972e-c22e9018020b)]
|
||||
interface nsIDocShell : nsIDocShellTreeItem
|
||||
{
|
||||
/**
|
||||
@ -237,11 +237,6 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||
*/
|
||||
attribute nsIDOMEventTarget chromeEventHandler;
|
||||
|
||||
/**
|
||||
* This allows chrome to set a custom User agent on a specific docshell
|
||||
*/
|
||||
attribute DOMString customUserAgent;
|
||||
|
||||
/**
|
||||
* Whether to allow plugin execution
|
||||
*/
|
||||
@ -255,7 +250,7 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||
/**
|
||||
* Attribute stating if refresh based redirects can be allowed
|
||||
*/
|
||||
attribute boolean allowMetaRedirects;
|
||||
attribute boolean allowMetaRedirects;
|
||||
|
||||
/**
|
||||
* Attribute stating if it should allow subframes (framesets/iframes) or not
|
||||
|
@ -84,7 +84,6 @@ skip-if = e10s # Bug 1220927 - Test tries to do addSHistoryListener on content.
|
||||
[browser_multiple_pushState.js]
|
||||
[browser_onbeforeunload_navigation.js]
|
||||
[browser_search_notification.js]
|
||||
[browser_ua_emulation.js]
|
||||
[browser_timelineMarkers-01.js]
|
||||
[browser_timelineMarkers-02.js]
|
||||
[browser_timelineMarkers-03.js]
|
||||
|
@ -1,49 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
// Test that the docShell UA emulation works
|
||||
var test = Task.async(function*() {
|
||||
yield openUrl("data:text/html;charset=utf-8,<iframe id='test-iframe'></iframe>");
|
||||
|
||||
let docshell = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShell);
|
||||
is(docshell.customUserAgent, "", "There should initially be no customUserAgent");
|
||||
|
||||
docshell.customUserAgent = "foo";
|
||||
is(content.navigator.userAgent, "foo", "The user agent should be changed to foo");
|
||||
|
||||
let frameWin = content.document.querySelector("#test-iframe").contentWindow;
|
||||
is(frameWin.navigator.userAgent, "foo", "The UA should be passed on to frames.");
|
||||
|
||||
let newFrame = content.document.createElement("iframe");
|
||||
content.document.body.appendChild(newFrame);
|
||||
|
||||
let newFrameWin = newFrame.contentWindow;
|
||||
is(newFrameWin.navigator.userAgent, "foo", "Newly created frames should use the new UA");
|
||||
|
||||
newFrameWin.location.reload();
|
||||
newFrameWin.addEventListener("load", () => {
|
||||
is(newFrameWin.navigator.userAgent, "foo", "New UA should persist across reloads");
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
});
|
||||
});
|
||||
|
||||
function openUrl(url) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
window.focus();
|
||||
|
||||
let tab = window.gBrowser.selectedTab = window.gBrowser.addTab(url);
|
||||
let linkedBrowser = tab.linkedBrowser;
|
||||
|
||||
linkedBrowser.addEventListener("load", function onload() {
|
||||
linkedBrowser.removeEventListener("load", onload, true);
|
||||
resolve(tab);
|
||||
}, true);
|
||||
});
|
||||
}
|
@ -2775,12 +2775,6 @@ Navigator::AppName(nsAString& aAppName, bool aUsePrefOverriddenValue)
|
||||
aAppName.AssignLiteral("Netscape");
|
||||
}
|
||||
|
||||
void
|
||||
Navigator::ClearUserAgentCache()
|
||||
{
|
||||
NavigatorBinding::ClearCachedUserAgentValue(this);
|
||||
}
|
||||
|
||||
nsresult
|
||||
Navigator::GetUserAgent(nsPIDOMWindow* aWindow, nsIURI* aURI,
|
||||
bool aIsCallerChrome,
|
||||
@ -2788,17 +2782,6 @@ Navigator::GetUserAgent(nsPIDOMWindow* aWindow, nsIURI* aURI,
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsIDocShell* docshell = aWindow->GetDocShell();
|
||||
nsString customUserAgent;
|
||||
if (docshell) {
|
||||
docshell->GetCustomUserAgent(customUserAgent);
|
||||
}
|
||||
|
||||
if (!customUserAgent.IsEmpty()) {
|
||||
aUserAgent = customUserAgent;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!aIsCallerChrome) {
|
||||
const nsAdoptingString& override =
|
||||
mozilla::Preferences::GetString("general.useragent.override");
|
||||
|
@ -182,10 +182,6 @@ public:
|
||||
bool aIsCallerChrome,
|
||||
nsAString& aUserAgent);
|
||||
|
||||
// Clears the user agent cache by calling:
|
||||
// NavigatorBinding::ClearCachedUserAgentValue(this);
|
||||
void ClearUserAgentCache();
|
||||
|
||||
already_AddRefed<Promise> GetDataStores(const nsAString& aName,
|
||||
const nsAString& aOwner,
|
||||
ErrorResult& aRv);
|
||||
|
@ -41,7 +41,7 @@ interface NavigatorID {
|
||||
readonly attribute DOMString appVersion;
|
||||
[Constant, Cached]
|
||||
readonly attribute DOMString platform;
|
||||
[Pure, Cached, Throws=Workers]
|
||||
[Constant, Cached, Throws=Workers]
|
||||
readonly attribute DOMString userAgent;
|
||||
[Constant, Cached]
|
||||
readonly attribute DOMString product; // constant "Gecko"
|
||||
|
Loading…
Reference in New Issue
Block a user