launchpad.net bug search broken with Opera

Forums » Opera for Windows/Mac/Linux » Opera browser

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

12. February 2012, 10:19:54

freedo

Posts: 111

launchpad.net bug search broken with Opera

When I go to a bugs page at launchpad.net, e.g. https://bugs.launchpad.net/ubuntu, Opera always appends "null" to the URL, e.g. https://bugs.launchpad.net/ubuntu/null. This in turn breaks search, I always get a "lost something" (a.k.a. "page not found") error, which seems to stem from the added null in the search URL.

Firefox works fine here. I guess there is some kind of JavaScript error, but I cannot say for sure.

15. February 2012, 02:11:10 (edited)

XP1

XP1

Posts: 869

From https://bugs.launchpad.net/+icing/rev14781/build/launchpad.js, the problem occurs on this line:

G.history[O === F ? "replaceState" : "pushState"](N, M.title || J.title || "", M.url || null);

When I researched further, this line is a part of YUI's history module:
http://yuilibrary.com/yui/docs/api/files/history_js_history-html5.js.html

https://github.com/yui/yui3/blob/master/src/history/js/history-html5.js

In YUI's "_storeState" function, the third, URL argument may be passed as null. In Chrome and Firefox, a null URL argument is ignored. In Opera, null is not ignored. Interestingly, Chrome ignores undefined, but Firefox and Opera do not ignore undefined.

Running this test confirms the results:
historyStateUrl.html:
<!DOCTYPE html>
<html dir="ltr" lang="en">
    <head>
        <meta charset="utf-8"/>
        <title>History state URL test</title>
    </head>
    <body>
        <article>
            <section class="buttons">
                <input type="button" id="restore" value="restore"/>
                <input type="button" id="test0" value="test0"/>
                <input type="button" id="test1" value="test1"/>
                <input type="button" id="test2" value="test2"/>
                <input type="button" id="test3" value="test3"/>
                <input type="button" id="other" value="other"/>
            </section>
        </article>
        <script>
            /*jslint browser: true, vars: true, white: true, maxerr: 50, indent: 4 */
            (function (history)
            {
                "use strict";

                var href = window.location.href;

                var restore = document.getElementById("restore");
                restore.setAttribute("value", "Restore");
                var test0 = document.getElementById("test0");
                test0.setAttribute("value", "Test 0: unspecified");
                var test1 = document.getElementById("test1");
                test1.setAttribute("value", "Test 1: \"\"");
                var test2 = document.getElementById("test2");
                test2.setAttribute("value", "Test 2: null");
                var test3 = document.getElementById("test3");
                test3.setAttribute("value", "Test 3: undefined");
                var other = document.getElementById("other");
                other.setAttribute("value", "Other");

                restore.addEventListener("click", function restore()
                {
                    history.pushState(null, "Restore", href);
                }, false);

                test0.addEventListener("click", function test0()
                {
                    history.pushState(null, "Test 0");
                }, false);

                test1.addEventListener("click", function test1()
                {
                    history.pushState(null, "Test 1", "");
                }, false);

                test2.addEventListener("click", function test2()
                {
                    history.pushState(null, "Test 2", null);
                }, false);

                test3.addEventListener("click", function test3()
                {
                    history.pushState(null, "Test 3", (void 0));
                }, false);

                other.addEventListener("click", function other()
                {
                    history.pushState(null, "Other", window.prompt("Enter URL:", ""));
                }, false);
            }(window.history));
        </script>
    </body>
</html>

Reported as bug DSK-357492. History replaceState and pushState treats specified null and undefined URL arguments as URL strings.

15. February 2012, 05:24:23 (edited)

XP1

XP1

Posts: 869

I have created a user JS that fixes HTML5 session history navigation when the URL argument is specified but is null or undefined.

Fix session history navigation:
https://gist.github.com/1832301/

Installing user JS:
  1. Create a folder for storing user JS files.
  2. Go to the user JS on GitHub > Right click on "raw" > Save Linked Content As... > Save the JS file to your user JS folder.
  3. Opera > Settings > Preferences... > Advanced > Content > JavaScript Options... > Under "User JavaScript folder", select "Choose..." > Select the folder > OK > OK > OK.

I have the includes set to Launchpad.

Launchpad uses HTTPS, so you need to enable: opera:config#UserPrefs|UserJavaScriptonHTTPS (select, copy, and paste the link if it doesn't work).

You will get a security warning message every session.
If you don't want this security warning message, you can patch the DLL (option 1):
http://my.opera.com/XAntares/blog/xanocta/
https://bitbucket.org/xaxa/nocta/src/

The patch is "xa-nocta-plugin-00-SilentHTTPSUserJS.pl".

Option 2 is bundling this user JS into an extension, so you won't need to enable the HTTPS user JS setting; thus, you will not see the security warning message.

19. February 2012, 17:26:20

freedo

Posts: 111

Thanks for the investigation, the bug report, and the fix!

I just installed the UserJS, and it works fine.

9. June 2012, 10:50:04

JanGen

Posts: 259

Annoying bug, couldn't login either in the Launchpad site.

Hope this bug will be fixed in 12 final, it isn't in the RC.

I thought it was a regression in the latest build, because I used Opera before on Launchpad with no problems.
But the bug is older unfortunately.

4. August 2012, 16:14:22

JanGen

Posts: 259

Fixed in the 12.50 alpha smile

Forums » Opera for Windows/Mac/Linux » Opera browser