Opera Core Concerns

Official blog for Core developers at Opera

Subscribe to RSS feed

CORS goes mainline

, , , ...

About 6 years ago Opera's Anne van Kesteren started working on a spec called "Access Control", which had been used in VoiceXML to allow limited cross-site access for cases where that didn't pose a security problem. After many years of working on the spec, in Opera, and with other browser developers, it is something the Web is starting to adopt - a real standard, now called CORS. Although it is still formally a working draft, it has been stabilising and getting deployed in test applications so we don't expect it to change a lot now.

This week, Opera integrated support for it into the core mainline, meaning it can start to be adopted in product builds - so look for it soon in a snapshot near you.

Read more...

First Selenium Meetup in Oslo

, , , ...

This Friday 19 August Oslo will see its first ever Selenium and Watir meetup. The meetup will be hosted by Opera at our headquarters and is open to anyone with interest in automated web application testing or browser automation!

About Selenium

Selenium automates browsers. What you do with that power is entirely up to you. Primarily it is for automating web applications for testing purposes, but is certainly not limited to just that. Boring web-based administration tasks can (and should!) also be automated as well.

Selenium has the support of some of the largest browser vendors who have taken steps to make Selenium a native part of their browser. It is also the core technology in countless other browser automation tools, APIs and frameworks.

Talks

Jari Bakken will give an introduction to what WebDriver and Watir is all about, and give you good arguments for why using these tools for testing the whole stack is the way to go.

Kristian Rosenvold will give his talk “Test First Development of Web Applications”, a fun live-coding demo he gave at Smidig 2010.

Speakers

Jari Bakken: As a core developer on both the Watir and Selenium projects, and the founder of related projects such as Celerity and watir-webdriver, Jari has extensive experience in the web test automation space. Since late 2009 his open source efforts have been focused on Selenium 2/WebDriver, for which he wrote and maintains the official Ruby bindings. His watir-webdriver project, an implementation of Watir's API on top of the WebDriver technology, marks an important step forward in consolidating the Watir and Selenium projects on the best browser automation tech available.

By day Jari works as a test engineer for Norwegian classified ads site FINN.no, where he develops automation solutions and test infrastructure. By night, he enjoys hacking on Ruby tools and making use of his degree in jazz guitar.

Kristian Rosenvold: Agile pragmatic programmer in Java, javascript, C# & Web-technologies, git-nerd. Apache Maven committer, Selenium committer. Works as a consultant for Zenior AS.

Practicalities

Where? Opera HQ, Waldemar Thranesgate 98 (entrance close to Sanner bridge at Alexander Kiellandsplass)
When? Friday 19 August at 15:00 CET
Who? Anyone! The event is free and open to the public.

If you are attending, please sign up so that we know approximately how many people are coming.

OperaDriver is now a part of Selenium and has experimental Android support

A bit of background

Back in early 2009, when I started working on OperaWatir, WebDriver was announced, and it looked very interesting with its really compact API. I started talking with Simon Stewart, "the WebDriver guy" and decided it would be great if we could support both the (Ruby-based) Watir and (Java-based) WebDriver APIs. JRuby, a Java implementation of the Ruby programming language, allowed us to connect the two, using OperaDriver as the back-end for OperaWatir.

The work on the current codebase started in February 2009, and we had a first working prototype in March 2009, which we announced on the Core blog. Soon thereafter, we started using OperaDriver internally for testing our Opera Presto engine. A public release took a bit longer, as the Scope protocol got a big change from XML to protobuff and was mostly rewritten. In February of this year, we then released OperaDriver and OperaWatir as open source projects.

What is OperaDriver?

OperaDriver is Opera's WebDriver implementation that follows the standard WebDriver API, which has recently become Selenium 2. It supports Opera browsers on desktop, mobile and even on devices. It uses a network protocol using protocol buffers and is a standalone package that you can directly use.

Testing benefits

Since we followed the WebDriver specifications, tests written for other browsers (such as Firefox, Chrome or Internet Explorer) should work out of the box with OperaDriver (to be correct, there are some exceptions involving browser specific APIs, but these are rather rare). Using OperaDriver you can automate the testing of your web application, run it through multiple browsers, and get back results with JUnit or your choice of test framework.

