Skip to content

Instantly share code, notes, and snippets.

Avatar

Robo deepak1556

  • Microsoft
  • Redmond
View GitHub Profile
@deepak1556
deepak1556 / frame.html
Last active Sep 14, 2021
Web Worker from OOP frame
View frame.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<h1>OOP frame</h1>
</body>
<script>
const corsUrl = "https://gist.githubusercontent.com/deepak1556/36c31867ad3a11c3b03a56ca8bd3f536/raw/24a02e75403d0e4fc2fb01959d5698eecc869f3d/worker.js";
@deepak1556
deepak1556 / main.js
Created Aug 30, 2021
Keyboard event tester in Electron
View main.js
// Modules to control application life and create native browser window
const {app, BrowserWindow} = require('electron')
const path = require('path')
function createWindow () {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
@deepak1556
deepak1556 / content_shell.patch
Created Aug 19, 2021
Minimal repro for v8::HeapProfiler crash
View content_shell.patch
diff --git a/content/shell/renderer/shell_render_frame_observer.cc b/content/shell/renderer/shell_render_frame_observer.cc
index ed6134a67e3e..dc6de8323542 100644
--- a/content/shell/renderer/shell_render_frame_observer.cc
+++ b/content/shell/renderer/shell_render_frame_observer.cc
@@ -8,7 +8,9 @@
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_frame_observer.h"
#include "content/shell/common/shell_switches.h"
+#include "third_party/blink/public/web/blink.h"
#include "third_party/blink/public/web/web_testing_support.h"
@deepak1556
deepak1556 / index.html
Created Jun 21, 2021
OOP shared worker
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
<script>
@deepak1556
deepak1556 / index.html
Last active Mar 12, 2021 — forked from jrieken/index.html
Service worker registration crash
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@deepak1556
deepak1556 / webp2png.js
Created Dec 7, 2013
webp support using libwebpjs (webp->png in canvas)
View webp2png.js
WebPDecodeAndDraw = function (data) {
var decoder = new WebPDecoder();
var bitmap = decoder.WebPDecode(data, data.length);
if (bitmap) {
//Draw Image
var output = ctx.createImageData(canvas.width, canvas.height);
var biWidth = canvas.width;
var outputData = output.data;
@deepak1556
deepak1556 / main.js
Created Dec 12, 2019
Super key menu labelling issue on linux
View main.js
const {app, BrowserWindow, Menu} = require('electron')
app.on('ready', function() {
var mainWindow = new BrowserWindow({});
var menuTemplate = [
{
label: 'View',
submenu: [
{
View compile.log
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\functional:10:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\xmemory(758,76): error: call to implicitly-deleted copy constructor of 'std::pair<const unsigned int, Ex1>'
::new (const_cast<void*>(static_cast<const volatile void*>(_Ptr))) _Objty(_STD forward<_Types>(_Args)...);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\list(541,25): note: in instantiation of function template specialization 'std::_Default_allocator_traits<std::allocator<std::_List_node<std::pair<const unsigned int, Ex1>,
void *> > >::construct<std::pair<const unsigned int, Ex1>, const std::pair<const unsigned int, Ex1> &>' requested here
_Alnode_traits::construct(this->_Al, _STD addressof(this->
View crash.txt
thread #1, name = 'CrRendererMain', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x500000018)
* frame #0: 0x000000010eb6bdb5 Electron Framework`v8::Context::GetIsolate() [inlined] v8::internal::Isolate::FromHeap(v8::internal::Heap*) at isolate.h:910:71 [opt]
frame #1: 0x000000010eb6bdb5 Electron Framework`v8::Context::GetIsolate() [inlined] v8::internal::GetIsolateFromWritableObject(object=<unavailable>) at isolate-utils-inl.h:41 [opt]
frame #2: 0x000000010eb6bdab Electron Framework`v8::Context::GetIsolate() [inlined] v8::internal::Context::GetIsolate(this=<unavailable>) const at contexts-inl.h:48 [opt]
frame #3: 0x000000010eb6bdab Electron Framework`v8::Context::GetIsolate(this=0x00007f80db840248) at api.cc:5997 [opt]
frame #4: 0x0000000111b32d74 Electron Framework`blink::ToLocalDOMWindow(context=(val_ = 0x00007f80db840248)) at v8_binding_for_core.cc:645:28 [opt]
frame #5: 0x0000000111b3c6a7 Electron Framework`blink::PromiseRejectHandlerInMainThread(v8:
View crash.txt
* thread #1, name = 'CrRendererMain', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x500000018)
* frame #0: 0x000000010b07cef5 Electron Framework`v8::Context::GetIsolate() [inlined] v8::internal::Isolate::FromHeap(v8::internal::Heap*) at isolate.h:910:71 [opt]
frame #1: 0x000000010b07cef5 Electron Framework`v8::Context::GetIsolate() [inlined] v8::internal::GetIsolateFromWritableObject(object=<unavailable>) at isolate-utils-inl.h:41 [opt]
frame #2: 0x000000010b07ceeb Electron Framework`v8::Context::GetIsolate() [inlined] v8::internal::Context::GetIsolate(this=<unavailable>) const at contexts-inl.h:48 [opt]
frame #3: 0x000000010b07ceeb Electron Framework`v8::Context::GetIsolate(this=0x00007fdcb203b218) at api.cc:5997 [opt]
frame #4: 0x000000010e0437e4 Electron Framework`blink::ToLocalDOMWindow(context=(val_ = 0x00007fdcb203b218)) at v8_binding_for_core.cc:645:28 [opt]
frame #5: 0x000000010e04d117 Electron Framework`blink::PromiseRejectHandlerInMainThread(v