Commit 22c159bf authored by Raine Makelainen's avatar Raine Makelainen

Merge branch 'nemo_embedlite_38_rebased' into 'master'

Rebase nemo_embedlite_38 onto master



See merge request !20
parents 4a8c6656 96e0a37f
......@@ -57,8 +57,12 @@ AS_IF([test "x$with_system_nspr" = "xyes"],
if test "$OBJ_PATH" != ""; then
SDK_DIR=$OBJ_PATH/dist
IDL_DIR=$OBJ_PATH/dist/idl
ENGINE_CFLAGS="-I$OBJ_PATH/dist/include -I$OBJ_PATH/dist/include/nspr -I$OBJ_PATH/dist/include/mozilla -I$OBJ_PATH/dist/include/dom -I/usr/include/nspr4"
ENGINE_LIBS="-L$OBJ_PATH/dist/sdk/lib -lxpcomglue_s -lxul -lmozalloc"
ENGINE_CFLAGS="-I$OBJ_PATH/dist/include -I$OBJ_PATH/dist/include/mozilla -I$OBJ_PATH/dist/include/dom"
AS_IF([test "x$with_system_nspr" = "xyes"],
[ENGINE_CFLAGS="${ENGINE_CFLAGS} `pkg-config --cflags-only-I nspr`"],
[ENGINE_CFLAGS="${ENGINE_CFLAGS} -I$OBJ_PATH/dist/include/nspr"]
)
ENGINE_LIBS="-L$OBJ_PATH/dist/sdk/lib -lxpcomglue_s -lxul"
else
PKG_CHECK_MODULES(ENGINE, libxul $NSPR,
[
......
This diff is collapsed.
......@@ -8,6 +8,7 @@ const Cr = Components.results;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/LoginManagerParent.jsm");
// Common helper service
......@@ -25,16 +26,21 @@ EmbedLiteGlobalHelper.prototype = {
dump("EmbedLiteGlobalHelper app-startup\n");
Services.obs.addObserver(this, "invalidformsubmit", false);
Services.obs.addObserver(this, "xpcom-shutdown", false);
// Init LoginManager, not important for gecko > 32
Services.obs.addObserver(this, "profile-after-change", false);
break;
}
case "invalidformsubmit": {
dump("EmbedLiteGlobalHelper invalidformsubmit\n");
break;
}
case "profile-after-change": {
// Init LoginManager
try {
Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
} catch (e) {
dump("E login manager\n");
}
break;
}
case "invalidformsubmit": {
dump("EmbedLiteGlobalHelper invalidformsubmit\n");
LoginManagerParent.init();
break;
}
case "xpcom-shutdown": {
......
......@@ -17,15 +17,11 @@ contract @mozilla.org/network/protocol/about;1?what=home {59f3da9a-6c88-11e2-b87
component {72de694e-6c88-11e2-a4ee-6b515bdf0cb7} LoginManagerPrompter.js
contract @mozilla.org/login-manager/prompter;1 {72de694e-6c88-11e2-a4ee-6b515bdf0cb7}
# DownloadManagerUI.js
component {2137921e-910e-11e2-b344-2bda2844afe1} DownloadManagerUI.js
contract @mozilla.org/download-manager-ui;1 {2137921e-910e-11e2-b344-2bda2844afe1}
category app-startup DownloadManagerUI service,@mozilla.org/download-manager-ui;1
# HelperAppDialog.js
component {e9d277a0-268a-4ec2-bb8c-10fdf3e44611} HelperAppDialog.js
contract @mozilla.org/helperapplauncherdialog;1 {e9d277a0-268a-4ec2-bb8c-10fdf3e44611}
# EmbedPrefService.js
component {4c5563a0-94eb-11e2-a5f4-7f3c5758e2ae} EmbedPrefService.js
contract @mozilla.org/embedlite-pref-service;1 {4c5563a0-94eb-11e2-a5f4-7f3c5758e2ae}
......@@ -50,6 +46,11 @@ component {c48047b0-9e6d-11e2-a162-bb9036ce396c} EmbedLiteFaviconService.js
contract @mozilla.org/embedlite-favicon-component;1 {c48047b0-9e6d-11e2-a162-bb9036ce396c}
category app-startup EmbedLiteFaviconService service,@mozilla.org/embedlite-favicon-component;1
# EmbedLiteOrientationChangeHandler.js
component {39c15bb1-0a5c-42ff-979a-f2cfd966743c} EmbedLiteOrientationChangeHandler.js
contract @mozilla.org/embedlite-orientationhandler-component;1 {39c15bb1-0a5c-42ff-979a-f2cfd966743c}
category app-startup EmbedLiteOrientationChangeHandler service,@mozilla.org/embedlite-orientationhandler-component;1
# EmbedLiteSearchEngine.js
component {924fe7ba-afa1-11e2-9d4f-533572064b73} EmbedLiteSearchEngine.js
contract @mozilla.org/embedlite-search-component;1 {924fe7ba-afa1-11e2-9d4f-533572064b73}
......@@ -106,6 +107,7 @@ contract @mozilla.org/network/protocol;1?name=geo {0b452f2d-c6b3-4aee-9a73-dec5a
component {d43dab24-fab1-11e3-b977-3c970e7aaa3d} RtspProtocolHandler.js
contract @mozilla.org/network/protocol;1?name=rtsp {d43dab24-fab1-11e3-b977-3c970e7aaa3d}
# Sidebar.js
component {1a8f0aa4-2433-441f-adad-ed3ea5be4b39} Sidebar.js
contract @mozilla.org/sidebar;1 {1a8f0aa4-2433-441f-adad-ed3ea5be4b39}
# EmbedliteDownloadManager.js
component {71b0a6e8-83ac-4006-af97-d66009db97c8} EmbedliteDownloadManager.js
contract @mozilla.org/embedlite/download-manager;1 {71b0a6e8-83ac-4006-af97-d66009db97c8}
category app-startup EmbedliteDownloadManager service,@mozilla.org/embedlite/download-manager;1
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("chrome://embedlite/content/OrientationChangeHandler.jsm")
XPCOMUtils.defineLazyServiceGetter(Services, "embedlite",
"@mozilla.org/embedlite-app-service;1",
"nsIEmbedAppService");
function EmbedLiteOrientationChangeHandler()
{
}
EmbedLiteOrientationChangeHandler.prototype = {
classID: Components.ID("{39c15bb1-0a5c-42ff-979a-f2cfd966743c}"),
_orientationListeners: {},
_initialize: function() {
Services.obs.addObserver(this, "embedliteviewcreated", true);
Services.obs.addObserver(this, "domwindowclosed", true);
},
observe: function(aSubject, aTopic, aData) {
let self = this;
switch (aTopic) {
case "app-startup": {
self._initialize();
break;
}
case "embedliteviewcreated": {
self.onWindowOpen(aSubject);
break;
}
case "domwindowclosed": {
self.onWindowClosed(aSubject);
break;
}
}
},
onWindowOpen: function(aWindow) {
this._orientationListeners[aWindow] = new OrientationChangeHandler(aWindow);
Services.embedlite.chromeEventHandler(aWindow).addEventListener("DOMContentLoaded", this._orientationListeners[aWindow], false);
},
onWindowClosed: function(aWindow) {
let chromeEventHandler = Services.embedlite.chromeEventHandler(aWindow);
if (chromeEventHandler) {
chromeEventHandler.removeEventListener("DOMContentLoaded", this._orientationListeners[aWindow], false);
}
delete this._orientationListeners[aWindow];
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference])
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([EmbedLiteOrientationChangeHandler]);
......@@ -19,21 +19,42 @@ EmbedLiteSearchEngine.prototype = {
classID: Components.ID("{924fe7ba-afa1-11e2-9d4f-533572064b73}"),
observe: function (aSubject, aTopic, aData) {
let searchCallback = {
onSuccess: function (engine) {
var message = {
"msg": "search-engine-added",
"engine": (engine && engine.name) || "",
"errorCode": 0,
}
Services.obs.notifyObservers(null, "embed:search", JSON.stringify(message));
},
onError: function (errorCode) {
// Checked possible failures from nsIBrowserSearchService.idl
var message = {
"msg": "search-engine-added",
"engine": "",
"errorCode": errorCode
}
Services.obs.notifyObservers(null, "embed:search", JSON.stringify(message));
}
}
switch(aTopic) {
// Engine DownloadManager notifications
case "app-startup": {
Services.obs.addObserver(this, "xpcom-shutdown", true);
Services.obs.addObserver(this, "embedui:search", true);
Services.obs.addObserver(this, "embedliteInitialized", true);
Services.obs.addObserver(this, "profile-after-change", false);
break;
}
case "embedliteInitialized": {
Services.obs.removeObserver(this, "embedliteInitialized");
case "profile-after-change": {
Services.obs.removeObserver(this, "profile-after-change");
Services.search.init(function addEngine_cb(rv) {
let engines = Services.search.getEngines({});
let engineNames = engines.map(function (element) {
return element.name;
});
let enginesAvailable = (engines && engines.length > 0);
var messg = {
msg: "init",
......@@ -49,7 +70,7 @@ EmbedLiteSearchEngine.prototype = {
var data = JSON.parse(aData);
switch (data.msg) {
case "loadxml": {
Services.search.addEngine(data.uri, Ci.nsISearchEngine.DATA_XML, null, data.confirm);
Services.search.addEngine(data.uri, Ci.nsISearchEngine.DATA_XML, null, data.confirm, searchCallback);
break;
}
case "restoreDefault": {
......
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
////////////////////////////////////////////////////////////////////////////////
//// Globals
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
const Cr = Components.results;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
"resource://gre/modules/Downloads.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
////////////////////////////////////////////////////////////////////////////////
//// DownloadViewer
let DownloadView = {
// This is a map of download => their properties since the previos change
prevState: {},
counter: 0,
onDownloadAdded: function(download) {
this.counter++;
this.prevState[download] = {
id: this.counter,
download: download,
progress: download.progress,
succeeded: download.succeeded,
error: download.error,
canceled: download.canceled,
stopped: download.stopped
};
Services.obs.notifyObservers(null, "embed:download",
JSON.stringify({
msg: "dl-start",
id: this.counter,
displayName: download.target.path.split('/').slice(-1)[0],
sourceUrl: download.source.url,
targetPath: download.target.path,
mimeType: download.contentType,
size: download.totalBytes
}));
if (download.progress) {
Services.obs.notifyObservers(null, "embed:download",
JSON.stringify({
msg: "dl-progress",
id: this.prevState[download].id,
percent: download.progress
}));
}
if (download.succeeded) {
Services.obs.notifyObservers(null, "embed:download",
JSON.stringify({
msg: "dl-done",
id: this.prevState[download].id,
targetPath: download.target.path
}));
}
if (download.error) {
dump("EmbedliteDownloadManager error: " + download.error.message + "\n");
Services.obs.notifyObservers(null, "embed:download",
JSON.stringify({
msg: "dl-fail",
id: this.prevState[download].id
}));
}
if (download.canceled) {
Services.obs.notifyObservers(null, "embed:download",
JSON.stringify({
msg: "dl-cancel",
id: this.prevState[download].id
}));
}
},
onDownloadChanged: function(download) {
if (this.prevState[download].progress !== download.progress) {
Services.obs.notifyObservers(null, "embed:download",
JSON.stringify({
msg: "dl-progress",
id: this.prevState[download].id,
percent: download.progress
}));
}
this.prevState[download].progress = download.progress;
if (!this.prevState[download].succeeded && download.succeeded) {
Services.obs.notifyObservers(null, "embed:download",
JSON.stringify({
msg: "dl-done",
id: this.prevState[download].id,
targetPath: download.target.path
}));
}
this.prevState[download].succeeded = download.succeeded;
if (!this.prevState[download].error && download.error) {
dump("EmbedliteDownloadManager error: " + download.error.message + "\n");
Services.obs.notifyObservers(null, "embed:download",
JSON.stringify({
msg: "dl-fail",
id: this.prevState[download].id
}));
}
this.prevState[download].error = download.error;
if (!this.prevState[download].canceled && download.canceled) {
Services.obs.notifyObservers(null, "embed:download",
JSON.stringify({
msg: "dl-cancel",
id: this.prevState[download].id
}));
}
this.prevState[download].canceled = download.canceled;
if (this.prevState[download].stopped && !download.stopped) {
Services.obs.notifyObservers(null, "embed:download",
JSON.stringify({
msg: "dl-start",
id: this.prevState[download].id,
displayName: download.target.path.split('/').slice(-1)[0],
sourceUrl: download.source.url,
targetPath: download.target.path,
mimeType: download.contentType,
size: download.totalBytes
}));
}
this.prevState[download].stopped = download.stopped;
},
onDownloadRemoved: function(download) {
delete this.prevState[download];
}
};
////////////////////////////////////////////////////////////////////////////////
//// EmbedliteDownloadManager
function EmbedliteDownloadManager()
{
dump("EmbedliteDownloadManager initialized\n");
}
EmbedliteDownloadManager.prototype = {
classID: Components.ID("{71b0a6e8-83ac-4006-af97-d66009db97c8}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
observe: function(aSubject, aTopic, aData) {
switch (aTopic) {
case "app-startup":
Services.obs.addObserver(this, "profile-after-change", false);
break;
case "profile-after-change":
Services.obs.removeObserver(this, "profile-after-change");
Services.obs.addObserver(this, "embedui:download", false);
Task.spawn(function() {
let list = yield Downloads.getList(Downloads.ALL);
yield list.addView(DownloadView);
}).then(null, Cu.reportError);
break;
case "embedui:download":
var data = JSON.parse(aData);
switch (data.msg) {
case "retryDownload":
for (var key in DownloadView.prevState) {
if (DownloadView.prevState[key].id === data.id) {
DownloadView.prevState[key].download.start();
}
}
break;
case "cancelDownload":
for (var key in DownloadView.prevState) {
if (DownloadView.prevState[key].id === data.id) {
DownloadView.prevState[key].download.cancel();
}
}
break;
case "addDownload":
Task.spawn(function() {
let list = yield Downloads.getList(Downloads.ALL);
let download = yield Downloads.createDownload({
source: data.from,
target: data.to
});
download.start();
list.add(download);
}).then(null, Cu.reportError);
break;
}
break;
}
}
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([EmbedliteDownloadManager]);
......@@ -5,11 +5,11 @@ jscomps_manifest_DATA = \
AlertsService.js \
LoginManagerPrompter.js \
HelperAppDialog.js \
DownloadManagerUI.js \
EmbedPrefService.js \
ContentPermissionPrompt.js \
EmbedLiteGlobalHelper.js \
EmbedLiteConsoleListener.js \
EmbedLiteOrientationChangeHandler.js \
EmbedLiteSyncService.js \
EmbedLiteFaviconService.js \
EmbedLiteSearchEngine.js \
......@@ -18,12 +18,12 @@ jscomps_manifest_DATA = \
XPIDialogService.js \
PromptService.js \
PrivateDataManager.js \
EmbedliteDownloadManager.js \
TelProtocolHandler.js \
SmsProtocolHandler.js \
MailtoProtocolHandler.js \
GeoProtocolHandler.js \
RtspProtocolHandler.js \
Sidebar.js \
$(NULL)
AM_CPPFLAGS = $(DEPS_CFLAGS)
......@@ -27,8 +27,20 @@ PrivateDataManager.prototype = {
return Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
},
get cacheService() {
return Cc["@mozilla.org/network/cache-service;1"].getService(Ci.nsICacheService);
clearCaches: function() {
var cache = Cc["@mozilla.org/netwerk/cache-storage-service;1"].getService(Ci.nsICacheStorageService);
try {
cache.clear();
} catch(e) {
debug("error in clearing storage cache: " + e);
}
var imageCache = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools).getImgCacheForDocument(null);
try {
imageCache.clearCache(false); // true=chrome, false=content
} catch(e) {
debug("error in clearing image cache: " + e);
}
},
clearPrivateData: function (aData) {
......@@ -44,9 +56,7 @@ PrivateDataManager.prototype = {
break;
}
case "cache": {
try {
this.cacheService.evictEntries(Ci.nsICache.STORE_ANYWHERE);
} catch (ex) {debug(ex)}
this.clearCaches()
debug("Cache cleaned");
break;
}
......
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const Ci = Components.interfaces;
const Cc = Components.classes;
const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
const SIDEBAR_CID = Components.ID("{1a8f0aa4-2433-441f-adad-ed3ea5be4b39}");
const SIDEBAR_CONTRACTID = "@mozilla.org/sidebar;1";
function Sidebar() {
// Depending on if we are in the parent or child, prepare to remote
// certain calls
var appInfo = Cc["@mozilla.org/xre/app-info;1"];
if (!appInfo || appInfo.getService(Ci.nsIXULRuntime).processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
// Parent process
this.inContentProcess = false;
// Used for wakeups service. FIXME: clean up with bug 593407
this.wrappedJSObject = this;
// Setup listener for child messages. We don't need to call
// addMessageListener as the wakeup service will do that for us.
this.receiveMessage = function(aMessage) {
switch (aMessage.name) {
case "Sidebar:AddSearchProvider":
this.AddSearchProvider(aMessage.json.descriptionURL);
}
};
} else {
// Child process
this.inContentProcess = true;
this.messageManager = Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsISyncMessageSender);
}
}
Sidebar.prototype = {
// =========================== utility code ===========================
_validateSearchEngine: function validateSearchEngine(engineURL, iconURL) {
try {
// Make sure we're using HTTP, HTTPS, or FTP.
if (! /^(https?|ftp):\/\//i.test(engineURL))
throw "Unsupported search engine URL";
// Make sure we're using HTTP, HTTPS, or FTP and refering to a
// .gif/.jpg/.jpeg/.png/.ico file for the icon.
if (iconURL &&
! /^(https?|ftp):\/\/.+\.(gif|jpg|jpeg|png|ico)$/i.test(iconURL))
throw "Unsupported search icon URL.";
} catch(ex) {
Cu.reportError("Invalid argument passed to window.sidebar.addSearchEngine: " + ex);
var searchBundle = Services.strings.createBundle("chrome://global/locale/search/search.properties");
var brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
var brandName = brandBundle.GetStringFromName("brandShortName");
var title = searchBundle.GetStringFromName("error_invalid_engine_title");
var msg = searchBundle.formatStringFromName("error_invalid_engine_msg",
[brandName], 1);
Services.prompt.alert(null, title, msg);
return false;
}
return true;
},
// The suggestedTitle and suggestedCategory parameters are ignored, but remain
// for backward compatibility.
addSearchEngine: function addSearchEngine(engineURL, iconURL, suggestedTitle,
suggestedCategory) {
if (!this._validateSearchEngine(engineURL, iconURL))
return;
// File extension for Sherlock search plugin description files
const SHERLOCK_FILE_EXT_REGEXP = /\.src$/i;
// OpenSearch files will likely be far more common than Sherlock files, and
// have less consistent suffixes, so we assume that ".src" is a Sherlock
// (text) file, and anything else is OpenSearch (XML).
var dataType;
if (SHERLOCK_FILE_EXT_REGEXP.test(engineURL))
dataType = Ci.nsISearchEngine.DATA_TEXT;
else
dataType = Ci.nsISearchEngine.DATA_XML;
Services.search.addEngine(engineURL, dataType, iconURL, true);
},
// This function exists to implement window.external.AddSearchProvider(),
// to match other browsers' APIs. The capitalization, although nonstandard here,
// is therefore important.
AddSearchProvider: function AddSearchProvider(aDescriptionURL) {
if (!this._validateSearchEngine(aDescriptionURL, ""))
return;
if (this.inContentProcess) {
this.messageManager.sendAsyncMessage("Sidebar:AddSearchProvider",
{ descriptionURL: aDescriptionURL });
return;
}
const typeXML = Ci.nsISearchEngine.DATA_XML;
Services.search.addEngine(aDescriptionURL, typeXML, "", true);
},
// This function exists to implement window.external.IsSearchProviderInstalled(),
// for compatibility with other browsers. It will return an integer value
// indicating whether the given engine is installed for the current user.
// However, it is currently stubbed out due to security/privacy concerns
// stemming from difficulties in determining what domain issued the request.
// See bug 340604 and
// http://msdn.microsoft.com/en-us/library/aa342526%28VS.85%29.aspx .
// XXX Implement this!
IsSearchProviderInstalled: function IsSearchProviderInstalled(aSearchURL) {
return 0;
},
// =========================== nsISupports ===========================
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
// XPCOMUtils stuff
classID: SIDEBAR_CID,
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([Sidebar]);
......@@ -51,7 +51,8 @@ UserAgentOverrideHelper.prototype = {
},
getUserAgentForURIAndWindow: function ssua_getUserAgentForURIAndWindow(aURI, aWindow) {
return UserAgent.getUserAgentForWindow(aURI, aWindow, true)
// aWindow is unused / not needed.
return UserAgent.getUserAgentForWindow(aURI)
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsISiteSpecificUserAgent, Ci.nsIObserver,
......@@ -102,7 +103,7 @@ var UserAgent = {
if (this._desktopMode)
return this.DESKTOP_UA;
return this._customUA ? this._customUA : this.DESKTOP_UA;
return this._customUA ? this._customUA : defaultUA;
},
getUserAgentForUriAndTab: function ua_getUserAgentForUriAndTab(aUri) {
......@@ -153,27 +154,19 @@ var UserAgent = {
if (this.overrideMap.has(host)) {
ua = this.overrideMap.get(host);
} else if (this.currentHost && (this.currentHost == windowHost) && this.overrideMap.has(windowHost)) {
} else if (this.overrideMap.has(windowHost)) {
ua = this.overrideMap.get(windowHost);
} else {
ua = this.getUserAgentForWindow(channel.URI, channelWindow, false);
ua = this.getUserAgentForWindow(channel.URI);
}
return ua
},
// Called if onRequest returns empty user-agent.
getUserAgentForWindow: function ua_getUserAgentForWindow(aUri, aWindow, aIsCurrentHost) {
getUserAgentForWindow: function ua_getUserAgentForWindow(aUri) {
// Try to pick 'general.useragent.override.*'
let ua = UserAgentOverrides.getOverrideForURI(aUri);
if (aIsCurrentHost) {
this.currentHost = aUri.asciiHost;
if (aWindow) {
aWindow.addEventListener("beforeunload", this, true);
}
}
let ua = UserAgentOverrides.getOverrideForURI(aUri)
if (!ua) {
ua = this.getUserAgentForUriAndTab(aUri);
}
......@@ -186,15 +179,6 @@ var UserAgent = {
return this.getDefaultUserAgent();
},
handleEvent: function(aEvent) {
switch (aEvent.type) {
case "beforeunload": {
this.currentHost = "";
break;
}
}
},
_getRequestLoadContext: function ua_getRequestLoadContext(aRequest) {
if (aRequest && aRequest.notificationCallbacks) {
try {
......
......@@ -233,7 +233,6 @@ var ContextMenuHandler = {
state.types.push("link");
state.label = state.linkURL = this._getLinkURL(elem);
linkUrl = state.linkURL;
state.linkTitle = popupNode.textContent || popupNode.title;
state.linkProtocol = this._getProtocol(this._getURI(state.linkURL));
// mark as text so we can pickup on selection below
......@@ -276,11 +275,11 @@ var ContextMenuHandler = {
} else if (Util.isText(elem)) {
isText = true;
} else if (elem instanceof Ci.nsIDOMHTMLMediaElement ||
elem instanceof Ci.nsIDOMHTMLVideoElement) {
elem instanceof targetWindow.HTMLVideoElement) {
state.label = state.mediaURL = (elem.currentSrc || elem.src);
state.types.push((elem.paused || elem.ended) ?
"media-paused" : "media-playing");
if (elem instanceof Ci.nsIDOMHTMLVideoElement) {
if (elem instanceof targetWindow.HTMLVideoElement) {