Ongoing testing framework standardization

A while back, the WebDriver and Selenium projects merged, with Watir joining as watir-webdriver. Similar to OperaWatir using OperaDriver as a back-end, watir-webdriver is using WebDriver to power browser driving. This ongoing standardization effort is going to make test automation of web applications and browsers a breeze, and we are very proud to have been a part of this effort from the start.

Worth noting in this context is that Selenium 2 RC3 came out on Monday, and it has built-in support for Opera!

Driving Opera Mobile on Android

As an added bonus, we're releasing our Android launcher, which is in its alpha stages. To use it, you need the Android SDK. Follow the instructions below to automate testing on Opera Mobile running on Android phones and tablets. The launcher allows you to start/stop Opera and also supports typing (note that there are some known bugs related to timing issues, especially in Android 3.0).

Below you can find instructions for Mac. Please replace USERNAME with your actual username.

Preparation:
  1. Download the Android SDK from http://developer.android.com/sdk/index.html and install it to e.g. /Developer
  2. Download Eclipse (Classic is fine) from http://www.eclipse.org/downloads/ and install it.
  3. Connect your Android phone with a USB cable to your computer and turn on USB debugging on the phone.
  4. Make sure your phone and computer are connected to the same Wi-Fi network
Installing the shepherd-release.apk
  1. Download release.zip to your desktop and unzip it to /Users/USERNAME/Desktop/release
  2. Open Terminal and do /Developer/android-sdk-mac_x86/tools/adb install /Users/USERNAME/Desktop/release/shepherd-release.apk - confirm the installation is a success.
Eclipse
  1. Start Eclipse
  2. Go to File > New > Java Project, type in a name (e.g. TestProject) and click Finish
  3. Right-click on TestProject and go to Properties
  4. Select Java Build Path from the sidebar, go to the Libraries tab and click Add External JARs...
  5. Navigate to /Users/USERNAME/Desktop/release/webdriver-opera , select all .jar files in that folder and click Open, then OK.
  6. Right-click on TestProject, go to New > Class
  7. Type in AndroidTest and click Finish
  8. Inside AndroidTest.java, replace the content with the following:
    import com.opera.core.systems.OperaDriver;
    import com.opera.core.systems.settings.OperaDriverSettings;
    
    public class AndroidTest {
    
    	public static void main(String[] args) throws Exception {
    		OperaDriverSettings settings = new OperaDriverSettings();
    		settings.setAndroid(true);
    		settings.setAdbPath("/Developer/android-sdk-mac_x86/tools/adb");
    		settings.setOperaLauncherHost("127.0.0.1"); // replace with your current IP
    		settings.setOperaLauncherListeningPort(9999);
    		OperaDriver driver = new OperaDriver(settings);
    		driver.closeAll(); // required due to a bug in window-manager
    		driver.get("http://www.google.no/m");
    		driver.findElementById("homepage_query_box_textbox").sendKeys("Opera");
    		driver.findElementById("homepage_query_box_submit").click();
    		Thread.sleep(5000); // sleep so we can see the results
    		driver.quit();
    	}
    }
    
  9. Replace 127.0.0.1 with your local network IP address, which you can find via the ifconfig command in the terminal, or under Network in System Preferences.
  10. Click on the Run button to execute the test. Save changes when prompted. The test will open Opera Mobile, go to the Google Mobile site for Norway, type Opera, search for it, wait 5 seconds and then close the browser.

I would like to thank Opera's Dev Tools team for their support during this project, and Andreas for his help with the blog post.

Native webcam support and orientation events - technology preview

, , , ...

UPDATE: We have released newer experimental builds with webcam support for both Opera Desktop on Mac/Linux/Windows and Opera Mobile on Android. You can get more information and download these builds here.

---

Last week we wrote a blog post discussing our internal prototyping of web camera streaming in the browser. On the very same day, the proposed standard interface on which that was built changed considerably.

This week we are pleased to announce the release an updated preview build of Opera Mobile for Android enabling web developers to access and interact natively with a device's webcam via JavaScript. This build has been entirely re-based on the new standards proposal introduced last week so it's goodbye to the <device> element and a big warm hello to the getUserMedia JavaScript API.

Read more...

Web, meet the <device> element (and orientation events)

, , , ...

Recently we've been prototyping on Opera Mobile for Android to add support for both the HTML <device> element and the W3C's proposed orientation events specification.

In our first internal build, web developers are able to access, display and interact in real-time with a user's web camera using native HTML features.

Read more...

WebGL and Hardware Acceleration

, , , ...

A long time ago, in an office far far away...Opera released a custom build showing an implementation of a 3D canvas context. Now, more than 3 years later, we are releasing the first public build with a standards-based 3D canvas implementation using WebGL for Windows.

Read more...

Ragnarök — viking browser with HTML5 parser!

, , , ...

Making its debut in a Labs build this week is Ragnarök, our implementation of the HTML5 Parsing algorithm. We'd love you to try to break this and give us feedback, so please grab a copy to install on your machine from one of the download links below.

The coolest HTML5 demo you'll see this week

The Web is littered with <canvas> games, HTML5 video players, drag-and-drop whizz-bangs and other demos of HTML5 and "HTML5". But here's a really cool demo, probably the coolest you'll see this week. Are you ready? Here goes:

<b><i>Yo!</b></i>

I can tell you're impressed, so let's dig deeper to see exactly why it is so cool. The elements are incorrectly nested: the innermost element - in this case, the <i> - should be the first one closed. What does this do to the DOM in different browsers?

We can check this out using Opera Dragonfly and its equivalents, or Ian Hickson's DOM viewer. Internet Explorer 9 and Safari 5 result in this innerHTML:

<!DOCTYPE HTML>
<html><HEAD></HEAD><BODY>
<B><I>Yo!</I></B><I></I>
</BODY></html>

while Opera, Firefox and Chrome produce this:

<!DOCTYPE HTML>
<html><HEAD></HEAD><BODY> <B><I>Yo!</I></B> </BODY></html>

All the browsers have sorted out the mis-nesting, but inconsistently: note that IE and Safari have an additional empty <i> element that Opera, Firefox and Chrome don't have. Which is correct? In an HTML4 world, both are. The HTML4 spec describes what to do with good markup, but not what to do with bad markup - and we know that 95% of the Web doesn't validate. Therefore, browsers have traditionally been left to their own devices and forced to guess what to do with bad markup, as error-handling was never defined for HTML4.

Our simple markup above already produces very different DOMs, so imagine what would result from more real world examples of tag soup with dozens or hundreds of elements. Writing JavaScript that has to operate across browsers with such inconsistencies is a major cause of hair loss and weeping amongst web developers.

Luckily, there is now a solution to this.

The HTML5 parsing algorithm

The HTML5 specification defines a set of parsing rules for all markup, whether valid or invalid. Once all browsers have HTML5 parsers, the same markup will produce the same DOM across all conforming browsers. There are two main effects of this:

  • JavaScripters will sport cheerful grins and bouffant hair
  • Consumers can expect fewer interoperability problems when using their favourite site between browsers

So validation is a thing of the past, right?

Absolutely not. It's still a vital QA tool, and just because the HTML5 parser will produce an interoperable DOM, it doesn't mean it's the DOM you actually want!

Opera's implementation

Our old HTML parser has basically been the same since Opera began 15 years ago. It's been continually patched to keep up with changing standards and countless different ways people came up with to not follow the specifications. After all the changes here and there, the code really started to look like a over-decorated christmas tree, and adding more stuff without knocking over the tree was getting increasingly hard.

With the decision to rewrite the entire parser came the opportunity to clean up the design significantly.

We can now proudly say that the new Ragnarök parser has a 99.9% pass-rate on an extensive test suite based on the html5lib tests for the parser part of the HTML 5 specification. The missing last 0.1% is going to be fixed before Ragnarök's golden release. The test suite will also be publicly released once completed so that you can verify it yourself and compare Opera to the other browsers out there.

Ragnarök also scores 11 out of 11 (plus two bonus points) on the somewhat non-comprehensive (and therefore rather misleading) html5test.com. (The two bonus points are for parsing embedded SVG and MathML in HTML5.)

