mate::ObjectTemplateBuilder AutoUpdater::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
return mate::ObjectTemplateBuilder(isolate)
- .SetMethod("setFeedUrl", &auto_updater::AutoUpdater::SetFeedURL)
+ .SetMethod("setFeedURL", &auto_updater::AutoUpdater::SetFeedURL)
.SetMethod("checkForUpdates", &auto_updater::AutoUpdater::CheckForUpdates)
.SetMethod("quitAndInstall", &AutoUpdater::QuitAndInstall);
}
Passed(&filter), callback))) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(&RunGetCookiesCallbackOnUIThread, isolate(),
- "Url is not valid", net::CookieList(), callback));
+ "URL is not valid", net::CookieList(), callback));
}
}
error_message = "Details(url, name) of removing cookie are required.";
}
if (error_message.empty() && !url.is_valid()) {
- error_message = "Url is not valid.";
+ error_message = "URL is not valid.";
}
if (!error_message.empty()) {
RunRemoveCookiesCallbackOnUIThread(isolate(), error_message, callback);
GURL gurl(url);
if (error_message.empty() && !gurl.is_valid()) {
- error_message = "Url is not valid.";
+ error_message = "URL is not valid.";
}
if (!error_message.empty()) {
return download_item_->GetTotalBytes();
}
-const GURL& DownloadItem::GetUrl() {
+const GURL& DownloadItem::GetURL() {
return download_item_->GetURL();
}
}
std::string DownloadItem::GetFilename() {
- return base::UTF16ToUTF8(net::GenerateFileName(GetUrl(),
+ return base::UTF16ToUTF8(net::GenerateFileName(GetURL(),
GetContentDisposition(),
std::string(),
download_item_->GetSuggestedFilename(),
.SetMethod("cancel", &DownloadItem::Cancel)
.SetMethod("getReceivedBytes", &DownloadItem::GetReceivedBytes)
.SetMethod("getTotalBytes", &DownloadItem::GetTotalBytes)
- .SetMethod("getUrl", &DownloadItem::GetUrl)
+ .SetMethod("getURL", &DownloadItem::GetURL)
.SetMethod("getMimeType", &DownloadItem::GetMimeType)
.SetMethod("hasUserGesture", &DownloadItem::HasUserGesture)
.SetMethod("getFilename", &DownloadItem::GetFilename)
bool HasUserGesture();
std::string GetFilename();
std::string GetContentDisposition();
- const GURL& GetUrl();
+ const GURL& GetURL();
void SetSavePath(const base::FilePath& path);
private:
.SetMethod("registerBufferProtocol",
&Protocol::RegisterProtocol<URLRequestBufferJob>)
.SetMethod("registerFileProtocol",
- &Protocol::RegisterProtocol<UrlRequestAsyncAsarJob>)
+ &Protocol::RegisterProtocol<URLRequestAsyncAsarJob>)
.SetMethod("registerHttpProtocol",
&Protocol::RegisterProtocol<URLRequestFetchJob>)
.SetMethod("unregisterProtocol", &Protocol::UnregisterProtocol)
.SetMethod("interceptBufferProtocol",
&Protocol::InterceptProtocol<URLRequestBufferJob>)
.SetMethod("interceptFileProtocol",
- &Protocol::InterceptProtocol<UrlRequestAsyncAsarJob>)
+ &Protocol::InterceptProtocol<URLRequestAsyncAsarJob>)
.SetMethod("interceptHttpProtocol",
&Protocol::InterceptProtocol<URLRequestFetchJob>)
.SetMethod("uninterceptProtocol", &Protocol::UninterceptProtocol);
.SetMethod("isAlive", &WebContents::IsAlive, true)
.SetMethod("getId", &WebContents::GetID)
.SetMethod("equal", &WebContents::Equal)
- .SetMethod("_loadUrl", &WebContents::LoadURL)
- .SetMethod("_getUrl", &WebContents::GetURL)
+ .SetMethod("_loadURL", &WebContents::LoadURL)
+ .SetMethod("_getURL", &WebContents::GetURL)
.SetMethod("getTitle", &WebContents::GetTitle)
.SetMethod("isLoading", &WebContents::IsLoading)
.SetMethod("isWaitingForResponse", &WebContents::IsWaitingForResponse)
# downloadItem is an EventEmitter.
downloadItem.__proto__ = EventEmitter.prototype
# Deprecated.
- deprecate.property downloadItem, 'url', 'getUrl'
+ deprecate.property downloadItem, 'url', 'getURL'
deprecate.property downloadItem, 'filename', 'getFilename'
deprecate.property downloadItem, 'mimeType', 'getMimeType'
deprecate.property downloadItem, 'hasUserGesture', 'hasUserGesture'
+ deprecate.rename downloadItem, 'getUrl', 'getURL'
downloadItemBindings._setWrapDownloadItem wrapDownloadItem
# Only one App object pemitted.
-module.exports =
+{deprecate} = require 'electron'
+
+autoUpdater =
if process.platform is 'win32'
require './auto-updater/auto-updater-win'
else
require './auto-updater/auto-updater-native'
+
+# Deprecated.
+deprecate.rename autoUpdater, 'setFeedUrl', 'setFeedURL'
+
+module.exports = autoUpdater
squirrelUpdate.processStart()
app.quit()
- setFeedUrl: (updateUrl) ->
- @updateUrl = updateUrl
+ setFeedURL: (updateURL) ->
+ @updateURL = updateURL
checkForUpdates: ->
- return @emitError 'Update URL is not set' unless @updateUrl
+ return @emitError 'Update URL is not set' unless @updateURL
return @emitError 'Can not find Squirrel' unless squirrelUpdate.supported()
@emit 'checking-for-update'
- squirrelUpdate.download @updateUrl, (error, update) =>
+ squirrelUpdate.download @updateURL, (error, update) =>
return @emitError error if error?
return @emit 'update-not-available' unless update?
@emit 'update-available'
- squirrelUpdate.update @updateUrl, (error) =>
+ squirrelUpdate.update @updateURL, (error) =>
return @emitError error if error?
{releaseNotes, version} = update
# Following information is not available on Windows, so fake them.
date = new Date
- url = @updateUrl
+ url = @updateURL
@emit 'update-downloaded', {}, releaseNotes, version, date, url, => @quitAndInstall()
spawnUpdate ['--processStart', exeName], true, ->
# Download the releases specified by the URL and write new results to stdout.
-exports.download = (updateUrl, callback) ->
- spawnUpdate ['--download', updateUrl], false, (error, stdout) ->
+exports.download = (updateURL, callback) ->
+ spawnUpdate ['--download', updateURL], false, (error, stdout) ->
return callback(error) if error?
try
callback null, update
# Update the application to the latest remote version specified by URL.
-exports.update = (updateUrl, callback) ->
- spawnUpdate ['--update', updateUrl], false, callback
+exports.update = (updateURL, callback) ->
+ spawnUpdate ['--update', updateURL], false, callback
# Is the Update.exe installed with the current application?
exports.supported = ->
return window for window in windows when window.devToolsWebContents?.equal webContents
# Helpers.
-BrowserWindow::loadUrl = -> @webContents.loadUrl.apply @webContents, arguments
+BrowserWindow::loadURL = -> @webContents.loadURL.apply @webContents, arguments
+BrowserWindow::getURL = -> @webContents.getURL()
BrowserWindow::reload = -> @webContents.reload.apply @webContents, arguments
BrowserWindow::send = -> @webContents.send.apply @webContents, arguments
BrowserWindow::openDevTools = -> @webContents.openDevTools.apply @webContents, arguments
BrowserWindow::inspectServiceWorker = -> @webContents.inspectServiceWorker()
# Deprecated.
-deprecate.rename BrowserWindow, 'restart', 'reload'
deprecate.member BrowserWindow, 'undo', 'webContents'
deprecate.member BrowserWindow, 'redo', 'webContents'
deprecate.member BrowserWindow, 'cut', 'webContents'
deprecate.member BrowserWindow, 'copy', 'webContents'
deprecate.member BrowserWindow, 'paste', 'webContents'
deprecate.member BrowserWindow, 'selectAll', 'webContents'
-deprecate.member BrowserWindow, 'getUrl', 'webContents'
deprecate.member BrowserWindow, 'reloadIgnoringCache', 'webContents'
deprecate.member BrowserWindow, 'getPageTitle', 'webContents'
deprecate.member BrowserWindow, 'isLoading', 'webContents'
deprecate.member BrowserWindow, 'executeJavaScriptInDevTools', 'webContents'
deprecate.member BrowserWindow, 'print', 'webContents'
deprecate.member BrowserWindow, 'printToPDF', 'webContents'
+deprecate.rename BrowserWindow, 'restart', 'reload'
+deprecate.rename BrowserWindow, 'loadUrl', 'loadURL'
+deprecate.rename BrowserWindow, 'getUrl', 'getURL'
module.exports = BrowserWindow
# JavaScript implementation of Chromium's NavigationController.
# Instead of relying on Chromium for history control, we compeletely do history
-# control on user land, and only rely on WebContents.loadUrl for navigation.
+# control on user land, and only rely on WebContents.loadURL for navigation.
# This helps us avoid Chromium's various optimizations so we can ensure renderer
# process is restarted everytime.
class NavigationController
@clearHistory()
# webContents may have already navigated to a page.
- if @webContents._getUrl()
+ if @webContents._getURL()
@currentIndex++
- @history.push @webContents._getUrl()
+ @history.push @webContents._getURL()
@webContents.on 'navigation-entry-commited', (event, url, inPage, replaceEntry) =>
if @inPageIndex > -1 and not inPage
@currentIndex++
@history.push url
- loadUrl: (url, options={}) ->
+ loadURL: (url, options={}) ->
@pendingIndex = -1
- @webContents._loadUrl url, options
+ @webContents._loadURL url, options
@webContents.emit 'load-url', url, options
- getUrl: ->
+ getURL: ->
if @currentIndex is -1
''
else
reload: ->
@pendingIndex = @currentIndex
- @webContents._loadUrl @getUrl(), {}
+ @webContents._loadURL @getURL(), {}
reloadIgnoringCache: ->
@webContents._reloadIgnoringCache() # Rely on WebContents to clear cache.
if @inPageIndex > -1 and @pendingIndex >= @inPageIndex
@webContents._goBack()
else
- @webContents._loadUrl @history[@pendingIndex], {}
+ @webContents._loadURL @history[@pendingIndex], {}
goForward: ->
return unless @canGoForward()
if @inPageIndex > -1 and @pendingIndex >= @inPageIndex
@webContents._goForward()
else
- @webContents._loadUrl @history[@pendingIndex], {}
+ @webContents._loadURL @history[@pendingIndex], {}
goToIndex: (index) ->
return unless @canGoToIndex index
@pendingIndex = index
- @webContents._loadUrl @history[@pendingIndex], {}
+ @webContents._loadURL @history[@pendingIndex], {}
goToOffset: (offset) ->
return unless @canGoToOffset offset
{EventEmitter} = require 'events'
-{ipcMain, NavigationController, Menu} = require 'electron'
+{deprecate, ipcMain, NavigationController, Menu} = require 'electron'
binding = process.atomBinding 'web_contents'
# Make sure webContents.executeJavaScript would run the code only when the
# web contents has been loaded.
webContents.executeJavaScript = (code, hasUserGesture=false) ->
- if @getUrl() and not @isLoading()
+ if @getURL() and not @isLoading()
@_executeJavaScript code, hasUserGesture
else
webContents.once 'did-finish-load', @_executeJavaScript.bind(this, code, hasUserGesture)
menu = Menu.buildFromTemplate params.menu
menu.popup params.x, params.y
+ # Deprecated.
+ deprecate.rename webContents, 'loadUrl', 'loadURL'
+ deprecate.rename webContents, 'getUrl', 'getURL'
+
webContents.printToPDF = (options, callback) ->
printingSetting =
pageRage: []
// Notice that we just combined the api key with the url together here, because
// if we use the standard {url: key} format Chromium would override our key with
// the predefined one in common.gypi of libchromiumcontent, which is empty.
-const char* kGeolocationProviderUrl =
+const char* kGeolocationProviderURL =
"https://www.googleapis.com/geolocation/v1/geolocate?key="
GOOGLEAPIS_API_KEY;
const LoadAccessTokensCallbackType& callback) {
AccessTokenSet access_token_set;
- // Equivelent to access_token_set[kGeolocationProviderUrl].
+ // Equivelent to access_token_set[kGeolocationProviderURL].
// Somehow base::string16 is causing compilation errors when used in a pair
// of std::map on Linux, this can work around it.
std::pair<GURL, base::string16> token_pair;
- token_pair.first = GURL(kGeolocationProviderUrl);
+ token_pair.first = GURL(kGeolocationProviderURL);
access_token_set.insert(token_pair);
auto browser_context = AtomBrowserMainParts::Get()->browser_context();
autoHideMenuBar: true,
useContentSize: true,
});
- mainWindow.loadUrl('file://' + __dirname + '/index.html');
+ mainWindow.loadURL('file://' + __dirname + '/index.html');
mainWindow.focus();
});
opts = {}
opts.httpReferrer = params.httpreferrer if params.httpreferrer
opts.userAgent = params.useragent if params.useragent
- @loadUrl params.src, opts
+ @loadURL params.src, opts
if params.allowtransparency?
@setAllowTransparency params.allowtransparency
nodeIntegration: params.nodeintegration ? false
plugins: params.plugins
webSecurity: !params.disablewebsecurity
- webPreferences.preloadUrl = params.preload if params.preload
+ webPreferences.preloadURL = params.preload if params.preload
webViewManager.addGuest guestInstanceId, elementInstanceId, embedder, guest, webPreferences
guest.attachParams = params
createGuest = (embedder, url, frameName, options) ->
guest = frameToGuest[frameName]
if frameName and guest?
- guest.loadUrl url
+ guest.loadURL url
return guest.id
guest = new BrowserWindow(options)
- guest.loadUrl url
+ guest.loadURL url
# Remember the embedder, will be used by window.opener methods.
v8Util.setHiddenValue guest.webContents, 'embedder', embedder
ipcMain.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE', (event, guestId, message, targetOrigin) ->
guestContents = BrowserWindow.fromId(guestId)?.webContents
- if guestContents?.getUrl().indexOf(targetOrigin) is 0 or targetOrigin is '*'
+ if guestContents?.getURL().indexOf(targetOrigin) is 0 or targetOrigin is '*'
guestContents.send 'ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', guestId, message, targetOrigin
ipcMain.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPENER_POSTMESSAGE', (event, guestId, message, targetOrigin, sourceOrigin) ->
embedder = v8Util.getHiddenValue event.sender, 'embedder'
- if embedder?.getUrl().indexOf(targetOrigin) is 0 or targetOrigin is '*'
+ if embedder?.getURL().indexOf(targetOrigin) is 0 or targetOrigin is '*'
embedder.send 'ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', guestId, message, sourceOrigin
ipcMain.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD', (event, guestId, method, args...) ->
namespace atom {
-UrlRequestAsyncAsarJob::UrlRequestAsyncAsarJob(
+URLRequestAsyncAsarJob::URLRequestAsyncAsarJob(
net::URLRequest* request,
net::NetworkDelegate* network_delegate)
: JsAsker<asar::URLRequestAsarJob>(request, network_delegate) {
}
-void UrlRequestAsyncAsarJob::StartAsync(scoped_ptr<base::Value> options) {
+void URLRequestAsyncAsarJob::StartAsync(scoped_ptr<base::Value> options) {
base::FilePath::StringType file_path;
if (options->IsType(base::Value::TYPE_DICTIONARY)) {
static_cast<base::DictionaryValue*>(options.get())->GetString(
namespace atom {
// Like URLRequestAsarJob, but asks the JavaScript handler for file path.
-class UrlRequestAsyncAsarJob : public JsAsker<asar::URLRequestAsarJob> {
+class URLRequestAsyncAsarJob : public JsAsker<asar::URLRequestAsarJob> {
public:
- UrlRequestAsyncAsarJob(net::URLRequest*, net::NetworkDelegate*);
+ URLRequestAsyncAsarJob(net::URLRequest*, net::NetworkDelegate*);
// JsAsker:
void StartAsync(scoped_ptr<base::Value> options) override;
private:
- DISALLOW_COPY_AND_ASSIGN(UrlRequestAsyncAsarJob);
+ DISALLOW_COPY_AND_ASSIGN(URLRequestAsyncAsarJob);
};
} // namespace atom
command_line->AppendSwitchNative(switches::kPreloadScript, preload);
else
LOG(ERROR) << "preload script must have absolute path.";
- } else if (web_preferences.GetString(options::kPreloadUrl, &preload)) {
+ } else if (web_preferences.GetString(options::kPreloadURL, &preload)) {
// Translate to file path if there is "preload-url" option.
base::FilePath preload_path;
if (net::FileURLToFilePath(GURL(preload), &preload_path))
template_.Reset(isolate, mate::ObjectTemplateBuilder(isolate)
.SetMethod("toPng", &NativeImage::ToPNG)
.SetMethod("toJpeg", &NativeImage::ToJPEG)
- .SetMethod("toDataUrl", &NativeImage::ToDataURL)
+ .SetMethod("toDataURL", &NativeImage::ToDataURL)
+ .SetMethod("toDataUrl", &NativeImage::ToDataURL) // deprecated.
.SetMethod("isEmpty", &NativeImage::IsEmpty)
.SetMethod("getSize", &NativeImage::GetSize)
.SetMethod("setTemplateImage", &NativeImage::SetTemplateImage)
dict.SetMethod("createEmpty", &atom::api::NativeImage::CreateEmpty);
dict.SetMethod("createFromPath", &atom::api::NativeImage::CreateFromPath);
dict.SetMethod("createFromBuffer", &atom::api::NativeImage::CreateFromBuffer);
- dict.SetMethod("createFromDataUrl",
+ dict.SetMethod("createFromDataURL",
&atom::api::NativeImage::CreateFromDataURL);
}
-binding = process.atomBinding 'crash_reporter'
fs = require 'fs'
os = require 'os'
path = require 'path'
{spawn} = require 'child_process'
+electron = require 'electron'
+binding = process.atomBinding 'crash_reporter'
+
class CrashReporter
start: (options={}) ->
- {@productName, companyName, submitUrl, autoSubmit, ignoreSystemCrashHandler, extra} = options
+ {@productName, companyName, submitURL, autoSubmit, ignoreSystemCrashHandler, extra} = options
+
+ # Deprecated.
+ {deprecate} = electron
+ if options.submitUrl
+ submitURL ?= options.submitUrl
+ deprecate.warn 'submitUrl', 'submitURL'
- electron = require 'electron'
{app} =
if process.type is 'browser'
electron
@productName ?= app.getName()
companyName ?= 'GitHub, Inc'
- submitUrl ?= 'http://54.249.141.255:1127/post'
+ submitURL ?= 'http://54.249.141.255:1127/post'
autoSubmit ?= true
ignoreSystemCrashHandler ?= false
extra ?= {}
extra._companyName ?= companyName
extra._version ?= app.getVersion()
- start = => binding.start @productName, companyName, submitUrl, autoSubmit, ignoreSystemCrashHandler, extra
+ start = => binding.start @productName, companyName, submitURL, autoSubmit, ignoreSystemCrashHandler, extra
if process.platform is 'win32'
args = [
- "--reporter-url=#{submitUrl}"
+ "--reporter-url=#{submitURL}"
"--application-name=#{@productName}"
"--v=1"
]
-module.exports = process.atomBinding 'native_image'
+{deprecate} = require 'electron'
+nativeImage = process.atomBinding 'native_image'
+
+# Deprecated.
+deprecate.rename nativeImage, 'createFromDataUrl', 'createFromDataURL'
+
+module.exports = nativeImage
const char kPreloadScript[] = "preload";
// Like --preload, but the passed argument is an URL.
-const char kPreloadUrl[] = "preloadUrl";
+const char kPreloadURL[] = "preloadURL";
// Enable the node integration.
const char kNodeIntegration[] = "nodeIntegration";
// The command line switch versions of the options.
const char kZoomFactor[] = "zoom-factor";
const char kPreloadScript[] = "preload";
-const char kPreloadUrl[] = "preload-url";
+const char kPreloadURL[] = "preload-url";
const char kNodeIntegration[] = "node-integration";
const char kGuestInstanceID[] = "guest-instance-id";
const char kExperimentalFeatures[] = "experimental-features";
extern const char kDirectWrite[];
extern const char kZoomFactor[];
extern const char kPreloadScript[];
-extern const char kPreloadUrl[];
+extern const char kPreloadURL[];
extern const char kNodeIntegration[];
extern const char kGuestInstanceID[];
extern const char kExperimentalFeatures[];
extern const char kZoomFactor[];
extern const char kPreloadScript[];
-extern const char kPreloadUrl[];
+extern const char kPreloadURL[];
extern const char kNodeIntegration[];
extern const char kGuestInstanceID[];
extern const char kExperimentalFeatures[];
// "Some versions of windows (Win2k before SP3, Win XP before SP1) crash in
// ShellExecute on long URLs (bug 161357 on bugzilla.mozilla.org). IE 5 and 6
// support URLS of 2083 chars in length, 2K is safe."
- const size_t kMaxUrlLength = 2048;
- if (escaped_url.length() > kMaxUrlLength) {
+ const size_t kMaxURLLength = 2048;
+ if (escaped_url.length() > kMaxURLLength) {
NOTREACHED();
return false;
}
blink::WebString::fromUTF8(scheme));
}
-void WebFrame::RegisterURLSchemeAsBypassingCsp(const std::string& scheme) {
+void WebFrame::RegisterURLSchemeAsBypassingCSP(const std::string& scheme) {
// Register scheme to bypass pages's Content Security Policy.
blink::WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy(
blink::WebString::fromUTF8(scheme));
&WebFrame::RegisterElementResizeCallback)
.SetMethod("attachGuest", &WebFrame::AttachGuest)
.SetMethod("setSpellCheckProvider", &WebFrame::SetSpellCheckProvider)
- .SetMethod("registerUrlSchemeAsSecure",
+ .SetMethod("registerURLSchemeAsSecure",
&WebFrame::RegisterURLSchemeAsSecure)
- .SetMethod("registerUrlSchemeAsBypassingCsp",
- &WebFrame::RegisterURLSchemeAsBypassingCsp)
- .SetMethod("registerUrlSchemeAsPrivileged",
+ .SetMethod("registerURLSchemeAsBypassingCSP",
+ &WebFrame::RegisterURLSchemeAsBypassingCSP)
+ .SetMethod("registerURLSchemeAsPrivileged",
&WebFrame::RegisterURLSchemeAsPrivileged);
}
v8::Local<v8::Object> provider);
void RegisterURLSchemeAsSecure(const std::string& scheme);
- void RegisterURLSchemeAsBypassingCsp(const std::string& scheme);
+ void RegisterURLSchemeAsBypassingCSP(const std::string& scheme);
void RegisterURLSchemeAsPrivileged(const std::string& scheme);
// mate::Wrappable:
-module.exports = process.atomBinding('web_frame').webFrame
+{deprecate} = require 'electron'
+{webFrame} = process.atomBinding 'web_frame'
+
+# Deprecated.
+deprecate.rename webFrame, 'registerUrlSchemeAsSecure', 'registerURLSchemeAsSecure'
+deprecate.rename webFrame, 'registerUrlSchemeAsBypassingCSP', 'registerURLSchemeAsBypassingCSP'
+deprecate.rename webFrame, 'registerUrlSchemeAsPrivileged', 'registerURLSchemeAsPrivileged'
+
+module.exports = webFrame
# Helper function to resolve relative url.
a = window.top.document.createElement 'a'
-resolveUrl = (url) ->
+resolveURL = (url) ->
a.href = url
a.href
options.height ?= 600
# Resolve relative urls.
- url = resolveUrl url
+ url = resolveURL url
(options[name] = parseInt(options[name], 10) if options[name]?) for name in ints
WEB_VIEW_EVENTS =
'load-commit': ['url', 'isMainFrame']
'did-finish-load': []
- 'did-fail-load': ['errorCode', 'errorDescription', 'validatedUrl']
+ 'did-fail-load': ['errorCode', 'errorDescription', 'validatedURL']
'did-frame-finish-load': ['isMainFrame']
'did-start-loading': []
'did-stop-loading': []
- 'did-get-response-details': ['status', 'newUrl', 'originalUrl',
+ 'did-get-response-details': ['status', 'newURL', 'originalURL',
'httpResponseCode', 'requestMethod', 'referrer',
'headers']
- 'did-get-redirect-request': ['oldUrl', 'newUrl', 'isMainFrame']
+ 'did-get-redirect-request': ['oldURL', 'newURL', 'isMainFrame']
'dom-ready': []
'console-message': ['level', 'message', 'line', 'sourceId']
'new-window': ['url', 'frameName', 'disposition', 'options']
# Helper function to resolve url set in attribute.
a = document.createElement 'a'
-resolveUrl = (url) ->
+resolveURL = (url) ->
a.href = url
a.href
getValue: ->
if @webViewImpl.webviewNode.hasAttribute @name
- resolveUrl @webViewImpl.webviewNode.getAttribute(@name)
+ resolveURL @webViewImpl.webviewNode.getAttribute(@name)
else
''
if useragent then opts.userAgent = useragent
guestContents = remote.getGuestWebContents(@webViewImpl.guestInstanceId)
- guestContents.loadUrl @getValue(), opts
+ guestContents.loadURL @getValue(), opts
# Attribute specifies HTTP referrer.
class HttpReferrerAttribute extends WebViewAttribute
getValue: ->
return '' unless @webViewImpl.webviewNode.hasAttribute @name
- preload = resolveUrl @webViewImpl.webviewNode.getAttribute(@name)
+ preload = resolveURL @webViewImpl.webviewNode.getAttribute(@name)
protocol = preload.substr 0, 5
unless protocol is 'file:'
console.error webViewConstants.ERROR_MSG_INVALID_PRELOAD_ATTRIBUTE
-{webFrame, remote} = require 'electron'
+{deprecate, webFrame, remote} = require 'electron'
v8Util = process.atomBinding 'v8_util'
guestViewInternal = require './guest-view-internal'
# Public-facing API methods.
methods = [
- "getUrl"
- "getTitle"
- "isLoading"
- "isWaitingForResponse"
- "stop"
- "reload"
- "reloadIgnoringCache"
- "canGoBack"
- "canGoForward"
- "canGoToOffset"
- "clearHistory"
- "goBack"
- "goForward"
- "goToIndex"
- "goToOffset"
- "isCrashed"
- "setUserAgent"
- "getUserAgent"
- "executeJavaScript"
- "insertCSS"
- "openDevTools"
- "closeDevTools"
- "isDevToolsOpened"
- "inspectElement"
- "setAudioMuted"
- "isAudioMuted"
- "undo"
- "redo"
- "cut"
- "copy"
- "paste"
- "pasteAndMatchStyle"
- "delete"
- "selectAll"
- "unselect"
- "replace"
- "replaceMisspelling"
- "send"
- "getId"
- "inspectServiceWorker"
- "print"
- "printToPDF"
- "sendInputEvent"
+ 'getURL'
+ 'getTitle'
+ 'isLoading'
+ 'isWaitingForResponse'
+ 'stop'
+ 'reload'
+ 'reloadIgnoringCache'
+ 'canGoBack'
+ 'canGoForward'
+ 'canGoToOffset'
+ 'clearHistory'
+ 'goBack'
+ 'goForward'
+ 'goToIndex'
+ 'goToOffset'
+ 'isCrashed'
+ 'setUserAgent'
+ 'getUserAgent'
+ 'executeJavaScript'
+ 'insertCSS'
+ 'openDevTools'
+ 'closeDevTools'
+ 'isDevToolsOpened'
+ 'inspectElement'
+ 'setAudioMuted'
+ 'isAudioMuted'
+ 'undo'
+ 'redo'
+ 'cut'
+ 'copy'
+ 'paste'
+ 'pasteAndMatchStyle'
+ 'delete'
+ 'selectAll'
+ 'unselect'
+ 'replace'
+ 'replaceMisspelling'
+ 'send'
+ 'getId'
+ 'inspectServiceWorker'
+ 'print'
+ 'printToPDF'
+ 'sendInputEvent'
]
# Forward proto.foo* method calls to WebViewImpl.foo*.
internal.webContents[m] args...
proto[m] = createHandler m for m in methods
+ # Deprecated.
+ deprecate.rename proto, 'getUrl', 'getURL'
+
window.WebView = webFrame.registerEmbedderCustomElement 'webview',
prototype: proto
* `releaseNotes` String
* `releaseName` String
* `releaseDate` Date
-* `updateUrl` String
+* `updateURL` String
Emitted when an update has been downloaded.
The `autoUpdater` object has the following methods:
-### `autoUpdater.setFeedUrl(url)`
+### `autoUpdater.setFeedURL(url)`
* `url` String
### `autoUpdater.checkForUpdates()`
-Asks the server whether there is an update. You must call `setFeedUrl` before
+Asks the server whether there is an update. You must call `setFeedURL` before
using this API.
### `autoUpdater.quitAndInstall()`
win = null;
});
-win.loadUrl('https://github.com');
+win.loadURL('https://github.com');
win.show();
```
Same as `webContents.printToPDF(options, callback)`
-### `win.loadUrl(url[, options])`
+### `win.loadURL(url[, options])`
-Same as `webContents.loadUrl(url[, options])`.
+Same as `webContents.loadURL(url[, options])`.
### `win.reload()`
crashReporter.start({
productName: 'YourName',
companyName: 'YourCompany',
- submitUrl: 'https://your-domain.com/url-to-submit',
+ submitURL: 'https://your-domain.com/url-to-submit',
autoSubmit: true
});
```
* `productName` String, default: Electron.
* `companyName` String, default: GitHub, Inc.
-* `submitUrl` String, default: http://54.249.141.255:1127/post.
+* `submitURL` String, default: http://54.249.141.255:1127/post.
* URL that crash reports will be sent to as POST.
* `autoSubmit` Boolean, default: `true`.
* Send the crash report without user interaction.
## crash-reporter Payload
-The crash reporter will send the following data to the `submitUrl` as `POST`:
+The crash reporter will send the following data to the `submitURL` as `POST`:
* `ver` String - The version of Electron.
* `platform` String - e.g. 'win32'.
Cancels the download operation.
-### `downloadItem.getUrl()`
+### `downloadItem.getURL()`
Returns a `String` represents the origin url where the item is downloaded from.
Creates a new `nativeImage` instance from `buffer`. The default `scaleFactor` is
1.0.
-### `nativeImage.createFromDataUrl(dataUrl)`
+### `nativeImage.createFromDataURL(dataURL)`
-* `dataUrl` String
+* `dataURL` String
-Creates a new `nativeImage` instance from `dataUrl`.
+Creates a new `nativeImage` instance from `dataURL`.
## Instance Methods
Returns a [Buffer][buffer] that contains the image's `JPEG` encoded data.
-### `image.toDataUrl()`
+### `image.toDataURL()`
Returns the data URL of the image.
const BrowserWindow = remote.require('electron').BrowserWindow;
var win = new BrowserWindow({ width: 800, height: 600 });
-win.loadUrl('https://github.com');
+win.loadURL('https://github.com');
```
**Note:** for the reverse (access the renderer process from the main process),
const BrowserWindow = require('electron').BrowserWindow;
var win = new BrowserWindow({ width: 800, height: 600 });
-win.loadUrl("http://github.com");
+win.loadURL("http://github.com");
var session = win.webContents.session
```
```javascript
session.on('will-download', function(event, item, webContents) {
event.preventDefault();
- require('request')(item.getUrl(), function(data) {
+ require('request')(item.getURL(), function(data) {
require('fs').writeFileSync('/somewhere', data);
});
});
var win = new BrowserWindow({ width: 800, height: 600 });
-win.loadUrl('https://github.com');
+win.loadURL('https://github.com');
win.webContents.on('did-finish-load', function() {
// Query all cookies.
app.on('ready', function() {
window = new BrowserWindow({width: 800, height: 600});
- window.loadUrl('https://github.com');
+ window.loadURL('https://github.com');
});
```
const BrowserWindow = require('electron').BrowserWindow;
var win = new BrowserWindow({width: 800, height: 1500});
-win.loadUrl("http://github.com");
+win.loadURL("http://github.com");
var webContents = win.webContents;
```
* `event` Event
* `errorCode` Integer
* `errorDescription` String
-* `validatedUrl` String
+* `validatedURL` String
This event is like `did-finish-load` but emitted when the load failed or was
cancelled, e.g. `window.stop()` is invoked.
* `event` Event
* `status` Boolean
-* `newUrl` String
-* `originalUrl` String
+* `newURL` String
+* `originalURL` String
* `httpResponseCode` Integer
* `requestMethod` String
* `referrer` String
Returns:
* `event` Event
-* `oldUrl` String
-* `newUrl` String
+* `oldURL` String
+* `newURL` String
* `isMainFrame` Boolean
* `httpResponseCode` Integer
* `requestMethod` String
Returns:
* `event` Event
-* `favicons` Array - Array of Urls
+* `favicons` Array - Array of URLs
Emitted when page receives favicon urls.
`window.location` object is changed or a user clicks a link in the page.
This event will not emit when the navigation is started programmatically with
-APIs like `webContents.loadUrl` and `webContents.back`.
+APIs like `webContents.loadURL` and `webContents.back`.
Calling `event.preventDefault()` will prevent the navigation.
See [session documentation](session.md) for this object's methods.
-### `webContents.loadUrl(url[, options])`
+### `webContents.loadURL(url[, options])`
* `url` URL
* `options` Object (optional), properties:
Loads the `url` in the window, the `url` must contain the protocol prefix,
e.g. the `http://` or `file://`.
-### `webContents.getUrl()`
+### `webContents.getURL()`
Returns URL of the current web page.
```javascript
var win = new BrowserWindow({width: 800, height: 600});
-win.loadUrl("http://github.com");
+win.loadURL("http://github.com");
-var currentUrl = win.webContents.getUrl();
+var currentURL = win.webContents.getURL();
```
### `webContents.getTitle()`
const fs = require('fs');
var win = new BrowserWindow({width: 800, height: 600});
-win.loadUrl("http://github.com");
+win.loadURL("http://github.com");
win.webContents.on("did-finish-load", function() {
// Use default printing options
var window = null;
app.on('ready', function() {
window = new BrowserWindow({width: 800, height: 600});
- window.loadUrl('file://' + __dirname + '/index.html');
+ window.loadURL('file://' + __dirname + '/index.html');
window.webContents.on('did-finish-load', function() {
window.webContents.send('ping', 'whoooooooh!');
});
Returns true if the process of saving page has been initiated successfully.
```javascript
-win.loadUrl('https://github.com');
+win.loadURL('https://github.com');
win.webContents.on('did-finish-load', function() {
win.webContents.savePage('/tmp/test.html', 'HTMLComplete', function(error) {
});
```
-### `webFrame.registerUrlSchemeAsSecure(scheme)`
+### `webFrame.registerURLSchemeAsSecure(scheme)`
* `scheme` String
`data` are secure schemes because they cannot be corrupted by active network
attackers.
-### `webFrame.registerUrlSchemeAsBypassingCsp(scheme)`
+### `webFrame.registerURLSchemeAsBypassingCSP(scheme)`
* `scheme` String
Resources will be loaded from this `scheme` regardless of the current page's
Content Security Policy.
-### `webFrame.registerUrlSchemeAsPrivileged(scheme)`
+### `webFrame.registerURLSchemeAsPrivileged(scheme)`
* `scheme` String
});
```
-### `<webview>.getUrl()`
+### `<webview>.getURL()`
Returns URL of guest page.
* `errorCode` Integer
* `errorDescription` String
-* `validatedUrl` String
+* `validatedURL` String
This event is like `did-finish-load`, but fired when the load failed or was
cancelled, e.g. `window.stop()` is invoked.
Returns:
* `status` Boolean
-* `newUrl` String
-* `originalUrl` String
+* `newURL` String
+* `originalURL` String
* `httpResponseCode` Integer
* `requestMethod` String
* `referrer` String
Returns:
-* `oldUrl` String
-* `newUrl` String
+* `oldURL` String
+* `newURL` String
* `isMainFrame` Boolean
Fired when a redirect was received while requesting a resource.
Returns:
-* `favicons` Array - Array of Urls.
+* `favicons` Array - Array of URLs.
Fired when page receives favicon urls.
```javascript
const BrowserWindow = require('electron').BrowserWindow;
var win = new BrowserWindow({width: 800, height: 600});
-win.loadUrl('file:///path/to/example.asar/static/index.html');
+win.loadURL('file:///path/to/example.asar/static/index.html');
```
### Web API
var onlineStatusWindow;
app.on('ready', function() {
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
- onlineStatusWindow.loadUrl('file://' + __dirname + '/online-status.html');
+ onlineStatusWindow.loadURL('file://' + __dirname + '/online-status.html');
});
```
var onlineStatusWindow;
app.on('ready', function() {
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
- onlineStatusWindow.loadUrl('file://' + __dirname + '/online-status.html');
+ onlineStatusWindow.loadURL('file://' + __dirname + '/online-status.html');
});
ipcMain.on('online-status-changed', function(event, status) {
mainWindow = new BrowserWindow({width: 800, height: 600});
// and load the index.html of the app.
- mainWindow.loadUrl('file://' + __dirname + '/index.html');
+ mainWindow.loadURL('file://' + __dirname + '/index.html');
// Open the DevTools.
mainWindow.webContents.openDevTools();
'plugins': true
}
});
- mainWindow.loadUrl('file://' + __dirname + '/index.html');
+ mainWindow.loadURL('file://' + __dirname + '/index.html');
// Something else
});
```
fs.unlinkSync(test)
assert.equal String(content), 'unload'
done()
- w.loadUrl 'file://' + path.join(fixtures, 'api', 'unload.html')
+ w.loadURL 'file://' + path.join(fixtures, 'api', 'unload.html')
it 'should emit beforeunload handler', (done) ->
w.on 'onbeforeunload', ->
done()
w.webContents.on 'did-finish-load', ->
w.close()
- w.loadUrl 'file://' + path.join(fixtures, 'api', 'beforeunload-false.html')
+ w.loadURL 'file://' + path.join(fixtures, 'api', 'beforeunload-false.html')
describe 'window.close()', ->
it 'should emit unload handler', (done) ->
fs.unlinkSync(test)
assert.equal String(content), 'close'
done()
- w.loadUrl 'file://' + path.join(fixtures, 'api', 'close.html')
+ w.loadURL 'file://' + path.join(fixtures, 'api', 'close.html')
it 'should emit beforeunload handler', (done) ->
w.on 'onbeforeunload', ->
done()
- w.loadUrl 'file://' + path.join(fixtures, 'api', 'close-beforeunload-false.html')
+ w.loadURL 'file://' + path.join(fixtures, 'api', 'close-beforeunload-false.html')
- describe 'BrowserWindow.loadUrl(url)', ->
+ describe 'BrowserWindow.loadURL(url)', ->
it 'should emit did-start-loading event', (done) ->
w.webContents.on 'did-start-loading', ->
done()
- w.loadUrl 'about:blank'
+ w.loadURL 'about:blank'
it 'should emit did-fail-load event', (done) ->
w.webContents.on 'did-fail-load', ->
done()
- w.loadUrl 'file://a.txt'
+ w.loadURL 'file://a.txt'
describe 'BrowserWindow.show()', ->
it 'should focus on window', ->
show: false
webPreferences:
preload: preload
- w.loadUrl 'file://' + path.join(fixtures, 'api', 'preload.html')
+ w.loadURL 'file://' + path.join(fixtures, 'api', 'preload.html')
describe '"node-integration" option', ->
it 'disables node integration when specified to false', (done) ->
webPreferences:
preload: preload
nodeIntegration: false
- w.loadUrl 'file://' + path.join(fixtures, 'api', 'blank.html')
+ w.loadURL 'file://' + path.join(fixtures, 'api', 'blank.html')
describe 'beforeunload handler', ->
it 'returning true would not prevent close', (done) ->
w.on 'closed', ->
done()
- w.loadUrl 'file://' + path.join(fixtures, 'api', 'close-beforeunload-true.html')
+ w.loadURL 'file://' + path.join(fixtures, 'api', 'close-beforeunload-true.html')
it 'returning non-empty string would not prevent close', (done) ->
w.on 'closed', ->
done()
- w.loadUrl 'file://' + path.join(fixtures, 'api', 'close-beforeunload-string.html')
+ w.loadURL 'file://' + path.join(fixtures, 'api', 'close-beforeunload-string.html')
it 'returning false would prevent close', (done) ->
w.on 'onbeforeunload', ->
done()
- w.loadUrl 'file://' + path.join(fixtures, 'api', 'close-beforeunload-false.html')
+ w.loadURL 'file://' + path.join(fixtures, 'api', 'close-beforeunload-false.html')
it 'returning empty string would prevent close', (done) ->
w.on 'onbeforeunload', ->
done()
- w.loadUrl 'file://' + path.join(fixtures, 'api', 'close-beforeunload-empty-string.html')
+ w.loadURL 'file://' + path.join(fixtures, 'api', 'close-beforeunload-empty-string.html')
describe 'new-window event', ->
return if isCI and process.platform is 'darwin'
assert.equal url, 'http://host/'
assert.equal frameName, 'host'
done()
- w.loadUrl "file://#{fixtures}/pages/window-open.html"
+ w.loadURL "file://#{fixtures}/pages/window-open.html"
it 'emits when link with target is called', (done) ->
w.webContents.once 'new-window', (e, url, frameName) ->
assert.equal url, 'http://host/'
assert.equal frameName, 'target'
done()
- w.loadUrl "file://#{fixtures}/pages/target-name.html"
+ w.loadURL "file://#{fixtures}/pages/target-name.html"
describe 'maximize event', ->
return if isCI
xdescribe 'beginFrameSubscription method', ->
it 'subscribes frame updates', (done) ->
- w.loadUrl "file://#{fixtures}/api/blank.html"
+ w.loadURL "file://#{fixtures}/api/blank.html"
w.webContents.beginFrameSubscription (data) ->
assert.notEqual data.length, 0
w.webContents.endFrameSubscription()
fs.rmdirSync savePageDir
done()
- w.loadUrl "file://#{fixtures}/pages/save_page/index.html"
+ w.loadURL "file://#{fixtures}/pages/save_page/index.html"
p = path.join fixtures, 'assets', 'logo.png'
i = nativeImage.createFromPath p
clipboard.writeImage p
- assert.equal clipboard.readImage().toDataUrl(), i.toDataUrl()
+ assert.equal clipboard.readImage().toDataURL(), i.toDataURL()
describe 'clipboard.readText()', ->
it 'returns unicode string correctly', ->
clipboard.write {text: "test", html: '<b>Hi</b>', image: p}
assert.equal clipboard.readText(), text
assert.equal clipboard.readHtml(), markup
- assert.equal clipboard.readImage().toDataUrl(), i.toDataUrl()
+ assert.equal clipboard.readImage().toDataURL(), i.toDataURL()
pathname: path.join fixtures, 'api', 'crash.html'
search: "?port=#{port}"
if process.platform is 'darwin'
- crashReporter.start {'submitUrl': 'http://127.0.0.1:' + port}
- w.loadUrl url
+ crashReporter.start {'submitURL': 'http://127.0.0.1:' + port}
+ w.loadURL url
event.returnValue = null
w.destroy()
done()
- w.loadUrl 'file://' + path.join(fixtures, 'api', 'send-sync-message.html')
+ w.loadURL 'file://' + path.join(fixtures, 'api', 'send-sync-message.html')
describe 'remote listeners', ->
it 'can be added and removed correctly', ->
server.listen 0, '127.0.0.1', ->
{port} = server.address()
- w.loadUrl "#{url}:#{port}"
+ w.loadURL "#{url}:#{port}"
w.webContents.on 'did-finish-load', ->
w.webContents.session.cookies.get {url: url}, (error, list) ->
return done(error) if error
ipcMain.removeAllListeners 'count'
assert not count
done()
- w.loadUrl 'file://' + path.join(fixtures, 'api', 'localstorage.html')
+ w.loadURL 'file://' + path.join(fixtures, 'api', 'localstorage.html')
w.webContents.on 'did-finish-load', ->
options =
origin: "file://",
downloadServer.listen 0, '127.0.0.1', ->
{port} = downloadServer.address()
ipcRenderer.sendSync 'set-download-option', false
- w.loadUrl "#{url}:#{port}"
+ w.loadURL "#{url}:#{port}"
ipcRenderer.once 'download-done', (event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename) ->
assert.equal state, 'completed'
assert.equal filename, 'mock.pdf'
downloadServer.listen 0, '127.0.0.1', ->
{port} = downloadServer.address()
ipcRenderer.sendSync 'set-download-option', true
- w.loadUrl "#{url}:#{port}/"
+ w.loadURL "#{url}:#{port}/"
ipcRenderer.once 'download-done', (event, state, url, mimeType, receivedBytes, totalBytes, disposition, filename) ->
assert.equal state, 'cancelled'
assert.equal filename, 'mock.pdf'
ipcMain.once 'dirname', (event, dirname) ->
assert.equal dirname, path.dirname(p)
done()
- w.loadUrl u
+ w.loadURL u
it 'loads script tag in html', (done) ->
after ->
w = new BrowserWindow(show: false, width: 400, height: 400)
p = path.resolve fixtures, 'asar', 'script.asar', 'index.html'
u = url.format protocol: 'file', slashed: true, pathname: p
- w.loadUrl u
+ w.loadURL u
ipcMain.once 'ping', (event, message) ->
assert.equal message, 'pong'
done()
w.webContents.on 'ipc-message', (event, args) ->
assert.deepEqual args, ['hidden', true]
done()
- w.loadUrl url
+ w.loadURL url
describe 'navigator.webkitGetUserMedia', ->
it 'calls its callbacks', (done) ->
w.webContents.on 'ipc-message', (event, args) ->
assert.deepEqual args, ['opener', null]
done()
- w.loadUrl url
+ w.loadURL url
it 'is not null for window opened by window.open', (done) ->
listener = (event) ->
crashReporter.start({
productName: 'Zombies',
companyName: 'Umbrella Corporation',
- submitUrl: 'http://127.0.0.1:' + port,
+ submitURL: 'http://127.0.0.1:' + port,
autoSubmit: true,
ignoreSystemCrashHandler: true,
extra: {
javascript: true // Test whether web-preferences crashes.
},
});
- window.loadUrl('file://' + __dirname + '/index.html');
+ window.loadURL('file://' + __dirname + '/index.html');
window.on('unresponsive', function() {
var chosen = dialog.showMessageBox(window, {
type: 'warning',
item.on('done', function(e, state) {
window.webContents.send('download-done',
state,
- item.getUrl(),
+ item.getURL(),
item.getMimeType(),
item.getReceivedBytes(),
item.getTotalBytes(),