API Call 'tabs.captureVisibleTab' is not supported in Edge - microsoft-edge

I'm using Edge on Windows 10 v1703, build 15063.296.
The documentation (https://learn.microsoft.com/en-us/microsoft-edge/extensions/api-support/supported-apis) states, that the API tabs.captureVisibleTab is available.
But when I use it in the background script, I'm getting the following error:
API Call 'tabs.captureVisibleTab' is not supported in Edge.
The code is:
browser.tabs.captureVisibleTab(currentTab.windowId, {format: "png"}, function (data) {});
Am I missing something?
UPDATE:
this is my manifest file (ported from Chrome):
{
"author": "Evgeny Suslikov",
"background": {
"page": "background.html",
"persistent": true
},
"browser_action": {
"default_icon": {
"19": "images/sss_19.png"
},
"default_title": "FireShot - Capture page",
"default_popup": "fsPopup.html"
},
"commands": {
"last-used-action": {
"suggested_key": {
"default": "Ctrl+Shift+Y",
"mac": "Command+Shift+Y"
},
"description": "__MSG_options_label_last_action_hotkey__"
}
},
"default_locale": "en",
"description": "__MSG_application_description__",
"icons": {
"16": "images/sss_16.png",
"32": "images/sss_32.png",
"48": "images/sss_48.png",
"128": "images/sss_128.png"
},
"Key": "B5SSrXXpDZAoT8SQ4vAzNeTQ1tBC2Z24nx+hHZXfykmVYfMy5aOwPkf0Hbt7SXlKbprwV0GwrYgCwIDAQAB",
"manifest_version": 2,
"name": "__MSG_application_title__",
"offline_enabled": true,
"optional_permissions": [
"tabs",
"<all_urls>",
"downloads"
],
"options_page": "fsOptions.html",
"permissions": [
"activeTab",
"tabs",
"contextMenus",
"nativeMessaging"
],
"short_name": "FireShot",
"version": "0.98.92",
"web_accessible_resources": [
"images/*.gif"
],
"-ms-preload": {
"backgroundScript": "backgroundScriptsAPIBridge.js",
"contentScript": "contentScriptsAPIBridge.js"
},
"content_scripts": [{
"matches": ["<all_urls>"],
"js": ["scripts/fsUtils.js", "scripts/fsSelection.js", "scripts/fsLinks.js", "scripts/fsContent.js"]
}]
}
In my fsBackground.js page I do the call:
browser.tabs.captureVisibleTab(windowId, {format: "png"}, function (data) {});
I get the following error: click to see screenshot...

That function is supported starting from Edge 15. On previous versions it was still unsupported, even though the documentation said differently.
Make sure to download the latest version of Microsoft Edge Extension Toolkit and to regenerate the bridge files with it.
You can look at the generated backgroundScriptsAPIBridge.js file to see what's changed.
Previous versions (unsupported):
captureVisibleTab(windowId, options, callback) {
bridgeLog.LogUnavailbleApi("tabs.captureVisibleTab");
}
New version (supported):
captureVisibleTab(windowId, options, callback) {
bridgeLog.DoActionAndLog(() => {
myBrowser.tabs.captureVisibleTab.apply(null, arguments);
}, "tabs.captureVisibleTab");
}

Related

Create new tab from Firefox extension doesn't works

i'm trying to create a new tab from Firefox extension, but it doesn't works.
manifest.js:
{
"manifest_version": 2,
"name": "nafy",
"version": "1.0",
"description": "NaFy",
"icons": {
"48": "icons/icon_48.png",
"96": "icons/icon_96.png"
},
"content_scripts": [
{
"matches": ["*://*.ebay.de/*"],
"js": ["background.js"]
}
],
"permissions": [
"tabs"
]
}
background.js:
createNewTab();
function onCreated(tab) {
console.log('Created new tab: ${tab.id}');
}
function onError(error) {
console.log('Error: ${error}');
}
function createNewTab()
{
let newTab = browser.tabs.create({
url:"https://www.ebay.de"
});
newTab.then(onCreated, onError);
};
What I'm doing wrong? (Everything works as expected in Chrome.)
Your background.js file is not actually a background script despite it's name, it's defined in your manifest.json as a content script.
Content scripts don't have access to the tabs API (see list of accessible APIs here).
To fix that, you need to move your background.js to be an actual background script:
{
"manifest_version": 2,
"name": "nafy",
"version": "1.0",
"description": "NaFy",
"icons": {
"48": "icons/icon_48.png",
"96": "icons/icon_96.png"
},
"background": {
"scripts": ["background.js"]
},
"permissions": [
"tabs"
]
}

Can't migrate background script to v3 in Chrome extension

I try to migrate my manifest from v2 to v3 and fail with background scripts. I get an error unexpected token. I think my syntax is correct. What I'm doing wrong? How can I migrate this setup with multiple background scripts?
manifest v2
{
"description": "Tooltip Dictionary",
"manifest_version": 2,
"name": "Tooltip Dictionary",
"permissions": [ "https://www.example.com/*", "storage" ],
"version": "1.0.0",
"icons":{
"16":"icon16.png",
"32":"icon32.png",
"48":"icon48.png",
"128":"icon128.png"
},
"browser_action":{
"default_icon": "icon32.png"
},
"content_scripts":[{
"matches":["<all_urls>"],
"js":["jquery.min.js", "tooltip.css.js", "cs.js"]
}],
"background":{
"scripts":[ "jquery.min.js","bg.js" ]
},
"commands":{
"run-script": {
"suggested_key": {
"default": "Alt+1",
"windows": "Alt+1",
"mac": "Command+E"
},
"description": "Run"
}
}
}
manifest v3
{
"description": "Tooltip Dictionary",
"manifest_version": 3,
"name": "Tooltip Dictionary",
"host_permissions": ["https://www.example.com/*"],
"permissions": ["storage"],
"version": "1.0.0",
"icons":{
"16":"icon16.png",
"32":"icon32.png",
"48":"icon48.png",
"128":"icon128.png"
},
"action":{
"default_icon": "icon32.png"
},
"content_scripts":[{
"matches":["<all_urls>"],
"js":["jquery.min.js", "tooltip.css.js", "cs.js"]
}],
"background": {
"service_worker": ["jquery.min.js", "bg.js"]
},
"commands":{
"run-script": {
"suggested_key": {
"default": "Alt+1",
"windows": "Alt+1",
"mac": "Command+E"
},
"description": "Run"
}
}
}
If I try to use a single background file, it can't be registered too, like on screenshot:

DWG to DGN conversion using Design Automation API

Is there any possibility for conversion from dwg to dgn using forge design automation api? If yes then what will be the best way to do that? Any suggestion would be helpful.
Yes, you can use the -DGNEXPORT command in your script to accomplish this.
I was trying to get a concrete codes for this question as it requires some tricks and support of seed file on Design Automation. By engineer team's help, now it is working.
Assume we test with Postman. If you are working with v2 of Design Automation, the scripts below demo the usage.
Activity:
{
"HostApplication": "",
"RequiredEngineVersion": "23.1",
"Parameters": {
"InputParameters": [{
"Name": "HostDwg",
"LocalFileName": "$(HostDwg)"
}],
"OutputParameters": [{
"Name": "Result",
"LocalFileName": "result.dgn"
}]
},
"Instruction": {
"CommandLineParameters": null,
"Script":"(command \"_-DGNEXPORT\" \"_V8\" (strcat (getvar \"DWGPREFIX\")
\"result.dgn\") \"_Master\" \"Standard\" (strcat (getvar \"LOCALROOTPREFIX\")
\"Template\\\\V8-Imperial-Seed3D.dgn\"))\n"
},
"Version": 1,
"Id": "CreateActByLISP"
}
WorkItem:
{
"#odata.type": "#ACES.Models.WorkItem",
"Arguments": {
"InputArguments": [
{
"Resource": "http://forge-test.oss-cn-shanghai.aliyuncs.com/test.dwg",
"Name": "HostDwg",
"StorageProvider": "Generic"
}
],
"OutputArguments": [
{
"Name": "Result",
"StorageProvider": "Generic",
"HttpVerb": "POST",
"Resource": null
}
]
},
"ActivityId": "CreateActByLISP",
"Id": ""
}
If working with v3 of Design Automation, the script would be as below. Note: the engine needs 23.1 (Autodesk.AutoCAD+23_1)
Activity
{
"commandLine": [
"$(engine.path)\\accoreconsole.exe /i $(args[HostDwg].path) /s $(settings[script].path)"
],
"parameters": {
"HostDwg": {
"verb": "get",
"description": "Host drawing to be loaded into acad.",
"localName": "$(HostDwg)"
},
"Result": {
"verb": "post",
"description": "Results",
"localName": "result.dgn"
}
},
"engine": "Autodesk.AutoCAD+23_1",
"appbundles": [],
"settings": {
"script": {
"value": "(command \"_-DGNEXPORT\" \"_V8\" (strcat (getvar \"DWGPREFIX\") \"result.dgn\") \"_Master\" \"Standard\" (strcat (getvar \"LOCALROOTPREFIX\") \"Template\\\\V8-Imperial-Seed3D.dgn\"))\n"
}
},
"description": "PlotToPdf for all layouts.",
"id": "myexportdgn"
}
WorkItem:
{
"activityId": "{{your nick name}}.myexportdgn+{{activity alias}}",
"arguments": {
"HostDwg": {
"url": "http://forge-test.oss-cn-shanghai.aliyuncs.com/test.dwg"
},
"Result": {
"verb": "put",
"url": "<your upload url>"
}
}
}

Highcharts line chart - incorrect point ordering - boost module

Issue
We are currently implementing a highcharts graph for large datasets that will require the boost module for performance reasons. However, on enabling the boost module we have encountered an intermittent issue that is proving challenging to consistently reproduce and isolate.
Because I am not able to replicate this I cannot create a jsfiddle as of yet. Does anyone have any idea how to isolate and fix this?
The graph should look like this:
Expected graph
But occasionally does this:
Actual graph
This has also happened on another occasion whilst manually testing with different data:
With different data
It has been observed on
Chrome 70.0.3538.67
IE 11.345.17134.0
Highcharts JS & Boost module v6.1.4
Input data
Sample of the type of data:
{
"label": "2018-04-19T15:17:02",
"value": "1"
}, {
"label": "2018-04-19T15:17:05",
"value": "9620035.36877074"
}, {
"label": "2018-04-19T15:17:59",
"value": "9583104.14689662"
}, {
"label": "2018-04-19T15:18:46",
"value": "9604094.84064805"
}, {
"label": "2018-04-19T15:20:17",
"value": "9571679.9536289"
}, {
"label": "2018-04-20T08:18:24",
"value": "7902991.39771514"
}
Or:
{
"label": "2018-04-19T15:17:59",
"value": "1.4132e-007"
}, {
"label": "2018-04-19T15:18:46",
"value": "1.41434e-007"
}, {
"label": "2018-04-19T15:20:17",
"value": "1.41355e-007"
}, {
"label": "2018-04-20T08:18:24",
"value": "1.40532e-007"
}, {
"label": "2018-04-20T08:20:35",
"value": "1.40928e-007"
}, {
"label": "2018-04-20T08:23:51",
"value": "1.4078e-007"
}, {
"label": "2018-04-20T08:24:39",
"value": "1.40901e-007"
}
Graph config
{
"chart": {
"type": "line",
"zoomType": "x",
"panning": true,
"panKey": "shift"
},
"boost": {
"usePreallocated": false
},
...
y-axis label customisation
title
exporting
etc
...
"series": [{
"showInLegend": false,
"name": "",
"data": []
}],
}
Update mechanism
When the HTTP response comes back the following is called on the graph instance:
graphToUpdate.series[0].setData(parsedData, true, true, false);

Atlassian Connect Express: Credentials rejected at connect-ace.atlassian.net

I'm evaluating atlassian-connect-express and just created an app
boilerplate with "atlassian-connect new", and then deployed it via ngrok
to my Jira dev account.
That works fine, but when I try to use the file "credentials.json" with
my account data, the plug starts with the error message:
Failed to register with host https‍://michael%40...:[My
password]#connect-ace.atlassian.net (401)
Add-on not registered; no compatible hosts detected
I get a similar message when I go to the url connect-ace.atlassian.net
Here my atlassian-connect.json
{
"key": "my-add-on",
"name": "Ping Pong",
"description": "My very first add-on",
"vendor": {
"name": "Angry Nerds",
"url": "https://www.atlassian.com/angrynerds"
},
"baseUrl": "https://xxxxxxx.ngrok.io",
"links": {
"self": "https://xxxxxxxx.ngrok.io/atlassian-connect.json",
"homepage": "https://xxxxxxx.ngrok.io/atlassian-connect.json"
},
"authentication": {
"type": "jwt"
},
"lifecycle": {
"installed": "/installed"
},
"scopes": [
"READ"
],
"modules": {
"generalPages": [
{
"key": "hello-world-page-jira",
"location": "system.top.navigation.bar",
"name": {
"value": "Hello World"
},
"url": "/hello-world",
"conditions": [{
"condition": "user_is_logged_in"
}]
},
{
"key": "hello-world-page-confluence",
"location": "system.header/left",
"name": {
"value": "Hello World"
},
"url": "/hello-world",
"conditions": [{
"condition": "user_is_logged_in"
}]
}
]
}
}
and my credatials.json
{
"hosts": {
"connect-ace.atlassian.net": {
"product": "jira",
"username": "michael#---",
"password": "---password---"
}
}
}
How can I get my dev account working with connect-ace?
Two things to check:
1 - Check the if the credentials.json has correct values. host url should start with https://. Password is the api token generated from here.
{
"hosts": {
"https://<your atlassian site name>.atlassian.net": {
"product": "jira",
"username": "<jira user name>",
"password": "<Token created from https://id.atlassian.com/manage/api-tokens>"
}
}
}
2- Enable development mode at Settings -> Apps -> Manage Apps -> Settings. (This is required if the app is not published in marketplace)
This error is a default from atlas-connect
Print error image
In atlasssian-connect.json
replace this :
"lifecycle": {
"installed": "/installed"
},
for this:
"lifecycle": {
"installed": "installed"
},
Have you tried spawning your own cloud instance and testing it there? If not yet, try creating one here. Once successfully registered, in your credentials.json, change "connect-ace" with your baseUrl/sitename and with the right credentials, it should automatically install it for you.

Resources