Skip to content
This repository was archived by the owner on May 30, 2023. It is now read-only.

Add frameName to onNavigationRequested. #11371

Closed

Conversation

kanzure
Copy link
Contributor

@kanzure kanzure commented Jun 3, 2013

An additional parameter is now passed to onNavigationRequested with the
name of the frame that originated the navigation request.

isMainFrame can be emulated by checking if frameName is equal to an
empty string, but hasn't been removed from the function signature for
backwards compatibility reasons.

An additional parameter is now passed to onNavigationRequested with the
name of the frame that originated the navigation request.

isMainFrame can be emulated by checking if frameName is equal to an
empty string, but hasn't been removed from the function signature.
@JamesMGreene
Copy link
Collaborator

I can't recall: is a frameName guaranteed?

cc: @detro

@kanzure
Copy link
Contributor Author

kanzure commented Jun 3, 2013

Good question.

Here's some wild, unsupported speculation. On the JS side, I expect frameName to be "" (an empty string) for the main WebPage object. Meanwhile, in src/webpage.cpp there has always been a QWebFrame passed in, so I am inclined to speculate that frame->frameName() will always return a usable QString.

However, I would also be okay with some other way to identify frames if necessary. (I can't distinguish between frames with only isMainFrame.)

@ariya
Copy link
Owner

ariya commented Jun 9, 2013

The code looks good!

This needs some minimalistic testing, i.e. specially crafted page content with named iframe.

@kanzure
Copy link
Contributor Author

kanzure commented Jun 9, 2013

Unnamed iframes are named like this:

<html>
    <iframe>
        <html>
            <iframe>some page</iframe>
        </html>
    </iframe>
</html>

The inner iframe in this case is named:

<!--framePath //<!--frame0-->/<!--frame0-->-->

The outer one is named:

<!--framePath //<!--frame0-->-->

The main WebPage has a frameName equal to an empty string.

I agree that some tests should be added (but no guarantees on those arriving today from me).

A null QWebFrame will cause frameName sent to onNavigationRequested to
equal "" (an empty QString).

see ariya#11374

ariya#11374
@kanzure
Copy link
Contributor Author

kanzure commented Jun 14, 2013

@ariya, could you look that over before I make a similar patch for #11373? Of course, both need specs added, but this is for the first concern you raised.

@ariya
Copy link
Owner

ariya commented Jun 15, 2013

@kanzure Looks good. Just squash them into one commit. Also, no need to initialize QString using empty literal ("") as its default constructor does that already.

@vitallium vitallium force-pushed the master branch 2 times, most recently from b3cd914 to c4df640 Compare June 27, 2015 08:43
@vitallium vitallium force-pushed the master branch 2 times, most recently from 573e969 to b483dd6 Compare October 6, 2015 20:31
@vitallium vitallium force-pushed the master branch 2 times, most recently from 1842ba8 to 842715b Compare March 15, 2016 17:40
@vitallium vitallium force-pushed the master branch 2 times, most recently from e024f31 to 5d99f2a Compare May 19, 2016 20:52
@ghost ghost closed this Dec 21, 2017
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants