Skip to content

Commit

Permalink
Firefox addon (#314)
Browse files Browse the repository at this point in the history
* update design properties with firefoxs calculated defaults

* firefox bugfix: rect requires inline w/h to work..?

* no plugins, no dynamic import

todo: make a new rollup config and make a bigger bundle for firefox that has all the plugins loaded

* polyfill not required, which is nice!

* visbug element renders again

* update lock

* to be safe, find all and remove

* new trick, inject on page not from extension

* remove polyfill, remove bundle from content script

* added web-ext to npm scripts

* added firefox to postcss browserlist to fix some bugs like with system-ui

* adds visbug bundle to web accessible resources

* thanks kezzbracey for the suggestion to go attributes

* remove opacity if backdrop filter isnt supported

* fixes hover inspect

* fixes margin and padding by removing typedOM usage

* fixes hueshift

* switch to less ambigious use of window

* fixes plugins and datalist autocomplete

* fixes safari search input styles

* add safari project

* adapt to platform

* prep for updated version

* safari build nits

* resolves loading jank

* puts a wrap on the safari build

* update icons and nudge project details

* fixes bug where extension button goes nowhere
  • Loading branch information
argyleink committed Nov 5, 2020
1 parent f030412 commit 86a294c
Show file tree
Hide file tree
Showing 46 changed files with 7,869 additions and 2,040 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -7,3 +7,4 @@ extension/toolbar/bundle.min.js
extension/toolbar/bundle.css
extension/build
extension/tuts
VisBug/VisBug.xcodeproj/project.xcworkspace/xcuserdata/argyle.xcuserdatad/UserInterfaceState.xcuserstate
33 changes: 33 additions & 0 deletions VisBug/VisBug Extension/Info.plist
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>VisBug Extension</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.Safari.web-extension</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).SafariWebExtensionHandler</string>
</dict>
</dict>
</plist>
26 changes: 26 additions & 0 deletions VisBug/VisBug Extension/SafariWebExtensionHandler.swift
@@ -0,0 +1,26 @@
//
// SafariWebExtensionHandler.swift
// VisBug Extension
//
// Created by Adam Argyle on 11/2/20.
//

import SafariServices
import os.log

let SFExtensionMessageKey = "message"

class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {

func beginRequest(with context: NSExtensionContext) {
let item = context.inputItems[0] as! NSExtensionItem
let message = item.userInfo?[SFExtensionMessageKey]
os_log(.default, "Received message from browser.runtime.sendNativeMessage: %@", message as! CVarArg)

let response = NSExtensionItem()
response.userInfo = [ SFExtensionMessageKey: [ "Response to": message ] ]

context.completeRequest(returningItems: [response], completionHandler: nil)
}

}
10 changes: 10 additions & 0 deletions VisBug/VisBug Extension/VisBug_Extension.entitlements
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
</dict>
</plist>

0 comments on commit 86a294c

Please sign in to comment.