Why in Opera the 'chrome_url_overrides' is not allowed for specified extension ID? - opera

I am making a cross-browser extension, which overrides the standard "New Tab" page.
There is a manifest.json key for that, called chrome_url_overrides:
"chrome_url_overrides": { "newtab": "index.html" }
It works in Chrome and Firefox! But in Opera (45.0) the following error occurs when I try to load the extension:
'chrome_url_overrides' is not allowed for specified extension ID.
Based on what I've read in the MDN chrome_url_overrides docs, Opera supports that.
Now I'm not sure if Opera doesn't allow that in general, or if there is a way to activate it?
Edit: I found a similar, unanswered yet, 3-months-old thread in the Opera Forums.

Actually Opera now officially does not support chrome_url_overrides. A piece of evidence can be found on the MDN page that you referenced and it was confirmed by an Opera representative in their forum.
A potential workaround for achieving a new tab extension in Opera (actually this should work in other browsers too) is to use a background script with the following code:
const redirectURLS = [
"opera://startpage/",
"browser://startpage/",
"chrome://startpage/"
];
chrome.tabs.onCreated.addListener(function(tab) {
for (let i = 0; i < redirectURLS.length; i++) {
if (tab.url === redirectURLS[i]) break; // user is trying to open startpage
if (i == redirectURLS.length - 1) return; // Tab is not trying to open a startpage
}
chrome.tabs.update(tab.id, { url: "index.html" });
});
Having this will check if the user tries to open a new tab and if this is the case it will open the custom index.html page that came with installing the plugin instead. It's a hacky and dirty and not sure if it's going to be accepted by Opera but still, this may be a path of salvation for someone desperately trying to get a new tab extension live among the other Opera Addons.
Fun fact: Opera developed and distributed an addon which helps you install chrome extension from chrome extension store on Opera but the new tab extensions don't work and fail upon installation with the following message:
[Compatibility notice]
Please, be aware that this extension requires APIs that are not supported in Opera.
It still can work in Opera, so complete installation to verify.

Opera's Acceptance Criteria say that:
Extensions cannot replace Opera’s default start page.
Even if you manage to accomplish your aim and replace the standard "New Tab" page, then the extension will not pass moderation.
Workarounds include assigning a keyboard shortcut to open your page, or launching it from a browser action button.

Related

Is there a way to change the browser locale in Cypress?

