Closed Bug 1163961 Opened 10 years ago Closed 9 years ago

Browser API: page search

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: paul, Assigned: paul)

References

Details

(Keywords: dev-doc-complete)

Attachments

(1 file, 6 obsolete files)

Attached patch wip (obsolete) (deleted) β€” β€” Splinter Review
We want to be able to search a string in the page.
Blocks: browser-api
Comment on attachment 8604591 [details] [diff] [review]
wip

Kanru, this is not finished, but can you take a quick look and tell me if I'm the right path (tested locally, it appears to work)?
Attachment #8604591 - Flags: feedback?(kchen)
Comment on attachment 8604591 [details] [diff] [review]
wip

Review of attachment 8604591 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me!
Attachment #8604591 - Flags: feedback?(kchen) → feedback+
Attached patch v1 (obsolete) (deleted) β€” β€” Splinter Review
Assignee: nobody → paul
Attachment #8604591 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attached patch v1 (obsolete) (deleted) β€” β€” Splinter Review
Attachment #8606974 - Attachment is obsolete: true
Attachment #8607303 - Flags: review?(kchen)
Blocks: graphene
Comment on attachment 8607303 [details] [diff] [review]
v1

Review of attachment 8607303 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me.

::: dom/browser-element/mochitest/browserElement_Find.js
@@ +36,5 @@
> +    ok(c(detail, {
> +      msg_name: "findchange",
> +      active: true,
> +      searchString: 'foo',
> +      searchLimit: 100,

Read expected searchLimit from pref

::: dom/browser-element/mochitest/test_browserElement_oop_Find.html
@@ +11,5 @@
> +</head>
> +<body>
> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1163961">Mozilla Bug 1163961</a>
> +
> +<script type="application/javascript;version=1.7" src="browserElement_Find.js">

Should this be version=1.8? The _inproc_ test is version=1.8

::: dom/html/nsBrowserElement.cpp
@@ +384,5 @@
> +  NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
> +  NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
> +
> +  nsresult rv = mBrowserElementAPI->FindAll(aSearchString, aCaseSensitive);
> +                                            

nit: trailing white spaces
Attachment #8607303 - Flags: review?(kchen) → review+
Attached patch v1 (r=kchen) (obsolete) (deleted) β€” β€” Splinter Review
https://treeherder.mozilla.org/#/jobs?repo=try&revision=0732e59f2d73
Attachment #8607303 - Attachment is obsolete: true
Attachment #8608652 - Flags: review+
Note to self:
- we need a DOM peer review
- segfault: https://treeherder.mozilla.org/#/jobs?repo=try&revision=0732e59f2d73
Not segfault:

INFO -  JavaScript error: chrome://global/content/BrowserElementChildPreload.js, line 1214: TypeError: Finder is not a constructor
https://treeherder.mozilla.org/#/jobs?repo=try&revision=acbc5d0a6988
Attached patch v1 (r=kchen) (obsolete) (deleted) β€” β€” Splinter Review
I had to add `this.Finder = Finder` at the end of Finder.jsm because of how B2G load modules.
Attachment #8608652 - Attachment is obsolete: true
Attachment #8616658 - Flags: review+
Attachment #8616658 - Flags: review?(ehsan)
Ehsan, I need to a DOM peer review too.
Comment on attachment 8616658 [details] [diff] [review]
v1 (r=kchen)

Review of attachment 8616658 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/webidl/BrowserElement.webidl
@@ +149,5 @@
> +
> +  [Throws,
> +   Pref="dom.mozBrowserFramesEnabled",
> +   CheckPermissions="browser"]
> +  void findAll(DOMString searchString, boolean caseSensitive);

Please do not use boolean argument names, since seeing "true" or "false" at the call site doesn't help at all in showing what the argument does.  Instead, use enums.  For example:

enum BrowserFindCaseSensitivity {
  "case-sensitive",
  "case-insensitive"
};

[...]
void findAll(DOMString searchString, BrowserFindCaseSensitivity caseSensitivity);

@@ +154,5 @@
> +
> +  [Throws,
> +   Pref="dom.mozBrowserFramesEnabled",
> +   CheckPermissions="browser"]
> +  void findNext(boolean forward);

Ditto.
Attachment #8616658 - Flags: review?(ehsan) → review-
Attached patch v2 (obsolete) (deleted) β€” β€” Splinter Review
I'm not sure about the way I'm juggling  with IDL and webdidl data types. There might be a better way. Let me know.
Attachment #8616658 - Attachment is obsolete: true
Attachment #8616864 - Flags: review?(ehsan)
https://treeherder.mozilla.org/#/jobs?repo=try&revision=bcd43c6474d3
Comment on attachment 8616864 [details] [diff] [review]
v2

Review of attachment 8616864 [details] [diff] [review]:
-----------------------------------------------------------------

r=me on BrowserElement.webidl.  I also briefly looked at nsIBrowserElementAPI.idl, and using the numeric constants there is probably OK (but you could also use a string and pass in the WebIDL enum values there if you want to.)

Let me know if you wanted a review of the other parts too.
Attachment #8616864 - Flags: review?(ehsan) → review+
(In reply to :Ehsan Akhgari (not reading bugmail, needinfo? me!) from comment #15)
> Comment on attachment 8616864 [details] [diff] [review]
> v2
> 
> Review of attachment 8616864 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> r=me on BrowserElement.webidl.  I also briefly looked at
> nsIBrowserElementAPI.idl, and using the numeric constants there is probably
> OK (but you could also use a string and pass in the WebIDL enum values there
> if you want to.)

Thanks you.

> Let me know if you wanted a review of the other parts too.

Kanru already reviewed the other parts, so I think we're good to go (once try server is fixed).
Attached patch v2 (r=kchen,r=ehsan) (deleted) β€” β€” Splinter Review
With correct commit message.
Attachment #8616864 - Attachment is obsolete: true
Attachment #8617719 - Flags: review+
Keywords: checkin-needed
Keywords: checkin-needed
Comment on attachment 8617719 [details] [diff] [review]
v2 (r=kchen,r=ehsan)

Ehsan, I'm actually not sure you looked at the changes to the C++ code since I moved to a enum.
Attachment #8617719 - Flags: review+ → review?(ehsan)
Comment on attachment 8617719 [details] [diff] [review]
v2 (r=kchen,r=ehsan)

Review of attachment 8617719 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/html/nsBrowserElement.h
@@ +20,5 @@
>  struct BrowserElementDownloadOptions;
>  class BrowserElementNextPaintEventCallback;
>  class DOMRequest;
> +enum class BrowserFindCaseSensitivity: uint32_t;
> +enum class BrowserFindDirection: uint32_t;

These are fine!
Attachment #8617719 - Flags: review?(ehsan) → review+
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/eb8508ac3545
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/eb8508ac3545
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: