text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_prefix|>import test from 'tape'
import WebTorrent from '../../index.js'
import fixtures from 'webtorrent-fixtures'
import get from 'simple-get'
// The image append/render tests don't work in electron, so skip them
// TODO get these working
// logic taken from https://github.com/atom/electron/issues/2288#issuecom... | fim | webtorrent/webtorrent | javascript |
<|fim_suffix|>
const parsedTorrentAlice = Object.assign({}, fixtures.alice.parsedTorrent)
parsedTorrentAlice.announce = ['wss://example.com', 'wss://example.com', 'wss://example.com']
const client = new WebTorrent({ dht: false, tracker: false, lsd: false, natUpnp: false, natPmp: false })
client.on('error', e... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fixtures from 'webtorrent-fixtures'
import test from 'tape'
import WebTorrent from '../index.js'
test('client.add: magnet uri, utf-8 string', t => {
t.plan(6)
const client = new WebTorrent({ dht: false, tracker: false, lsd: false, natUpnp: false, natPmp: false })
client.on('error', err => ... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fixtures from 'webtorrent-fixtures'
import test from 'tape'
import WebTorrent from '../index.js'
test('after client.destroy(), throw on client.add() or client.seed()', t => {
t.plan(3)
const client = new WebTorrent({ dht: false, tracker: false, lsd: false, natUpnp: false, natPmp: false })
<|... | fim | webtorrent/webtorrent | javascript |
<|fim_suffix|> torrent.on('infoHash', async () => {
t.equal(torrent.infoHash, fixtures.leaves.parsedTorrent.infoHash)
await client.remove(torrent, err => { t.error(err, 'torrent destroyed') })
t.equal(client.torrents.length, 0)
client.destroy(err => { t.error(err, 'client destroyed') })
})
})
<|fim_... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fixtures from 'webtorrent-fixtures'
import test from 'tape'
import WebTorrent from '../index.js'
test('client.seed: torrent file (Buffer)', t => {
t.plan(6)
const client = new WebTorrent({ dht: false, tracker: false, lsd: false, natUpnp: false, natPmp: false })
client.on('error', err => { ... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import os from 'os'
import fs from 'fs'
import path from 'path'
const getDownloadPath = (infix, infoHash) <|fim_suffix|>r) {
tmpPath = path.join(typeof os.tmpdir === 'function' ? os.tmpdir() : '/')
}
return path.join(tmpPath, 'webtorrent', 'test', infix, infoHash)
}
export default { getDownloadP... | fim | webtorrent/webtorrent | javascript |
<|fim_suffix|>on('error', err => { t.fail(err) })
client.on('warning', err => { t.fail(err) })
client.seed(fixtures.leaves.content, {
name: 'Leaves of Grass by Walt Whitman.epub',
announce: []
}, torrent1 => {
t.equal(client.torrents.length, 1)
const torrent2 = client.add(torrent1.infoHash)
... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fixtures from 'webtorrent-fixtures'
import test from 'tape'
import WebTorrent from '../index.js'
test('file buffer: use chunk store iterator if done', t => {
t.plan(8)
const client = new WebTorrent({ dht: false, tracker: false, lsd: false, natUpnp: false, natPmp: false })
client.on('error'... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fixtures from 'webtorrent-fixtures'
import test from 'tape'
import FileIterator from '../lib/file-iterator.js'
import WebTorrent from '../index.js'
test('file iterator: use chunk store iterator if done', t => {
t.plan(<|fim_suffix|>erator.return()
await client.remove(fixtures.leaves.torrent... | fim | webtorrent/webtorrent | javascript |
<|fim_suffix|>= torrent.path
client.remove(torrent, { destroyStore: true }, err => {
if (err) t.fail(err)
fs.stat(path.join(torrentPath, 'alice.txt'), err => {
if (err && err.code === 'ENOENT') t.pass('file deleted')
else t.fail('file still exists')
client.destroy(err => { t.er... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import { Server as DHT } from 'bittorrent-dht'
import fixtures from 'webtorrent-fixtures'
import series from 'run-series'
import test from 'tape'
import WebTorrent from '../../index.js'
import common from '../common.js'
test('blockl<|fim_suffix|> {
t.error(err, 'client2 destroyed')
})
})
})
<... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fixtures from 'webtorrent-fixtures'
import series from 'run-series'
import test from 'tape'
import { Server as TrackerServer } from 'bittorrent-tracker'
import WebTorrent from '../../index.js'
import common from '../common.js'
test('blocklist blocks peers discovered via tracker', t => {
t.plan(9... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fs from 'fs'
import http from 'http'
import zlib from 'zlib'
import fixtures from 'webtorrent-fixtures'
import test from 'tape'
import WebTorrent from '../../index.js'
function assertBlocked (t, torrent, addr) {
torrent.once('blockedPeer', _addr => {
t.equal(addr, _addr)
})
t.notOk(torre... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fixtures from 'webtorrent-fixtures'
import MemoryChunkStore from 'memory-chunk-store'
import test from 'tape'
import WebTorrent from '../../index.js'
function setupClient ({ t, onTorrent, onIdle, addTorrentProps = {} }) {
const client1 = new WebTorrent({ dht: false, tracker: false, lsd: false, u... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import test from 'tape'
import fixtures from 'webtorrent-fixtures'
import MemoryChunkStore from 'memory-chunk-store'
import dgram from 'dgram'
import WebTorrent from '../../index.js'
test('client.conn-pool: use TCP when uTP disabled', t => {
t.plan(6)
const client1 = new WebTorrent({ dht: false, tra... | fim | webtorrent/webtorrent | javascript |
<|fim_suffix|> }
gotBuffer = true
maybeDone()
})
client2.add(fixtures.leaves.magnetURI, { store: MemoryChunkStore })
function maybeDone () {
if (gotBuffer && gotDone) cb(null)
}
}
], err => {
t.error(err)
client1.destroy(err => {
t.error(err, '... | fim | webtorrent/webtorrent | javascript |
<|fim_suffix|>uffer()
t.deepEqual(new Uint8Array(ab), new Uint8Array(fixtures.leaves.content), 'downloaded correct content')
} catch (err) {
t.error(err)
}
gotBuffer = true
maybeDone()
}
})
client2.add(fixtures.leaves.parsedTorrent, { ... | fim | webtorrent/webtorrent | javascript |
<|fim_suffix|>ew Uint8Array(fixtures.leaves.content), 'downloaded correct content')
} catch (err) {
t.error(err)
}
seeder.destroy((err) => t.error(err, 'seeder destroyed'))
downloader.destroy((err) => t.error(err, 'downloader destroyed'))
}
})
})
... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fi<|fim_suffix|>ent 2 destroyed') })
})
})
<|fim_middle|>xtures from 'webtorrent-fixtures'
import MemoryChunkStore from 'memory-chunk-store'
import test from 'tape'
import WebTorrent from '../../index.js'
test('Download using LSD (via magnet uri)', t => {
t.plan(3)
const client1 = new WebTo... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fixtures from 'webtorrent-fixtures'
import MemoryChunkStore from 'memory-chunk-store'
import test from 'tape'
import WebTorrent from '../../index.js'
test('Download using LSD (via .torrent file)', t => {
t.plan(3)
const client1 = new WebTorrent({ dht: false, tracker: false, lsd: true })
con... | fim | webtorrent/webtorrent | javascript |
<|fim_suffix|>oryChunkStore })
setTimeout(() => {
// no crash by now
client.destroy(err => { t.error(err, 'client destroyed') })
}, 100)
})
<|fim_prefix|>import http from 'http'
import fixtures from 'webtorrent-fixtures'
import MemoryChunkStore from 'memory-chunk-store'
import test from 'tape'
import WebTo... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import { Server as DHT } from 'bittorrent-dht'
import fixtures from 'webtorrent-fixtures'
import MemoryChunkStore from 'memory-chunk-store'
import series from 'run-series'
import test from 'tape'
import WebTorrent from '../../index.js'
test('private torrent should not use DHT', t => {
t.plan(4)
cons... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fs from 'fs'
import fixtures from 'webtorrent-fixtures'
import MemoryChunkStore from 'memory-chunk-store'
import series from 'run-series'
import test from 'tape'
import { Server as TrackerServer } from 'bittorrent-tracker'
import WebTorrent from '../../index.js'
test('Download using UDP tracker (v... | fim | webtorrent/webtorrent | javascript |
<|fim_suffix|>error', err => { t.fail(err) })
client2.on('warning', err => { t.fail(err) })
client2.add(parsedTorrent, { store: MemoryChunkStore })
client2.on('torrent', async torrent => {
let gotBuffer = false
let torrentDone = false
function maybeDone () {
if (got... | fim | webtorrent/webtorrent | javascript |
import http from 'http'
import path from 'path'
import finalhandler from 'finalhandler'
import fixtures from 'webtorrent-fixtures'
import MemoryChunkStore from 'memory-chunk-store'
import series from 'run-series'
import serveStatic from 'serve-static'
import test from 'tape'
import WebTorrent from '../../index.js'
tes... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import http from 'http'
import path from 'path'
import finalhandler from 'finalhandler'
import fixtures from 'webtorrent-fixtures'
import MemoryChunkStore from 'memory-chunk-store'
import series from 'run-series'
import serveStatic from 'serve-static'
import test from 'tape'
import WebTorrent from '../../... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fs from 'fs'
import test from 'tape'
import fixtures from 'webtorrent-fixtures'
import MemoryChunkStore from 'memory-chunk-store'
import WebTorrent from '../../index.js'
const leavesContentPath = fixtures.leaves.contentPath
function createClient (opts = {}) {
return new WebTorrent({
dht: fa... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fixtures from 'webtorrent-fixtures'
import test from 'tape'
import WebTorrent from '../../index.js'
test('extension support', t => {
t.plan(6)
let extendedHandshakes = 0
class Extension {
constructor (wire) {
wire.extendedHandshake.test = 'Hello, World!'
}
onExtendedHands... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fixtures from 'webtorrent-fixtures'
import test from 'tape'
import MemoryChunkStore from 'memory-chunk-store'
import WebTorrent from '../../index.js'
const DOWNLOAD_SPEED_LIMIT = 200 * 1000 // 200 KB/s
const UPLOAD_SPEED_LIMIT = 200 * 1000 // 200 KB/s
function testSpeed (t, downloaderOpts, upload... | fim | webtorrent/webtorrent | javascript |
<|fim_suffix|>peed <= UPLOAD_SPEED_LIMIT))
})
})
test('Limit download speed by methods when utp connection', t => {
t.plan(3)
testSpeed(t, { utp: true, downloadLimit: DOWNLOAD_SPEED_LIMIT }, { utp: true }, downloadSpeeds => {
t.ok(downloadSpeeds.every(downloadSpeed => downloadSpeed <= DOWNLOAD_SPEED_LIMIT))... | fim | webtorrent/webtorrent | javascript |
<|fim_suffix|>
})
})
})
})
<|fim_prefix|>import fixtures from 'webtorrent-fixtures'
import test from 'tape'
import WebTorrent from '../../index.js'
test('ut_m<|fim_middle|>etadata transfer', t => {
t.plan(6)
const client1 = new WebTorrent({ dht: false, tracker: false, lsd: false, natUpnp: false, natPm... | fim | webtorrent/webtorrent | javascript |
<|fim_suffix|>fail(err) })
tracker.on('warning', err => { t.fail(err) })
let seeder, client, announceUrl, magnetURI
series([
cb => {
tracker.listen(cb)
},
cb => {
const port = tracker.http.address().port
announceUrl = `http://localhost:${port}/announce`
seeder = new WebTorr... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fs from 'fs'
import { Server as DHT } from 'bittorrent-dht'
import fixtures from 'webtorrent-fixtures'
import MemoryChunkStore from 'memory-chunk-store'
import series from 'run-series'
import test from 'tape'
import WebTorrent from '../../index.js'
test('Seed and download a file at the same time',... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fs from 'fs'
import fixtures from 'webtorrent-fixtures'
import createTorrent from 'create-torrent'
import get from 'simple-get'
import { Readable } from 'streamx'
import test from 'tape'
import WebTorrent from '../../index.js'
test('client.createServer: programmatic http server', t => {
t.plan(1... | fim | webtorrent/webtorrent | javascript |
<|fim_suffix|>t wire')
// t.equal(swarm2.wires.length, 1)
// t.ok(/127\.0\.0\.1:\d{1,5}/.test(addr))
// t.equal(wire.peerId.toString('hex'), peerId)
// })
// t.on('end', function () {
// swarm1.destroy()
// swarm2.destroy()
// })
// })
// })
<|fim_prefix|>// var randombytes... | fim | webtorrent/webtorrent | javascript |
// var randombytes = require('randombytes')
// var Swarm = require('../../lib/swarm')
// var test = require('tape')
// var infoHash = 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36'
// var peerId1 = Buffer.from('-WW0001-' + randombytes(6).toString('hex'), 'utf8').toString('hex')
// var peerId2 = Buffer.from('-WW0001-' + ra... | fim | webtorrent/webtorrent | javascript |
<|fim_suffix|>ires = 0
// swarm1.on('wire', function (wire) {
// numWires += 1
// if (numWires === 1) {
// t.ok(wire, 'Got wire via listening port')
// t.equal(swarm1.wires.length, 1)
// // swarm2 should never get a wire since swarm1 refuses to send it a
// // handshake
... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fixtures from 'w<|fim_suffix|>ent.on('done', () => {
t.equal(++order, 4)
})
torrent.on('seed', () => {
t.equal(++order, 5)
client.destroy(err => { t.error(err, 'client destroyed') })
})
})
test('file.select: check multiple idle events', t => {
t.plan(5)
const client1 = new W... | fim | webtorrent/webtorrent | javascript |
<|fim_suffix|> wire.peerPieces.set(1)
wire.peerPieces.set(2)
torrent._onWire(wire)
}
function removeWire (index) {
const wire = torrent.wires.splice(index, 1)[0]
wire.destroy()
}
})
t.on('end', () => {
torrent.wires.forEach(wire => {
wire.destroy()
})
torr... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import { Selections, isCoveringExisting, isInsideExisting, isLowerIntersecting, isUpperIntersecting } from '../lib/selections.js'
import test from 'tape'
const testCases = {
isLowerIntersecting: {
fn: isLowerIntersecting,
cases: [
{ newItem: { from: 8, to: 12 }, existing: { from: 1, to: 1... | fim | webtorrent/webtorrent | javascript |
// var randombytes from 'randombytes')
// var Swarm from '../lib/swarm')
// var test from 'tape')
// var infoHash = 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36'
// var infoHash2 = 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa37'
// var peerId = Buffer.from('-WW0001-' + randombytes(6).toString('hex'), 'utf8').toString('hex')
/... | fim | webtorrent/webtorrent | javascript |
<|fim_prefix|>import fixtures from 'webtorrent-fixtures'
import test from 'tape'
import WebTorrent from '../index.js'
test('torrent.destroy: destroy and remove torrent', t => {
t.plan(5)
const client = new WebTorrent({ dht: false, tracker: false, lsd: false, natUpnp: false, natPmp: false })
client.on('error', ... | fim | webtorrent/webtorrent | javascript |
<|fim_suffix|> rowObject[header[j]] = transform(header[j], rows[i][j], schema);
}
result.push(rowObject);
}
return result;
}
function loadString(content, schema) {
return processRows(parseRows(extractLines(content)), schema);
}
function loadFile(filePath, schema) {
return loadString(... | fim | webview/webview | javascript |
<|fim_suffix|>include <cstdint>
#else
#include <stdint.h>
#endif
typedef struct EventRegistrationToken {
int64_t value;
} EventRegistrationToken;
#endif // __eventtoken_h__
#endif // _WIN32
#endif // WEBVIEW_COMPAT_EVENTTOKEN_H
<|fim_prefix|>#ifndef WEBVIEW_COMPAT_EVENTTOKEN_H
#define WEBVIEW_COMPAT_EVENTTOKEN_H
#i... | fim | webview/webview | c |
<|fim_suffix|> in the binding handler (see webview_bind()).
* @param status A status of zero tells the JS side that the binding call was
* successful; any other value indicates an error.
* @param result The result of the binding call to be returned to the JS side.
* This must eith... | fim | webview/webview | c |
<|fim_suffix|>", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTIO... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
<|fim_suffix|>c::release(m_script); }
impl(const impl &) = delete;
impl &operator=(const impl &) = delete;
impl(impl &&) = delete;
impl &operator=(impl &&) = delete;
id get_native() const { return m_script; }
private:
id m_script{};
};
// Encapsulate backend in its own namespace to avoid polluting the p... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
<|fim_suffix|>type &&error) : m_error{std::forward<error_type>(error)} {}
bool ok() const { return !has_error(); }
bool has_error() const { return m_error.has_value(); }
void ensure_ok() {
if (!ok()) {
throw exception_type{error()};
}
}
const error_type &error() const {
if (!has_error())... | fim | webview/webview | cpp |
<|fim_suffix|>unction<void()> f) = 0;
virtual noresult set_title_impl(const std::string &title) = 0;
virtual noresult set_size_impl(int width, int height,
webview_hint_t hints) = 0;
virtual noresult set_html_impl(const std::string &html) = 0;
virtual noresult eval_impl(const std... | fim | webview/webview | cpp |
/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including witho... | fim | webview/webview | cpp |
<|fim_suffix|> delete[] decoded;
return result;
}
}
return "";
}
} // namespace detail
} // namespace webview
#endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
#endif // WEBVIEW_DETAIL_JSON_HH
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Stef... | fim | webview/webview | cpp |
<|fim_suffix|>ne bool is_loaded(const std::string &name) {
#ifdef _WIN32
auto handle = GetModuleHandleW(widen_string(name).c_str());
#else
auto handle = dlopen(name.c_str(), RTLD_NOW | RTLD_NOLOAD);
if (handle) {
dlclose(handle);
}
#endif
return !!handle;
}
private:
#ifdef _WIN32
using mo... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
<|fim_suffix|>detail {
namespace cocoa {
enum NSApplicationActivationPolicy : NSInteger {
NSApplicationActivationPolicyRegular = 0
};
enum NSEventMask : NSUInteger { NSEventMaskAny = NSUIntegerMax };
enum NSModalResponse : NSInteger { NSModalResponseOK = 1 };
namespace NSRunLoopMode {
inline id NSDefaultRunLoopMo... | fim | webview/webview | cpp |
<|fim_suffix|>shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHAL... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and<|fim_suffix|>:data2:"),
type, location, modifier_flags, timestamp, window_number, context,
... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
<|fim_suffix|>us) && !defined(WEBVIEW_HEADER)
#endif // WEBVIEW_PLATFORM_DARWIN_COCOA_NSMETHODSIGNATURE_HH
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this soft... | fim | webview/webview | cpp |
<|fim_suffix|>TY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEA... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
<|fim_suffix|>__cplusplus) && !defined(WEBVIEW_HEADER)
#endif // WEBVIEW_PLATFORM_DARWIN_COCOA_NSOBJECT_HH
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this soft... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
<|fim_suffix|>pr inline NSRect NSRectMake(CGFloat x, CGFloat y, CGFloat w, CGFloat h) {
return CGRectMake(x, y, w, h);
}
} // namespace cocoa
} // namespace detail
} // namespace webview
#endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
#endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
#... | fim | webview/webview | cpp |
<|fim_suffix|>ed to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED T... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentat<|fim_suffix|>.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF A... | fim | webview/webview | cpp |
<|fim_suffix|>FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS I... | fim | webview/webview | cpp |
/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including witho... | fim | webview/webview | cpp |
<|fim_suffix|>ARWIN_COCOA_NSURLREQUEST_HH
#if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
#include "../../../../macros.h"
#if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
#include "../objc/objc.hh"
namespace webview {
namespace detail {
namespace cocoa {
inline id NSURLRequest_requestWithURL(id... | fim | webview/webview | cpp |
<|fim_suffix|>GS IN THE
* SOFTWARE.
*/
#ifndef WEBVIEW_PLATFORM_DARWIN_COCOA_NSVALUE_HH
#define WEBVIEW_PLATFORM_DARWIN_COCOA_NSVALUE_HH
#if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
#include "../../../../macros.h"
#if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
#include "../objc/objc.hh"
... | fim | webview/webview | cpp |
/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including witho... | fim | webview/webview | cpp |
<|fim_suffix|>line NSRect NSWindow_get_frame(id self) {
return objc::msg_send_stret<NSRect>(self, objc::selector("frame"));
}
inline void NSWindow_setFrame(id self, NSRect frame_rect, bool display,
bool animate) {
objc::msg_send<void>(self, objc::selector("setFrame:display:animate:"),... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including witho... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
<|fim_suffix|> webview
#endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
#endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
#endif // WEBVIEW_PLATFORM_DARWIN_WEBKIT_WKSCRIPTMESSAGE_HH
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André L... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including witho... | fim | webview/webview | cpp |
<|fim_suffix|>dler) {
return objc::msg_send<void>(
self, objc::selector("evaluateJavaScript:completionHandler:"), js_string,
completion_handler);
}
inline void WKWebView_set_inspectable(id self, bool inspectable) {
#if defined(__has_builtin)
#if __has_builtin(__builtin_available)
if (__builtin_availabl... | fim | webview/webview | cpp |
/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including witho... | fim | webview/webview | cpp |
<|fim_suffix|>h"
#if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
// IWYU pragma: begin_exports
#include "WKOpenPanelParameters.hh"
#include "WKScriptMessage.hh"
#include "WKUserContentController.hh"
#include "WKUserScript.hh"
#include "WKWebView.hh"
#include "WKWebViewConfiguration.hh"
// IWYU pragma: ... | fim | webview/webview | cpp |
<|fim_suffix|>(window) == widget) {
gtk_window_set_child(window, nullptr);
}
#else
gtk_container_remove(GTK_CONTAINER(window), widget);
#endif
}
static void widget_set_visible(GtkWidget *widget, bool visible) {
#if GTK_MAJOR_VERSION >= 4
gtk_widget_set_visible(widget, visible ? TRUE : FALSE);
#el... | fim | webview/webview | cpp |
<|fim_suffix|>pt_result_get_js_value(r);
return get_string_from_js_result(value);
#else
JSGlobalContextRef ctx = webkit_javascript_result_get_global_context(r);
JSValueRef value = webkit_javascript_result_get_value(r);
JSStringRef js = JSValueToStringCopy(ctx, value, nullptr);
size_t n = JSStringGet... | fim | webview/webview | cpp |
<|fim_suffix|>eturn GDK_IS_X11_DISPLAY(gdk_display); // NOLINT(misc-const-correctness)
#else
return false;
#endif
}
// Checks whether WebKit is affected by bug when using DMA-BUF renderer.
// Returns true if all of the following conditions are met:
// - WebKit version is >= 2.42 (please narrow this down when there'... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, fr<|fim_suffix|> COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF O... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including witho... | fim | webview/webview | cpp |
<|fim_suffix|>RANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT,... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
<|fim_prefix|>/*
* MIT License
*
* Copyright (c) 2017 Serge Zaitsev
* Copyright (c) 2022 Steffen André Langnes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | fim | webview/webview | cpp |
<|fim_suffix|>_AWARENESS;
using SetProcessDpiAwareness_t = HRESULT(WINAPI *)(PROCESS_DPI_AWARENESS);
constexpr auto SetProcessDpiAwareness =
library_symbol<SetProcessDpiAwareness_t>("SetProcessDpiAwareness");
} // namespace shcore_symbols
} // namespace detail
} // namespace webview
#endif // defined(WEBVIEW_PLA... | fim | webview/webview | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.