mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-09 08:48:07 +00:00
Bug 768035 - Allow overriding user agent based on window. r=bz
This commit is contained in:
parent
e89c2a6319
commit
0dec93958f
@ -306,7 +306,7 @@ Navigator::GetUserAgent(nsAString& aUserAgent)
|
||||
do_GetService("@mozilla.org/dom/site-specific-user-agent;1");
|
||||
NS_ENSURE_TRUE(siteSpecificUA, NS_OK);
|
||||
|
||||
return siteSpecificUA->GetUserAgentForURI(codebaseURI, aUserAgent);
|
||||
return siteSpecificUA->GetUserAgentForURIAndWindow(codebaseURI, win, aUserAgent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -16,7 +16,7 @@ const DEFAULT_UA = Cc["@mozilla.org/network/protocol;1?name=http"]
|
||||
function SiteSpecificUserAgent() {}
|
||||
|
||||
SiteSpecificUserAgent.prototype = {
|
||||
getUserAgentForURI: function ssua_getUserAgentForURI(aURI) {
|
||||
getUserAgentForURIAndWindow: function ssua_getUserAgentForURIAndWindow(aURI, aWindow) {
|
||||
return UserAgentOverrides.getOverrideForURI(aURI) || DEFAULT_UA;
|
||||
},
|
||||
|
||||
|
@ -5,12 +5,13 @@
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIURI;
|
||||
interface nsIDOMWindow;
|
||||
|
||||
/**
|
||||
* nsISiteSpecificUserAgent provides you with site-specific User Agent strings.
|
||||
* nsISiteSpecificUserAgent provides you with site/window-specific User Agent strings.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(604a64af-9809-4c2f-a91d-f6ebfa21f6cb)]
|
||||
[scriptable, uuid(a509469a-ef3d-4ad1-8dba-c92a96b0bc64)]
|
||||
interface nsISiteSpecificUserAgent : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -18,8 +19,10 @@ interface nsISiteSpecificUserAgent : nsISupports
|
||||
*
|
||||
* @param aURI is the URI of the page the UA string is used for.
|
||||
*
|
||||
* @param aWindow is the window this UA is being requested for
|
||||
*
|
||||
* @returns the User Agent string for the given URI. If no override applies,
|
||||
* the default User Agent string is used.
|
||||
*/
|
||||
AString getUserAgentForURI(in nsIURI aURI);
|
||||
AString getUserAgentForURIAndWindow(in nsIURI aURI, in nsIDOMWindow aWindow);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user