I have looked around online and quite a bit on stackoverflow and cant seem to find an up-to-date answer for this question. I have found other questions here, here, and here - and none of those solution work anymore. Does anyone know if this functionality is available in Cypress or if there's a way to force a locale change? Thanks
That's not too easy - as this differs from the browser you will be running your tests in.
Also, I believe that only are testing that your application looks and behaves right when the USER selected a specific language, you should consider adding a parameter when initiating your test session, e.g.
http://myapp.com/start?lang=en
then storing the selected language in LocaleStorage or a Cookie and selecting the language from there, as it is a lot more portable - and you will have users wanting to use your application in a different language than the browser default.
Still, There might be a few scenarios (e.g. if you want to tests, that your application detects the browser language correctly) where setting the browser language can be required, but I would suggest keeping tests that rely on a browser configuration to a minimum.
Is is possible tho, at least for Electron (verified with Electron 100) and Firefox (verified with Firefox 102). It used to work in Chrome too, but doesn't work for me anymore.
For Electron:
As Electron is being started along with the cypress GUI, changing the language afterwards is not possible. But you can expose an environment variable to the process, e.g.
ELECTRON_EXTRA_LAUNCH_ARGS=--lang=en npx cypress open
to start electron with the wanted locale.
For Firefox:
In your cypress.config.ts expand the defineConfig to contain such a block:
export default defineConfig({
// ...
e2e: {
// ....
setupNodeEvents(on, config) {
on('before:browser:launch', (browser, launchOptions) => {
if (browser.family === 'firefox') {
launchOptions.preferences['intl.locale.requested'] = "en_US"
return launchOptions
}
}
}
}
The Firefox Setup will only work, if you have no other Firefox instance running in another locale.

jQuery 3.3.1 file upload freeze in Safari 12.1.2 and higher

I'm trying to upload a file using jQuery 3.3.1 in Safari 12.1.2 and it allows me to browse and select the file that needs to be uploaded. But when I try to upload the selected file. It does nothing. No error message is displayed, at least in the browser console. This is working fine in Safari versions below 12.1.2, Chrome and Firefox. Can some one please let me know a clue to at least start troubleshooting this issue. (I also tried to debug the code but it ended up in jQuery-3.3.1.min.js and terminates.)
Found the change required to fix the issue. Option "forceIframeTransport" In the code snippet that refers to the fileupload function in jdeQuery-File-Upload has been set to "true" in my code. (As per the jQuery-File-Upload doc this value is set to false by default) How ever for a unknown reason file upload fails in Safari 12.1.2 and above when this value is set to true. So simple the fix in my case is setting "forceIframeTransport" to "false" as shown in below code snippet. (please note that it's not required to have cross cite file uploads which is affected by this option in my application)
$('.assetupload').fileupload({
**forceIframeTransport : false**,
add : function(e, data) {
.......
.......
});

Changing background-image property to a local image file using Safari Extension

(MacBook Pro Mid 2015 / OS X Yosemite 10.10.5 / Safari 8.0.8)
I want to change background-image of a particular webpage.
I made a Safari Extension and make such a css file as style.css
body { background-image: url('background.png'); }
I also put background.png to the same directory with style.css
And Safari Developer license is already set.
Then, in Extension Builder, I set some properties as follows:
Extension Website Access: All
Injected Extension Content:
Style Sheets: style.css
Whitelist: http://__mywebsite__.com/*
Although I installed this, background of my webpage didn't seem to be enabled.
I think the solution must be these:
Safari Extension can't find a local file background.png
I set wrong whitelist pattern
I set wrong parameter to Extension Website Access
What should I do? Any comments would be thankful.
What happens if you link to an image on a web page, does it work? try putting this link in and see if it works: http://dummyimage.com/600x400/000/fff
If it does then the problem is with the directory or one of the other things you mentioned

Run js-test-driver Eclipse plugin in IE8 document mode when having IE9 installed

I want to use the Eclipse plugin of js test driver to execute my tests in IE. I have IE9 installed but want the tests to run in IE8 document mode because this is what the app we are developing is running in.
So is there any way to start the js-test-driver plugin in IE8 document mode when having IE9 installed? Its possible to switch mode in MS Developer Tools but that is not what I'm looking for.
I've tried to load a script that adds meta tags at start up by adding a script like this in the jsTestDriver.conf file:
...
load:
- js/bootstrap-IE8.js
...
and the code in the bootstrap file:
(function(){
var meta = document.createElement('meta');
meta.setAttribute('http-equiv','X-UA-Compatible');
meta.setAttribute('content','IE=8');
var meta2 = document.createElement('meta');
meta2.setAttribute('Content-Type','X-UA-Compatible');
meta2.setAttribute('content','text/html; charset=utf-8');
var tophead = top.document.getElementsByTagName('head')[0];
var toptitle = tophead.firstChild;
tophead.insertBefore(meta, toptitle);
tophead.insertBefore(meta2, toptitle);
})();
I have tried to find a way to solve this as you describe have not found any way to do this (or JSTestDriver files to modify)
However, this can be done by modifing the registry by setting FEATURE_BROWSER_EMULATION feature that defines the default emulation mode for Internet Explorer to 8888 (0x22B8).
It is descibed at http://msdn.microsoft.com/en-us/library/ee330730%28VS.85%29.aspx#browser_emulation
Note that your browser will use IE8 document mode always.

How to deal with Java warning popup?

While running WebDriver automation scripts I came across a situation where it is trying to open a page which contain one segment with live camera (Made with Java applet). Once script reaches to this page - a Security Warning alert (with allow and not allow) shows up and blocks the execution process. Is this something that anyone faced before - actually I am looking for an option to block this security warning to get displayed on the page.
A popup is coming where i want to click on the "Allow". How to move the focus to the new popup window and click on Allow.
Can anyone please help me for the above problem?
I was having problems accepting the java applet "Allow"
My solution was to create a firefox profile that had the settings to always activate the plugin:
FirefoxProfile fp = new FirefoxProfile();
fp.setAcceptUntrustedCertificates( true );
fp.setPreference( "security.enable_java", true );
fp.setPreference( "plugin.state.java", 2 );
WebDriver d = new FirefoxDriver( fp );
Where plugin.state.java:
plugin.state.java = 0 --> never activate
plugin.state.java = 1 --> ask to activate
plugin.state.java = 2 --> always activate
This might get you closer...
Selenium uses a different firefox profile because Java was inactive for me and I did not have my firebug plugin in the Firefox browser Selenium launched. I would have to open another Firefox to use Firebug.
I found my default Firefox profile by searching %appdata% in the start menu then clicking on Roaming/ Mozilla/ Firefox/ Profile/ and then it gave my default profile name.
You can also open the firefox help menu (? logo) & click troubleshoot info... click Show Profile Folder
I then configured selenium to use my default profile so Java was enabled and Firebug was available in the browser Selenium launched:
Make sure that you use "/" in selenium even though it may use "\" in the windows path location
fp = webdriver.FirefoxProfile('C:/Users/xxx/AppData/Roaming/Mozilla/Firefox/Profiles/41s7nq9o.default')
driver = webdriver.Firefox(fp)
driver.get('www.stackoverflow.com')
where 41s7nq9o.default is the name of your default profile