chore: address TODO for WebContents.prototype.setSize / reportRemovedAttribute removal (#14517)

* chore: remove WebContents.prototype.setSize

* chore: remove reportRemovedAttribute

* chore: remove unused fixtures
This commit is contained in:
Milan Burda 2018-09-11 09:58:57 +02:00 committed by Samuel Attard
parent f5aac36421
commit 38419e3a6a
4 changed files with 0 additions and 71 deletions

View file

@ -269,12 +269,6 @@ WebContents.prototype.getZoomFactor = function (callback) {
})
}
// TODO(zcbenz): Remove the stub in 4.0.
WebContents.prototype.setSize = function () {
console.error('The WebContents.setSize method has been removed, see',
'https://github.com/electron/electron/issues/14120 for more.')
}
// Add JavaScript wrappers for WebContents class.
WebContents.prototype._init = function () {
// The navigation controller.

View file

@ -16,13 +16,6 @@ const getNextId = function () {
return ++nextId
}
// A list of removed attributes from 3.0.
const removedAttributes = [
'autoresize',
'disableguestresize',
'guestinstance'
]
// Represents the internal state of the WebView node.
class WebViewImpl {
constructor (webviewNode) {
@ -32,13 +25,6 @@ class WebViewImpl {
this.beforeFirstNavigation = true
this.hasFocus = false
// Check for removed attributes.
for (const attributeName of removedAttributes) {
if (this.webviewNode.hasAttribute(attributeName)) {
this.reportRemovedAttribute(attributeName)
}
}
// on* Event handlers.
this.on = {}
@ -106,11 +92,6 @@ class WebViewImpl {
// attribute, if necessary. See BrowserPlugin::UpdateDOMAttribute for more
// details.
handleWebviewAttributeMutation (attributeName, oldValue, newValue) {
if (removedAttributes.includes(attributeName)) {
this.reportRemovedAttribute(attributeName)
return
}
if (!this.attributes[attributeName] || this.attributes[attributeName].ignoreMutation) {
return
}
@ -215,12 +196,6 @@ class WebViewImpl {
// even documented.
this.resizeObserver = new ResizeObserver(this.onElementResize.bind(this)).observe(this.internalElement)
}
// TODO(zcbenz): Remove the warning in 4.0.
reportRemovedAttribute (attributeName) {
console.error(`The "${attributeName}" attribute has been removed from the <webview> tag,`,
'see https://github.com/electron/electron/issues/14120 for more.')
}
}
// Registers <webview> custom element.

View file

@ -1,17 +0,0 @@
<html>
<body>
<script type="text/javascript" charset="utf-8">
var ipcRenderer = require('electron').ipcRenderer
ipcRenderer.on('guestinstance', function(event, instance) {
var webview = new WebView()
webview.setAttribute('guestinstance', instance)
document.body.appendChild(webview)
webview.addEventListener('did-attach', function (){
ipcRenderer.send('pong')
})
})
</script>
</body>
</html>

View file

@ -1,23 +0,0 @@
<html>
<style>
* {
width: 100%;
height: 100%;
margin: 0;
}
</style>
<body>
<webview id="webview" nodeintegration disableguestresize src="resize.html"/>
</body>
<script type="text/javascript" charset="utf-8">
const {ipcRenderer} = require('electron')
const webview = document.getElementById('webview')
webview.addEventListener('did-finish-load', () => {
ipcRenderer.send('webview-loaded')
}, {once: true})
webview.addEventListener('resize', event => {
ipcRenderer.send('webview-element-resize', event.newWidth, event.newHeight)
}, false)
</script>
</html>