Memory consumption

The main reason we kept our old parser for so long was its efficient memory usage when handling bad markup. Instead of duplicating nodes like the HTML5 specification states, our parser had a intricate system of pointers that indicated which nodes should have been duplicated. This saved it from allocating memory to actually duplicating the element data, but also made the code that traversed the data structure more complex. Now we have switched to copying the nodes, it uses slightly more memory. Before the final release we will minimize that side effect — Opera has always been about memory efficiency, and working on smaller devices too.

Performance

It's not obvious now, because this technical preview isn't optimized for speed like the golden releases will be, but another advantage of the rewrite has been an increase in parser performance. Since the time taken parsing the markup of a page is relatively small compared to loading and rendering, this will not affect benchmarks dramatically, but all performance improvements are for the better, right?

Get it while it's hot!

We have made some builds contain the new parser so that you can test it out, right now, and earn the right to brag to your friends that "Hah, I've been running that for quite some time now" when the final product is out in the stores in a short while.

Disclaimer: The builds are only meant as a technical preview of the new parser, and have not gone through the usual thorough testing our golden releases get, so they might be more unstable. The email client is not working properly so do not use it. Delayed Script Execution is also unstable at the moment. The builds are not optimized for speed so don't expect any useful results from performance benchmarks yet. Better stats will be available when the final version is out.

OperaWatir pre-release

, , ,

The Norwegian Opera & Ballet House in Bjørvika, Oslo. Notice the water.

Photo: Rafał Konieczny, CC by-sa

We are pleased to announce the pre-release of OperaWatir, a library for driving the Opera browser. It is the latest addition to the Watir family, a toolkit for automating interactions with web browsers, and to Opera Software's range of testing frameworks.

OperaWatir provides a querying engine and Ruby bindings to OperaDriver, the back end library. It lets you easily and automatically test your web applications just like a human would, simulating mouse clicks, text entry and the submitting of forms, reporting the results back so you know when things work, and when they break. By using a real web browser to test exactly what users see you are ensuring that your entire stack, including HTML, scripts, styling, embedded resources and back end functionality, is working.

At Opera Software, we use Watir not only to test web applications, but also for testing the browser itself. We have about 1,200 automated renderer tests running against every new internal build we compile. You can read more about the background of OperaWatir and testing at Opera in an earlier blog post my colleague wrote in 2009.

The source code is already available on GitHub, so you can go and check it out now! While the OperaDriver back end is not yet free software, we aim to release it early next year.

We need to point out that this is a pre-release, and that it should not be considered stable or suitable for use in production yet. Also, while we maintain compatibility with the current Watir implementations, it includes a proof of concept API based on Jari Bakken's ideas for Watir 2. For the more technically inclined I would highly recommend having a look at our ideas. If you have any feedback, let us know! It is our hope that we can discuss and develop this API further in cooperation with the other Watir implementors.

We hope you will enjoy playing around with OperaWatir. You are likely to find some bugs, but we decided to follow the release early and often principle, and push it out to the public before Christmas rather than waiting for another month or two until it is pristine and perfect.

We hope that you will enjoy this little Christmas gift, and furthermore, we wish you a Merry Christmas and a Happy New Year from us here at Opera Software in Oslo!

Pulling our socks up

, , , ...

One of the things we are always doing at Opera is looking for bugs and fixing them. Anyone who files one knows they get a number, whether it is a feature request or a rendering issue. But in the Core department we have begun work on a special bug. We also reached an important milestone...

Read more...

Extensions in Opera

,

An alpha of Opera 11 for desktop was just released by the Desktop team. One of the major new changes in this version is support for Browser Extensions, a feature we have been working on in Core for some time now (see also the API documentation).

When implementing Browser Extensions, we wanted to re-use as much as possible of the Web platform we already support in the Opera core. We found that our implementation of the W3C Widget family of specifications was particularly well-suited for the task. Unlike the packaging formats that other browser makers are using, these specifications give us a W3C standardized way of packaging software based on web technologies such as HTML, CSS and JavaScript.

Read more...